Skip to content

Commit b40512d

Browse files
committed
Only mark symbols found in a local symbol table
1 parent 3d9c920 commit b40512d

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/compiler/checker.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ namespace ts {
5151
const compilerOptions = host.getCompilerOptions();
5252
const languageVersion = compilerOptions.target || ScriptTarget.ES3;
5353
const modulekind = getEmitModuleKind(compilerOptions);
54-
const noUnusedIdentifiers = compilerOptions.noUnusedLocals || compilerOptions.noUnusedParameters;
54+
const noUnusedIdentifiers = !!compilerOptions.noUnusedLocals || !!compilerOptions.noUnusedParameters;
5555
const allowSyntheticDefaultImports = typeof compilerOptions.allowSyntheticDefaultImports !== "undefined" ? compilerOptions.allowSyntheticDefaultImports : modulekind === ModuleKind.System;
5656
const strictNullChecks = compilerOptions.strictNullChecks;
5757

@@ -849,6 +849,10 @@ namespace ts {
849849
location = location.parent;
850850
}
851851

852+
if (result && nameNotFoundMessage && noUnusedIdentifiers) {
853+
result.isReferenced = true;
854+
}
855+
852856
if (!result) {
853857
result = getSymbol(globals, name, meaning);
854858
}
@@ -899,10 +903,6 @@ namespace ts {
899903
error(errorLocation, Diagnostics.Identifier_0_must_be_imported_from_a_module, name);
900904
}
901905
}
902-
903-
if (result && noUnusedIdentifiers && !isInAmbientContext(location)) {
904-
result.isReferenced = true;
905-
}
906906
}
907907
return result;
908908
}

0 commit comments

Comments
 (0)