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
I have declared function getter(key: string|number).
Inside I try to do var x = someObject[key]
I get a TS error saying "An index expression argument must be of type 'string', 'number' or 'any'.
Obviously key satisfies this constraint as it is either a string or a number. But I guess the TS compiler does hard type equality checks in this case.
The text was updated successfully, but these errors were encountered:
I have declared
function getter(key: string|number)
.Inside I try to do
var x = someObject[key]
I get a TS error saying "An index expression argument must be of type 'string', 'number' or 'any'.
Obviously
key
satisfies this constraint as it is either a string or a number. But I guess the TS compiler does hard type equality checks in this case.The text was updated successfully, but these errors were encountered: