-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Compiler crashes with generics #37974
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
Comments
Minimal repro: // @strict: true
declare function resolver<T>(): () => void;
declare function wrapResolver<T>(resolverFunction: () => void): void;
// compiler crashes here
wrapResolver(resolver() || []) |
Here’s what’s happening.
Clearly, we should have recognized that the instantiated signature is a match from the beginning, but I’m not sure how. Everything I try tweaking breaks a bunch of other tests. It seems a little weird to me that |
@andrewbranch I just put up a PR that fixes this by propagating the A bit more detail... The An argument could be made that any operation applied to a Aside from the fix to this particular bug, I'm somewhat concerned with the brittleness of the error reporting logic in |
The In this case, based on the fix and your description, it looks like it was a logical error - the I don't think there's a great way to rewrite the error handling to still work - what sucks and is hard to reason about is the implict invariant that |
Any chance this drops into a 3.8.4 hotfix release ? this bug is really blocking me on a big project, maybe you know a workaround to wait a later release ? |
@JesusTheHun I’d have to see your specific code to be able to advise on a workaround—in the original repro, there’s a simple workaround of removing a meaningless |
I have created a small repo to show case an issue I have with my IDE that may actually be a TS performance issue, I got lucky this small repo crashes on compilation : https://github.com/JesusTheHun/typescript-slow-case Edit : doesn't crash with |
TypeScript Version: "^3.8.3"
"No error for last overload signature" error
Code
I could narrow it down to this repository:
https://github.com/mohsen1/TS-No-error-for-last-overload-signature
https://github.com/mohsen1/TS-No-error-for-last-overload-signature/blob/fbd33f9aad6b3fd1f914b6bfe23cebc5db1dd12f/src/index.ts#L22-L23
Expected behavior:
Type error,
wrapResolver
is not suppose to get an arrayActual behavior:
Compiler crash
Related Issues:
#33133
#33732
#35186
The text was updated successfully, but these errors were encountered: