Let’s say there is a type
type Groceries = {
totalCost: number;
items: Array<{
name: string;
price: number;
}>
And I want to index into the nested type of price
How can I achieve this?
Doing Groceries["items"]["price"]
is throwing an error, I believe because it is an Array type. How can I index into the individual types defined in the Array type?
Tried indexing by doing Groceries["items"]["price"]