Demo, all content is generated
Question

Type instantiation is excessively deep and possibly infinite, after Cursor added a zod form schema

Open · 65 views · asked by pooja_s · edited

Signup form with react-hook-form + zod. Since Cursor refactored the schema into a shared schemas.ts, VS Code shows this on useForm:

Type instantiation is excessively deep and possibly infinite. ts(2589)

The app still runs and the form works. tsc --noEmit also reports it, so the Vercel build fails because of it. The schema is not that big, 9 fields and one .refine() for password confirmation.

What I’ve tried

Asked Cursor to fix it, it added // @ts-ignore above the line. Removed the refine, error stays. Restarted the TS server.

Comment
What versions of zod, react-hook-form and @hookform/resolvers? I've seen this exact error from mismatched versions of those three. clara_w · edited

Activity

22 helpers notified