From cfa0abee0d5e9ebabefb2948707ec2abc7b4fccf Mon Sep 17 00:00:00 2001 From: Pete Gonzalez <4673363+octogonz@users.noreply.github.com> Date: Thu, 3 Jun 2021 14:11:33 -0700 Subject: [PATCH] Add a workaround for https://github.com/microsoft/TypeScript/issues/44422 --- apps/api-extractor/src/analyzer/Span.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/apps/api-extractor/src/analyzer/Span.ts b/apps/api-extractor/src/analyzer/Span.ts index c702c312a6f..c834f4bcb90 100644 --- a/apps/api-extractor/src/analyzer/Span.ts +++ b/apps/api-extractor/src/analyzer/Span.ts @@ -142,7 +142,16 @@ export class Span { let previousChildSpan: Span | undefined = undefined; + const visitedChildren: Set = new Set(); + for (const childNode of this.node.getChildren() || []) { + // FIX ME: This is a temporary workaround for a problem introduced by TypeScript 4.3. + // https://github.com/microsoft/TypeScript/issues/44422 + if (visitedChildren.has(childNode)) { + continue; + } + visitedChildren.add(childNode); + const childSpan: Span = new Span(childNode); childSpan._parent = this; childSpan._previousSibling = previousChildSpan;