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, React
typescriptpropstype-safety
Type unsupported props as never to forbid them
When a component must not receive a prop (e.g. data-testid it ignores), declare it as `never` so passing it is a compile error.
PR: hegnar-zephr-components · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codetypescript
| 1 | interface Props { |
| 2 | children: React.ReactNode; |
| 3 | // nothing stops callers passing data-testid, which is silently dropped |
| 4 | } |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | interface Props { |
| 2 | children: React.ReactNode; |
| 3 | 'data-testid'?: never; // compile error if anyone passes it |
| 4 | } |
Explanation (EN)
Objašnjenje (HR)