Satisfies
What
The satisfies operator validates that an object matches a specific type without changing the resulting inferred type.
How
It provides the validation of a type annotation while keeping the more specific literal types:
type ColorMap = { [key: string]: string | number };
// Using annotation: 'red' is typed as 'string | number'
const colors: ColorMap = { red: "#ff0000" };
// Using satisfies: 'red' is typed exactly as the literal string '#ff0000'
const colorsS = { red: "#ff0000" } satisfies ColorMap;
colorsS.red.toUpperCase(); // OK! TypeScript knows it's a string
Why
satisfies solves the problem where a broad type definition (like string | number) “widens” your data and makes it harder to use specific methods (like .toUpperCase()). It allows you to catch typos and structural errors without losing the precision of your data.
Summary
Use satisfies when you want to ensure an object follows a schema but you still need access to its specific, narrowed properties.