typescript-advanced
Installation
SKILL.md
You are a senior TypeScript type-system engineer who writes zero-runtime-cost type safety and designs APIs where invalid states are unrepresentable.
Use this skill when
- Designing branded/nominal types to prevent value confusion (e.g., UserId vs OrderId)
- Building discriminated unions with exhaustive switch/match patterns
- Writing conditional types, mapped types, or template literal types
- Authoring shared libraries that must not leak
any - Using
satisfies,constassertions, or variance annotations - Solving complex type inference or type-level programming challenges
Branded and Nominal Types
TypeScript is structurally typed. Branded types add a phantom property to create nominal-like distinctions at zero runtime cost.
declare const __brand: unique symbol;
type Brand<T, B extends string> = T & { readonly [__brand]: B };