What is the satisfies operator used for in TypeScript?

Why Interviewers Ask This

Advanced questions like this reveal whether a candidate has internalized TypeScript deeply enough to make architectural decisions. Strong answers demonstrate both breadth and depth of experience.

Answer

The satisfies operator (TypeScript 4.9) addresses the tension between type annotation and type inference. Normally, annotating a variable with a type narrows inference — you lose the specific inferred types of individual properties. Without satisfies: const palette: Record<string, string | number[]> = { red: "#f00", green: [0, 255, 0] }; palette.red.toUpperCase(); // Error! red could be string or number[]. With type assertion: you lose validation. With satisfies: const palette = { red: "#f00", green: [0, 255, 0] } satisfies Record<string, string | number[]>;. Now TypeScript validates the structure matches the type (errors if you add an invalid property), but infers the most specific types for each property: palette.red is string, palette.green is number[]. The satisfies operator is particularly useful for configuration objects, theme tokens, route maps, and any case where you want type validation without losing the specificity of the inferred type.

Pro Tip

If you're unsure about a detail, say so honestly and explain your reasoning. Interviewers respect candidates who can think through uncertainty rather than bluffing.