Overview
TypeScript Mastery loads a complete typing doctrine into your agent: types are sets, the compiler is a prover, and every bad type traces to lying to it, withholding evidence, or proving in the wrong place. The core file carries fifteen non-negotiables and two decision frameworks (any/unknown/never/assertion, and where a type should live); eight reference files go deep on tsconfig and module resolution, narrowing and control flow, generics that pay rent, type-level programming, runtime validation at boundaries, everyday type design, declarations and publishing, and decoding compiler errors — loaded only when the task needs them, so the rune stays light in context.
What it grants
- 01Version- and config-aware from the first line: reads tsconfig strictness before advising, knows erasable-syntax runtimes
- 02The strict baseline plus the flags worth adding: noUncheckedIndexedAccess, exactOptionalPropertyTypes, verbatimModuleSyntax
- 03Narrowing doctrine: discriminated unions, enforced exhaustiveness, and the six walls where control flow gives up
- 04Generics discipline: the parameter-appears-twice rule, inference-first design, NoInfer and const type params
- 05Type-level programming with a conscience: conditional/mapped/template-literal types, named and tested, derived from values when possible
- 06Parse-don't-assert at every boundary: zod schemas, branded identifiers, errors as unknown, Result unions for expected failures
- 07interface-vs-type settled, satisfies over annotation for const data, enums replaced with as-const objects
- 08Publishing types that survive contact: exports maps validated with attw, module augmentation, JS→TS migration ratchet
- 09Compiler-error decoder ring and tsc performance triage: from 'not assignable' archaeology to instantiation-depth blowups
Try it like this
agent> Review this module the typescript-mastery way — hunt the lies (as, any, !), fix the boundaries with parsed types, and make every switch exhaustive.