Loading...
Loading...
Use when working with TypeScript projects, tooling, and ecosystem. Covers the type system, project configuration, package management, CLI development, and library packages. USE FOR: TypeScript language features, choosing build tools, package managers, project structure, type system guidance, runtime selection DO NOT USE FOR: specific tool configuration details (use the sub-skills: project-system, package-management, cli, packages)
npx skill4agent add tyler-r-kendrick/agent-skills typescripttypescript/
├── project-system/ # tsconfig.json, build tools, bundlers, compilation
├── package-management/ # npm, yarn, pnpm, bun, workspaces, publishing
├── cli/ # Commander, yargs, oclif, ink, chalk, CLI tooling
└── packages/ # Popular libraries (Express, Next.js, Zod, Prisma, etc.)| Problem | Sub-Skill | Notes |
|---|---|---|
| Configure tsconfig.json or compiler options | | Covers target, module, strict, paths, and all compiler flags |
| Choose or configure a bundler (Vite, esbuild, etc.) | | Build tool comparison with speed, features, and config examples |
| Set up monorepo with project references | | Composite projects, tsc --build, path aliases |
| Choose a package manager (npm, pnpm, yarn, bun) | | Feature comparison, lockfiles, disk usage, monorepo support |
| Configure workspaces for a monorepo | | npm/yarn/pnpm/bun workspace patterns and turborepo integration |
| Publish a package to npm | | Publishing workflow, provenance, package.json exports |
| Build a CLI tool | | Commander, yargs, oclif, ink for TUI, packaging strategies |
| Add interactive prompts or terminal styling | | inquirer, prompts, chalk, ora, listr2 |
| Choose or use a specific library | | Express, Fastify, Next.js, Zod, Prisma, tRPC, and more |
| Version | Key Features |
|---|---|
| 4.0 | Variadic tuple types, labeled tuple elements, class property inference from constructors |
| 4.1 | Template literal types, key remapping in mapped types, recursive conditional types |
| 4.2 | Leading/middle rest elements in tuples, stricter |
| 4.3 | |
| 4.4 | Control flow analysis of aliased conditions, symbol and template literal index signatures |
| 4.5 | |
| 4.6 | Control flow analysis for destructured discriminated unions, |
| 4.7 | |
| 4.8 | Improved intersection reduction, |
| 4.9 | |
| 5.0 | Decorators (TC39 standard), |
| 5.1 | Easier implicit returns for |
| 5.2 | |
| 5.3 | Import attributes, |
| 5.4 | |
| 5.5+ | Inferred type predicates, |
// Union types — value can be one of several types
type Result = "success" | "error" | "pending";
type ID = string | number;
// Intersection types — combine multiple types
type Employee = Person & { employeeId: string };
// Generics — parameterized types
function first<T>(arr: T[]): T | undefined {
return arr[0];
}
// Conditional types — type-level if/else
type IsString<T> = T extends string ? true : false;
// Mapped types — transform properties
type Readonly<T> = { readonly [K in keyof T]: T[K] };
type Optional<T> = { [K in keyof T]?: T[K] };
// Template literal types — string manipulation at the type level
type EventName<T extends string> = `on${Capitalize<T>}`;
type ClickEvent = EventName<"click">; // "onClick"
// satisfies operator — validate type without widening
const palette = {
red: [255, 0, 0],
green: "#00ff00",
} satisfies Record<string, string | number[]>;
// const assertions — narrow to literal types
const routes = ["home", "about", "contact"] as const;
type Route = (typeof routes)[number]; // "home" | "about" | "contact"
// Discriminated unions — tagged union pattern
type Shape =
| { kind: "circle"; radius: number }
| { kind: "rectangle"; width: number; height: number };
function area(shape: Shape): number {
switch (shape.kind) {
case "circle":
return Math.PI * shape.radius ** 2;
case "rectangle":
return shape.width * shape.height;
}
}| Utility | Purpose | Example |
|---|---|---|
| Make all properties optional | |
| Make all properties required | |
| Make all properties readonly | |
| Select specific properties | |
| Remove specific properties | |
| Object type with key/value types | |
| Remove types from a union | |
| Keep only matching union members | |
| Remove null and undefined | |
| Extract function return type | |
| Extract function parameter types | |
| Unwrap Promise types | |
| Prevent inference on a type parameter | |
| Runtime | Key Strengths | TypeScript Support |
|---|---|---|
| Node.js | Largest ecosystem, widest deployment, mature tooling | Via |
| Deno | Built-in TypeScript, secure by default, web-standard APIs | Native — no build step required |
| Bun | Fastest startup, built-in bundler/test runner/package manager | Native — runs |
| Cloudflare Workers | Edge computing, V8 isolates, global deployment | Via Wrangler with esbuild under the hood |
.tsstrictstrictNullChecksnoImplicitAnystrictFunctionTypesanyunknownunknownanyfunction parse(input: unknown): Config {
if (typeof input === "object" && input !== null && "port" in input) {
return input as Config;
}
throw new Error("Invalid config");
}// Prefer this
if (typeof value === "string") {
console.log(value.toUpperCase());
}
// Over this
console.log((value as string).toUpperCase());type UserId = string & { __brand: "UserId" };
type OrderId = string & { __brand: "OrderId" };
function getUser(id: UserId): User { /* ... */ }
// getUser(orderId) — compile error!satisfiesconstnoUncheckedIndexedAccessany