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.
Activity
ahejlsberg commentedon Jan 18, 2015
You're right, we'll fix that.