Fix infinite loop while searching for nodes in type chain

This commit is contained in:
Sam Vervaeck 2023-04-13 17:22:15 +02:00
parent 9f6fe70f38
commit e2923f63c0
Signed by: samvv
SSH key fingerprint: SHA256:dIg0ywU1OP+ZYifrYxy8c5esO72cIKB+4/9wkZj1VaY

View file

@ -529,11 +529,10 @@ function describeKind(kind: Kind): string {
}
function getFirstNodeInTypeChain(type: Type): Syntax | null {
let curr = type.next;
while (curr !== type && (curr.kind === TypeKind.Var || curr.node === null)) {
curr = curr.next;
while (type !== type && (type.kind === TypeKind.Var || type.node === null)) {
type = type.next;
}
return curr.node;
return type.node;
}
interface PrintExcerptOptions {