How to get type of array items?

If you’re looking to how to extract { name: string; test: number; } type, you can simply create alias to “item at index”:

type Foo = Array<{ name: string; test: number; }>;
type FooItem = Foo[0];

or

type FooItem = Foo[number];

Leave a Comment