Skip to content
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

Improve parser to support more typescript syntax #64

Open
simonseyock opened this issue Feb 6, 2021 · 2 comments
Open

Improve parser to support more typescript syntax #64

simonseyock opened this issue Feb 6, 2021 · 2 comments

Comments

@simonseyock
Copy link

Hi! I wanted to ask if you are open to accept PRs that would enable JSDoc to parse more typescript specific types. For example the intersection types (See #62). I think this would be good because more and more projects are using JSDoc together with the typescript parser.

@hegemonic
Copy link
Owner

Yes, that would be terrific! It would be ideal if Catharsis supported all TypeScript types.

I'd prefer to make users specify whether they're passing in a TypeScript type expression; a Closure Compiler type expression; or a JSDoc type expression, which is basically Closure Compiler + a few extras. (I don't want to fool anyone into thinking that Closure Compiler supports TypeScript syntax, or vice-versa.) So it might make sense to write a separate PEG grammar for TypeScript type expressions, rather than trying to shoehorn TypeScript support into the existing grammar.

Similarly, it might make sense to write a separate stringifier for TypeScript types. In contrast, the parse tree should use the same format as for Closure Compiler types.

If you think any of that doesn't make sense, let me know. If that all sounds good, I'd welcome a PR!

@simonseyock
Copy link
Author

I would be interested to add support for typescript syntax, but I don't think I would want to write a whole new part of the software.

The main thing why I want to do this, is that I do a little work for an open source project (https://github.com/openlayers/openlayers) that uses jsdoc for the documentation but uses more complex types that are checked by typescript.
At the moment we have rewriting step before the jsdoc processing that rewrites crucial types. That is suboptimal at least.

For us it would be great if there was a route where we could gradually add changes to feel the benefits in a reasonable amount of time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants