You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
TS5115 "infinitely circular" on .catchall(z.json()) with the TypeScript 7.1 nightlies #6637
error TS5115: Instantiations of the following types appear infinitely circular: 'IsOptionalIn', '$ZodTypeInternals', '$InferZodRecordInput'.
same with zod 4.5.4 and 4.6.5. typescript 7.0.2 is fine
it comes from this typescript change, which makes the checker stricter about a type that references itself through the type arguments of its base type:
zod showed up in their top 1000 repo run for it, and anders suggested taking the type arguments off the $ZodTypeInternals base of $ZodRecordInternals and declaring input/output directly:
(his comment has input: $InferZodRecordOutput, i think thats a typo since input should stay $InferZodRecordInput)
i tried that in 4.6.5's v4/core/schemas.d.ts and .d.cts. the repro is clean on both the nightly and 7.0.2, and z.input/z.output of a z.record(...) come out the same as before. PRs look limited to collaborators here so i couldn't open one, but the change plus a type test is on this branch if it's useful:
Activity
parnilV06 commentedon Oct 8, 2026
Hey !
I would like to work on this issue
colinhacks commentedon Oct 9, 2026
Fixed in #6645, which goes out in the next release. Thanks for tracking this down, @maschwenk 👍
test: cover .catchall(z.json()) inference