You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the type expected for defineEmit is a function type or union type, but the type ((e: 'foo' | 'bar') => void) | ((e: 'baz', id: number) => void) is actually not useful as a emit function, as can be seen in the above TypeScript playground, since the type ((e: 'foo' | 'bar') => void) | ((e: 'baz', id: number) => void) is equivalent to ((e: never, id: number) => void).
The correct way to specifies this seems to be using call signature {(e: 'foo' | 'bar'): void; (e: 'baz', id: number): void;}.
The text was updated successfully, but these errors were encountered:
Version
3.0.4
Reproduction link
TypeScript Playground
Steps to reproduce
What is expected?
Should be able to specify SOME_TYPE_HERE correctly so the resulting program has no TypeScript error and no error from vue compiler.
What is actually happening?
SOME_TYPE_HERE = ((e: 'foo' | 'bar') => void) | ((e: 'baz', id: number) => void)
=> TypeScript errorSOME_TYPE_HERE = {(e: 'foo' | 'bar'): void; (e: 'baz', id: number): void;}
=> vue compiler errorhttps://github.com/vuejs/vue-next/blob/085bbd5fe07c52056e9f7151fbaed8f6a2e442b3/packages/compiler-sfc/__tests__/compileScript.spec.ts#L522
Currently the type expected for defineEmit is a function type or union type, but the type
((e: 'foo' | 'bar') => void) | ((e: 'baz', id: number) => void)
is actually not useful as a emit function, as can be seen in the above TypeScript playground, since the type((e: 'foo' | 'bar') => void) | ((e: 'baz', id: number) => void)
is equivalent to((e: never, id: number) => void)
.The correct way to specifies this seems to be using call signature
{(e: 'foo' | 'bar'): void; (e: 'baz', id: number): void;}
.The text was updated successfully, but these errors were encountered: