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
namingtypescriptapiconventions
Name raw backend payload types with a Response suffix
Keep two types per fetch function: one suffixed Response for the raw web-service payload and one without the suffix for the resolved domain value.
PR: hegnar-forum-web · org-mining-hist-2026-06Created: Jun 20, 2026
Bad example
Old codetypescript
| 1 | // one ambiguous interface used for both wire and domain |
| 2 | interface ThreadsPage { items: Thread[]; } |
| 3 | async function getThreads(): Promise<ThreadsPage> { ... } |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | interface ThreadsResponse { items: Thread[]; } // raw web-service shape |
| 2 | type Threads = Thread[]; // resolved value |
| 3 | async function getThreads(): Promise<Threads> { ... } |
Explanation (EN)
Objašnjenje (HR)