Codectionary / Developer documentation / TypeScript

TypeScript satisfies Operator

The satisfies operator checks that an expression is compatible with a type without replacing the expression’s more specific inferred type.

Syntax

const palette = { primary: "#1769ff" } satisfies Record<string, string>;

Examples

Checking an object shape

A small, runnable example of this syntax.

type Route = { path: string; secure: boolean };

const routes = {
  home: { path: "/", secure: false },
  account: { path: "/account", secure: true }
} satisfies Record<string, Route>;

routes.home.path;

Best practices

  • Use satisfies for configuration objects when you want validation without losing helpful literal inference.
  • Keep examples small while learning, then combine the idea with a real project.

Runtime & versions

Compiled to JavaScript. Feature availability depends on the language and runtime version used by your project; consult the official reference below.

TypeScript Handbook

Specifications & further reading