Support component TS type resolving in Volar context
ShenQingchuan opened this issue · comments
Purpose
Make Vue Vine become usage compatible with Vue SFC
i.e. user can import the components that export from .vine.ts
in .vue
file, and no type issues.
This issue may need Volar 2.0 TS Plugin's help.
We need to implicitly convert the "Vine component function" type to a "Vue component" object's type, based on information like props, emits and so on ...
I'd be so appreciated if @johnsoncodehk could provide some information about it. Thanks ❤️ !
Tracking volarjs/volar.js#85
Waiting for stable API from Volar 2.0
We should collect props and slots definition from Vine function component and convert them into pure TS files
We should collect props and slots definition from Vine function component and convert them into pure TS files
Sounds good! So what is the actual form/struct/content in those pure TS files?
// _VINE_VLS.virtual.ts ??
interface _Comp1_Props_ {
// ...
}
interface _Comp1_Slots {
// ...
}
interface _Comp1_Emits {
// ...
}
You mean something like this ??
Yes! And then we can convert Vine component function into such code:
export default defineComponent({
props: {} as _Comp1_Props,
slots: {} as _Comp1_Slots,
emits: {} as _Comp1_Emits,
})
So you mean I need to write a complete process of this generation by myself manually or just provide these enough data for Volar new API?🥹🥰😜
Not sure if volar provides such function 🥹