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

No type check for events #516

Closed
jfrs opened this issue Sep 22, 2021 · 0 comments
Closed

No type check for events #516

jfrs opened this issue Sep 22, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@jfrs
Copy link

jfrs commented Sep 22, 2021

If I declare and use this component (adding a template and/or props doesn't change anything) the events are recognized but not properly type checked in the parent:

<script setup lang="ts">
defineEmits<{
  (event: "foo"): void;
  (event: "bar", thing: number): void;
}>();
</script>

If I use the component like this <HelloWorldTest @foo="handleTest" @bar="handleTest" /> with function handleTest(str: string): void {}, I get (property) foo: (($event?: undefined) => any) | undefined and (property) bar: ((thing: number) => any) | undefined on hover, but there is no error.

To reproduce just add the above script to the volar-starter project and use it in another component.

Visual Studio Code

TypeScript Vue Plugin (Volar)
v0.27.23
Vue Language Features (Volar)
v0.27.23

Version: 1.60.2
Commit: 7f6ab5485bbc008386c4386d08766667e155244e
Date: 2021-09-22T12:01:43.795Z
Electron: 13.1.8
Chrome: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Linux x64 5.11.0-34-generic
@johnsoncodehk johnsoncodehk added the bug Something isn't working label Sep 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants