What is the correct TypeScript type for fields returned by useForm() #939
Unanswered
aayushmaan-54
asked this question in
Q&A
Replies: 1 comment
-
hi @aayushmaan-54 conform/packages/conform-react/hooks.ts Lines 46 to 69 in 0c00a13 import type { FormMetadata } from '@conform-to/react';
import type { output } from 'zod';
type Props = {
fields: ReturnType<FormMetadata<output<typeof fileUploadSchema >, any>['getFieldset']>
}
const Dropzone = ({ fields }: Props) => {
return (
...
)
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using
useForm
from Conform with a nested Zod schema (fileUploadSchema
). The hook returnsform
andfields
, like this:Inside my form, I'm passing
fields
as props to a child component (<Dropzone />
), like this:My
DropzoneProps
interface currently has this:❓ Question: What is the correct TypeScript type for
fields
returned byuseForm()
when using a nested Zod schema likefileUploadSchema
?I want to avoid using
any
and get full IntelliSense and type safetyBeta Was this translation helpful? Give feedback.
All reactions