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.

At a glance

Purpose
Static types for JavaScript
File extension
.ts · .tsx
Runs in
Compiled to JavaScript
Usually used with
JavaScript and its ecosystem

Specifications & further reading

Related TypeScript documentation