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
Type '{ [K: string]: number | undefined; }[S]' is not assignable to type 'number'.
Type 'number | undefined' is not assignable to type 'number'.
Type 'undefined' is not assignable to type 'number'.
TypeScript Version: [email protected], [email protected]
Code
Expected behavior:
No error
Actual behavior:
Playground Link: http://www.typescriptlang.org/play/index.html#src=declare%20const%20dict%3A%20%7B%20%5BK%3A%20string%5D%3A%20number%20%7C%20undefined%20%7D%3B%0D%0Afunction%20foo%3CS%20extends%20string%3E(betSpot%3A%20S)%3A%20number%20%7B%0D%0A%20%20%20%20const%20value%20%3D%20dict%5BbetSpot%5D%3B%0D%0A%20%20%20%20return%20value%20%3F%20value%20%3A%200%3B%0D%0A%7D
Related Issues:
#21770 #21760 seem related