TypeScript · Lesson 88 of 120
satisfies
Check without widening.
A type annotation checks a value, but also replaces its type with the wider one. Satisfies checks the value, and keeps its exact type. You get safety and precision.

- Annotations widen
- satisfies checks
- And keeps the exact type
Exact keys, still checked
Hours must satisfy a record of strings, so every value is checked. But its type keeps the exact keys. So hours dot sat is known to exist. Run it.
app.tstypescript
const hours = {
mon: "9-6",
sat: "9-5",
sun: "closed",
} satisfies Record<string, string>;
console.log(hours.sat.toUpperCase());
type Day = keyof typeof hours; // "mon" | "sat" | "sun"
const today: Day = "sun";
console.log(today, hours[today]);Output
9-5 sun closed
Still checked
If a value breaks the rule, satisfies reports it. Here Sunday is a number. Run it.
app.tstypescript
const hours = {
mon: "9-6",
sun: 0,
} satisfies Record<string, string>;Output
app.ts line 3: Type 'number' is not assignable to type 'string'.
Summary
Satisfies checks a value against a type, without losing the value's exact type. Next, branded types.
Key takeaways- satisfies
- Exact keys
- Still checked
Next up: Branded Types — ids that can't mix