Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
fullstack ruleP1stack specificStack: typescript
typescripttypesanytype-safety
Avoid the any type; declare precise types
Replace any with a concrete type, union, or generic so the compiler and IDE can catch mistakes and provide hints.
PR: frontpage-web · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codetypescript
| 1 | interface IProps { |
| 2 | styles?: any; |
| 3 | } |
| 4 | type: string; // free-form |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | interface IProps { |
| 2 | styles?: { [key: string]: string }; |
| 3 | } |
| 4 | type: 'shopping' | 'stuntbox'; // IDE hints + typo protection |
Explanation (EN)
Objašnjenje (HR)