Skip to content

Commit

Permalink
πŸš” close #8653 when useFormContext provide no generic for type check (#…
Browse files Browse the repository at this point in the history
…8654)

* close #8653 when useFormContext provide no generic for type check

* update api contract
  • Loading branch information
bluebill1049 committed Jul 8, 2022
1 parent 5f0882b commit 2e0c3f8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion reports/api-extractor.md
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ export function useForm<TFieldValues extends FieldValues = FieldValues, TContext
export type UseFormClearErrors<TFieldValues extends FieldValues> = (name?: FieldPath<TFieldValues> | FieldPath<TFieldValues>[] | readonly FieldPath<TFieldValues>[]) => void;

// @public
export const useFormContext: <TFieldValues extends FieldValues>() => UseFormReturn<TFieldValues, any>;
export const useFormContext: <TFieldValues extends FieldValues = FieldValues>() => UseFormReturn<TFieldValues, any>;

// @public
export type UseFormGetFieldState<TFieldValues extends FieldValues> = <TFieldName extends FieldPath<TFieldValues>>(name: TFieldName, formState?: FormState<TFieldValues>) => {
Expand Down
2 changes: 1 addition & 1 deletion src/useFormContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const HookFormContext = React.createContext<UseFormReturn | null>(null);
* ```
*/
export const useFormContext = <
TFieldValues extends FieldValues,
TFieldValues extends FieldValues = FieldValues,
>(): UseFormReturn<TFieldValues> =>
React.useContext(HookFormContext) as unknown as UseFormReturn<TFieldValues>;

Expand Down

0 comments on commit 2e0c3f8

Please sign in to comment.