-
Notifications
You must be signed in to change notification settings - Fork 7
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
Object literals not supported in @type #35
Comments
Hi! Thanks for the issue, that interesting case, I'm try to think how it can be fixed w/o adding the new dependency |
Yes I understand that. My first idea was to solve it with pure regex, but javascript regex does not provide the PCRE recursive parameter But your comment made me realize that the matcher for types does not need to ignore closing - const TYPE = '\\{([^\\}]*)\\}';
+ const TYPE = '\\{(.*)\\}'; It's not perfect but it passes all current tests plus the tests I made for Object literals and nested literals. |
Ok, looks good as a quick fix. Please create PR and I'm merge it and then publish a new version 😄 |
fix(jsdoc): Object literals not supported in type annotation (#35)
Thanks for a fix! |
Adding this to
examples/Button.svelte
:and running
yarn generate-examples
produces this.json
(only showing relevant part) :where
type.text
andtype.type
lose the closing curly brace.I have a fix ready, but it adds a new dependency to the project (
"xregexp": "^4.4.0"
).If you're open to this idea, I can create a PR.
I also added jsdoc unit tests for Object literals and nested literals, but only for
'Parse type keyword'
.The text was updated successfully, but these errors were encountered: