-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support using lib types with the @property JSDoc tag #67
Comments
Hi Nick, thanks for creating this issue and making me aware of it! First of all, lit-plugin right now runs with a very old version of web-component-analyzer. Testing what you showed with the newest version doesn't crash for me (so your first issue seems to have been fixed with the next version): npx web-component-analyzer analyze my-element.js Next, the reason it doesn't see complex types such as "Error" is because of a missing feature in |
Hey, thanks for the update! Much appreciated 😄 |
Update: Support for nullable JSDoc type is now live in version 1.1.6 of the vscode plugin. You can add The following would also fix your issue (if you want to use public class fields): class ErrorDialog extends LitElement {
/**
* @type {Error}
*/
error;
} I have also taken the freedom to rename this issue :-) |
Sweet! After updating, things no longer crash with an Thanks again! I'm going to be on-boarding some of my team to modern web practice stuff and your plugin is just a really nice quality of life enhancement. |
This is an intersection with the VSCode plugin, but from my logs this is the underlying component that has the issue.
First of all, thank you very much for your plugin, it's awesome!
I just noticed that a nullable type in a
@prop
JSDoc tag seems to crash language server features. For example, after typing the below example@prop
line, other custom elements in my template no longer get hover-info, autocomplete etc.Example:
The
@prop {?Error} error
bit seems to mess it up. Just for sureness' sake, I tried nullable notation on other types, eg.Number
and the same result occurred.The logs I get when I enable verbose logging in the VSCode plugin:
Looking at that call stack, the second section looks like this:
which led me to infer that it might be the nullable notation, given the regex used there.
If I change the
@prop
line to:@prop {Error | null}
(ultimately, the same thing), everything works again.This is obviously not a showstopper, as like I mentioned you can just use the union type notation instead and work around it in the meantime.
Just wanted to let you know - thanks for your time!
The text was updated successfully, but these errors were encountered: