-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
issue: invalid useFieldArray context type #7853
Labels
TS
Typescript related issues
Comments
Possible regression, @bluebill1049? The export declare type Control<TFieldValues extends FieldValues = FieldValues, TContext extends object = object> = {
...
_updateProps: (props: UseFormProps<TFieldValues, TContext>) => void;
...
}; and export declare type UseFieldArrayProps<TFieldValues extends FieldValues = FieldValues, TFieldArrayName extends FieldArrayPath<TFieldValues> = FieldArrayPath<TFieldValues>, TKeyName extends string = 'id'> = {
...
control?: Control<TFieldValues>;
...
}; hence the Type 'Resolver<FormValues, { isValid: boolean; }>' is not assignable to type 'Resolver<FormValues, object>' |
bluebill1049
added a commit
that referenced
this issue
Feb 19, 2022
* 🐛 fix(useFieldArray): pass context type down to Control Closes: #7845 * fix type error caused by context infer on control object * fix useWatch api as well * fix missing overload * Revert "fix type error caused by context infer on control object" This reverts commit 0de0a00. * change TContext to type any instead of object * remove breaking change context generic * remove breaking change context generic * update API extrator * change to unknown instead of any * Revert "change to unknown instead of any" This reverts commit ec596c3. Co-authored-by: Beier Luo <bluebill1049@hotmail.com>
bluebill1049
added a commit
that referenced
this issue
Mar 13, 2022
* 🐛 fix(useFieldArray): pass context type down to Control Closes: #7845 * fix type error caused by context infer on control object * fix useWatch api as well * fix missing overload * Revert "fix type error caused by context infer on control object" This reverts commit 0de0a00. * change TContext to type any instead of object * remove breaking change context generic * remove breaking change context generic * update API extrator * change to unknown instead of any * Revert "change to unknown instead of any" This reverts commit ec596c3. Co-authored-by: Beier Luo <bluebill1049@hotmail.com>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Version Number
7.27.0
Codesandbox/Expo snack
https://codesandbox.io/s/resolver-context-forked-m8rcrl
Steps to reproduce
Check line 38, the control cannot infer the context type.
Expected behaviour
Control should infer context type.
What browsers are you seeing the problem on?
Chrome
Relevant log output
Code of Conduct
The text was updated successfully, but these errors were encountered: