typescript-satisfies-operator

Validate TypeScript object shapes while preserving literal types with satisfies.

1|Updated Mar 20, 2026
One-click install
npx skills add https://github.com/Thomashighbaugh/opencode --skill typescript-satisfies-operator-thomashighbaugh
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: typescript-satisfies-operator
Source: https://github.com/Thomashighbaugh/opencode/tree/main/skills/typescript-satisfies-operator
Command: npx skills add https://github.com/Thomashighbaugh/opencode --skill typescript-satisfies-operator-thomashighbaugh

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Guides proper usage of TypeScript's satisfies operator vs type annotations. Use this skill when deciding between type annotations (colon) and satisfies, validating object shapes while preserving literal types, or troubleshooting type inference issues.

Core Features & Use Cases

  • Clarifies when to use colon vs satisfies to control type widening and value inference.
  • Shows validation patterns that preserve literal types while ensuring structural correctness.
  • Helps troubleshoot common type-inference issues in complex objects and configs.

Quick Start

Demonstrate how to preserve literal types with satisfies in a compact TS example.

Frequently Asked Questions about typescript-satisfies-operator

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I preserve literal types while validating object shapes in TypeScript?

The TypeScript satisfies operator preserves literal types while validating object shapes against a target type without widening the inferred values. This enables precise error detection and safer code during complex data validation scenarios.

TypeScript satisfies vs type annotation: when should I use which?

Use the TypeScript satisfies operator instead of a type annotation when you need to validate object shapes while preserving literal types. Type annotations often widen inferred types, whereas satisfies ensures structural correctness without losing exact literal values.

Why does TypeScript widen my literal types during type inference?

TypeScript widens literal types during type inference when using standard type annotations. To avoid this, use the satisfies operator to check structural correctness against a target type while retaining the precise literal values for safer code.

How to troubleshoot type inference issues in complex TypeScript objects?

Troubleshoot type inference issues in complex TypeScript objects by applying the satisfies operator. This validates the object shape while preserving literal types, allowing exact property value inference and enabling precise error detection in configurations.

Can I use the TypeScript satisfies operator for static type safety in complex configs?

Yes, you can use the TypeScript satisfies operator for static type safety in complex configs. It validates object shapes while preserving exact literal values, ensuring structural correctness and safer code without widening the inferred types.