Closed leoasis closed 7 years ago
Looks like this was fixed by #18317. In typescript@next
your last line is an error.
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.
TypeScript Version: 2.4.2
Code
Expected behavior:
Last statement should be invalid, since
propB
is of type'b'
, which should be enough information for TS to know that i'm setting theb
property.Actual behavior:
Last statement is valid for TS. This also happens for union types of string or number literals. When the types for the values in those keys are the same, and attempting to set a value using a computed property, TS allows invalid values.