What does as const do to these types, and what does the code log?
Name the type each ^? line points at, every error TypeScript reports, and what the last line logs when you run the code anyway, with its types removed.
const roles = ["admin", "editor"] as const;// ^?type Role = (typeof roles)[number];// ^?const config = { retries: 3, mode: "fast" } as const;// ^? roles.push("viewer");config.retries = 4;console.log(roles.length, config.retries);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…