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

fix: relax ComponentPublicInstanceConstructor type for class components #1943

Merged
merged 4 commits into from
Aug 25, 2020

Conversation

ktsn
Copy link
Member

@ktsn ktsn commented Aug 23, 2020

fix vuejs/vue-class-component#441

Because the current ComponentPublicInstanceConstructor only accepts a constructor with no arguments, class components are rejected as they receive two arguments under the hood.

We can safely make the arguments type (...args: never[]) as the constructor will never be called in vue core.

@ktsn
Copy link
Member Author

ktsn commented Aug 23, 2020

Oops, the type is used in h function. Let me fix it.

@sunhao0313

This comment has been minimized.

@yyx990803
Copy link
Member

This seems to fail the tests introduced in 955450f

@@ -107,7 +107,7 @@ export type ComponentPublicInstanceConstructor<
__isFragment?: never
__isTeleport?: never
__isSuspense?: never
new (): T
new (...args: never[]): T
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using any[] passes the tests - which I think is fine.

@yyx990803 yyx990803 merged commit 67b6e0f into vuejs:master Aug 25, 2020
@ktsn ktsn deleted the fix-constructor-type branch August 25, 2020 03:00
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.

v8 type error when register components in Options
3 participants