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
api-designtypesclean-code
Accept the simplest type a function actually needs
If a method only ever uses url.toString(), accept a string rather than a URL object so the signature reflects the real dependency.
PR: hegnar-ws · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codetypescript
| 1 | private async fetchData(url: URL) { |
| 2 | return fetch(url.toString()); |
| 3 | } |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | private async fetchData(url: string) { |
| 2 | return fetch(url); |
| 3 | } |
Explanation (EN)
Objašnjenje (HR)