TypeScript Cursor Rules
Cursor rules for TypeScript: enforce strict mode, eliminate any types, and write type-safe code with these .cursorrules configurations.
- Enable strict mode in tsconfig.json — never disable it - Never use any; prefer unknown for external data and narrow before use - Prefer interfaces over type aliases for object shapes - Use const assertions and readonly modifiers for immutable data - Use satisfies operator for type-safe object literals - Use Result/Option patterns instead of throwing for expected errors - Use zod or valibot for runtime validation of external/user data - Prefer named exports over default exports for better refactoring
How to use with Cursor
Create a `.cursorrules` file in your project root and paste these rules. Cursor reads this automatically on every AI interaction.
Related Rules
Python Cursor Rules
Best Cursor AI coding rules for Python development. Enforce type hints, PEP 8, Pythonic patterns, and modern Python best practices in your .cursorrules file.
React Cursor Rules
Cursor rules for React: component patterns, hooks best practices, performance optimization, and clean state management conventions.
Next.js Cursor Rules
Cursor rules for Next.js App Router: server components, data fetching, routing, and deployment best practices.
Rust Cursor Rules
Cursor rules for Rust: ownership patterns, error handling with Result, idiomatic Rust, and performance-aware coding conventions.