-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
Add Vue component typings #4707
Conversation
Side note, I originally wanted to port the components to TypeScript, to get automatic typings, but I couldn't figure out how to add TypeScript support to the current build system. If someone is willing to help to get TypeScript up and running with the existing system, porting the Vue components to TypeScript should be fairly straightforward and will yield better typings than this. |
|
Merged, thanks! I will add build pipeline |
@nolimits4web maybe migrating the source to TS should be considered? |
I think yes, will move Vue to .ts in upcoming releases |
Hey @MrTimscampi and @nolimits4web I browsed through the correspondense here and the code merged in this PR and had hopes that it would help my case of Vue having a hard time to infer types inside a Any clue to what could help ? I am getting the following error:
What I had done so far but in vain:
(attached image shows the culprit throwing the type error) I would appreciate any best practices how to tackle this. |
I have usually had to explicitly type all refs in components (using |
Yeah I though about doing the same. @MrTimscampi do you know in which module I can possibly import the interface to than type with |
This adds proper TypeScript definitions to the Vue components.
I'm not fully sure everything is 100% good, but it was tested on another project and seems to work fine there, so I figured I'd upstream it.
It is probably missing some things like the emits, but it has all the (current) attributes defined.Emits have been added, so it should have everything now.I was a bit lost with the multiple package.json files in multiple places, so feel free to correct me if I messed something up 😄
Fixes #3916
Edit: I went over the typings again and fixed a bunch of props, all the defaults and added typings for all the emits/event callbacks.
This should now be pretty much complete.