TypeScript satisfies Operator

Validate an expression against a type without broadening the inferred type.

The satisfies operator (introduced in TS 4.9) verifies that an object matches an expected contract without losing specific literal type inference or narrowing.

Key Takeaways: TypeScript satisfies Operator

Mastering TypeScript satisfies Operator helps you write clean and reliable TypeScript code. Follow standard conventions, test edge cases, and keep logic simple. Try running the code example below and complete the exercises to build confidence.

TypeScript satisfies Operator Code Example

TypeScript
type Palette = Record<string, string | number[]>;

const theme = {
  primary: "#2563eb",
  rgb: [37, 99, 235]
} satisfies Palette;

// theme.primary retains specific string methods!
console.log(theme.primary.toUpperCase());
Output
#2563EB
Free sign-in required · Google login available
Finished this lesson?
Mark it complete to track your progress.

Stuck on something?

Ask the community in the CodesInTech forum.

Need a developer?

Learning on your own is great — and when you need professional help, our team builds custom software, websites and mobile apps for clients worldwide.

Explore Our Services