--- description: Example rule demonstrating Cursor rule structure globs: - "**/*.ts" - "**/*.tsx" alwaysApply: false --- # Example Coding Standards When working with TypeScript files, follow these conventions: 1. **Use explicit types** - Avoid `any` unless absolutely necessary 2. **Prefer `const` over `let`** - Use immutable bindings when possible 3. **Use async/await** - Prefer async/await over raw Promises 4. **Handle errors explicitly** - Always catch and handle errors appropriately ## Example ```typescript // ✅ Good const fetchData = async (id: string): Promise => { try { const response = await api.get(`/data/${id}`); return response.data; } catch (error) { console.error('Failed to fetch data:', error); throw error; } }; // ❌ Bad const fetchData = (id) => { return api.get('/data/' + id).then(r => r.data); }; ```