TypeScript Best Practices
When to use this skill
Use this skill when you need to:
- Implement TypeScript code following best practices
- Refactor JavaScript to TypeScript
- Improve type safety and code maintainability
- Choose between different TypeScript patterns
- Teach or explain TypeScript best practices
- Review code for TypeScript anti-patterns
Instructions
- Identify the pattern: Which best practice applies to your situation?
- Apply the pattern: Follow the code examples provided
- Verify types: Ensure TypeScript infers the correct types
- Test usage: Confirm autocomplete and type checking work as expected
Best Practices
- Use
as constInstead of Enums: read at as-const-pattern