TypeScript Rules
TypeScript compiler commands for type checking, building, and configuring projects with strict type safety.
4 rules
Generics Best Practices
Use TypeScript generics effectively — constrain type parameters, avoid over-generic functions, use utility types, and apply the principle of least generic typing for maximum clarity.
Ban the 'any' Type
Never use 'any' in TypeScript code — use unknown for truly unknown types, generics for flexible functions, union types for multiple options, and proper type narrowing instead.
Strict Mode Required in tsconfig.json
Every TypeScript project must enable strict mode and all additional strict checks — noUncheckedIndexedAccess, exactOptionalPropertyTypes, and noImplicitOverride for maximum type safety.
Type Guards and Narrowing Patterns
Use TypeScript type guards effectively — typeof, instanceof, in operator, discriminated unions, and custom type predicates for safe runtime type checking with compile-time guarantees.