← CodeClarityLab Home
Browse by Category
+ added · updated 7d
← Back to glossary

satisfies Operator (TS 4.9)

typescript 4.9 Intermediate

TL;DR

satisfies validates that a value matches a type without widening the inferred type — keeping precise literal types while checking against an interface.

Explanation

Before satisfies, you had to choose: use 'as Type' (loses inference) or rely on inference (no type safety). satisfies validates the shape without widening. Example: const palette = { red: [255,0,0], green: '#00ff00' } satisfies Record<string, string | number[]> — TypeScript knows palette.red is number[] (not string | number[]) because inference is preserved. This enables calling .toUpperCase() on palette.green without a type assertion, while still checking it conforms to the Record type. Useful for config objects, CSS-in-JS, and any case where you want validation without losing specificity.

Common Misconception

satisfies is the same as 'as' type assertion — 'as' forces a type and can hide errors. satisfies validates without widening.

Why It Matters

satisfies allows type-safe config objects and large data structures where you want both validation and precise property types — previously impossible without redundancy.

Common Mistakes

  • Using 'as Type' when satisfies is more appropriate — 'as' silences errors.
  • Using satisfies without understanding it preserves inferred types for each property.
  • Expecting satisfies to change the runtime behaviour — it's compile-time only.

Code Examples

✗ Vulnerable
// As-assertion loses specificity:
const config = {
    timeout: 5000,
    endpoint: '/api'
} as Config; // config.timeout is now Config['timeout'], not 5000
✓ Fixed
type Config = { timeout: number; endpoint: string };

const config = {
    timeout: 5000,    // TypeScript knows this is 5000, not just number
    endpoint: '/api'  // TypeScript knows this is '/api', not just string
} satisfies Config;

config.timeout; // type: 5000 (literal) — not number

Added 22 Mar 2026
Views 26
Rate this term
No ratings yet
🤖 AI Guestbook educational data only
| |
Last 30 days
0 pings W 0 pings T 0 pings F 0 pings S 0 pings S 0 pings M 0 pings T 0 pings W 0 pings T 1 ping F 0 pings S 1 ping S 1 ping M 0 pings T 0 pings W 0 pings T 1 ping F 0 pings S 1 ping S 0 pings M 0 pings T 0 pings W 1 ping T 1 ping F 0 pings S 1 ping S 0 pings M 0 pings T 0 pings W 0 pings T
No pings yet today
No pings yesterday
Amazonbot 12 Unknown AI 3 Google 3 Ahrefs 3 Perplexity 2 ChatGPT 1 Meta AI 1
crawler 22 crawler_json 1 pre-tracking 2
DEV INTEL Tools & Severity
🔵 Info ⚙ Fix effort: Low
⚡ Quick Fix
Replace 'as Type' for config objects with 'satisfies Type' to preserve literal types while validating shape.
📦 Applies To
typescript 4.9 web cli
🔗 Prerequisites
🔍 Detection Hints
satisfies
Auto-detectable: ✗ No typescript
🤖 AI Agent
Confidence: Low False Positives: Medium ✓ Auto-fixable Fix: Low Context: Line

✓ schema.org compliant