Dev Helpers

TypeScript / Type-safe configuration

Override a single option with satisfies

Dev Helpers · June 28, 2025

The satisfies operator checks a value against a contract without replacing its inferred type with that contract. It can catch a misspelled option early.

Worked example

type Config = {
  mode: "dev" | "prod";
  retries: number;
  tags: readonly string[];
};
const defaults: Config = { mode: "dev", retries: 2, tags: ["api"] };
console.log({ ...defaults, retries: 4 } satisfies Config);

Result

{ mode: 'dev', retries: 4, tags: [ 'api' ] }

Implementation notes

A settings override can satisfy a type and still violate a runtime relationship between settings. Validate cross-field rules separately.

Try it yourself

Add an unknown option and inspect the error at the declaration.

Open the TypeScript example →

Editorial date June 28, 2025 · Published December 6, 2026

Related articles

Reject fractional cent amounts

A numeric type cannot by itself guarantee whole cents. Validate integrality where money enters the typed part of the application.

Infer route names from a registry

A route registry can drive both lookup and allowed route names. Type the keys from the registry so a removed route cannot survive in a separate union.