What does TypeScript report and infer for these Record types?
Name the type each ^? line points at, and every error TypeScript reports.
type Status = "idle" | "loading" | "success" | "error"; const labels: Record<Status, string> = { idle: "Idle", loading: "Loading", success: "Done",}; const icons: Partial<Record<Status, string>> = { error: "warning" };const icon = icons.loading;// ^? const counts: Record<string, number> = {};const count = counts.anything;// ^?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…