tsc-rs 0.1.0 reports TS5115 on any z.infer of an object that holds z.json(), with Zod 4.5.0 through 4.6.5. tsc 7.0.2 checks the same code clean. The port is faithful here: the Go checker at the pin (microsoft/TypeScript@673a5f17) prints the same error, so I'm filing it for tracking, not as a port bug.
Repro
index.ts, with zod@4.6.5 installed:
import * as z from "zod";
const item = z.object({ data: z.json() });
export const x: z.infer<typeof item> = { data: 1 };
tsconfig.json:
{
"compilerOptions": {
"strict": true,
"noEmit": true,
"module": "preserve",
"moduleResolution": "bundler",
"target": "esnext",
"skipLibCheck": true
},
"files": ["index.ts"]
}
tsc -p . --pretty false
Output
index.ts(5,40): error TS5115: Instantiations of the following types appear infinitely circular: '$ZodTypeInternals', '$InferZodRecordInput', 'IsOptionalIn'.
Versions
| Checker |
Result |
| tsc-rs 0.1.0 (darwin-arm64 release) |
TS5115 |
Go cmd/tsc built at the pin, microsoft/TypeScript@673a5f17 |
same TS5115 |
Go cmd/tsc at 19dadef8 (microsoft/TypeScript#64372) |
same TS5115 |
Go cmd/tsc at 21b3aeb3, the parent of 19dadef8 |
clean |
typescript 7.0.2 and 7.1.0-dev.20260928.1 |
clean |
typescript 7.1.0-dev.20260929.1 through 7.1.0-dev.20261007.1 |
same TS5115 |
Upstream status
microsoft/TypeScript#64372 ("Restore idempotency to resolveObjectTypeMembers") introduced it. Zod's author filed microsoft/TypeScript#64605, which is open, and merged a Zod-side fix in colinhacks/zod#6645 for the next Zod release. Until one of those lands, Zod 4.5.0 to 4.6.5 users see this error with tsc-rs. In a larger project, which call sites get flagged depends on check order, because the error fires at the 100-deep instantiation limit (instantiate_type_with_alias, crates/ts_goport/src/checker/checker_p24.rs:1799).
tsc-rs 0.1.0 reports TS5115 on any
z.inferof an object that holdsz.json(), with Zod 4.5.0 through 4.6.5. tsc 7.0.2 checks the same code clean. The port is faithful here: the Go checker at the pin (microsoft/TypeScript@673a5f17) prints the same error, so I'm filing it for tracking, not as a port bug.Repro
index.ts, withzod@4.6.5installed:tsconfig.json:{ "compilerOptions": { "strict": true, "noEmit": true, "module": "preserve", "moduleResolution": "bundler", "target": "esnext", "skipLibCheck": true }, "files": ["index.ts"] }tsc -p . --pretty falseOutput
Versions
cmd/tscbuilt at the pin, microsoft/TypeScript@673a5f17cmd/tscat 19dadef8 (microsoft/TypeScript#64372)cmd/tscat 21b3aeb3, the parent of 19dadef8typescript7.0.2 and 7.1.0-dev.20260928.1typescript7.1.0-dev.20260929.1 through 7.1.0-dev.20261007.1Upstream status
microsoft/TypeScript#64372 ("Restore idempotency to
resolveObjectTypeMembers") introduced it. Zod's author filed microsoft/TypeScript#64605, which is open, and merged a Zod-side fix in colinhacks/zod#6645 for the next Zod release. Until one of those lands, Zod 4.5.0 to 4.6.5 users see this error with tsc-rs. In a larger project, which call sites get flagged depends on check order, because the error fires at the 100-deep instantiation limit (instantiate_type_with_alias, crates/ts_goport/src/checker/checker_p24.rs:1799).