Skip to content

Recursive tuples #5089

@trustedtomato

Description

@trustedtomato

As of right now, recursive tuples such as

const y = z.lazy((): any => z.tuple([y, y]).or(z.string()))
y.parse(["a", ["b", "c"]])
// infinite recursion

cause infinite recursion. However, recursive arrays have no such problem:

const y = z.lazy((): any => z.array(y).or(z.string()))
y.parse(["a", ["b", "c"]])
// works

Would it be possible to also enable creating recursive tuples?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions