Skip to content

Commit dc5cf33

Browse files
committed
Do not report unused errors for module augmentations
1 parent bc7c6cc commit dc5cf33

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/compiler/checker.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14604,7 +14604,11 @@ namespace ts {
1460414604
if (hasProperty(node.locals, key)) {
1460514605
const local = node.locals[key];
1460614606
if (!local.hasReference && !local.exportSymbol) {
14607-
forEach(local.declarations, d => error(d.name, Diagnostics._0_is_declared_but_never_used, local.name));
14607+
for (const declaration of local.declarations) {
14608+
if (!isAmbientModule(declaration)) {
14609+
error(declaration.name, Diagnostics._0_is_declared_but_never_used, local.name);
14610+
}
14611+
}
1460814612
}
1460914613
}
1461014614
}
@@ -16487,7 +16491,9 @@ namespace ts {
1648716491

1648816492
if (node.body) {
1648916493
checkSourceElement(node.body);
16490-
checkUnusedIdentifiersDeferred(node);
16494+
if (!isGlobalScopeAugmentation(node)) {
16495+
checkUnusedIdentifiersDeferred(node);
16496+
}
1649116497
}
1649216498
}
1649316499

0 commit comments

Comments
 (0)