Skip to content

FormPathLeaves<> fails when used with a recursive zod schema. #269

Open
@fnimick

Description

@fnimick

Description
When used with a recursive zod schema, FormPathLeaves fails with an error such as:

Type of property 'ingredients' circularly references itself in mapped type '{ [K in keyof NonNullable<Ingredient>]-?: K extends string ? NonNullable<NonNullable<Ingredient>[K]> extends object ? `${K}${NonNullable<...> extends unknown[] ? "" : "."}${StringPathLeaves<...> & string}` : never : never; }'

This prevents the use of componentized fields with a form validated with a recursive schema as shown in https://superforms.rocks/components.

If applicable, a MRE
https://stackblitz.com/edit/sveltekit-superforms-1-testing-whrq5p?file=src%2Froutes%2Fschema.ts

Observe the error on the reified type ExampleFormPathLeaves. This error occurs wherever FormPathLeaves is used on the form type resulting from validating this schema.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestlaterMay be worked on in the future.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions