Skip to content

Conversation

@adityasinghz
Copy link
Contributor

Description

This PR completes the incomplete test case "mutual recursion with cyclical data" in lazy.test.ts. The test previously had a TODO comment and no assertions, leaving it non-functional.

Changes

  • ✅ Added proper TypeScript interfaces (CyclicalA and CyclicalB) matching the schema structure
  • ✅ Added assertions to verify that mutually recursive lazy schemas can be created successfully
  • ✅ Added test case to verify the schemas correctly parse non-cyclical data
  • ✅ Added documentation explaining the known limitation that cyclical data causes infinite loops when parsing (as mentioned in Zod documentation)

Testing

All tests pass:
✓ mutual recursion with cyclical dataThe test now properly validates:

  1. Schema creation works for mutually recursive lazy schemas
  2. Non-cyclical data parsing works correctly
  3. Documents the known limitation about cyclical data

Related

This addresses the TODO comment on line 175 of packages/zod/src/v4/classic/tests/lazy.test.ts.

@colinhacks
Copy link
Owner

colinhacks commented Dec 2, 2025

Please stop submitting these PRs. This doesn't improve the codebase.

@colinhacks colinhacks closed this Dec 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants