Index signature
See also Constants, interfaces and types
# Basic usage
The name of the next (eg, id
, key
) is arbitrary.
interface Foo { [id: number]: string; [key: string]: string; }
# Using a set of literals
type FooKey = 'a' | 'b' | 'c' type Foo { [key in FooKey]: string }