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

Support component TS type resolving in Volar context #53

Open
ShenQingchuan opened this issue Aug 11, 2023 · 6 comments
Open

Support component TS type resolving in Volar context #53

ShenQingchuan opened this issue Aug 11, 2023 · 6 comments

Comments

@ShenQingchuan
Copy link
Member

ShenQingchuan commented Aug 11, 2023

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 ❤️ !

@ShenQingchuan ShenQingchuan added this to the release-v0.1.0 milestone Aug 11, 2023
@ShenQingchuan
Copy link
Member Author

Tracking volarjs/volar.js#85

Waiting for stable API from Volar 2.0

@so1ve
Copy link
Member

so1ve commented Dec 18, 2023

We should collect props and slots definition from Vine function component and convert them into pure TS files

@ShenQingchuan
Copy link
Member Author

ShenQingchuan commented Dec 19, 2023

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 ??

@so1ve
Copy link
Member

so1ve commented Dec 20, 2023

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,
})

@ShenQingchuan
Copy link
Member Author

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?🥹🥰😜

@so1ve
Copy link
Member

so1ve commented Dec 20, 2023

Not sure if volar provides such function 🥹

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

No branches or pull requests

2 participants