Closed
Description
Bug Report
🔎 Search Terms
"Return type annotation circularly references itself"
🕗 Version & Regression Information
The code works in 4.6.4 and stopped working when attempting to upgrade to 4.7+. I also verified the issue still appears in 4.8.X
- This changed between versions 4.6.4 and 4.7
⏯ Playground Link
https://github.com/davidmdm/myzod
Issue has been reported with davidmdm/myzod#52
Note that I am not the author of the linked library but rather a user. The author appears to be busy at the moment, so I was creating this ticket to see if the problem was a potential regression on the TypeScript side that could be fixed here instead if that is indeed the root cause.
💻 Code
https://github.com/davidmdm/myzod/blob/master/src/types.ts
🙁 Actual behavior
The code fails with the following errors
node_modules/myzod/libs/types.d.ts:256:40 - error TS2577: Return type annotation circularly references itself.
256 and<K extends AnyType>(schema: K): IntersectionResult<this, K>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/myzod/libs/types.d.ts:306:40 - error TS2577: Return type annotation circularly references itself.
306 and<K extends AnyType>(schema: K): IntersectionResult<this, K>;
🙂 Expected behavior
The code compiles successfully.