-
-
Notifications
You must be signed in to change notification settings - Fork 371
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
after update to 0.32.1, component event has payload type error #1001
Comments
Could you also provide what is the old behavior in 0.32.0? |
I installed 0.32.0 VSIX, here is the old behavior; @johnsoncodehk |
@johnsoncodehk I have a minimal reproduction here - https://github.com/NikhilVerma/vue-tsc-issue My event emits a number, but the event prop is hardcoded to be |
+1 |
Is there an estimate for a fix for this? It causes nearly all my components to show problems and is quite detrimental to efficient development. |
@barfurth please use 0.32.0 for now. I'm working on #1009 currently, this pr change all server code so I can't resolve other problem before merge it. |
@ysneo seems element-ui do not have valid events define in ElSelect class, it should have If element-ui not going to support types, I recommend you to use Vetur as it built-in support intellisense for ElementUI in Vue2. @NikhilVerma your component does not provide a valid type, try change it to // Component.vue
<template>
<div @click="selectTab">hello</div>
</template>
<script lang="ts">
import Component from "vue-class-component";
@Component
export default class Comp extends Vue {
$emit!: { (e: 'select', value: number): any }
selectTab() {
this.$emit("select", 1);
}
}
</script> // Consumer.vue
<template>
<Component @select="selectTab" />
</template>
<script lang="ts">
import Component from "vue-class-component";
import MyComponent from "./Component.vue";
@Component({
components: {
Component,
},
})
export default class Consumer extends Vue {
static components: { Component: typeof MyComponent }
selectTab(value: number) {
console.log(value);
}
}
</script> See #750 (comment). |
@johnsoncodehk I’m not sure this issue is addressed considering this was working before. We can’t really expect every UI library to type their components? Also this would not work for dynamically registered components, because Volar wouldn’t know what to look for (e.g. Nuxt directory based imports)? Perhaps this is a separate issue. |
@barfurth it's changed in 99386be. For dynamically components, see #682 (comment). |
vue 2.6
volar update to 0.32.1
ts 4.5.5
I use elementui select component. it has change event , has payload error after volar update to 0.32.1;
(property) 'change': ((payload: Event) => void) | undefined Type '(item: any[]) => Promise<void>' is not assignable to type '(payload: Event) => void'. Types of parameters 'item' and 'payload' are incompatible.
The text was updated successfully, but these errors were encountered: