Reputation: 710
Is it possible to create a type that can get the type part of the index signature? Example:
type Foo = { [id: string]: Date }
type IndexSignatureType<T> = ???
const bar: IndexSignatureType<Foo>; // has type Date
Upvotes: 1
Views: 40
Reputation: 249506
You can just use an index type query:
type Foo = { [id: string]: Date }
const bar: Foo[string]; // is Date
Upvotes: 1