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-hook-formtypescriptgenericsdx
Type form context with the form-values generic for autocomplete
Pass your form-values interface as the generic to the form hook so getValues and friends are typed and autocompleted.
PR: hegnar-forum-web · org-mining-hist-2026-06Created: Jun 20, 2026
Bad example
Old codetypescript
| 1 | const { getValues } = useFormContext(); |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | const { getValues } = useFormContext<CreateThreadFields>(); |
Explanation (EN)
Objašnjenje (HR)