Skip to content
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

Typings in form wrapper #20

Closed
Manubi opened this issue Aug 12, 2021 · 1 comment
Closed

Typings in form wrapper #20

Manubi opened this issue Aug 12, 2021 · 1 comment

Comments

@Manubi
Copy link

Manubi commented Aug 12, 2021

Does anyone have an idea how to correctly type the src/client/components/Form/Form.tsx


export const Form = <
  TFormValues extends Record<string, any> = Record<string, any>,
  Schema extends ZodType<any, any, any> = ZodType<any, any, any>
>({
  onSubmit,
  children,
  className,
  options,
  id,
  schema,
}: FormProps<TFormValues, Schema>) => {
  const methods = useForm<TFormValues>({
    ...options,
    resolver: schema && zodResolver(schema),
  });

There are quiet some any types which I'd like to get rid off.

Thanks for the help!

@alan2207
Copy link
Owner

Hi, I have updated it to the following:

export const Form = <
  TFormValues extends Record<string, unknown> = Record<string, unknown>,
  Schema extends ZodType<unknown, ZodTypeDef, unknown> = ZodType<unknown, ZodTypeDef, unknown>
>({
....
})

Thanks for reporting it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants