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

Generate Typescript types instead of jsdoc types #25

Open
mycarrysun opened this issue Jul 20, 2020 · 1 comment
Open

Generate Typescript types instead of jsdoc types #25

mycarrysun opened this issue Jul 20, 2020 · 1 comment

Comments

@mycarrysun
Copy link

I wondered if there were any plans to create types files in TypeScript for projects that have TypeScript integration? It would be just an option at runtime of course but I could see that giving more accurate predictions since the current jsdocs are giving me props that appear on any component, instead of limiting me to choosing props that are on the component I am typing props on (at least in the autocomplete popup).

@panstromek
Copy link
Owner

panstromek commented Jul 31, 2020

Sorry for the late response, I've read this and then forgot about it 😄

I am actually not sure what is the problem exactly. From IntelliJ point of view, TypeScript and jsDoc are basically the same thing - IDE will use both sources and give you completions based on the types in both. Initially, I tried to generate both TS and jsdoc and I found that it was mostly the same, but some details weren't working so well for TS, so I sticked with jsdoc. From that point of view, I don't understand what's not working for you. Can you give some example of it?

the current jsdocs are giving me props that appear on any component, instead of limiting me to choosing props that are on the component I am typing props on (at least in the autocomplete popup)

Especially this seems very weird to me, because I always get correct props completion only for the component that I am currently writing. If you could paste some code where this happens, that'd help a lot.

As for supporting generating TS instead of JS - I didn't consider it, just because I expected this glorious hack to not be needed pretty soon and I also vaguely remember there were some problems with it, but that may be gone. WebStorm can already do a lot of stuff on its own, and our generated files provide just a tiny bit more info (basically only enum-like props completion.

Quasar also generates type definitions for everything already. I tried to somehow use these types in the files generated by ide-helper (some kind of reexport scheme with sugaring) but I couldn't make it work, WebStorm just wouldn't pick it up correctly, so I sticked with the original generated files with jsdoc. I think it's possible to generate TS, but from what I tried, I don't think it would change how the IDE uses those files. Anyway, If you could provide an example where this could help, I guess I can try that (even though I am not that hyped to work on this package much anymore 😄, I mostly just want it to become obsolete) or feel free to submit a PR 😉

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