Quick Note
TypeScriptTIL

TypeScript: The satisfies Operator

Using satisfies for better type inference while still validating types.

1 min read

The satisfies operator validates a type without widening it:

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

// config.port is number, not string | number!

This gives you both validation AND precise inference.

Found this note helpful? Show some love!

20 views

Comments