satisfies

Checks that an expression matches a type without widening its inferred type.

Since TS 4.9 Spec ↗

Syntax

expression satisfies Type

Examples

const config = {
  host: 'localhost',
  port: 8080,
} satisfies Record<string, string | number>;

config.port.toFixed(0); // port is still number
type Routes = Record<string, () => void>;
const routes = {
  home: () => {},
} satisfies Routes;

Notes

Validates an expression against a type while preserving the narrower inferred type for later use. Unlike `as`, it cannot change the type and reports an error on mismatch. Use it for typed config objects where you still want precise literal inference.

See also