Skip to content

Recursive Schema Causes Type Instantiation Is Excessively Deep or Infinite #1830

@TweedChristian

Description

@TweedChristian

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions