Skip to content

Excessive stack depth error in type identity check #46631

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ahejlsberg opened this issue Nov 1, 2021 · 0 comments · Fixed by #46632
Closed

Excessive stack depth error in type identity check #46631

ahejlsberg opened this issue Nov 1, 2021 · 0 comments · Fixed by #46632
Assignees
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue

Comments

@ahejlsberg
Copy link
Member

ahejlsberg commented Nov 1, 2021

🕗 Version & Regression Information

Nightly build. For an example, see the typeorm error in #46610.

⏯ Playground Link

https://www.typescriptlang.org/play?ts=4.5.0-dev.20211101#code/JYOwLgpgTgZghgYwgAgGKgCYHkAO05gD2UAPACoB8yA3gLABQyTyMhhAXMmQNwMC+DBmACeeNJgDChEBmBhg0gM7kqAXhoNmyANoAFZKGQBrCMMIwuAXQD8ndDKky5CkMrJ7LVAD7iZufESk9hiOsvJK5B4UFLz0fLEMMACuIAjhICxsJACi4HLCFAAUAJQajMwAbnBQyAAedpLSYS7KcCAFsVpVNfW+IU3OEbnyIjFMAPTjyNm1SIqKwBUoimCIRsgYEDhgABbI0FDE-AxAA

💻 Code

interface FindOperator<T> {
    foo: T;
}

type FindConditions<T> = {
    [P in keyof T]?: FindConditions<T[P]> | FindOperator<FindConditions<T[P]>>;
};

function foo<Entity>() {
    var x: FindConditions<any>;
    var x: FindConditions<Entity>;  // Excessive stack depth error
}

🙁 Actual behavior

Excessive stack depth error.

🙂 Expected behavior

No excessive stack depth error (but still an error about the two declarations having different types).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants