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
{{ message }}
Repository navigation
Mapped properties in interfaces have undefined behavior #18299
No errors at all, and roughly equivalent semantics.
A parse error, in case this should specifically be disallowed (to align with classes, since [foo in bar] is required to be a valid class property/method name).
Actual behavior:
A mess of type errors because [P in T]: any is parsed in interfaces as a computed symbol property with key P in T (i.e. a boolean). In kind, I get three sets of type errors:
For P:
A computed property name in an interface must directly refer to a built-in symbol.
Cannot find name 'P'.
The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
For 'a' | 'b':
A computed property name in an interface must directly refer to a built-in symbol.
The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.
The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
Activity