Skip to content

Excessive stack depth error in type identity checkΒ #46631

@ahejlsberg

Description

@ahejlsberg

πŸ•— 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).

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions