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 ruleP2universalStack: TypeScript
typescripttypespackagesweb-components
Ship custom-element type definitions inside the package that provides them
Consumers should not have to redeclare a web component's JSX types; the type definitions belong in the package exporting the component so all consumers get them automatically.
PR: hegnar-zephr-components · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codetypescript
| 1 | // in a consuming app's react.d.ts |
| 2 | declare namespace JSX { |
| 3 | interface IntrinsicElements { 'hegnar-tooltip': any } |
| 4 | } |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | // shipped inside the component package so consumers inherit it |
| 2 | declare namespace JSX { |
| 3 | interface IntrinsicElements { 'hegnar-tooltip': HegnarTooltipProps } |
| 4 | } |
Explanation (EN)
Objašnjenje (HR)