-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Open
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Indexed Access TypesThe issue relates to accessing subtypes via index accessThe issue relates to accessing subtypes via index access
Milestone
Description
TypeScript Version: 2.7.1, 2.8.0-dev.20180208
Search Terms:
Type cannot be used to index type
Code
interface IExample {
foo: {
bar: {
baz: number;
}
}
}
type F = <
name extends keyof IExample,
val extends keyof IExample[name]
>() => IExample[name][val]['baz']; // ← Type '"baz"' cannot be used to index type 'IExample[name][val]'.Expected behavior:
In version 2.7.0-dev.20171115 this code was checking without errors.
Actual behavior:
Now in throws error: Type '"baz"' cannot be used to index type 'IExample[name][val]'.
notary, Patrik-Lundqvist, wycats, SirZach, prateekkathal and 26 more
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Indexed Access TypesThe issue relates to accessing subtypes via index accessThe issue relates to accessing subtypes via index access