TypeScript Expert Guide - December 2025
Current Landscape
TypeScript Versions
| Version |
Status |
Key Feature |
| 5.7 |
Stable |
Uninitialized variable detection |
| 5.8 |
Stable |
--erasableSyntaxOnly, require(esm) support |
| 5.9 |
Current |
import defer, improved tsc --init |
| 7.0 |
Preview |
Go port (Strada), 10x faster type-checking |
Runtime Options
| Runtime |
TS Support |
Speed |
Use Case |
| Node 22+ |
Native (strip types) |
Baseline |
Production, ecosystem compatibility |
| Bun |
Native |
3x faster |
Development, all-in-one toolkit |
| Deno |
Native |
~Node |
Security-first, standard APIs |
| tsx |
esbuild |
Fast |
Node + TS quick execution |
Linting Landscape
| Tool |
Speed vs ESLint |
Type-Aware |
Notes |
| Biome 2.0 |
20x faster |
85% coverage |
All-in-one (lint + format) |
| Oxlint 1.0 |
50-100x faster |
Experimental |
Linting only, 520+ rules |
| ESLint |
Baseline |
Full |
Most customizable |
Quick Patterns
Modern tsconfig.json (TS 5.9+)
{
"compilerOptions": {
"target": "ESNext",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"strict": true,
"noEmit": true,
"isolatedModules": true,
"esModuleInterop": true,
"skipLibCheck": true,
"declaration": true,
"declarationMap": true
}
}
Run TypeScript Directly
# Node 22+ (native)
node --experimental-strip-types app.ts
# Bun (zero config)
bun app.ts
# tsx (Node + esbuild)
npx tsx app.ts
Type-Safe Object Definition
// satisfies: validate type while preserving literal inference
const config = {
port: 3000,
env: 'production',
} satisfies { port: number; env: string };
// config.env is 'production', not string
// as const: immutable literals
const routes = ['/', '/api', '/admin'] as const;
// routes[0] is '/', not string
Template Literal Types
type EventName = 'click' | 'hover' | 'scroll';
type Handler = `on${Capitalize<EventName>}`;
// 'onClick' | 'onHover' | 'onScroll'
type Route = `/api/${string}/${'get' | 'post'}`;
// '/api/users/get' | '/api/users/post' | ...
Reference Files
Load based on task:
- TS 5.5-5.9 features & TS 7 preview: See typescript-5x-features.md
- Bun, tsx, tsup, Node 22: See modern-tooling.md
- Advanced type patterns: See advanced-types.md
- Biome, Oxlint, ESLint: See linting-formatting.md
- tsconfig, package.json, ESM/CJS: See project-setup.md
- Zod, error handling, async: See runtime-patterns.md
Build Tool Quick Reference
tsup (Library Bundling)
tsup src/index.ts --format esm,cjs --dts
Bun Build
bun build ./src/index.ts --outdir ./dist --target node
Package Scripts
{
"scripts": {
"dev": "bun --watch src/index.ts",
"build": "tsup src/index.ts --format esm,cjs --dts",
"lint": "biome check .",
"typecheck": "tsc --noEmit"
}
}
Key Compiler Flags (TS 5.8+)
| Flag |
Purpose |
--erasableSyntaxOnly |
Enforce type-strippable syntax (no enums, decorators) |
--rewriteRelativeImportExtensions |
Rewrite .ts → .js in imports |
--isolatedDeclarations |
Parallel .d.ts generation |
--noCheck |
Skip type-checking (build only) |
--verbatimModuleSyntax |
Enforce explicit type imports |
Utility Types Quick Reference
// Built-in
Partial<T> // All optional
Required<T> // All required
Readonly<T> // All readonly
Pick<T, K> // Select keys
Omit<T, K> // Exclude keys
Record<K, V> // Key-value map
Extract<T, U> // Filter union
Exclude<T, U> // Remove from union
NonNullable<T> // Remove null/undefined
ReturnType<T> // Function return type
Parameters<T> // Function parameters
Awaited<T> // Unwrap Promise
// String manipulation
Uppercase<S>
Lowercase<S>
Capitalize<S>
Uncapitalize<S>
Decision Framework
Runtime Choice
- Bun: New projects, maximum speed, all-in-one
- Node 22+: Production, ecosystem compatibility
- tsx: Existing Node projects, quick migration
Linter Choice
- Biome: New projects, speed + simplicity
- Oxlint: Speed-critical CI, existing ESLint config
- ESLint: Complex rules, full type-aware linting
Build Tool Choice
- tsup: Library publishing, ESM/CJS dual
- Bun build: Bun-native projects
- tsc: Type-checking only (use with bundler)
1---2name: typescript-expert-20253description: Expert TypeScript development patterns and tooling for December 2025. Use when (1) Setting up modern TypeScript projects with Bun, Node 22+, or Deno, (2) Configuring tsconfig, ESM/CJS dual publishing, or build tooling, (3) Implementing advanced type patterns like satisfies, as const, template literals, mapped types, (4) Choosing between Biome, Oxlint, or ESLint for linting, (5) Optimizing TypeScript performance, or any expert-level TypeScript architecture questions.4---5
6# TypeScript Expert Guide - December 2025
7
8## Current Landscape
9
10### TypeScript Versions
11| Version | Status | Key Feature |
12|---------|--------|-------------|
13| **5.7** | Stable | Uninitialized variable detection |
14| **5.8** | Stable | `--erasableSyntaxOnly`, `require(esm)` support |
15| **5.9** | Current | `import defer`, improved `tsc --init` |
16| **7.0** | Preview | Go port (Strada), 10x faster type-checking |
17
18### Runtime Options
19| Runtime | TS Support | Speed | Use Case |
20|---------|-----------|-------|----------|
21| **Node 22+** | Native (strip types) | Baseline | Production, ecosystem compatibility |
22| **Bun** | Native | 3x faster | Development, all-in-one toolkit |
23| **Deno** | Native | ~Node | Security-first, standard APIs |
24| **tsx** | esbuild | Fast | Node + TS quick execution |
25
26### Linting Landscape
27| Tool | Speed vs ESLint | Type-Aware | Notes |
28|------|-----------------|------------|-------|
29| **Biome 2.0** | 20x faster | 85% coverage | All-in-one (lint + format) |
30| **Oxlint 1.0** | 50-100x faster | Experimental | Linting only, 520+ rules |
31| **ESLint** | Baseline | Full | Most customizable |
32
33## Quick Patterns
34
35### Modern tsconfig.json (TS 5.9+)
36```json
37{
38 "compilerOptions": {
39 "target": "ESNext",
40 "module": "NodeNext",
41 "moduleResolution": "NodeNext",
42 "strict": true,
43 "noEmit": true,
44 "isolatedModules": true,
45 "esModuleInterop": true,
46 "skipLibCheck": true,
47 "declaration": true,
48 "declarationMap": true
49 }
50}
51```
52
53### Run TypeScript Directly
54```bash
55# Node 22+ (native)
56node --experimental-strip-types app.ts
57
58# Bun (zero config)
59bun app.ts
60
61# tsx (Node + esbuild)
62npx tsx app.ts
63```
64
65### Type-Safe Object Definition
66```typescript
67// satisfies: validate type while preserving literal inference
68const config = {
69 port: 3000,
70 env: 'production',
71} satisfies { port: number; env: string };
72// config.env is 'production', not string
73
74// as const: immutable literals
75const routes = ['/', '/api', '/admin'] as const;
76// routes[0] is '/', not string
77```
78
79### Template Literal Types
80```typescript
81type EventName = 'click' | 'hover' | 'scroll';
82type Handler = `on${Capitalize<EventName>}`;
83// 'onClick' | 'onHover' | 'onScroll'
84
85type Route = `/api/${string}/${'get' | 'post'}`;
86// '/api/users/get' | '/api/users/post' | ...
87```
88
89## Reference Files
90
91Load based on task:
92
93- **TS 5.5-5.9 features & TS 7 preview**: See [typescript-5x-features.md](references/typescript-5x-features.md)
94- **Bun, tsx, tsup, Node 22**: See [modern-tooling.md](references/modern-tooling.md)
95- **Advanced type patterns**: See [advanced-types.md](references/advanced-types.md)
96- **Biome, Oxlint, ESLint**: See [linting-formatting.md](references/linting-formatting.md)
97- **tsconfig, package.json, ESM/CJS**: See [project-setup.md](references/project-setup.md)
98- **Zod, error handling, async**: See [runtime-patterns.md](references/runtime-patterns.md)
99
100## Build Tool Quick Reference
101
102### tsup (Library Bundling)
103```bash
104tsup src/index.ts --format esm,cjs --dts
105```
106
107### Bun Build
108```bash
109bun build ./src/index.ts --outdir ./dist --target node
110```
111
112### Package Scripts
113```json
114{
115 "scripts": {
116 "dev": "bun --watch src/index.ts",
117 "build": "tsup src/index.ts --format esm,cjs --dts",
118 "lint": "biome check .",
119 "typecheck": "tsc --noEmit"
120 }
121}
122```
123
124## Key Compiler Flags (TS 5.8+)
125
126| Flag | Purpose |
127|------|---------|
128| `--erasableSyntaxOnly` | Enforce type-strippable syntax (no enums, decorators) |
129| `--rewriteRelativeImportExtensions` | Rewrite .ts → .js in imports |
130| `--isolatedDeclarations` | Parallel .d.ts generation |
131| `--noCheck` | Skip type-checking (build only) |
132| `--verbatimModuleSyntax` | Enforce explicit type imports |
133
134## Utility Types Quick Reference
135
136```typescript
137// Built-in
138Partial<T> // All optional
139Required<T> // All required
140Readonly<T> // All readonly
141Pick<T, K> // Select keys
142Omit<T, K> // Exclude keys
143Record<K, V> // Key-value map
144Extract<T, U> // Filter union
145Exclude<T, U> // Remove from union
146NonNullable<T> // Remove null/undefined
147ReturnType<T> // Function return type
148Parameters<T> // Function parameters
149Awaited<T> // Unwrap Promise
150
151// String manipulation
152Uppercase<S>
153Lowercase<S>
154Capitalize<S>
155Uncapitalize<S>
156```
157
158## Decision Framework
159
160### Runtime Choice
161- **Bun**: New projects, maximum speed, all-in-one
162- **Node 22+**: Production, ecosystem compatibility
163- **tsx**: Existing Node projects, quick migration
164
165### Linter Choice
166- **Biome**: New projects, speed + simplicity
167- **Oxlint**: Speed-critical CI, existing ESLint config
168- **ESLint**: Complex rules, full type-aware linting
169
170### Build Tool Choice
171- **tsup**: Library publishing, ESM/CJS dual
172- **Bun build**: Bun-native projects
173- **tsc**: Type-checking only (use with bundler)