@typescript-deploys/pr-build 5.3.0-pr-55887-9 → 5.3.0-pr-55860-30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +95 -105
- package/lib/tsserver.js +95 -105
- package/lib/typescript.js +95 -105
- package/lib/typingsInstaller.js +2 -2
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.3";
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20230928`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -6651,6 +6651,7 @@ var Diagnostics = {
|
|
|
6651
6651
|
Import_attributes_cannot_be_used_with_type_only_imports_or_exports: diag(2857, 1 /* Error */, "Import_attributes_cannot_be_used_with_type_only_imports_or_exports_2857", "Import attributes cannot be used with type-only imports or exports."),
|
|
6652
6652
|
Import_attribute_values_must_be_string_literal_expressions: diag(2858, 1 /* Error */, "Import_attribute_values_must_be_string_literal_expressions_2858", "Import attribute values must be string literal expressions."),
|
|
6653
6653
|
Excessive_complexity_comparing_types_0_and_1: diag(2859, 1 /* Error */, "Excessive_complexity_comparing_types_0_and_1_2859", "Excessive complexity comparing types '{0}' and '{1}'."),
|
|
6654
|
+
The_type_of_this_declaration_is_ambiguous_and_may_be_observed_as_either_0_or_1: diag(2860, 1 /* Error */, "The_type_of_this_declaration_is_ambiguous_and_may_be_observed_as_either_0_or_1_2860", "The type of this declaration is ambiguous and may be observed as either '{0}' or '{1}'."),
|
|
6654
6655
|
Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
|
|
6655
6656
|
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* Error */, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
|
|
6656
6657
|
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* Error */, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
|
|
@@ -16009,7 +16010,6 @@ function Symbol4(flags, name) {
|
|
|
16009
16010
|
this.exportSymbol = void 0;
|
|
16010
16011
|
this.constEnumOnlyModule = void 0;
|
|
16011
16012
|
this.isReferenced = void 0;
|
|
16012
|
-
this.isInitialized = void 0;
|
|
16013
16013
|
this.isAssigned = void 0;
|
|
16014
16014
|
this.links = void 0;
|
|
16015
16015
|
}
|
|
@@ -43525,16 +43525,11 @@ function createTypeChecker(host) {
|
|
|
43525
43525
|
checkSourceFileWithEagerDiagnostics(file);
|
|
43526
43526
|
Debug.assert(!!(getNodeLinks(file).flags & 1 /* TypeChecked */));
|
|
43527
43527
|
diagnostics2 = addRange(diagnostics2, suggestionDiagnostics.getDiagnostics(file.fileName));
|
|
43528
|
-
|
|
43529
|
-
|
|
43530
|
-
|
|
43531
|
-
|
|
43532
|
-
|
|
43533
|
-
}
|
|
43534
|
-
},
|
|
43535
|
-
/*checkUnused*/
|
|
43536
|
-
true
|
|
43537
|
-
);
|
|
43528
|
+
checkUnusedIdentifiers(getPotentiallyUnusedIdentifiers(file), (containingNode, kind, diag2) => {
|
|
43529
|
+
if (!containsParseError(containingNode) && !unusedIsError(kind, !!(containingNode.flags & 33554432 /* Ambient */))) {
|
|
43530
|
+
(diagnostics2 || (diagnostics2 = [])).push({ ...diag2, category: 2 /* Suggestion */ });
|
|
43531
|
+
}
|
|
43532
|
+
});
|
|
43538
43533
|
return diagnostics2 || emptyArray;
|
|
43539
43534
|
} finally {
|
|
43540
43535
|
cancellationToken = void 0;
|
|
@@ -44031,7 +44026,7 @@ function createTypeChecker(host) {
|
|
|
44031
44026
|
var deferredGlobalClassAccessorDecoratorTargetType;
|
|
44032
44027
|
var deferredGlobalClassAccessorDecoratorResultType;
|
|
44033
44028
|
var deferredGlobalClassFieldDecoratorContextType;
|
|
44034
|
-
var
|
|
44029
|
+
var allPotentiallyUnusedIdentifiers = /* @__PURE__ */ new Map();
|
|
44035
44030
|
var flowLoopStart = 0;
|
|
44036
44031
|
var flowLoopCount = 0;
|
|
44037
44032
|
var sharedFlowCount = 0;
|
|
@@ -44074,6 +44069,7 @@ function createTypeChecker(host) {
|
|
|
44074
44069
|
var potentialReflectCollisions = [];
|
|
44075
44070
|
var potentialUnusedRenamedBindingElementsInTypes = [];
|
|
44076
44071
|
var awaitedTypeStack = [];
|
|
44072
|
+
var ambiguousVariableDeclarationsWhenWidened = [];
|
|
44077
44073
|
var diagnostics = createDiagnosticCollection();
|
|
44078
44074
|
var suggestionDiagnostics = createDiagnosticCollection();
|
|
44079
44075
|
var typeofType = createTypeofType();
|
|
@@ -44742,10 +44738,10 @@ function createTypeChecker(host) {
|
|
|
44742
44738
|
function isConstAssertion(location) {
|
|
44743
44739
|
return isAssertionExpression(location) && isConstTypeReference(location.type) || isJSDocTypeTag(location) && isConstTypeReference(location.typeExpression);
|
|
44744
44740
|
}
|
|
44745
|
-
function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals = false, getSpellingSuggestions = true
|
|
44746
|
-
return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions,
|
|
44741
|
+
function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals = false, getSpellingSuggestions = true) {
|
|
44742
|
+
return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, getSymbol);
|
|
44747
44743
|
}
|
|
44748
|
-
function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions,
|
|
44744
|
+
function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, lookup) {
|
|
44749
44745
|
var _a, _b, _c;
|
|
44750
44746
|
const originalLocation = location;
|
|
44751
44747
|
let result;
|
|
@@ -44971,9 +44967,6 @@ function createTypeChecker(host) {
|
|
|
44971
44967
|
if (isUse && result && (!lastSelfReferenceLocation || result !== lastSelfReferenceLocation.symbol)) {
|
|
44972
44968
|
result.isReferenced |= meaning;
|
|
44973
44969
|
}
|
|
44974
|
-
if (isWritten && result) {
|
|
44975
|
-
result.isInitialized = true;
|
|
44976
|
-
}
|
|
44977
44970
|
if (!result) {
|
|
44978
44971
|
if (lastLocation) {
|
|
44979
44972
|
Debug.assertNode(lastLocation, isSourceFile);
|
|
@@ -64481,10 +64474,7 @@ function createTypeChecker(host) {
|
|
|
64481
64474
|
node,
|
|
64482
64475
|
!isWriteOnlyAccess(node),
|
|
64483
64476
|
/*excludeGlobals*/
|
|
64484
|
-
false
|
|
64485
|
-
/*getSpellingSuggestions*/
|
|
64486
|
-
void 0,
|
|
64487
|
-
isWriteAccess(node)
|
|
64477
|
+
false
|
|
64488
64478
|
) || unknownSymbol;
|
|
64489
64479
|
}
|
|
64490
64480
|
return links.resolvedSymbol;
|
|
@@ -69918,8 +69908,6 @@ function createTypeChecker(host) {
|
|
|
69918
69908
|
false,
|
|
69919
69909
|
/*getSpellingSuggestions*/
|
|
69920
69910
|
true,
|
|
69921
|
-
/*isWritten*/
|
|
69922
|
-
false,
|
|
69923
69911
|
(symbols, name, meaning2) => {
|
|
69924
69912
|
Debug.assertEqual(outerName, name, "name should equal outerName");
|
|
69925
69913
|
const symbol = getSymbol(symbols, name, meaning2);
|
|
@@ -75374,7 +75362,7 @@ function createTypeChecker(host) {
|
|
|
75374
75362
|
}
|
|
75375
75363
|
}
|
|
75376
75364
|
if (node.kind !== 181 /* IndexSignature */ && node.kind !== 324 /* JSDocFunctionType */) {
|
|
75377
|
-
|
|
75365
|
+
registerForUnusedIdentifiersCheck(node);
|
|
75378
75366
|
}
|
|
75379
75367
|
}
|
|
75380
75368
|
}
|
|
@@ -75919,7 +75907,7 @@ function createTypeChecker(host) {
|
|
|
75919
75907
|
}
|
|
75920
75908
|
}
|
|
75921
75909
|
}
|
|
75922
|
-
|
|
75910
|
+
registerForUnusedIdentifiersCheck(node);
|
|
75923
75911
|
}
|
|
75924
75912
|
function checkTemplateLiteralType(node) {
|
|
75925
75913
|
for (const span of node.templateSpans) {
|
|
@@ -76905,27 +76893,25 @@ function createTypeChecker(host) {
|
|
|
76905
76893
|
}
|
|
76906
76894
|
}
|
|
76907
76895
|
}
|
|
76908
|
-
function
|
|
76909
|
-
addLazyDiagnostic(
|
|
76910
|
-
function
|
|
76896
|
+
function registerForUnusedIdentifiersCheck(node) {
|
|
76897
|
+
addLazyDiagnostic(registerForUnusedIdentifiersCheckDiagnostics);
|
|
76898
|
+
function registerForUnusedIdentifiersCheckDiagnostics() {
|
|
76911
76899
|
const sourceFile = getSourceFileOfNode(node);
|
|
76912
|
-
let
|
|
76913
|
-
if (!
|
|
76914
|
-
|
|
76915
|
-
|
|
76900
|
+
let potentiallyUnusedIdentifiers = allPotentiallyUnusedIdentifiers.get(sourceFile.path);
|
|
76901
|
+
if (!potentiallyUnusedIdentifiers) {
|
|
76902
|
+
potentiallyUnusedIdentifiers = [];
|
|
76903
|
+
allPotentiallyUnusedIdentifiers.set(sourceFile.path, potentiallyUnusedIdentifiers);
|
|
76916
76904
|
}
|
|
76917
|
-
|
|
76905
|
+
potentiallyUnusedIdentifiers.push(node);
|
|
76918
76906
|
}
|
|
76919
76907
|
}
|
|
76920
|
-
function
|
|
76908
|
+
function checkUnusedIdentifiers(potentiallyUnusedIdentifiers, addDiagnostic) {
|
|
76921
76909
|
for (const node of potentiallyUnusedIdentifiers) {
|
|
76922
76910
|
switch (node.kind) {
|
|
76923
76911
|
case 263 /* ClassDeclaration */:
|
|
76924
76912
|
case 231 /* ClassExpression */:
|
|
76925
|
-
|
|
76926
|
-
|
|
76927
|
-
checkUnusedTypeParameters(node, addDiagnostic);
|
|
76928
|
-
}
|
|
76913
|
+
checkUnusedClassMembers(node, addDiagnostic);
|
|
76914
|
+
checkUnusedTypeParameters(node, addDiagnostic);
|
|
76929
76915
|
break;
|
|
76930
76916
|
case 312 /* SourceFile */:
|
|
76931
76917
|
case 267 /* ModuleDeclaration */:
|
|
@@ -76934,12 +76920,7 @@ function createTypeChecker(host) {
|
|
|
76934
76920
|
case 248 /* ForStatement */:
|
|
76935
76921
|
case 249 /* ForInStatement */:
|
|
76936
76922
|
case 250 /* ForOfStatement */:
|
|
76937
|
-
|
|
76938
|
-
checkUnusedLocalsAndParameters(node, addDiagnostic);
|
|
76939
|
-
}
|
|
76940
|
-
if (checkUninitialized) {
|
|
76941
|
-
checkUninitializedLocals(node);
|
|
76942
|
-
}
|
|
76923
|
+
checkUnusedLocalsAndParameters(node, addDiagnostic);
|
|
76943
76924
|
break;
|
|
76944
76925
|
case 176 /* Constructor */:
|
|
76945
76926
|
case 218 /* FunctionExpression */:
|
|
@@ -76948,15 +76929,10 @@ function createTypeChecker(host) {
|
|
|
76948
76929
|
case 174 /* MethodDeclaration */:
|
|
76949
76930
|
case 177 /* GetAccessor */:
|
|
76950
76931
|
case 178 /* SetAccessor */:
|
|
76951
|
-
if (
|
|
76952
|
-
|
|
76953
|
-
checkUnusedLocalsAndParameters(node, addDiagnostic);
|
|
76954
|
-
}
|
|
76955
|
-
checkUnusedTypeParameters(node, addDiagnostic);
|
|
76956
|
-
}
|
|
76957
|
-
if (checkUninitialized) {
|
|
76958
|
-
checkUninitializedLocals(node);
|
|
76932
|
+
if (node.body) {
|
|
76933
|
+
checkUnusedLocalsAndParameters(node, addDiagnostic);
|
|
76959
76934
|
}
|
|
76935
|
+
checkUnusedTypeParameters(node, addDiagnostic);
|
|
76960
76936
|
break;
|
|
76961
76937
|
case 173 /* MethodSignature */:
|
|
76962
76938
|
case 179 /* CallSignature */:
|
|
@@ -76965,14 +76941,10 @@ function createTypeChecker(host) {
|
|
|
76965
76941
|
case 185 /* ConstructorType */:
|
|
76966
76942
|
case 265 /* TypeAliasDeclaration */:
|
|
76967
76943
|
case 264 /* InterfaceDeclaration */:
|
|
76968
|
-
|
|
76969
|
-
checkUnusedTypeParameters(node, addDiagnostic);
|
|
76970
|
-
}
|
|
76944
|
+
checkUnusedTypeParameters(node, addDiagnostic);
|
|
76971
76945
|
break;
|
|
76972
76946
|
case 195 /* InferType */:
|
|
76973
|
-
|
|
76974
|
-
checkUnusedInferTypeParameter(node, addDiagnostic);
|
|
76975
|
-
}
|
|
76947
|
+
checkUnusedInferTypeParameter(node, addDiagnostic);
|
|
76976
76948
|
break;
|
|
76977
76949
|
default:
|
|
76978
76950
|
Debug.assertNever(node, "Node should not have been registered for unused identifiers check");
|
|
@@ -77162,26 +77134,6 @@ function createTypeChecker(host) {
|
|
|
77162
77134
|
}
|
|
77163
77135
|
});
|
|
77164
77136
|
}
|
|
77165
|
-
function checkUninitializedLocals(nodeWithLocals) {
|
|
77166
|
-
nodeWithLocals.locals.forEach((local) => {
|
|
77167
|
-
if (!(local.flags & 3 /* Variable */) || local.isInitialized || !local.isReferenced) {
|
|
77168
|
-
return;
|
|
77169
|
-
}
|
|
77170
|
-
const declaration = local.valueDeclaration;
|
|
77171
|
-
if (!declaration) {
|
|
77172
|
-
return;
|
|
77173
|
-
}
|
|
77174
|
-
if (isVariableDeclaration(declaration)) {
|
|
77175
|
-
if (getCombinedNodeFlagsCached(declaration) & 33554432 /* Ambient */ || declaration.exclamationToken || declaration.initializer || !declaration.type) {
|
|
77176
|
-
return;
|
|
77177
|
-
}
|
|
77178
|
-
const type = getTypeFromTypeNode(declaration.type);
|
|
77179
|
-
if (!(type.flags & 3 /* AnyOrUnknown */) && !containsUndefinedType(type)) {
|
|
77180
|
-
error(declaration, Diagnostics.Variable_0_is_used_before_being_assigned, idText(declaration.name));
|
|
77181
|
-
}
|
|
77182
|
-
}
|
|
77183
|
-
});
|
|
77184
|
-
}
|
|
77185
77137
|
function checkPotentialUncheckedRenamedBindingElementsInTypes() {
|
|
77186
77138
|
var _a;
|
|
77187
77139
|
for (const node of potentialUnusedRenamedBindingElementsInTypes) {
|
|
@@ -77228,7 +77180,7 @@ function createTypeChecker(host) {
|
|
|
77228
77180
|
forEach(node.statements, checkSourceElement);
|
|
77229
77181
|
}
|
|
77230
77182
|
if (node.locals) {
|
|
77231
|
-
|
|
77183
|
+
registerForUnusedIdentifiersCheck(node);
|
|
77232
77184
|
}
|
|
77233
77185
|
}
|
|
77234
77186
|
function checkCollisionWithArgumentsInGeneratedCode(node) {
|
|
@@ -77577,6 +77529,29 @@ function createTypeChecker(host) {
|
|
|
77577
77529
|
}
|
|
77578
77530
|
checkCollisionsForDeclarationName(node, node.name);
|
|
77579
77531
|
}
|
|
77532
|
+
function canHaveLiteralInitializer2(node2) {
|
|
77533
|
+
switch (node2.kind) {
|
|
77534
|
+
case 172 /* PropertyDeclaration */:
|
|
77535
|
+
case 171 /* PropertySignature */:
|
|
77536
|
+
return !hasEffectiveModifier(node2, 8 /* Private */);
|
|
77537
|
+
case 169 /* Parameter */:
|
|
77538
|
+
case 260 /* VariableDeclaration */:
|
|
77539
|
+
return true;
|
|
77540
|
+
}
|
|
77541
|
+
return false;
|
|
77542
|
+
}
|
|
77543
|
+
function shouldPrintWithInitializer(node2) {
|
|
77544
|
+
return canHaveLiteralInitializer2(node2) && isLiteralConstDeclaration(node2);
|
|
77545
|
+
}
|
|
77546
|
+
function isPrivateDeclaration(node2) {
|
|
77547
|
+
return hasEffectiveModifier(node2, 8 /* Private */) || isPrivateIdentifierClassElementDeclaration(node2);
|
|
77548
|
+
}
|
|
77549
|
+
if (getEmitDeclarations(compilerOptions) && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* Signature */)) && !shouldPrintWithInitializer(node) && !isPrivateDeclaration(node)) {
|
|
77550
|
+
const widenedLiteralType = getWidenedLiteralType(type);
|
|
77551
|
+
if (!isTypeIdenticalTo(type, widenedLiteralType)) {
|
|
77552
|
+
ambiguousVariableDeclarationsWhenWidened.push([node, type, widenedLiteralType]);
|
|
77553
|
+
}
|
|
77554
|
+
}
|
|
77580
77555
|
}
|
|
77581
77556
|
function errorNextVariableOrPropertyDeclarationMustHaveSameType(firstDeclaration, firstType, nextDeclaration, nextType) {
|
|
77582
77557
|
const nextDeclarationName = getNameOfDeclaration(nextDeclaration);
|
|
@@ -77778,7 +77753,7 @@ function createTypeChecker(host) {
|
|
|
77778
77753
|
checkExpression(node.incrementor);
|
|
77779
77754
|
checkSourceElement(node.statement);
|
|
77780
77755
|
if (node.locals) {
|
|
77781
|
-
|
|
77756
|
+
registerForUnusedIdentifiersCheck(node);
|
|
77782
77757
|
}
|
|
77783
77758
|
}
|
|
77784
77759
|
function checkForOfStatement(node) {
|
|
@@ -77817,7 +77792,7 @@ function createTypeChecker(host) {
|
|
|
77817
77792
|
}
|
|
77818
77793
|
checkSourceElement(node.statement);
|
|
77819
77794
|
if (node.locals) {
|
|
77820
|
-
|
|
77795
|
+
registerForUnusedIdentifiersCheck(node);
|
|
77821
77796
|
}
|
|
77822
77797
|
}
|
|
77823
77798
|
function checkForInStatement(node) {
|
|
@@ -77849,7 +77824,7 @@ function createTypeChecker(host) {
|
|
|
77849
77824
|
}
|
|
77850
77825
|
checkSourceElement(node.statement);
|
|
77851
77826
|
if (node.locals) {
|
|
77852
|
-
|
|
77827
|
+
registerForUnusedIdentifiersCheck(node);
|
|
77853
77828
|
}
|
|
77854
77829
|
}
|
|
77855
77830
|
function checkRightHandSideOfForOf(statement) {
|
|
@@ -78581,7 +78556,7 @@ function createTypeChecker(host) {
|
|
|
78581
78556
|
}
|
|
78582
78557
|
});
|
|
78583
78558
|
if (node.caseBlock.locals) {
|
|
78584
|
-
|
|
78559
|
+
registerForUnusedIdentifiersCheck(node.caseBlock);
|
|
78585
78560
|
}
|
|
78586
78561
|
}
|
|
78587
78562
|
function checkLabeledStatement(node) {
|
|
@@ -78921,7 +78896,7 @@ function createTypeChecker(host) {
|
|
|
78921
78896
|
}
|
|
78922
78897
|
function checkClassExpressionDeferred(node) {
|
|
78923
78898
|
forEach(node.members, checkSourceElement);
|
|
78924
|
-
|
|
78899
|
+
registerForUnusedIdentifiersCheck(node);
|
|
78925
78900
|
}
|
|
78926
78901
|
function checkClassDeclaration(node) {
|
|
78927
78902
|
const firstDecorator = find(node.modifiers, isDecorator);
|
|
@@ -78933,7 +78908,7 @@ function createTypeChecker(host) {
|
|
|
78933
78908
|
}
|
|
78934
78909
|
checkClassLikeDeclaration(node);
|
|
78935
78910
|
forEach(node.members, checkSourceElement);
|
|
78936
|
-
|
|
78911
|
+
registerForUnusedIdentifiersCheck(node);
|
|
78937
78912
|
}
|
|
78938
78913
|
function checkClassLikeDeclaration(node) {
|
|
78939
78914
|
checkGrammarClassLikeDeclaration(node);
|
|
@@ -79494,7 +79469,7 @@ function createTypeChecker(host) {
|
|
|
79494
79469
|
forEach(node.members, checkSourceElement);
|
|
79495
79470
|
addLazyDiagnostic(() => {
|
|
79496
79471
|
checkTypeForDuplicateIndexSignatures(node);
|
|
79497
|
-
|
|
79472
|
+
registerForUnusedIdentifiersCheck(node);
|
|
79498
79473
|
});
|
|
79499
79474
|
}
|
|
79500
79475
|
function checkTypeAliasDeclaration(node) {
|
|
@@ -79508,7 +79483,7 @@ function createTypeChecker(host) {
|
|
|
79508
79483
|
}
|
|
79509
79484
|
} else {
|
|
79510
79485
|
checkSourceElement(node.type);
|
|
79511
|
-
|
|
79486
|
+
registerForUnusedIdentifiersCheck(node);
|
|
79512
79487
|
}
|
|
79513
79488
|
}
|
|
79514
79489
|
function computeEnumMemberValues(node) {
|
|
@@ -79779,7 +79754,7 @@ function createTypeChecker(host) {
|
|
|
79779
79754
|
if (node.body) {
|
|
79780
79755
|
checkSourceElement(node.body);
|
|
79781
79756
|
if (!isGlobalScopeAugmentation(node)) {
|
|
79782
|
-
|
|
79757
|
+
registerForUnusedIdentifiersCheck(node);
|
|
79783
79758
|
}
|
|
79784
79759
|
}
|
|
79785
79760
|
addLazyDiagnostic(checkModuleDeclarationDiagnostics);
|
|
@@ -80777,8 +80752,8 @@ function createTypeChecker(host) {
|
|
|
80777
80752
|
return Debug.assertNever(kind);
|
|
80778
80753
|
}
|
|
80779
80754
|
}
|
|
80780
|
-
function
|
|
80781
|
-
return
|
|
80755
|
+
function getPotentiallyUnusedIdentifiers(sourceFile) {
|
|
80756
|
+
return allPotentiallyUnusedIdentifiers.get(sourceFile.path) || emptyArray;
|
|
80782
80757
|
}
|
|
80783
80758
|
function checkSourceFileWorker(node) {
|
|
80784
80759
|
const links = getNodeLinks(node);
|
|
@@ -80792,30 +80767,42 @@ function createTypeChecker(host) {
|
|
|
80792
80767
|
clear(potentialWeakMapSetCollisions);
|
|
80793
80768
|
clear(potentialReflectCollisions);
|
|
80794
80769
|
clear(potentialUnusedRenamedBindingElementsInTypes);
|
|
80770
|
+
clear(ambiguousVariableDeclarationsWhenWidened);
|
|
80795
80771
|
forEach(node.statements, checkSourceElement);
|
|
80796
80772
|
checkSourceElement(node.endOfFileToken);
|
|
80797
80773
|
checkDeferredNodes(node);
|
|
80798
80774
|
if (isExternalOrCommonJsModule(node)) {
|
|
80799
|
-
|
|
80775
|
+
registerForUnusedIdentifiersCheck(node);
|
|
80800
80776
|
}
|
|
80801
80777
|
addLazyDiagnostic(() => {
|
|
80802
|
-
|
|
80803
|
-
|
|
80804
|
-
|
|
80805
|
-
|
|
80806
|
-
|
|
80807
|
-
|
|
80808
|
-
diagnostics.add(diag2);
|
|
80809
|
-
}
|
|
80810
|
-
},
|
|
80811
|
-
checkUnused,
|
|
80812
|
-
strictNullChecks
|
|
80813
|
-
);
|
|
80778
|
+
if (!node.isDeclarationFile && (compilerOptions.noUnusedLocals || compilerOptions.noUnusedParameters)) {
|
|
80779
|
+
checkUnusedIdentifiers(getPotentiallyUnusedIdentifiers(node), (containingNode, kind, diag2) => {
|
|
80780
|
+
if (!containsParseError(containingNode) && unusedIsError(kind, !!(containingNode.flags & 33554432 /* Ambient */))) {
|
|
80781
|
+
diagnostics.add(diag2);
|
|
80782
|
+
}
|
|
80783
|
+
});
|
|
80814
80784
|
}
|
|
80815
80785
|
if (!node.isDeclarationFile) {
|
|
80816
80786
|
checkPotentialUncheckedRenamedBindingElementsInTypes();
|
|
80817
80787
|
}
|
|
80818
80788
|
});
|
|
80789
|
+
addLazyDiagnostic(() => {
|
|
80790
|
+
function isVisibleExternally(elem) {
|
|
80791
|
+
if (isOmittedExpression(elem)) {
|
|
80792
|
+
return false;
|
|
80793
|
+
}
|
|
80794
|
+
if (isBindingPattern(elem.name)) {
|
|
80795
|
+
return some(elem.name.elements, isVisibleExternally);
|
|
80796
|
+
} else {
|
|
80797
|
+
return isDeclarationVisible(elem);
|
|
80798
|
+
}
|
|
80799
|
+
}
|
|
80800
|
+
for (const [node2, type, widenedLiteralType] of ambiguousVariableDeclarationsWhenWidened) {
|
|
80801
|
+
if (isVisibleExternally(node2)) {
|
|
80802
|
+
error(node2.name, Diagnostics.The_type_of_this_declaration_is_ambiguous_and_may_be_observed_as_either_0_or_1, typeToString(widenedLiteralType), typeToString(type));
|
|
80803
|
+
}
|
|
80804
|
+
}
|
|
80805
|
+
});
|
|
80819
80806
|
if (compilerOptions.importsNotUsedAsValues === 2 /* Error */ && !node.isDeclarationFile && isExternalModule(node)) {
|
|
80820
80807
|
checkImportsForTypeOnlyConversion(node);
|
|
80821
80808
|
}
|
|
@@ -80838,6 +80825,9 @@ function createTypeChecker(host) {
|
|
|
80838
80825
|
forEach(potentialReflectCollisions, checkReflectCollision);
|
|
80839
80826
|
clear(potentialReflectCollisions);
|
|
80840
80827
|
}
|
|
80828
|
+
if (ambiguousVariableDeclarationsWhenWidened.length) {
|
|
80829
|
+
clear(ambiguousVariableDeclarationsWhenWidened);
|
|
80830
|
+
}
|
|
80841
80831
|
links.flags |= 1 /* TypeChecked */;
|
|
80842
80832
|
}
|
|
80843
80833
|
}
|