diff --git a/src/downlevel-dts.ts b/src/downlevel-dts.ts index 5fa265d2..929604ba 100644 --- a/src/downlevel-dts.ts +++ b/src/downlevel-dts.ts @@ -185,7 +185,7 @@ function semanticallyEqualDeclarations(left: string, right: string): boolean { // TypeScript may emit duplicated reference declarations... which are absent from Downlevel-DTS' output... // https://github.com/microsoft/TypeScript/issues/48143 const REFERENCES_TYPES_NODE = '/// '; - if (normalized.startsWith(`${REFERENCES_TYPES_NODE}\n${REFERENCES_TYPES_NODE}`)) { + while (normalized.startsWith(`${REFERENCES_TYPES_NODE}\n${REFERENCES_TYPES_NODE}`)) { normalized = normalized.slice(REFERENCES_TYPES_NODE.length + 1); }