mastering-typescript
Master enterprise-grade TypeScript development with type-safe patterns, modern tooling, and framework integration. This skill provides comprehensive guidance for TypeScript 5.9+, covering type system fundamentals (generics, mapped types, conditional types, satisfies operator), enterprise patterns (e
By spillwavesolutions · 748 installs
npx skills add spillwavesolutions/mastering-typescript-skill --skill mastering-typescript
Source repository · Upstream listing
Mastering Modern TypeScript
Build enterprise grade, type safe applications with TypeScript 5.9+.
Compatibility: TypeScript 5.9+, Node.js 22 LTS, Vite 7, NestJS 11, React 19
Quick Start
When to Use This Skill
Use when:
Building type safe React, NestJS, or Node.js applications
Migrating JavaScript codebases to TypeScript
Implementing advanced type patterns (generics, mapped types, conditional types)
Configuring modern TypeScript toolchains (Vite, pnpm, ESLint)
Designing type safe API contracts with Zod validation
Comparing TypeScript approaches with Java or Python
Project Setup Checklist
Before starting any TypeScript project:
Type System Quick Reference
Primitive Types
Union and Intersection Types
Type Guards
The satisfies Operator (TS 5.0+)
Validate type conformance while preserving inference:
Generics Patterns
Basic Generic Function
Constrained Generics
Generic API Response Wrapper
Utility Types Reference
Type Purpose Example
Partial<T All properties optional Partial<User
Required<T All properties required Required<Config
Pick<T, K Select specific properties Pick<User, "id" \ "name"
Omit<T, K Exclude specific properties Omit<User, "password"
Record<K, V Object with typed keys/values Record<string, number
ReturnType<F Extract function return type ReturnType<typeof fn
Parameters<F Extract function parameters Parameters<typeof fn
Awaited<T Unwrap Promise type Awaited<Promise<User
Conditional Types
Mapped Types
Framework Integration
React with TypeScript
NestJS with TypeScript
See [react integration.md](references/react integration.md) and [nestjs integration.md](references/nestjs integration.md) for detailed patterns.
Validation with Zod
Modern Toolchain (2025)
Tool Version Purpose
TypeScript 5.9+ Type checking and compilation
Node.js 22 LTS Runtime environment
Vite 7.x Build tool and dev server
pnpm 9.x Package manager
ESLint 9.x Linting with flat config
Vitest 3.x Testing framework
Prettier 3.x Code formatting
ESLint Flat Config (ESLint 9+)
Migration Strategies
Incremental Migration
1. Add allowJs: true and checkJs: false to tsconfig.json
2. Rename files from .js to .ts one at a time
3. Add type annotations gradually
4. Enable stricter options incrementally
JSDoc for Gradual Typing
See [enterprise patterns.md](references/enterprise patterns.md) for comprehensive migration guides.
Common Mistakes
Mistake Problem Fix
Using any liberally Defeats type safety Use unknown and narrow
Ignoring strict mode Misses null/undefined bugs Enable all strict options
Type assertions ( as ) Can hide type errors Use satisfies or guards
Enum for simple unions Generates runtime code Use literal unions instead
Not validating API data Runtime type mismatches Use Zod at boundaries
Cross Language Comparison
Feature TypeScript Java Python
Type System Structural Nominal Gradual (duck typing)
Nullability Explicit ( T \ null ) @Nullable annotations Optional via typing
Generics Type level, erased Type level, erased Runtime via typing
Interfaces Structural matching Must implement Protocol (3.8+)
Enums Avoid (use unions) First class Enum class
Reference Files
[type system.md](references/type system.md) — Complete type system guide
[generics.md](references/generics.md) — Advanced generics patterns
[enterprise patterns.md](references/enterprise patterns.md) — Error handling, validation, architecture
[react integration.md](references/react integration.md) — React + TypeScript patterns
[nestjs integration.md](references/nestjs integration.md) — NestJS API development
[toolchain.md](references/toolchain.md) — Modern build tools configuration
Assets
[tsconfig template.json](assets/tsconfig template.json) — Strict enterprise config
[eslint template.js](assets/eslint template.js) — ESLint 9 flat config
Scripts
[validate setup.sh](scripts/validate setup.sh) — Verify TypeScript environment