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

VSCode intellisense is wrong on type of emit #2755

Closed
vidal7 opened this issue Apr 28, 2023 · 4 comments
Closed

VSCode intellisense is wrong on type of emit #2755

vidal7 opened this issue Apr 28, 2023 · 4 comments
Labels
duplicate This issue or pull request already exists

Comments

@vidal7
Copy link

vidal7 commented Apr 28, 2023

In Vue 2.7, options API (defineComponent), TS 5, Volar 1.6.1, type of event is wrong in VSCode

image

It should have been

'event-without-payload': ($event?: undefined) => void

Also, it would have been nice that Volar throw a typescript error on handleEventWithPayload in the template has handleEventWithPayload does not satisfy the type (a: number, b: boolean) => void has defined in the p-component-issue

emits: {
            'event-without-payload': (): void => { },
            'event-with-payload': (a: number, b: boolean) => { }
        }

For reproduction repo, you can take the same as the issue 2742 (https://github.com/vidal7/volar-issue-2742)

@johnsoncodehk
Copy link
Member

Duplicate of #1855

@johnsoncodehk johnsoncodehk marked this as a duplicate of #1855 May 1, 2023
@johnsoncodehk johnsoncodehk added the duplicate This issue or pull request already exists label May 1, 2023
@vidal7
Copy link
Author

vidal7 commented May 3, 2023

@johnsoncodehk , are you sure it is related to #1855 ? This issue does not involve that one of an event has an argument typed as any

@johnsoncodehk
Copy link
Member

Yes it has nothing to do with any, it's about how Volar infers a specific type from multiple overloads. Can you post your use case in #1855?

@vidal7
Copy link
Author

vidal7 commented May 3, 2023

Done here. #1855 (comment)

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants