← ClaudeAtlas

functional-typescriptlisted

Use when applying functional design in TypeScript without a functional library, including branded types, discriminated unions, and hand-rolled Result.
yutna/functional-design-skills · ★ 0 · AI & Automation · score 75
Install: claude install-skill yutna/functional-design-skills
# Functional TypeScript ## Overview TypeScript's type system can express nearly everything the core skills ask for: discriminated unions give choice types, branded types give single-case wrappers, and exhaustiveness checking through `never` turns a missed case into a compile error. What it does not do by default is stop you opting out. The value of this pack depends on a strict configuration and on a few habits that keep the escape hatches closed. ## When to use - A TypeScript project using the standard library only - Deciding how to express a domain type, a Result, or a pipeline - Reviewing TypeScript against the core design rules Not for: projects built on Effect, which have [functional-typescript-effect](../functional-typescript-effect/SKILL.md); or ts-pattern matching, which has [functional-typescript-ts-pattern](../functional-typescript-ts-pattern/SKILL.md). ## Notation mapping | Neutral notation | TypeScript | | ------------------- | --------------------------------------------------- | | Record type | `type X = { readonly a: A }` | | Choice type | Discriminated union on a literal field | | Single-case wrapper | Branded type plus a parser | | `Option<T>` | `T \| undefined`, or a `Maybe` union | | `Result<T, E>` | `{ ok: true; value: T } \| { ok: false; error: E }` | | `NonEmptyList<T>` | `readonly [T, ...T[]]`