"semantic error TS2589: Type instantiation is excessively deep and possibly infinite" with Zod 3.2
See original GitHub issueFor a simple type such as:-
export const ZCustomer = z.object({
name: ZString()
});
where ZString is:-
export const ZString = () => z.string().min(1)
I am getting a typescript error:-
semantic error TS2589: Type instantiation is excessively deep and possibly infinite
I am using typescript 4.3.2 with Zod 3.2.0 in a tsdx 0.14.1 setup. Not sure what’s wrong here.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:12 (3 by maintainers)
Top Results From Across the Web
how to ignore "Type instantiation is excessively deep and ...
After update to Typescript 3.5 i'm getting a lot of "Type instantiation is excessively deep and possibly infinite.ts(2589)" errors.
Read more >TypeScript. Type instantiation is excessively deep ... - Ilya Zykin
Type instantiation is excessively deep and possibly infinite.ts(2589). Visual Studio Code IDE displays it to me for a component. The most unpleasant thing ......
Read more >"I can't not brag about this — I solved a TypeScript issue in ...
An unintuitive error (“Type instantiation is excessively deep and possibly infinite”). Fixed by casting the type (IMessage) to the generic ...
Read more >Error In Reactspring With Typescript For React
semantic error TS2589 : Type instantiation is excessively deep and possibly infinite with Zod 3.2. nikhilag opened this issue 4 months ago 11...
Read more >Announcing TypeScript 4.7
It looks like the toughest upgrade though, I'm getting a lot of Type instantiation is excessively deep and possibly infinite errors.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Also running into this issue with Typecsript 4.3.2 and Zod 3.2. It occurs intermittently, which makes replicating likely difficult. Running tsc or jest twice in a row will throw the error one time and compile perfectly fine the next.
So far it seems to only occur on object schemas, even simple ones.
Maybe something to do with memory pressure?
@ingro Can you try with Typescript 4.1+? As mentioned in the documentation, Zod 3 requires TS 4.1+