You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In G the constraint of DataT is being pulled down in the access expression DataT["b"]. So it is not that true extends false, rather it is eagerly using the base constraint in DataT so you get true extends boolean. This is not covered by the fix #27490 because "b" is not a generic type. You can see the correct behaviour if you defer the check using a parameter.
This might be related to some problems I found while working on the React types; proving that 'x' extends keyof T is not sufficient to let you index T with 'x'.
Activity
AnyhowStep commentedon Nov 23, 2018
This has no problems in either TS 3.2 or TS 3.0.1
jack-williams commentedon Nov 23, 2018
I think this is happening because of #27470
In
Gthe constraint ofDataTis being pulled down in the access expressionDataT["b"]. So it is not thattrue extends false, rather it is eagerly using the base constraint inDataTso you gettrue extends boolean. This is not covered by the fix #27490 because"b"is not a generic type. You can see the correct behaviour if you defer the check using a parameter.or even doing:
AnyhowStep commentedon Nov 23, 2018
Yikes. I hope this is fixed. This breaks a lot of my code that was working in 3.0.1.
Using your workaround would make the type declarations even more verbose and complex =(
Thank you for looking into it! I had this gnawing at me even as I tried to sleep.
I guess I'll hold off on upgrading TS for now :x
Jessidhia commentedon Nov 27, 2018
This might be related to some problems I found while working on the React types; proving that
'x' extends keyof Tis not sufficient to let you indexTwith'x'.ahejlsberg commentedon Nov 28, 2018
Simplified repro with expected outcomes:
Currently
Foois eagerly evaluated to"yes"so every outcome is"yes".AnyhowStep commentedon Nov 29, 2018
Thank you for fixing this so quickly!
I just updated from
3.0.1to3.3.0-dev.20181129and nothing broke!