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).
backend ruleP2universalStack: TypeScript
typescouplingarchitecture
Do not couple a generic interface to a more specific one
Picking fields from a narrower interface to define a broader/more generic one inverts the dependency direction; define the shared shape independently.
PR: hegnar-ws · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codetypescript
| 1 | type InstrumentInfo = Pick<ITickerTag, 'milistreamId' | 'name' | 'symbol'>; |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | interface InstrumentInfo { milistreamId: string; name: string; symbol: string; } |
| 2 | interface ITickerTag extends InstrumentInfo { /* extra fields */ } |
Explanation (EN)
Objašnjenje (HR)