-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
There is a new issue that appeared in TypeScript 4.5.0-dev.20211001 and exists until now.
To reproduce the error:
npm init -y
npm add zod
npm add -D typescript@next
echo 'import { z } from "zod";' > main.ts
echo '{"compilerOptions":{"lib":["es2020"]},"include":["main.ts"]}' > tsconfig.json
npx tsc -p .TypeScript output:
node_modules/zod/lib/helpers/partialUtil.d.ts:4:29 - error TS2589: Type instantiation is excessively deep and possibly infinite.
4 [k in keyof Shape]: ZodOptional<DeepPartial<Shape[k]>>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Found 1 error.
It affects the latest Zod (3.10.1), and also any other 3.x version. The issue appeared in microsoft/TypeScript#41821 (producing a memory error), and later a check was added in microsoft/TypeScript#46326 to prevent the infinite loop and give a meaningful message.
This is the same issue as #689 except that now we have an error message.
Demo code: https://github.com/mmvsk/zod-issue-715
ryami333
Metadata
Metadata
Assignees
Labels
No labels