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 ruleP2stack specificStack: typescript
typescripttypesreadability
Give a Map's value a named type instead of a bare primitive
Wrap a Map value in a named type or object so Map<number, X> documents what the value means rather than an opaque boolean.
PR: hegnar-web · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codetypescript
| 1 | const cache = new Map<number, boolean>(); // boolean meaning unclear |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | type FileInfo = { isJsx: boolean }; |
| 2 | const cache = new Map<number, FileInfo>(); |
Explanation (EN)
Objašnjenje (HR)