You have an object full of settings, routes or colours. You want TypeScript to tell you when you misspell a key or forget one. You also want the editor to know that one value is a string and another is a tuple, so you can call the right methods on each. With a plain type annotation you only get the first. With no annotation you only get the second.
The satisfies operator, added in TypeScript 4.9, gives you both. This article is for anyone who writes TypeScript day to day and has ever fought an annotation that made a value less useful than it was before. We will start with the problem, look at what satisfies actually does, and finish with the patterns where it earns its place.
The problem with type annotations
#Here is a small palette. Each colour can be a hex string or an RGB tuple.
_12type Colour = "red" | "green" | "blue";_12type RGB = [number, number, number];_12type Palette = Record<Colour, string | RGB>;_12_12const palette: Palette = {_12 red: [255, 0, 0],_12 green: "#00ff00",_12 blue: [0, 0, 255],_12};_12_12palette.green.toUpperCase();_12// Error: Property 'toUpperCase' does not exist on type 'string | RGB'.
The annotation did its job of checking the object. But it also replaced the type TypeScript inferred with the declared type. Now every property is string | RGB, even though you can see that green is a string. You end up writing extra checks or casts for information the compiler already had.
The problem with no annotation
#Remove the annotation and inference gives you precise types back.
_10const palette = {_10 red: [255, 0, 0],_10 green: "#00ff00",_10 bleu: [0, 0, 255],_10};_10_10palette.green.toUpperCase(); // fine
The catch is the typo. bleu slipped through, and nothing warns you that blue is missing. You find out later, usually at runtime, when something reads palette.blue and gets undefined.
What satisfies does
#satisfies sits after an expression and checks that the expression is assignable to a type. Unlike an annotation, it does not change the type of the expression. The value keeps its inferred type, and the target type is used only for checking and for contextual typing.
_10const palette = {_10 red: [255, 0, 0],_10 green: "#00ff00",_10 blue: [0, 0, 255],_10} satisfies Palette;_10_10palette.green.toUpperCase(); // fine: green is a string_10palette.red.at(0); // fine: red is an RGB tuple
And the mistakes are caught again:
_10const palette = {_10 red: [255, 0, 0],_10 green: "#00ff00",_10 bleu: [0, 0, 255],_10} satisfies Palette;_10// Error: Object literal may only specify known properties,_10// and 'bleu' does not exist in type 'Palette'.
If you remove blue entirely, you get an error saying the property is missing. If you write red: [255, 0], you get an error because a two-item array is not an RGB.
Notice that red is inferred as a tuple, not as number[]. That is the contextual typing part: TypeScript uses Palette as a hint while inferring the literal, so arrays and string literals are inferred in a shape that fits the target. You get the precision of inference and the shape of the type you asked for.
A useful way to remember the difference:
- An annotation says "this variable has this type".
satisfiessays "this value must fit this type, but keep what you know about it".
satisfies is not as
#It is easy to confuse satisfies with a type assertion, because both appear after an expression. They do opposite jobs.
_10type User = { id: string; name: string };_10_10const a = {} as User; // compiles, and a is now a lie_10const b = {} satisfies User; // Error: missing properties 'id' and 'name'
as tells the compiler to trust you. It only refuses when the two types have nothing in common. satisfies asks the compiler to check you. If you have been using as on object literals to get autocomplete, satisfies is almost always the safer swap.
Combining satisfies with as const
#as const makes a literal deeply read-only and keeps every value as its narrowest literal type. On its own, it checks nothing. Put the two together and you get literal types that are also validated.
_11const routes = {_11 home: "/",_11 articles: "/articles",_11 article: "/article/:id",_11} as const satisfies Record<string, `/${string}`>;_11_11type RouteName = keyof typeof routes;_11// "home" | "articles" | "article"_11_11const path = routes.article;_11// type is "/article/:id", not string
The template literal type in the constraint means every value must start with a slash. Write "articles" without one and you get an error on that property. The order matters: as const applies first, then satisfies checks the read-only result.
Real-world uses
#Lookup tables that must cover every case
A Record keyed by a union forces you to handle every member. With satisfies, each entry keeps its own precise type.
_10type Status = "draft" | "review" | "published";_10_10const statusLabel = {_10 draft: { text: "Draft", tone: "neutral" },_10 review: { text: "In review", tone: "warning" },_10 published: { text: "Published", tone: "success" },_10} satisfies Record<Status, { text: string; tone: "neutral" | "warning" | "success" }>;
Add "archived" to Status and this object fails to compile until you add a label. That turns a forgotten case into a build error rather than a blank badge in production.
Configuration files
Many tools export a config type. Using satisfies on the default export checks your settings and keeps the literal values visible to anything that imports the config.
_10import type { NextConfig } from "next";_10_10const nextConfig = {_10 reactStrictMode: true,_10 images: {_10 remotePatterns: [{ protocol: "https", hostname: "images.example.com" }],_10 },_10} satisfies NextConfig;_10_10export default nextConfig;
An annotation would work just as well for the tool itself. The difference shows when your own code reads the object, for example a test that checks a specific setting.
Deriving types from a checked value
Sometimes the value is the source of truth and the types should follow it. satisfies lets you check the value against a loose shape, then derive narrow types from it.
_13type Handler = (payload: unknown) => void;_13_13const handlers = {_13 "user.created": (payload) => console.log("created", payload),_13 "user.deleted": (payload) => console.log("deleted", payload),_13} satisfies Record<string, Handler>;_13_13type EventName = keyof typeof handlers;_13// "user.created" | "user.deleted"_13_13function dispatch(name: EventName, payload: unknown) {_13 handlers[name](payload);_13}
With an annotation of Record<string, Handler>, keyof typeof handlers would just be string, and dispatch("user.updated", ...) would compile. With satisfies, it does not. The parameters in each handler are also contextually typed as unknown, so you do not need to annotate them.
What satisfies does not do
#A few limits are worth knowing so you are not surprised.
- It has no runtime effect. Like every type construct, it is erased when your code is compiled or stripped. It will not validate data from an API, a form or a file. For that you need a runtime check, such as a schema library or a hand-written type guard.
- Excess property checks only apply to fresh literals. If you build an object elsewhere and then write
existing satisfies Palette, extra properties are not reported, the same as with normal assignment. - It does not make anything read-only. Mutating a property is still allowed unless you add
as constor areadonlytype. - It checks once, where it is written. If you later reassign a
letvariable, the new value is checked against the variable's inferred type, not thesatisfiestarget.
Version support
#satisfies arrived in TypeScript 4.9, released in November 2022, so any current TypeScript version supports it, including 6.0 and the native 7.0 compiler. Tools that strip types without checking them, such as esbuild, SWC, Babel and Node's built-in type stripping, all understand and remove it. Because it is erasable syntax, it is also allowed under the erasableSyntaxOnly compiler option.
If your editor or linter reports satisfies as a syntax error, the tool is bundling an older TypeScript version than your project. Updating the tool or pointing it at the workspace TypeScript fixes it.
When not to use it
#satisfies is not a replacement for every annotation. Reach for a plain annotation when:
- You are typing function parameters and return types. These are contracts for callers. An annotation is the clearest way to state them, and
satisfiescannot be used on a parameter anyway. - You want the wider type on purpose. If you export an object and do not want callers to depend on its exact current values, annotate it with the broad type. Literal types leak detail into your public API.
- The variable will be reassigned. A
letthat holds different values over time is better described by its declared type than by the type of its first value. - The value is already well typed. Writing
satisfies stringafter a string literal adds noise and nothing else.
A reasonable rule of thumb: use satisfies on object and array literals that are mostly read, especially configuration, lookup tables and maps of handlers. Use annotations at boundaries.
Wrapping up
#- An annotation checks a value but replaces its inferred type.
satisfieschecks the value and keeps what TypeScript inferred. assilences the compiler,satisfiesasks it to check you. Prefersatisfieson object literals.as const satisfies SomeTypegives you deeply literal, read-only values that are still validated.- Pair it with a
Recordkeyed by a union to turn forgotten cases into build errors. - It is compile-time only, so untrusted data still needs runtime validation.
TypescriptWas this article helpful?

About the author
Danny Engineering
A software engineer with a strong belief in human-centric design and driven by a deep empathy for users. Combining the latest technology with human values to build a better, more connected world.