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).
frontend ruleP1stack specificStack: typescript
typescripttypespropsaccuracy
Narrow prop types to the fields actually used with Pick/Omit
When a component only needs a few fields of a larger model, type the prop with Pick/Omit (or pass only those fields) instead of declaring the full type and passing unused data.
PR: hegnar-forum-web · org-mining-2026-06Created: Jun 17, 2026
Bad example
Old codetsx
| 1 | interface Props { ticker: Ticker; } // passes id, insref... unused |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | interface Props { ticker: Pick<Ticker, 'fullname' | 'name' | 'logo'>; } |
Explanation (EN)
Objašnjenje (HR)