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
typeLimitedFieldName="name"|"email"|"phone";interfaceObjectWithLimitedField{[key: LimitedFieldName]: string;}// not oktypeAnyFieldName=string;interfaceObjectWithAnyField{[key: AnyFieldName]: string;}// not okinterfaceObjectWithStringField{[key: string]: string;}// ok
Expected behavior:
Index signature should allow types that evaluate to string or subset of string. The same for number.
Actual behavior:
Any literal other than string and number is explicitly disallowed.
The text was updated successfully, but these errors were encountered:
WRT using string type aliases as the index type for interfaces, etc., I believe this is being worked on, but I don't remember which issue is tracking it.
TypeScript Version: 2.2.1
Code
Expected behavior:
Index signature should allow types that evaluate to string or subset of string. The same for number.
Actual behavior:
Any literal other than string and number is explicitly disallowed.
The text was updated successfully, but these errors were encountered: