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 ruleP2stack specificStack: typescript
typescripttypesdryreact
Derive related prop types from their source rather than redefining them
Reference an existing component/function's prop type (e.g. ComponentProps['onChange']) instead of hand-redeclaring it, so changes propagate automatically.
PR: vinify-frontend · org-mining-2026-06Created: Jun 17, 2026
Bad example
Old codets
| 1 | interface ToolbarProps { |
| 2 | onPageChange: (page: number) => void; // duplicates PageInput's onChange |
| 3 | } |
Explanation (EN)
Objašnjenje (HR)
Good example
New codets
| 1 | interface ToolbarProps { |
| 2 | onPageChange: PageInputProps['onChange']; |
| 3 | } |
Explanation (EN)
Objašnjenje (HR)