在 TypeScript 7.1 夜间版中,TS5115 在 `.catchall(z.json())` 上执行"无限循环"
作者: maschwenk创建于 2026年9月29日更新于 2026年9月29日
the TypeScript 7.1 nightlies (7.1.0-dev.20260929.1 and later) report this on any .catchall(z.json()):
import { z } from 'zod'
export const schema = z.object({ n: z.number() }).catchall(z.json())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
内容来源: colinhacks/zod