Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

TypeScript · Const

satisfies

The satisfies operator checks that an expression conforms to a target type without changing the expression’s inferred type. It catches structural mistakes while preserving precise property and method inference.

Since
4.9

How it works

The postfix satisfies operator checks that an expression conforms to a target type, but leaves the expression's inferred type intact. This combines structural validation—such as detecting missing or misspelled properties—with precise property access and method inference afterward.

Syntax

expression satisfies Type

Parameters

NameTypeDescription
expressionany expressionThe expression whose compatibility is checked.
TypetypeThe type the expression must satisfy.

Returns

The original expression's inferred type, unchanged by the compatibility check.

Key points

  • Use satisfies when an expression must conform to a design or configuration shape.
  • The operator preserves detailed inference, including property-specific types useful to later code.
  • It is a postfix operator placed after the expression and followed by the target type.
  • A mapped target such as Record<Colors, string | RGB> can validate every named property against an allowed value type.
  • It is useful for configuration objects where misspelled keys and incompatible values should be rejected.

Common mistakes

  • satisfies validates compatibility but does not replace the expression's inferred type with the target type.
  • It checks the expression against the target type, so incompatible properties or keys still produce errors.

Example: Validate a palette without widening its values

type RGB = [red: number, green: number, blue: number];
type Colors = "red" | "green" | "blue";

const palette = {
  red: [255, 0, 0],
  green: "#00ff00",
  blue: [0, 0, 255],
} satisfies Record<Colors, string | RGB>;

const greenUpper = palette.green.toUpperCase();
console.log(greenUpper);

The object is checked against the required color map while palette.green retains its inferred string type, so string methods remain available.

When to use it

Configuration validation

Validate application settings or build metadata while retaining literal and property-specific inference.

Exhaustive object maps

Check that named keys and their values fit a union or mapped record type.

Precise downstream inference

Preserve tuple, array, or string-specific operations after checking a broader contract.

Interview questions

QWhat problem does the satisfies operator solve?

satisfies checks whether an expression is compatible with a type, while preserving the expression's own inferred type. This lets TypeScript report structural mistakes without losing specific property information.

Follow-up: How would you retain tuple information in a validated configuration? Use satisfies with a target containing the tuple type, allowing the original tuple inference to remain available.

QHow does satisfies differ from a type annotation?

A type annotation can make a value conform to a broader type and thereby expose only that broader view. satisfies performs the compatibility check without changing the value's resulting type, so specific members and methods remain usable.

Follow-up: Why can palette.green.toUpperCase() work in the documentation example? The property is inferred as the string literal value type rather than being reduced to the broader string-or-array union.

QWhat kinds of errors can satisfies catch?

In a record-like object, satisfies can detect an unknown key such as a misspelled color because every property must be compatible with the target mapping. At the same time, correctly typed properties keep their precise inferred forms.

Follow-up: What happens if a required key is omitted? The expression fails validation because it does not satisfy the required record shape.

  • Record
  • implements
  • @satisfies
  • TypeScript 5.0

Source: Documentation - TypeScript 4.9. Checked 2026-10-15.