Loading...
Loading...
TypeScript language expertise covering the type system, generics, utility types, advanced type patterns, and project configuration. Use this skill whenever writing, reviewing, or refactoring TypeScript code, designing type-safe APIs, working with complex generics, debugging type errors, configuring tsconfig.json, migrating JavaScript to TypeScript, or leveraging TypeScript 5.x features like satisfies, const type parameters, decorators, and the using keyword. Also use when the user asks about type narrowing, conditional types, mapped types, template literal types, branded types, discriminated unions, or any TypeScript type system question — even seemingly simple ones, because TypeScript's type system has subtle gotchas that catch experienced developers.
npx skill4agent add biggora/claude-plugins-registry typescript-expertCovers TypeScript through 5.8 (latest stable as of March 2026). The official handbook at https://www.typescriptlang.org/docs/handbook/ is the canonical reference.
| You need to... | Read |
|---|---|
| Understand primitives, inference, narrowing | core-type-system |
Choose between | core-interfaces-types |
| Write generic functions, classes, constraints | core-generics |
Use | core-utility-types |
Build conditional types with | advanced-conditional-types |
| Create mapped types and key remapping | advanced-mapped-types |
| Use template literal types for string patterns | advanced-template-literals |
| Narrow types with guards and discriminated unions | advanced-type-guards |
| Use TC39 decorators (TS 5.0+) | advanced-decorators |
Configure | best-practices-tsconfig |
| Apply common patterns (branded types, error handling, immutability) | best-practices-patterns |
| Optimize type-level performance | best-practices-performance |
Use TS 5.0-5.8 features ( | features-ts5x |
// Unnecessary — TypeScript infers `number`
const count: number = 5;
// Good — let inference work
const count = 5;
// DO annotate function signatures (parameters + return types for public APIs)
function getUser(id: string): Promise<User> { ... }
// Return type annotation catches accidental returns
function parse(input: string): ParseResult {
if (!input) return null; // Error! null isn't ParseResult — good, we caught a bug
}unknownanyanyunknown// Bad — silently breaks type safety
function process(data: any) {
data.foo.bar; // No error, but might crash at runtime
}
// Good — forces you to check before using
function process(data: unknown) {
if (typeof data === "object" && data !== null && "foo" in data) {
// Now TypeScript knows data has a foo property
}
}"strict": truestrictNullChecksnoImplicitAnystrictFunctionTypesreadonly// Model states explicitly — impossible to access data in loading/error state
type AsyncState<T> =
| { status: "loading" }
| { status: "error"; error: Error }
| { status: "success"; data: T };
// Branded types prevent ID mixups at compile time
type UserId = string & { readonly __brand: "UserId" };
type OrderId = string & { readonly __brand: "OrderId" };
function getOrder(orderId: OrderId): Order { ... }
getOrder(userId); // Error! UserId is not assignable to OrderIdinterface Point { x: number; y: number }
interface Coordinate { x: number; y: number }
const p: Point = { x: 1, y: 2 };
const c: Coordinate = p; // OK — same shape
// This means excess property checks only apply to object literals
function plot(point: Point) { ... }
plot({ x: 1, y: 2, z: 3 }); // Error — excess property check on literal
const obj = { x: 1, y: 2, z: 3 };
plot(obj); // OK — no excess check on variable| Gotcha | Explanation |
|---|---|
| Use |
| Arrays are mutable by default. Use |
| Prefer union types ( |
Optional vs | |
| Type assertions ( |
| A single |
| Version | Feature | Why it matters |
|---|---|---|
| 5.0 | TC39 Decorators | Standard decorator syntax, no |
| 5.0 | | |
| 5.1 | Easier implicit returns | |
| 5.2 | | Deterministic resource cleanup (like C# |
| 5.4 | | Prevents unwanted inference from specific positions |
| 5.5 | Inferred type predicates | |
| 5.6 | Iterator helper methods | |
| 5.7 | | Faster composite project builds |
| 5.8 | | Strip types without full compilation (Node.js |