DevTool control prop does not match Control type output by `useForm`
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 55/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- react, typescript
- Domain
- developer-experience, tooling
Research direction
Start by locating the TypeScript declaration for DevTool described in the issue and compare its Control generic parameters with UseFormReturn. Update the declaration so TContext and TTransformedValues are preserved, then verify that a transformed Control from useForm is accepted without a typing error.
Written by the indexing model from the issue text.
Description
"@hookform/devtools": "^4.4.0"
"react-hook-form": "^7.58.0"
"@hookform/resolvers": "^5.1.1"
Problem
Currently the typing for DevTool is
export declare const DevTool: <T extends FieldValues>(props?: ({
id?: string | undefined;
control?: Control<T, any, T> | undefined;
} & Pick<DevtoolUIProps, "placement" | "styles">) | undefined) => JSX.Element | null;
However, the typing for Control when output by useForm is of form
export type UseFormReturn<TFieldValues extends FieldValues = FieldValues, TContext = any, TTransformedValues = TFieldValues> = {
...
control: Control<TFieldValues, TContext, TTransformedValues>;
...
};
The issue is that Control<T, any, T> never ingests the TTransformedValues if set, leading to a typing error.
Proposed Solution
Change the typing for DevTool to the following:
export declare const DevTool: <TFieldValues extends FieldValues = FieldValues, TContext = any, TTransformedValues = TFieldValues>(props?: ({
id?: string | undefined;
control?: Control<TFieldValues, TContext, TTransformedValues> | undefined;
} & Pick<DevtoolUIProps, "placement" | "styles">) | undefined) => JSX.Element | null;
- Dominant language
- TypeScript
- Stars
- 670
- Forks
- 55
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from react-hook-form/devtools
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
react-hook-form/devtools#234 · 1 comment · 5 reactions ·
-
Difficulty 3/5 1-2 days Newbie friendliness 42/100
react-hook-form/devtools#226 · 3 reactions ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 25/100
react-hook-form/devtools#212 · 5 comments · 8 reactions ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
react-hook-form/devtools#208 · 13 comments · 21 reactions ·
-
Difficulty 3/5 1-2 days Newbie friendliness 30/100
react-hook-form/devtools#207 · 6 comments · 1 reaction ·
All issues in react-hook-form/devtools
Similar issues
-
clawsweeper:linked-pr-open clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:message-loss issue-rating: 🦞 diamond lobster maturity:stable P2
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#616 ·
-
ZCode 3.14.3 に対応する Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
supermomonga/zcode-acp#24 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
growthbook/growthbook#7100 ·
-
triage
Difficulty 1/5 1-3 hours Newbie friendliness 88/100