Better TypeScript integration and API generation #15774
-
|
Currently the TypeScript integration is decent albeit not perfect. I feel like it could be improved in several ways while reducing maintenance burden and increasing DX. Currently the API and types are generated from manually curated JSON files for each component/plugin/composable. This unnecessary duplication not only takes time but is also error prone and may easily get out of sync if not watched carefully. The workflow for API and type stub generation could be improved if the documentation would instead be moved inside the component files and extracted from there. With the release of v2, an incremental migration to TS was announced which could also help in this endavour.
Originally posted by @IlCallo in #7836 (comment) Instead of manually setting the type in the JSON file, it could be directly inferred from the component definition. Not only would this reduce maintenance burden, it also allows more precise types. For some of these scenarios where the JSON format does not provide sufficiently detailed types, there are currently manual stub files such as the one for Another great benefit would be that the I know that this is a large undertaking. However, given that it apparently is already planned for the Quasar v2 lifecycle, I would be curious if where this is currently on the roadmap and invite to discuss more about the benefits and challenges this might bring. Personally, I definitely plan to play around with the generic support for |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
|
We already explored the topic and actually moved some steps in that direction, @yusufkandemir was the one experimenting on that The migration to ESM which is currently going on is a step towards making the TS migration easier |
Beta Was this translation helpful? Give feedback.
-
|
Regarding the topic of generic components, slots and events: This is now stabilized as of Vue 3.3 |
Beta Was this translation helpful? Give feedback.
We already explored the topic and actually moved some steps in that direction, @yusufkandemir was the one experimenting on that
As I wrote in the comment you reported, the foundations are already in place, but unluckily that's not a thing we plan to work on this year
The migration to ESM which is currently going on is a step towards making the TS migration easier