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.71k stars 155 forks source link

type error #641

Closed stephenomas closed 1 month ago

stephenomas commented 10 months ago

i keep getting this error any time i try to build my nextjs app

Failed to compile.

./node_modules/@hookform/resolvers/yup/dist/yup.d.ts:3:138 Type error: '>' expected.

1 | import * as Yup from 'yup'; 2 | import { FieldValues, Resolver } from 'react-hook-form';

3 | export declare function yupResolver(schema: Yup.ObjectSchema | ReturnType<typeof Yup.lazy<Yup.ObjectSchema>>, schemaOptions?: Parameters<(typeof schema)['validate']>[1], resolverOptions?: { | ^ 4 | /* 5 | @default async 6 | */

EvanAgee commented 9 months ago

Same here.

jorisre commented 8 months ago

Can you provide a Codesandbox with the issue? thank you

antonsolversio commented 8 months ago

Any updates or solutions? I have same issue.

Please let me know if you found a version w/o this bug

keithrz commented 7 months ago

I was seeing this error in my project, and it was because I had an older version of TypeScript. I was on TS 4.2.x

It looks like the "bad" TypeScript mentioned in this issue relies on a feature added in TypeScript 4.7: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-7.html#instantiation-expressions

After upgrading to TypeScript 4.7.4, the issue went away.

stefdomandtom commented 2 months ago

@keithrz thank you so much

jorisre commented 1 month ago

It appears @keithrz's solution has resolved the issue. Closing this now.