TypeScript code style and optimization guidelines. Use when writing TypeScript code (.ts, .tsx, .mts files), reviewing code quality, or implementing type-safe patterns. Triggers on TypeScript development, type safety questions, or code style discussions.
any; explicitly type when necessaryRecord<PropertyKey, unknown> over object or anyinterface for object shapes (e.g., React props); use type for unions/intersectionsas const satisfies XyzInterface over plain as const@ts-expect-error over @ts-ignore over as anyasync/await over callbacks or .then() chains*Syncimport { readFile } from 'fs/promises'Promise.all, Promise.race for concurrent operations where safefor…of loops over index-based for loopspackages/utils or installed npm packagesDate.now() to a constant once and reuse for consistencyimport { log } from 'debug' directly (logs to console)console.error in catch blocks instead of debug package