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

DefineComponent instead of class to improve type-checking #973

Closed
wants to merge 1 commit into from

Conversation

johnsoncodehk
Copy link

@johnsoncodehk johnsoncodehk commented Feb 15, 2021

⚠️ don't marge, this PR just to show a solution.

I'm searching using $emit types library, and I found that this library define lot of events in some single component.

If define component types as class, IDE can't infer args types because typescript limit, please see: vuejs/language-tools#60

A solution is use DefineComponent instead of class, volar already supported emit SFC (.vue) to typescript declaration (.d.ts).

In this repo you need a jsconfig.json to tell volar pickup vue files, and than you can use Volar: Emit TypeScript declaration file command to emit typescript declaration. please take a consider.

@johnsoncodehk johnsoncodehk marked this pull request as draft February 15, 2021 09:13
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

Successfully merging this pull request may close these issues.

1 participant