-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Incorrect type inference for generic types with 'prototype' property #55199
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
There's a lot going on here, could you reduce to a single bug report? The stuff about the emitted JavaScript seems like a separate topic entirely... and I don't see how that's supposed to be a bug either; Are you saying that the type of |
@jcalz I'm reporting about type issue mainly. Both result types below should be equal injectWithProto<Set<number>>(Set)
injectWithProto(Set<number>); The compiled version is not breaking, but it's weird and might be related to type inference issue I'm repporting. |
It's unrelated, so having it here is distracting at best. It also seems like you don't care primarily about If I were filing this issue it would be as a suggestion (not a bug report) that The typing of But since |
@jcalz The main issue is that I expect the same behavior for both function calls
|
I'm confused too. Different lines of code may well have different behavior; that's how stuff gets done. Which line is wrong, and why? Can you post a straightforward example with no other things going on? |
@jcalz oh, I understood... |
This isn't an actionable description of a bug. |
Bug Report
🔎 Search Terms
🕗 Version & Regression Information
prototype
⏯ Playground Link
Playground link with relevant code
💻 Code
The compiled version has a bug too - double parentheses (reproduced both with the
injectWithType
and theinjectWithProto
.):🙁 Actual behavior
When using an
interface
or atype
with theprototype
property to declare class, generic type is getting wrong, especially in theExpressionWithTypeArguments
(‼️)
case.🙂 Expected behavior
(⚠️)
- These lines should have the same type (Set<any>
orSet<unknown>
)(‼️)
- This line should correctly infer generic type (Set<number>
)The text was updated successfully, but these errors were encountered: