@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/tsserver.js
CHANGED
|
@@ -2330,7 +2330,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2330
2330
|
|
|
2331
2331
|
// src/compiler/corePublic.ts
|
|
2332
2332
|
var versionMajorMinor = "5.3";
|
|
2333
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2333
|
+
var version = `${versionMajorMinor}.0-insiders.20230928`;
|
|
2334
2334
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2335
2335
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2336
2336
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -10181,6 +10181,7 @@ var Diagnostics = {
|
|
|
10181
10181
|
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."),
|
|
10182
10182
|
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."),
|
|
10183
10183
|
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}'."),
|
|
10184
|
+
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}'."),
|
|
10184
10185
|
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}'."),
|
|
10185
10186
|
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}'."),
|
|
10186
10187
|
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}'."),
|
|
@@ -20131,7 +20132,6 @@ function Symbol4(flags, name) {
|
|
|
20131
20132
|
this.exportSymbol = void 0;
|
|
20132
20133
|
this.constEnumOnlyModule = void 0;
|
|
20133
20134
|
this.isReferenced = void 0;
|
|
20134
|
-
this.isInitialized = void 0;
|
|
20135
20135
|
this.isAssigned = void 0;
|
|
20136
20136
|
this.links = void 0;
|
|
20137
20137
|
}
|
|
@@ -48239,16 +48239,11 @@ function createTypeChecker(host) {
|
|
|
48239
48239
|
checkSourceFileWithEagerDiagnostics(file);
|
|
48240
48240
|
Debug.assert(!!(getNodeLinks(file).flags & 1 /* TypeChecked */));
|
|
48241
48241
|
diagnostics2 = addRange(diagnostics2, suggestionDiagnostics.getDiagnostics(file.fileName));
|
|
48242
|
-
|
|
48243
|
-
|
|
48244
|
-
|
|
48245
|
-
|
|
48246
|
-
|
|
48247
|
-
}
|
|
48248
|
-
},
|
|
48249
|
-
/*checkUnused*/
|
|
48250
|
-
true
|
|
48251
|
-
);
|
|
48242
|
+
checkUnusedIdentifiers(getPotentiallyUnusedIdentifiers(file), (containingNode, kind, diag2) => {
|
|
48243
|
+
if (!containsParseError(containingNode) && !unusedIsError(kind, !!(containingNode.flags & 33554432 /* Ambient */))) {
|
|
48244
|
+
(diagnostics2 || (diagnostics2 = [])).push({ ...diag2, category: 2 /* Suggestion */ });
|
|
48245
|
+
}
|
|
48246
|
+
});
|
|
48252
48247
|
return diagnostics2 || emptyArray;
|
|
48253
48248
|
} finally {
|
|
48254
48249
|
cancellationToken = void 0;
|
|
@@ -48745,7 +48740,7 @@ function createTypeChecker(host) {
|
|
|
48745
48740
|
var deferredGlobalClassAccessorDecoratorTargetType;
|
|
48746
48741
|
var deferredGlobalClassAccessorDecoratorResultType;
|
|
48747
48742
|
var deferredGlobalClassFieldDecoratorContextType;
|
|
48748
|
-
var
|
|
48743
|
+
var allPotentiallyUnusedIdentifiers = /* @__PURE__ */ new Map();
|
|
48749
48744
|
var flowLoopStart = 0;
|
|
48750
48745
|
var flowLoopCount = 0;
|
|
48751
48746
|
var sharedFlowCount = 0;
|
|
@@ -48788,6 +48783,7 @@ function createTypeChecker(host) {
|
|
|
48788
48783
|
var potentialReflectCollisions = [];
|
|
48789
48784
|
var potentialUnusedRenamedBindingElementsInTypes = [];
|
|
48790
48785
|
var awaitedTypeStack = [];
|
|
48786
|
+
var ambiguousVariableDeclarationsWhenWidened = [];
|
|
48791
48787
|
var diagnostics = createDiagnosticCollection();
|
|
48792
48788
|
var suggestionDiagnostics = createDiagnosticCollection();
|
|
48793
48789
|
var typeofType = createTypeofType();
|
|
@@ -49456,10 +49452,10 @@ function createTypeChecker(host) {
|
|
|
49456
49452
|
function isConstAssertion(location) {
|
|
49457
49453
|
return isAssertionExpression(location) && isConstTypeReference(location.type) || isJSDocTypeTag(location) && isConstTypeReference(location.typeExpression);
|
|
49458
49454
|
}
|
|
49459
|
-
function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals = false, getSpellingSuggestions = true
|
|
49460
|
-
return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions,
|
|
49455
|
+
function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals = false, getSpellingSuggestions = true) {
|
|
49456
|
+
return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, getSymbol2);
|
|
49461
49457
|
}
|
|
49462
|
-
function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions,
|
|
49458
|
+
function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, lookup) {
|
|
49463
49459
|
var _a, _b, _c;
|
|
49464
49460
|
const originalLocation = location;
|
|
49465
49461
|
let result;
|
|
@@ -49685,9 +49681,6 @@ function createTypeChecker(host) {
|
|
|
49685
49681
|
if (isUse && result && (!lastSelfReferenceLocation || result !== lastSelfReferenceLocation.symbol)) {
|
|
49686
49682
|
result.isReferenced |= meaning;
|
|
49687
49683
|
}
|
|
49688
|
-
if (isWritten && result) {
|
|
49689
|
-
result.isInitialized = true;
|
|
49690
|
-
}
|
|
49691
49684
|
if (!result) {
|
|
49692
49685
|
if (lastLocation) {
|
|
49693
49686
|
Debug.assertNode(lastLocation, isSourceFile);
|
|
@@ -69195,10 +69188,7 @@ function createTypeChecker(host) {
|
|
|
69195
69188
|
node,
|
|
69196
69189
|
!isWriteOnlyAccess(node),
|
|
69197
69190
|
/*excludeGlobals*/
|
|
69198
|
-
false
|
|
69199
|
-
/*getSpellingSuggestions*/
|
|
69200
|
-
void 0,
|
|
69201
|
-
isWriteAccess(node)
|
|
69191
|
+
false
|
|
69202
69192
|
) || unknownSymbol;
|
|
69203
69193
|
}
|
|
69204
69194
|
return links.resolvedSymbol;
|
|
@@ -74632,8 +74622,6 @@ function createTypeChecker(host) {
|
|
|
74632
74622
|
false,
|
|
74633
74623
|
/*getSpellingSuggestions*/
|
|
74634
74624
|
true,
|
|
74635
|
-
/*isWritten*/
|
|
74636
|
-
false,
|
|
74637
74625
|
(symbols, name, meaning2) => {
|
|
74638
74626
|
Debug.assertEqual(outerName, name, "name should equal outerName");
|
|
74639
74627
|
const symbol = getSymbol2(symbols, name, meaning2);
|
|
@@ -80088,7 +80076,7 @@ function createTypeChecker(host) {
|
|
|
80088
80076
|
}
|
|
80089
80077
|
}
|
|
80090
80078
|
if (node.kind !== 181 /* IndexSignature */ && node.kind !== 324 /* JSDocFunctionType */) {
|
|
80091
|
-
|
|
80079
|
+
registerForUnusedIdentifiersCheck(node);
|
|
80092
80080
|
}
|
|
80093
80081
|
}
|
|
80094
80082
|
}
|
|
@@ -80633,7 +80621,7 @@ function createTypeChecker(host) {
|
|
|
80633
80621
|
}
|
|
80634
80622
|
}
|
|
80635
80623
|
}
|
|
80636
|
-
|
|
80624
|
+
registerForUnusedIdentifiersCheck(node);
|
|
80637
80625
|
}
|
|
80638
80626
|
function checkTemplateLiteralType(node) {
|
|
80639
80627
|
for (const span of node.templateSpans) {
|
|
@@ -81619,27 +81607,25 @@ function createTypeChecker(host) {
|
|
|
81619
81607
|
}
|
|
81620
81608
|
}
|
|
81621
81609
|
}
|
|
81622
|
-
function
|
|
81623
|
-
addLazyDiagnostic(
|
|
81624
|
-
function
|
|
81610
|
+
function registerForUnusedIdentifiersCheck(node) {
|
|
81611
|
+
addLazyDiagnostic(registerForUnusedIdentifiersCheckDiagnostics);
|
|
81612
|
+
function registerForUnusedIdentifiersCheckDiagnostics() {
|
|
81625
81613
|
const sourceFile = getSourceFileOfNode(node);
|
|
81626
|
-
let
|
|
81627
|
-
if (!
|
|
81628
|
-
|
|
81629
|
-
|
|
81614
|
+
let potentiallyUnusedIdentifiers = allPotentiallyUnusedIdentifiers.get(sourceFile.path);
|
|
81615
|
+
if (!potentiallyUnusedIdentifiers) {
|
|
81616
|
+
potentiallyUnusedIdentifiers = [];
|
|
81617
|
+
allPotentiallyUnusedIdentifiers.set(sourceFile.path, potentiallyUnusedIdentifiers);
|
|
81630
81618
|
}
|
|
81631
|
-
|
|
81619
|
+
potentiallyUnusedIdentifiers.push(node);
|
|
81632
81620
|
}
|
|
81633
81621
|
}
|
|
81634
|
-
function
|
|
81622
|
+
function checkUnusedIdentifiers(potentiallyUnusedIdentifiers, addDiagnostic) {
|
|
81635
81623
|
for (const node of potentiallyUnusedIdentifiers) {
|
|
81636
81624
|
switch (node.kind) {
|
|
81637
81625
|
case 263 /* ClassDeclaration */:
|
|
81638
81626
|
case 231 /* ClassExpression */:
|
|
81639
|
-
|
|
81640
|
-
|
|
81641
|
-
checkUnusedTypeParameters(node, addDiagnostic);
|
|
81642
|
-
}
|
|
81627
|
+
checkUnusedClassMembers(node, addDiagnostic);
|
|
81628
|
+
checkUnusedTypeParameters(node, addDiagnostic);
|
|
81643
81629
|
break;
|
|
81644
81630
|
case 312 /* SourceFile */:
|
|
81645
81631
|
case 267 /* ModuleDeclaration */:
|
|
@@ -81648,12 +81634,7 @@ function createTypeChecker(host) {
|
|
|
81648
81634
|
case 248 /* ForStatement */:
|
|
81649
81635
|
case 249 /* ForInStatement */:
|
|
81650
81636
|
case 250 /* ForOfStatement */:
|
|
81651
|
-
|
|
81652
|
-
checkUnusedLocalsAndParameters(node, addDiagnostic);
|
|
81653
|
-
}
|
|
81654
|
-
if (checkUninitialized) {
|
|
81655
|
-
checkUninitializedLocals(node);
|
|
81656
|
-
}
|
|
81637
|
+
checkUnusedLocalsAndParameters(node, addDiagnostic);
|
|
81657
81638
|
break;
|
|
81658
81639
|
case 176 /* Constructor */:
|
|
81659
81640
|
case 218 /* FunctionExpression */:
|
|
@@ -81662,15 +81643,10 @@ function createTypeChecker(host) {
|
|
|
81662
81643
|
case 174 /* MethodDeclaration */:
|
|
81663
81644
|
case 177 /* GetAccessor */:
|
|
81664
81645
|
case 178 /* SetAccessor */:
|
|
81665
|
-
if (
|
|
81666
|
-
|
|
81667
|
-
checkUnusedLocalsAndParameters(node, addDiagnostic);
|
|
81668
|
-
}
|
|
81669
|
-
checkUnusedTypeParameters(node, addDiagnostic);
|
|
81670
|
-
}
|
|
81671
|
-
if (checkUninitialized) {
|
|
81672
|
-
checkUninitializedLocals(node);
|
|
81646
|
+
if (node.body) {
|
|
81647
|
+
checkUnusedLocalsAndParameters(node, addDiagnostic);
|
|
81673
81648
|
}
|
|
81649
|
+
checkUnusedTypeParameters(node, addDiagnostic);
|
|
81674
81650
|
break;
|
|
81675
81651
|
case 173 /* MethodSignature */:
|
|
81676
81652
|
case 179 /* CallSignature */:
|
|
@@ -81679,14 +81655,10 @@ function createTypeChecker(host) {
|
|
|
81679
81655
|
case 185 /* ConstructorType */:
|
|
81680
81656
|
case 265 /* TypeAliasDeclaration */:
|
|
81681
81657
|
case 264 /* InterfaceDeclaration */:
|
|
81682
|
-
|
|
81683
|
-
checkUnusedTypeParameters(node, addDiagnostic);
|
|
81684
|
-
}
|
|
81658
|
+
checkUnusedTypeParameters(node, addDiagnostic);
|
|
81685
81659
|
break;
|
|
81686
81660
|
case 195 /* InferType */:
|
|
81687
|
-
|
|
81688
|
-
checkUnusedInferTypeParameter(node, addDiagnostic);
|
|
81689
|
-
}
|
|
81661
|
+
checkUnusedInferTypeParameter(node, addDiagnostic);
|
|
81690
81662
|
break;
|
|
81691
81663
|
default:
|
|
81692
81664
|
Debug.assertNever(node, "Node should not have been registered for unused identifiers check");
|
|
@@ -81876,26 +81848,6 @@ function createTypeChecker(host) {
|
|
|
81876
81848
|
}
|
|
81877
81849
|
});
|
|
81878
81850
|
}
|
|
81879
|
-
function checkUninitializedLocals(nodeWithLocals) {
|
|
81880
|
-
nodeWithLocals.locals.forEach((local) => {
|
|
81881
|
-
if (!(local.flags & 3 /* Variable */) || local.isInitialized || !local.isReferenced) {
|
|
81882
|
-
return;
|
|
81883
|
-
}
|
|
81884
|
-
const declaration = local.valueDeclaration;
|
|
81885
|
-
if (!declaration) {
|
|
81886
|
-
return;
|
|
81887
|
-
}
|
|
81888
|
-
if (isVariableDeclaration(declaration)) {
|
|
81889
|
-
if (getCombinedNodeFlagsCached(declaration) & 33554432 /* Ambient */ || declaration.exclamationToken || declaration.initializer || !declaration.type) {
|
|
81890
|
-
return;
|
|
81891
|
-
}
|
|
81892
|
-
const type = getTypeFromTypeNode(declaration.type);
|
|
81893
|
-
if (!(type.flags & 3 /* AnyOrUnknown */) && !containsUndefinedType(type)) {
|
|
81894
|
-
error2(declaration, Diagnostics.Variable_0_is_used_before_being_assigned, idText(declaration.name));
|
|
81895
|
-
}
|
|
81896
|
-
}
|
|
81897
|
-
});
|
|
81898
|
-
}
|
|
81899
81851
|
function checkPotentialUncheckedRenamedBindingElementsInTypes() {
|
|
81900
81852
|
var _a;
|
|
81901
81853
|
for (const node of potentialUnusedRenamedBindingElementsInTypes) {
|
|
@@ -81942,7 +81894,7 @@ function createTypeChecker(host) {
|
|
|
81942
81894
|
forEach(node.statements, checkSourceElement);
|
|
81943
81895
|
}
|
|
81944
81896
|
if (node.locals) {
|
|
81945
|
-
|
|
81897
|
+
registerForUnusedIdentifiersCheck(node);
|
|
81946
81898
|
}
|
|
81947
81899
|
}
|
|
81948
81900
|
function checkCollisionWithArgumentsInGeneratedCode(node) {
|
|
@@ -82291,6 +82243,29 @@ function createTypeChecker(host) {
|
|
|
82291
82243
|
}
|
|
82292
82244
|
checkCollisionsForDeclarationName(node, node.name);
|
|
82293
82245
|
}
|
|
82246
|
+
function canHaveLiteralInitializer2(node2) {
|
|
82247
|
+
switch (node2.kind) {
|
|
82248
|
+
case 172 /* PropertyDeclaration */:
|
|
82249
|
+
case 171 /* PropertySignature */:
|
|
82250
|
+
return !hasEffectiveModifier(node2, 8 /* Private */);
|
|
82251
|
+
case 169 /* Parameter */:
|
|
82252
|
+
case 260 /* VariableDeclaration */:
|
|
82253
|
+
return true;
|
|
82254
|
+
}
|
|
82255
|
+
return false;
|
|
82256
|
+
}
|
|
82257
|
+
function shouldPrintWithInitializer(node2) {
|
|
82258
|
+
return canHaveLiteralInitializer2(node2) && isLiteralConstDeclaration(node2);
|
|
82259
|
+
}
|
|
82260
|
+
function isPrivateDeclaration(node2) {
|
|
82261
|
+
return hasEffectiveModifier(node2, 8 /* Private */) || isPrivateIdentifierClassElementDeclaration(node2);
|
|
82262
|
+
}
|
|
82263
|
+
if (getEmitDeclarations(compilerOptions) && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* Signature */)) && !shouldPrintWithInitializer(node) && !isPrivateDeclaration(node)) {
|
|
82264
|
+
const widenedLiteralType = getWidenedLiteralType(type);
|
|
82265
|
+
if (!isTypeIdenticalTo(type, widenedLiteralType)) {
|
|
82266
|
+
ambiguousVariableDeclarationsWhenWidened.push([node, type, widenedLiteralType]);
|
|
82267
|
+
}
|
|
82268
|
+
}
|
|
82294
82269
|
}
|
|
82295
82270
|
function errorNextVariableOrPropertyDeclarationMustHaveSameType(firstDeclaration, firstType, nextDeclaration, nextType) {
|
|
82296
82271
|
const nextDeclarationName = getNameOfDeclaration(nextDeclaration);
|
|
@@ -82492,7 +82467,7 @@ function createTypeChecker(host) {
|
|
|
82492
82467
|
checkExpression(node.incrementor);
|
|
82493
82468
|
checkSourceElement(node.statement);
|
|
82494
82469
|
if (node.locals) {
|
|
82495
|
-
|
|
82470
|
+
registerForUnusedIdentifiersCheck(node);
|
|
82496
82471
|
}
|
|
82497
82472
|
}
|
|
82498
82473
|
function checkForOfStatement(node) {
|
|
@@ -82531,7 +82506,7 @@ function createTypeChecker(host) {
|
|
|
82531
82506
|
}
|
|
82532
82507
|
checkSourceElement(node.statement);
|
|
82533
82508
|
if (node.locals) {
|
|
82534
|
-
|
|
82509
|
+
registerForUnusedIdentifiersCheck(node);
|
|
82535
82510
|
}
|
|
82536
82511
|
}
|
|
82537
82512
|
function checkForInStatement(node) {
|
|
@@ -82563,7 +82538,7 @@ function createTypeChecker(host) {
|
|
|
82563
82538
|
}
|
|
82564
82539
|
checkSourceElement(node.statement);
|
|
82565
82540
|
if (node.locals) {
|
|
82566
|
-
|
|
82541
|
+
registerForUnusedIdentifiersCheck(node);
|
|
82567
82542
|
}
|
|
82568
82543
|
}
|
|
82569
82544
|
function checkRightHandSideOfForOf(statement) {
|
|
@@ -83295,7 +83270,7 @@ function createTypeChecker(host) {
|
|
|
83295
83270
|
}
|
|
83296
83271
|
});
|
|
83297
83272
|
if (node.caseBlock.locals) {
|
|
83298
|
-
|
|
83273
|
+
registerForUnusedIdentifiersCheck(node.caseBlock);
|
|
83299
83274
|
}
|
|
83300
83275
|
}
|
|
83301
83276
|
function checkLabeledStatement(node) {
|
|
@@ -83635,7 +83610,7 @@ function createTypeChecker(host) {
|
|
|
83635
83610
|
}
|
|
83636
83611
|
function checkClassExpressionDeferred(node) {
|
|
83637
83612
|
forEach(node.members, checkSourceElement);
|
|
83638
|
-
|
|
83613
|
+
registerForUnusedIdentifiersCheck(node);
|
|
83639
83614
|
}
|
|
83640
83615
|
function checkClassDeclaration(node) {
|
|
83641
83616
|
const firstDecorator = find(node.modifiers, isDecorator);
|
|
@@ -83647,7 +83622,7 @@ function createTypeChecker(host) {
|
|
|
83647
83622
|
}
|
|
83648
83623
|
checkClassLikeDeclaration(node);
|
|
83649
83624
|
forEach(node.members, checkSourceElement);
|
|
83650
|
-
|
|
83625
|
+
registerForUnusedIdentifiersCheck(node);
|
|
83651
83626
|
}
|
|
83652
83627
|
function checkClassLikeDeclaration(node) {
|
|
83653
83628
|
checkGrammarClassLikeDeclaration(node);
|
|
@@ -84208,7 +84183,7 @@ function createTypeChecker(host) {
|
|
|
84208
84183
|
forEach(node.members, checkSourceElement);
|
|
84209
84184
|
addLazyDiagnostic(() => {
|
|
84210
84185
|
checkTypeForDuplicateIndexSignatures(node);
|
|
84211
|
-
|
|
84186
|
+
registerForUnusedIdentifiersCheck(node);
|
|
84212
84187
|
});
|
|
84213
84188
|
}
|
|
84214
84189
|
function checkTypeAliasDeclaration(node) {
|
|
@@ -84222,7 +84197,7 @@ function createTypeChecker(host) {
|
|
|
84222
84197
|
}
|
|
84223
84198
|
} else {
|
|
84224
84199
|
checkSourceElement(node.type);
|
|
84225
|
-
|
|
84200
|
+
registerForUnusedIdentifiersCheck(node);
|
|
84226
84201
|
}
|
|
84227
84202
|
}
|
|
84228
84203
|
function computeEnumMemberValues(node) {
|
|
@@ -84493,7 +84468,7 @@ function createTypeChecker(host) {
|
|
|
84493
84468
|
if (node.body) {
|
|
84494
84469
|
checkSourceElement(node.body);
|
|
84495
84470
|
if (!isGlobalScopeAugmentation(node)) {
|
|
84496
|
-
|
|
84471
|
+
registerForUnusedIdentifiersCheck(node);
|
|
84497
84472
|
}
|
|
84498
84473
|
}
|
|
84499
84474
|
addLazyDiagnostic(checkModuleDeclarationDiagnostics);
|
|
@@ -85491,8 +85466,8 @@ function createTypeChecker(host) {
|
|
|
85491
85466
|
return Debug.assertNever(kind);
|
|
85492
85467
|
}
|
|
85493
85468
|
}
|
|
85494
|
-
function
|
|
85495
|
-
return
|
|
85469
|
+
function getPotentiallyUnusedIdentifiers(sourceFile) {
|
|
85470
|
+
return allPotentiallyUnusedIdentifiers.get(sourceFile.path) || emptyArray;
|
|
85496
85471
|
}
|
|
85497
85472
|
function checkSourceFileWorker(node) {
|
|
85498
85473
|
const links = getNodeLinks(node);
|
|
@@ -85506,30 +85481,42 @@ function createTypeChecker(host) {
|
|
|
85506
85481
|
clear(potentialWeakMapSetCollisions);
|
|
85507
85482
|
clear(potentialReflectCollisions);
|
|
85508
85483
|
clear(potentialUnusedRenamedBindingElementsInTypes);
|
|
85484
|
+
clear(ambiguousVariableDeclarationsWhenWidened);
|
|
85509
85485
|
forEach(node.statements, checkSourceElement);
|
|
85510
85486
|
checkSourceElement(node.endOfFileToken);
|
|
85511
85487
|
checkDeferredNodes(node);
|
|
85512
85488
|
if (isExternalOrCommonJsModule(node)) {
|
|
85513
|
-
|
|
85489
|
+
registerForUnusedIdentifiersCheck(node);
|
|
85514
85490
|
}
|
|
85515
85491
|
addLazyDiagnostic(() => {
|
|
85516
|
-
|
|
85517
|
-
|
|
85518
|
-
|
|
85519
|
-
|
|
85520
|
-
|
|
85521
|
-
|
|
85522
|
-
diagnostics.add(diag2);
|
|
85523
|
-
}
|
|
85524
|
-
},
|
|
85525
|
-
checkUnused,
|
|
85526
|
-
strictNullChecks
|
|
85527
|
-
);
|
|
85492
|
+
if (!node.isDeclarationFile && (compilerOptions.noUnusedLocals || compilerOptions.noUnusedParameters)) {
|
|
85493
|
+
checkUnusedIdentifiers(getPotentiallyUnusedIdentifiers(node), (containingNode, kind, diag2) => {
|
|
85494
|
+
if (!containsParseError(containingNode) && unusedIsError(kind, !!(containingNode.flags & 33554432 /* Ambient */))) {
|
|
85495
|
+
diagnostics.add(diag2);
|
|
85496
|
+
}
|
|
85497
|
+
});
|
|
85528
85498
|
}
|
|
85529
85499
|
if (!node.isDeclarationFile) {
|
|
85530
85500
|
checkPotentialUncheckedRenamedBindingElementsInTypes();
|
|
85531
85501
|
}
|
|
85532
85502
|
});
|
|
85503
|
+
addLazyDiagnostic(() => {
|
|
85504
|
+
function isVisibleExternally(elem) {
|
|
85505
|
+
if (isOmittedExpression(elem)) {
|
|
85506
|
+
return false;
|
|
85507
|
+
}
|
|
85508
|
+
if (isBindingPattern(elem.name)) {
|
|
85509
|
+
return some(elem.name.elements, isVisibleExternally);
|
|
85510
|
+
} else {
|
|
85511
|
+
return isDeclarationVisible(elem);
|
|
85512
|
+
}
|
|
85513
|
+
}
|
|
85514
|
+
for (const [node2, type, widenedLiteralType] of ambiguousVariableDeclarationsWhenWidened) {
|
|
85515
|
+
if (isVisibleExternally(node2)) {
|
|
85516
|
+
error2(node2.name, Diagnostics.The_type_of_this_declaration_is_ambiguous_and_may_be_observed_as_either_0_or_1, typeToString(widenedLiteralType), typeToString(type));
|
|
85517
|
+
}
|
|
85518
|
+
}
|
|
85519
|
+
});
|
|
85533
85520
|
if (compilerOptions.importsNotUsedAsValues === 2 /* Error */ && !node.isDeclarationFile && isExternalModule(node)) {
|
|
85534
85521
|
checkImportsForTypeOnlyConversion(node);
|
|
85535
85522
|
}
|
|
@@ -85552,6 +85539,9 @@ function createTypeChecker(host) {
|
|
|
85552
85539
|
forEach(potentialReflectCollisions, checkReflectCollision);
|
|
85553
85540
|
clear(potentialReflectCollisions);
|
|
85554
85541
|
}
|
|
85542
|
+
if (ambiguousVariableDeclarationsWhenWidened.length) {
|
|
85543
|
+
clear(ambiguousVariableDeclarationsWhenWidened);
|
|
85544
|
+
}
|
|
85555
85545
|
links.flags |= 1 /* TypeChecked */;
|
|
85556
85546
|
}
|
|
85557
85547
|
}
|