iway1 / react-ts-form

https://react-ts-form.com
MIT License
2.01k stars 35 forks source link

ZodEffects support #72

Closed iway1 closed 1 year ago

iway1 commented 1 year ago

Library doesn't support .transform on schemas currently:

const mapping = [[z.string(), TextField]] as const;

const Form = createTsForm(mapping);

const FormSchema = z.object({textField: z.string().tranform(v=>parseInt(v));

<Form schema={FormSchema} /> // Errors no found schema

Would be nice to be able to transform / preprocess stuff in the schema and still have it match the schema.

nkalpak commented 1 year ago

Here's a type for this in case you need it :))

iway1 commented 1 year ago

@nkalpak nice thanks!

iway1 commented 1 year ago

going to close for now because we can't support this without ejecting from RHF, but do want to add it in 2.0

scamden commented 9 months ago

fwiw, we are running into the desire for this as well