-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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
TSX Wrong Emit Handler Return Type #4288
Comments
@webfansplz I edited type code with your pull request and nothing changed. The problem is here I think. I don't have a good knowledge about typing types but if I change it to this, I don't get any type error in component file but in type file. |
Hi @kadiryazici,Maybe you just forgot to return it when you invoked it import { defineComponent } from 'vue';
const Component = defineComponent({
emits: {
something: (value: string) => true
}
});
const OtherComponent = defineComponent({
render() {
return (
<Component
onSomething={() => {
console.log('yeah');
return true // return true
}}
/>
);
}
});
export default OtherComponent |
@webfansplz it is not the return type of emit, it is just validator. I return true from validator because I don't need validaton. Vscode type checking is enough for me. Emit handler should return any or void always. |
@kadiryazici You are right, I have mentioned PR to fix this |
Version
3.2.1
Reproduction link
https://jsfiddle.net/986ukynp/
Steps to reproduce
Event handler should return void not validation value of emit.
What is expected?
No type error
What is actually happening?
Type error is happening
The text was updated successfully, but these errors were encountered: