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
typescriptconfiginterfacesmodeling
Extend the base config type for non-generic keys instead of polluting it
Add feature-specific config keys via an extension/derived interface rather than appending them to a generic shared config type.
PR: frontpage-web · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codetypescript
| 1 | interface IDataSourceConfig { |
| 2 | url: string; |
| 3 | currencyList?: string[]; // only currency uses this |
| 4 | } |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | interface IDataSourceConfig { url: string; } |
| 2 | interface ICurrencyConfig extends IDataSourceConfig { currencyList: string[]; } |
Explanation (EN)
Objašnjenje (HR)