Open
Description
Bug Report
π Search Terms
cannot be used as an index type
π Version & Regression Information
- This changed between versions 4.9.5 and 5.0.4
β― Playground Link
Playground link with relevant code
π» Code
interface Dict {
foo: 1
bar: 1
}
type A = Dict['foo'] // works
type F = 'foo'
type B = Dict[F] // works
type FF = 'foo' extends ('foo' | 'bar') ? 'foo' : never // in theory, FF === F
type C = Dict[FF] // not working, Type '"foo"' cannot be used as an index type.(2538)
π Actual behavior
type C
throws error
π Expected behavior
no error