react-hook-form / resolvers

📋 Validation resolvers: Yup, Zod, Superstruct, Joi, Vest, Class Validator, io-ts, Nope, computed-types, typanion, Ajv, TypeBox, ArkType, Valibot, effect-ts and VineJS
https://react-hook-form.com/
MIT License
1.77k stars 161 forks source link

[effect-ts] Expected string, actual undefined #706

Open fredericrous opened 3 months ago

fredericrous commented 3 months ago

Describe the bug using effect-ts resolver, when I click submit, I get the error "Expected string, actual undefined" however I expect my custom error to show (which is "name required")

To Reproduce Steps to reproduce the behavior:

const schema = S.Struct({
  name: S.String.pipe(S.nonEmpty({ message: () => 'name required' })),
})

Expected behavior "'name required" should have been shown, but we got "Expected string, actual undefined"

Desktop (please complete the following information): not relevant but here it is

Additional context

"@effect/schema": "^0.68.26",
"@hookform/resolvers": "^3.9.0",
fredericrous commented 3 months ago

a workaround is to set the default value to an empty string