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

Type error when ref-ing a component with an empty props object #317

Closed
henribru opened this issue Jul 17, 2021 · 2 comments
Closed

Type error when ref-ing a component with an empty props object #317

henribru opened this issue Jul 17, 2021 · 2 comments
Labels

Comments

@henribru
Copy link

henribru commented Jul 17, 2021

Putting a ref on a component that has an empty props object gives a pretty obscure type error, see https://github.com/henribru/volar-bug-repro for a reproduction.

Argument of type '{ ref: string; }' is not assignable to parameter of type '(Partial<{ [x: number]: string; } | {}> & Omit<(Readonly<readonly unknown[] & { [x: number]: string; } & { [iterator]?: IterableIterator<string> | undefined; length?: number | undefined; ... 21 more ...; flat?: unknown[] | undefined; }> | Readonly<...>) & (VNodeProps & ... 2 more ... & Readonly<...>), never>) & Omit...'.\n  Type '{ ref: string; }' is not assignable to type 'Partial<{}> & Omit<(Readonly<readonly unknown[] & { [x: number]: string; } & { [iterator]?: IterableIterator<string> | undefined; length?: number | undefined; toString?: string | undefined; ... 20 more ...; flat?: unknown[] | undefined; }> | Readonly<...>) & (VNodeProps & ... 2 more ... & Readonly<...>), never> & Om...'.
@johnsoncodehk johnsoncodehk added the bug Something isn't working label Jul 17, 2021
@johnsoncodehk johnsoncodehk reopened this Jul 17, 2021
@johnsoncodehk
Copy link
Member

@pikax when props option is empty object, $props type seem became array type, is it expected?

螢幕截圖 2021-07-18 上午6 35 07

@pikax
Copy link
Member

pikax commented Jul 18, 2021

@johnsoncodehk I noticed that when I was trying to fix vuejs/core#4051

@johnsoncodehk johnsoncodehk added upstream and removed bug Something isn't working labels Jul 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants