Certain conditional types allow unsound assignments #55733
Labels
Bug
A bug in TypeScript
Cursed?
It's likely this is extremely difficult to fix without making something else much, much worse
Help Wanted
You can do this
Milestone
π Search Terms
"conditional type" generic assignment
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play?#code/C4TwDgpgBAQg9gDwDwBUB8UC8UDeUBuAhgDYCuEAXFClAL4BQ9okUAqgHYBGiAku+xABOqDNhoQEwCOwAmAZ1iIkAS3YAzIVABKGAPxsuvfkKQ6oVPKUMIIMqjQbNoHbsnRYDrvgOHoA2gDkVq62AQC6jDIQAMbEhILQalbRwMpw7FDBSugAFAj2AJRULtlojEnsKWkZEoQAtmDEECJ5hbj0UFBNwFCEHlkIeQUdvR4BwAAWygpyE3CkxDJQnNCENYKCcIIB9LRAA
π» Code
π Actual behavior
In
example
we can assign arbitrary values toa
, even though it's typed asUnbox<T>
.π Expected behavior
Attempting to assign invalid values to
a
(just about anything, since its type depends on a type parameter) should cause a type error.Additional information about the issue
These issues may possibly be related:
cc @webstrand
The text was updated successfully, but these errors were encountered: