-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
SFC compiler goes into infinite loop on bad defineEmit #2973
Comments
I tried to create a minimal repro and indeed, I observed the same error as @HcySunYang. I guess I'll have to find out why in my real project it goes into an infinite loop. In the meantime, I noticed that the type validation isn't perfect. defineEmit<((c: number) => void) | { a(n: number): void }>() |
I think the |
Closing in favor of #2983 since this one has no reproduction |
Yes, those are 2 different issues. |
You are right, I missed the names! A new issue with a proper repro like the other one is still preferred, thanks! |
Quick heads-up: I can confirm my real project still goes in an infinite loop in Vite when I change the correct const emits = defineEmit<{ showRevision(e: 'showRevision', sha: string): void }>(); As that doesn't seem to be sufficient I'll try to work out a repro if I have the time to do so. |
Version
3.0.5
Reproduction link
vitejs/vite#1436
Steps to reproduce
See link for original context.
Try to compile a bad
defineEmit
What is expected?
Some kind of error message?
What is actually happening?
SFC compiler goes into an infinite loop
The typing of
T
indefineEmit<T>
does not extendFunction
or anything, so there's no IDE feedback on improper usage such as this example. Would be nice to harden the typing here, if possible.The text was updated successfully, but these errors were encountered: