-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Unexpected behavior of conditional types on generics #33296
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
I'm on mobile, This variation gives errors. This looks similar to things I've seen before. Is this one of those variance markers not being propagated properly? |
Duplicate of #31295 Please ignore me failing to use github correctly |
But... there's no |
The |
This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
I stumbled upon a rather odd behavior while trying to combine conditional types with generics. It looks like, even when the produced types are structurally different, it's still possible to assign a values between them.
At first I thought this might be caused by generics being intentionally ignored but that seemed weird, since the types end up being structurally different and checks seem to work for literals, so I though I would report it, just in case.
TypeScript Version: 3.6.2
Search Terms: generics, conditional type, type inheritance
Expected behavior: exclusive structural conditional types derived from generic should not be assignable to each other.
Actual behavior: assignation seems to pass type check even when types are structurally incompatible.
Playground Link: here
The text was updated successfully, but these errors were encountered: