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: react
typescriptreactcss-variablestype-safety
Augment CSSProperties for custom CSS vars instead of casting
Extend React's CSSProperties type to allow custom properties rather than using `as React.CSSProperties` casts.
PR: hegnar-components · org-mining-deep-2026-06Created: Jun 17, 2026
Bad example
Old codetsx
| 1 | <div style={{ '--x': v } as React.CSSProperties} /> |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | // react-app-env.d.ts |
| 2 | declare module 'react' { |
| 3 | interface CSSProperties { [key: `--${string}`]: string | number | undefined; } |
| 4 | } |
| 5 | <div style={{ '--x': v }} /> |
Explanation (EN)
Objašnjenje (HR)