TypeScript Patterns
TypeScript patterns and strict typing rules.
Quick Reference
- Imports: See imports.md for path aliases (~/@, ~~/, #shared, #server)
- Types: See types.md for interfaces and when to use interface vs type
- Type Guards: See guards.md for type predicates and runtime type checking
- Type Assertions: See type-assertions.md for avoiding
askeyword - Validation: See validation.md for Valibot validation patterns
Strict Typing Rules
- NO
anytypes - always use proper types orunknown - Explicit return types on exported functions
- Use
unknownfor uncertain types, then narrow with type guards - Import types separately:
import type { ... }when only importing types
