-
-
Notifications
You must be signed in to change notification settings - Fork 415
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
Can't use own type in defineEmits
in new Vue 3.3 structure
#3223
Comments
Can confirm. Related: #3169 (comment) |
try using |
@so1ve That did the trick! Thank you for the suggestion. This works great: type Emits = {
someEmit: [value: string];
}
const emits = defineEmits<Emits>();
emits('someEmit', value); I also had to disable the |
Well that's a typescript limitation: microsoft/TypeScript#42825 but I think we can avoid it. |
@jdk2pq Could you please confirm if this works: type Simplify<T> = { [K in keyof T]: T[K] } & {}
interface Emits { ... }
defineEmits<Simplify<Emits>>() ? |
Yep, that's passing |
Well this is not a fix (actually). The complex type cannot pass vue's compiler :( So, maybe a vue core's type problem? Can you try to import defineEmits from vue in a fresh ts file instead of a SFC and check whether this issue still exists? If so, that's a vue issue. |
@so1ve Sure thing. When I use the But if I don't use that, I get the same type errors I was seeing before here #3169 (comment) : |
OK! Now we can confirm this is a vue issue. |
Created an issue: vuejs/core#8457 |
Thanks @so1ve ! |
Work:
Don't work:
Previous structure works fine:
The text was updated successfully, but these errors were encountered: