The TypeScript satisfies Operator: Validate Types Without Losing Inference
How the satisfies operator works, how it differs from type annotations and as casts, and practical uses for configs, route maps, theme objects and records.
Published December 6, 2026
Annotating a variable with a type checks that the value fits, but it also widens the variable to that type, throwing away the more precise information TypeScript inferred. The satisfies operator, introduced in TypeScript 4.9, checks that a value conforms to a type while keeping the inferred, narrower type. It is perfect for configuration objects, lookup tables and anything where you want both validation and precise autocompletion.
The concept
Compare three forms. const routes: Record<string, Route> = {...} validates but widens keys to string, so routes.hme is not an error. const routes = {...} as Record<string, Route> skips most checks entirely. const routes = {...} satisfies Record<string, Route> validates every entry against Route and keeps the literal keys, so routes.home autocompletes and routes.hme is a compile error.
Common combinations include satisfies with as const for deeply immutable literal configs, satisfies Record<Union, ...> to guarantee every key of a union is present, and satisfies on objects passed to libraries to catch typos in options without losing literal types used later.
Annotation vs as vs satisfies
| Form | Checks value? | Keeps precise type? | Typo in key caught later? |
|---|---|---|---|
| const x: T = v | Yes | No (widened to T) | Not for index signatures |
| const x = v as T | Barely | No | No |
| const x = v satisfies T | Yes | Yes | Yes |
What satisfies does
Where it shines
| Use case | Pattern |
|---|---|
| Config objects | config satisfies AppConfig |
| Exhaustive maps over a union | labels satisfies Record<Status, string> |
| Immutable literal tables | {...} as const satisfies readonly Item[] |
| Theme / design tokens | tokens satisfies Record<string, `#${string}`> |
Practical examples
Route map with precise keys
Validated entries, literal keys preserved.
type Route = { path: string; auth: boolean }
const routes = {
home: { path: '/', auth: false },
settings: { path: '/settings', auth: true },
} satisfies Record<string, Route>
routes.settings.path // ok, autocompletes
// routes.setings // error: Property 'setings' does not existExhaustive record over a union
Missing or extra keys are errors.
type Plan = 'basic' | 'pro'
const limits = {
basic: { smtp: 5, templates: 10 },
pro: { smtp: 20, templates: 100 },
} satisfies Record<Plan, { smtp: number; templates: number }>as const + satisfies
Immutable literals that still match a contract.
const TOOLS = [
{ slug: 'json', label: 'JSON Beautifier' },
{ slug: 'jwt', label: 'JWT Tools' },
] as const satisfies readonly { slug: string; label: string }[]
type ToolSlug = (typeof TOOLS)[number]['slug'] // 'json' | 'jwt'Common mistakes
- Using as to silence errors that satisfies would have caught.
- Expecting satisfies to change the runtime value (it is compile-time only).
- Annotating config objects and losing literal keys needed elsewhere.
- Forgetting satisfies requires TypeScript 4.9 or newer.
Key takeaways
- satisfies validates a value without widening its inferred type.
- It catches typos while keeping precise autocompletion.
- Combine with as const for immutable literal tables.
- Prefer it over as casts for object literals.
FAQ
Does satisfies affect runtime?
No. Like all type syntax, it is erased during compilation.
When should I still annotate?
When you want the variable to have exactly the declared type, for example a mutable variable that will hold other values later.
Can I use satisfies on function return values?
Yes, on any expression: return {...} satisfies Result.