form icon indicating copy to clipboard operation
form copied to clipboard

Recursive Schema Causes Type Instantiation Is Excessively Deep or Infinite

Open TweedChristian opened this issue 2 months ago • 1 comments

Describe the bug

I am using a necessarily recursive schema for a feature to store logic as JSON. We're unable to actually have type validation due to the Type instantiation is excessively deep and possibly infinite error that shows up. I used the most recent zod syntax for the recursive schema as well.

Your minimal, reproducible example

https://stackblitz.com/edit/sveltejs-kit-template-default-vqnfhqkw?file=src%2Froutes%2F%2Bpage.svelte

Steps to reproduce

  1. Clone the StackBlitz
  2. Run npm install
  3. Open the +page.svelte file in your editor

Expected behavior

In my editor, I would like to still see type hints without type errors. I understand that type depth might be limited, but since I am using recursive components I am not actually managing this entirely in the UI.

How often does this bug happen?

Every time

Screenshots or Videos

Image

Platform

  • OS: MacOS
  • Browser: Chrome

TanStack Form adapter

None

TanStack Form version

v1.23.8

TypeScript version

v5.9.2

Additional context

I am using svelte-form, but that's not an option, you should add it to the TanStack Form adapter options for the GH issue form.

TweedChristian avatar Oct 30 '25 01:10 TweedChristian

Oops, I'll add svelte-form to the options. Thanks for pointing it out!

Related issue #1553

LeCarbonator avatar Oct 30 '25 08:10 LeCarbonator