What do these indexed access types resolve to, and which lines does TypeScript reject?
Name the type each ^? line points at, and list the errors TypeScript reports.
type User = { name: string; age: number; tags: string[]; address: { city: string; zip: string };}; type NameOrAge = User["name" | "age"];// ^?type City = User["address"]["city"];// ^?type Tag = User["tags"][number];// ^? type Entry = [string, number];type EntryLength = Entry["length"];// ^? const field = "name";type Name = User[field];type Email = User["email"];Work it out first: the compiler shows every error and type.
The answer
Work out every error TypeScript reports and every type it shows, line by line. Then check.
Checking your sign-in…