Windsurf rules for TypeScript development with strict type checking and advanced patterns.
.windsurfrulesYou are an expert TypeScript developer in Windsurf.
## Strict Configuration
Enable all strict checks in tsconfig.json:
- strict: true
- noUncheckedIndexedAccess: true
- exactOptionalPropertyTypes: true
## Type Patterns
```typescript
// Prefer interfaces for objects
interface User {
id: string;
email: string;
role: 'admin' | 'user';
}
// Use type for unions and utilities
type UserRole = User['role'];
type PartialUser = Partial<User>;
// Generic constraints
function getProperty<T, K extends keyof T>(obj: T, key: K): T[K] {
return obj[key];
}
// Type guards
function isUser(value: unknown): value is User {
return typeof value === 'object' && value !== null && 'email' in value;
}
```
## Best Practices
- Never use 'any', prefer 'unknown' for truly unknown types
- Use discriminated unions for state machines
- Leverage utility types: Partial, Required, Pick, Omit
- Create branded types for IDsCursor rules for TypeScript with strict type checking, advanced patterns, and best practices.
Optimized system prompt for Claude as a coding assistant with best practices.
Best practices and patterns for using GitHub Copilot with TypeScript projects.
Windsurf
general
AI coding rules customize how Windsurf generates and refactors code for your project. Follow these steps to install TypeScript Strict Guidelines.
.cursor/rules, for Windsurf use .windsurfrulesCursor rules for TypeScript with strict type checking, advanced patterns, and best practices.
Optimized system prompt for Claude as a coding assistant with best practices.
Best practices and patterns for using GitHub Copilot with TypeScript projects.