From e2923f63c0b3e8bf942e0f06d967755c91998178 Mon Sep 17 00:00:00 2001 From: Sam Vervaeck Date: Thu, 13 Apr 2023 17:22:15 +0200 Subject: [PATCH] Fix infinite loop while searching for nodes in type chain --- src/diagnostics.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/diagnostics.ts b/src/diagnostics.ts index f5bf498f7..3824e3c18 100644 --- a/src/diagnostics.ts +++ b/src/diagnostics.ts @@ -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 {