Skip to content

4.7 circular type annotation regression #50688

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Fix AvailableA PR has been opened for this issueHas ReproThis issue has compiler-backed repros: https://aka.ms/ts-reprosNeeds InvestigationThis issue needs a team member to investigate its status.

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions