loading...

re: TypeScript - get types from data using typeof VIEW POST

TOP OF THREAD FULL DISCUSSION
re: Thanks for the post. Is there documentation on that typeof myConst[number] syntax? Specifically the [number] part is something i've never seen in t...
 

New TS Handbook has a mention about [number] syntax:

const MyArray = [
    { name: "Alice", age: 15 },
    { name: "Bob", age: 23 },
    { name: "Eve", age: 38 }
];
type T = (typeof MyArray)[number];
code of conduct - report abuse