@typescript-deploys/pr-build 5.3.0-pr-55887-24 → 5.3.0-pr-55867-7
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 +183 -133
- package/lib/tsserver.js +208 -1084
- package/lib/typescript.d.ts +4 -1
- package/lib/typescript.js +206 -1088
- package/lib/typingsInstaller.js +6 -5
- 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.20230929`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -6202,7 +6202,7 @@ var Diagnostics = {
|
|
|
6202
6202
|
An_arithmetic_operand_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2356, 1 /* Error */, "An_arithmetic_operand_must_be_of_type_any_number_bigint_or_an_enum_type_2356", "An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type."),
|
|
6203
6203
|
The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: diag(2357, 1 /* Error */, "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", "The operand of an increment or decrement operator must be a variable or a property access."),
|
|
6204
6204
|
The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: diag(2358, 1 /* Error */, "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter."),
|
|
6205
|
-
|
|
6205
|
+
The_right_hand_side_of_an_instanceof_expression_must_be_either_of_type_any_a_class_function_or_other_type_assignable_to_the_Function_interface_type_or_an_object_type_with_a_Symbol_hasInstance_method: diag(2359, 1 /* Error */, "The_right_hand_side_of_an_instanceof_expression_must_be_either_of_type_any_a_class_function_or_other_2359", "The right-hand side of an 'instanceof' expression must be either of type 'any', a class, function, or other type assignable to the 'Function' interface type, or an object type with a 'Symbol.hasInstance' method."),
|
|
6206
6206
|
The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2362, 1 /* Error */, "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362", "The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."),
|
|
6207
6207
|
The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2363, 1 /* Error */, "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363", "The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."),
|
|
6208
6208
|
The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: diag(2364, 1 /* Error */, "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364", "The left-hand side of an assignment expression must be a variable or a property access."),
|
|
@@ -6651,6 +6651,8 @@ 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_left_hand_side_of_an_instanceof_expression_must_be_assignable_to_the_first_argument_of_the_right_hand_side_s_Symbol_hasInstance_method: diag(2860, 1 /* Error */, "The_left_hand_side_of_an_instanceof_expression_must_be_assignable_to_the_first_argument_of_the_right_2860", "The left-hand side of an 'instanceof' expression must be assignable to the first argument of the right-hand side's '[Symbol.hasInstance]' method."),
|
|
6655
|
+
An_object_s_Symbol_hasInstance_method_must_return_a_boolean_value_for_it_to_be_used_on_the_right_hand_side_of_an_instanceof_expression: diag(2861, 1 /* Error */, "An_object_s_Symbol_hasInstance_method_must_return_a_boolean_value_for_it_to_be_used_on_the_right_han_2861", "An object's '[Symbol.hasInstance]' method must return a boolean value for it to be used on the right-hand side of an 'instanceof' expression."),
|
|
6654
6656
|
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
6657
|
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
6658
|
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}'."),
|
|
@@ -10814,6 +10816,13 @@ function isAutoAccessorPropertyDeclaration(node) {
|
|
|
10814
10816
|
return isPropertyDeclaration(node) && hasAccessorModifier(node);
|
|
10815
10817
|
}
|
|
10816
10818
|
function isClassFieldAndNotAutoAccessor(node) {
|
|
10819
|
+
if (isInJSFile(node) && isExpandoPropertyDeclaration(node)) {
|
|
10820
|
+
return (!isBindableStaticAccessExpression(node) || !isPrototypeAccess(node.expression)) && !isBindableStaticNameExpression(
|
|
10821
|
+
node,
|
|
10822
|
+
/*excludeThisKeyword*/
|
|
10823
|
+
true
|
|
10824
|
+
);
|
|
10825
|
+
}
|
|
10817
10826
|
return node.parent && isClassLike(node.parent) && isPropertyDeclaration(node) && !hasAccessorModifier(node);
|
|
10818
10827
|
}
|
|
10819
10828
|
function isMethodOrAccessor(node) {
|
|
@@ -13076,6 +13085,8 @@ function getInvokedExpression(node) {
|
|
|
13076
13085
|
case 286 /* JsxOpeningElement */:
|
|
13077
13086
|
case 285 /* JsxSelfClosingElement */:
|
|
13078
13087
|
return node.tagName;
|
|
13088
|
+
case 226 /* BinaryExpression */:
|
|
13089
|
+
return node.right;
|
|
13079
13090
|
default:
|
|
13080
13091
|
return node.expression;
|
|
13081
13092
|
}
|
|
@@ -15582,6 +15593,12 @@ function isRightSideOfAccessExpression(node) {
|
|
|
15582
15593
|
function isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName(node) {
|
|
15583
15594
|
return isQualifiedName(node.parent) && node.parent.right === node || isPropertyAccessExpression(node.parent) && node.parent.name === node || isJSDocMemberName(node.parent) && node.parent.right === node;
|
|
15584
15595
|
}
|
|
15596
|
+
function isInstanceOfExpression(node) {
|
|
15597
|
+
return isBinaryExpression(node) && node.operatorToken.kind === 104 /* InstanceOfKeyword */;
|
|
15598
|
+
}
|
|
15599
|
+
function isRightSideOfInstanceofExpression(node) {
|
|
15600
|
+
return isInstanceOfExpression(node.parent) && node === node.parent.right;
|
|
15601
|
+
}
|
|
15585
15602
|
function isEmptyObjectLiteral(expression) {
|
|
15586
15603
|
return expression.kind === 210 /* ObjectLiteralExpression */ && expression.properties.length === 0;
|
|
15587
15604
|
}
|
|
@@ -15861,9 +15878,6 @@ function accessKind(node) {
|
|
|
15861
15878
|
return node === parent.objectAssignmentInitializer ? 0 /* Read */ : accessKind(parent.parent);
|
|
15862
15879
|
case 209 /* ArrayLiteralExpression */:
|
|
15863
15880
|
return accessKind(parent);
|
|
15864
|
-
case 249 /* ForInStatement */:
|
|
15865
|
-
case 250 /* ForOfStatement */:
|
|
15866
|
-
return node === parent.initializer ? 1 /* Write */ : 0 /* Read */;
|
|
15867
15881
|
default:
|
|
15868
15882
|
return 0 /* Read */;
|
|
15869
15883
|
}
|
|
@@ -43072,9 +43086,8 @@ var CheckMode = /* @__PURE__ */ ((CheckMode3) => {
|
|
|
43072
43086
|
CheckMode3[CheckMode3["SkipContextSensitive"] = 4] = "SkipContextSensitive";
|
|
43073
43087
|
CheckMode3[CheckMode3["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
|
|
43074
43088
|
CheckMode3[CheckMode3["IsForSignatureHelp"] = 16] = "IsForSignatureHelp";
|
|
43075
|
-
CheckMode3[CheckMode3["
|
|
43076
|
-
CheckMode3[CheckMode3["
|
|
43077
|
-
CheckMode3[CheckMode3["TypeOnly"] = 128] = "TypeOnly";
|
|
43089
|
+
CheckMode3[CheckMode3["RestBindingElement"] = 32] = "RestBindingElement";
|
|
43090
|
+
CheckMode3[CheckMode3["TypeOnly"] = 64] = "TypeOnly";
|
|
43078
43091
|
return CheckMode3;
|
|
43079
43092
|
})(CheckMode || {});
|
|
43080
43093
|
var SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
|
|
@@ -43527,16 +43540,11 @@ function createTypeChecker(host) {
|
|
|
43527
43540
|
checkSourceFileWithEagerDiagnostics(file);
|
|
43528
43541
|
Debug.assert(!!(getNodeLinks(file).flags & 1 /* TypeChecked */));
|
|
43529
43542
|
diagnostics2 = addRange(diagnostics2, suggestionDiagnostics.getDiagnostics(file.fileName));
|
|
43530
|
-
|
|
43531
|
-
|
|
43532
|
-
|
|
43533
|
-
|
|
43534
|
-
|
|
43535
|
-
}
|
|
43536
|
-
},
|
|
43537
|
-
/*checkUnused*/
|
|
43538
|
-
true
|
|
43539
|
-
);
|
|
43543
|
+
checkUnusedIdentifiers(getPotentiallyUnusedIdentifiers(file), (containingNode, kind, diag2) => {
|
|
43544
|
+
if (!containsParseError(containingNode) && !unusedIsError(kind, !!(containingNode.flags & 33554432 /* Ambient */))) {
|
|
43545
|
+
(diagnostics2 || (diagnostics2 = [])).push({ ...diag2, category: 2 /* Suggestion */ });
|
|
43546
|
+
}
|
|
43547
|
+
});
|
|
43540
43548
|
return diagnostics2 || emptyArray;
|
|
43541
43549
|
} finally {
|
|
43542
43550
|
cancellationToken = void 0;
|
|
@@ -43566,7 +43574,7 @@ function createTypeChecker(host) {
|
|
|
43566
43574
|
candidates,
|
|
43567
43575
|
/*argumentCount*/
|
|
43568
43576
|
void 0,
|
|
43569
|
-
|
|
43577
|
+
0 /* Normal */
|
|
43570
43578
|
));
|
|
43571
43579
|
for (const candidate of candidates) {
|
|
43572
43580
|
candidatesSet.add(candidate);
|
|
@@ -44033,7 +44041,7 @@ function createTypeChecker(host) {
|
|
|
44033
44041
|
var deferredGlobalClassAccessorDecoratorTargetType;
|
|
44034
44042
|
var deferredGlobalClassAccessorDecoratorResultType;
|
|
44035
44043
|
var deferredGlobalClassFieldDecoratorContextType;
|
|
44036
|
-
var
|
|
44044
|
+
var allPotentiallyUnusedIdentifiers = /* @__PURE__ */ new Map();
|
|
44037
44045
|
var flowLoopStart = 0;
|
|
44038
44046
|
var flowLoopCount = 0;
|
|
44039
44047
|
var sharedFlowCount = 0;
|
|
@@ -44744,10 +44752,10 @@ function createTypeChecker(host) {
|
|
|
44744
44752
|
function isConstAssertion(location) {
|
|
44745
44753
|
return isAssertionExpression(location) && isConstTypeReference(location.type) || isJSDocTypeTag(location) && isConstTypeReference(location.typeExpression);
|
|
44746
44754
|
}
|
|
44747
|
-
function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals = false, getSpellingSuggestions = true
|
|
44748
|
-
return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions,
|
|
44755
|
+
function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals = false, getSpellingSuggestions = true) {
|
|
44756
|
+
return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, getSymbol);
|
|
44749
44757
|
}
|
|
44750
|
-
function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions,
|
|
44758
|
+
function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, lookup) {
|
|
44751
44759
|
var _a, _b, _c;
|
|
44752
44760
|
const originalLocation = location;
|
|
44753
44761
|
let result;
|
|
@@ -44973,9 +44981,6 @@ function createTypeChecker(host) {
|
|
|
44973
44981
|
if (isUse && result && (!lastSelfReferenceLocation || result !== lastSelfReferenceLocation.symbol)) {
|
|
44974
44982
|
result.isReferenced |= meaning;
|
|
44975
44983
|
}
|
|
44976
|
-
if (isWritten && result) {
|
|
44977
|
-
result.isAssigned = true;
|
|
44978
|
-
}
|
|
44979
44984
|
if (!result) {
|
|
44980
44985
|
if (lastLocation) {
|
|
44981
44986
|
Debug.assertNode(lastLocation, isSourceFile);
|
|
@@ -51604,7 +51609,7 @@ function createTypeChecker(host) {
|
|
|
51604
51609
|
return type.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */) ? "" + type.value : void 0;
|
|
51605
51610
|
}
|
|
51606
51611
|
function getTypeForBindingElement(declaration) {
|
|
51607
|
-
const checkMode = declaration.dotDotDotToken ?
|
|
51612
|
+
const checkMode = declaration.dotDotDotToken ? 32 /* RestBindingElement */ : 0 /* Normal */;
|
|
51608
51613
|
const parentType = getTypeForBindingElementParent(declaration.parent.parent, checkMode);
|
|
51609
51614
|
return parentType && getBindingElementTypeFromParentType(
|
|
51610
51615
|
declaration,
|
|
@@ -63771,7 +63776,7 @@ function createTypeChecker(host) {
|
|
|
63771
63776
|
if (!couldContainTypeVariables(target)) {
|
|
63772
63777
|
return;
|
|
63773
63778
|
}
|
|
63774
|
-
if (source === wildcardType) {
|
|
63779
|
+
if (source === wildcardType || source === blockedStringType) {
|
|
63775
63780
|
const savePropagationType = propagationType;
|
|
63776
63781
|
propagationType = source;
|
|
63777
63782
|
inferFromTypes(target, target);
|
|
@@ -63828,6 +63833,10 @@ function createTypeChecker(host) {
|
|
|
63828
63833
|
return;
|
|
63829
63834
|
}
|
|
63830
63835
|
if (!inference.isFixed) {
|
|
63836
|
+
const candidate = propagationType || source;
|
|
63837
|
+
if (candidate === blockedStringType) {
|
|
63838
|
+
return;
|
|
63839
|
+
}
|
|
63831
63840
|
if (inference.priority === void 0 || priority < inference.priority) {
|
|
63832
63841
|
inference.candidates = void 0;
|
|
63833
63842
|
inference.contraCandidates = void 0;
|
|
@@ -63835,7 +63844,6 @@ function createTypeChecker(host) {
|
|
|
63835
63844
|
inference.priority = priority;
|
|
63836
63845
|
}
|
|
63837
63846
|
if (priority === inference.priority) {
|
|
63838
|
-
const candidate = propagationType || source;
|
|
63839
63847
|
if (contravariant && !bivariant) {
|
|
63840
63848
|
if (!contains(inference.contraCandidates, candidate)) {
|
|
63841
63849
|
inference.contraCandidates = append(inference.contraCandidates, candidate);
|
|
@@ -64407,7 +64415,7 @@ function createTypeChecker(host) {
|
|
|
64407
64415
|
const constraint = getConstraintOfTypeParameter(inference.typeParameter);
|
|
64408
64416
|
if (constraint) {
|
|
64409
64417
|
const instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
|
|
64410
|
-
if (!inferredType ||
|
|
64418
|
+
if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
|
|
64411
64419
|
inference.inferredType = fallbackType && context.compareTypes(fallbackType, getTypeWithThisArgument(instantiatedConstraint, fallbackType)) ? fallbackType : instantiatedConstraint;
|
|
64412
64420
|
}
|
|
64413
64421
|
}
|
|
@@ -64483,10 +64491,7 @@ function createTypeChecker(host) {
|
|
|
64483
64491
|
node,
|
|
64484
64492
|
!isWriteOnlyAccess(node),
|
|
64485
64493
|
/*excludeGlobals*/
|
|
64486
|
-
false
|
|
64487
|
-
/*getSpellingSuggestions*/
|
|
64488
|
-
void 0,
|
|
64489
|
-
isWriteAccess(node)
|
|
64494
|
+
false
|
|
64490
64495
|
) || unknownSymbol;
|
|
64491
64496
|
}
|
|
64492
64497
|
return links.resolvedSymbol;
|
|
@@ -65261,7 +65266,10 @@ function createTypeChecker(host) {
|
|
|
65261
65266
|
let signature = links.effectsSignature;
|
|
65262
65267
|
if (signature === void 0) {
|
|
65263
65268
|
let funcType;
|
|
65264
|
-
if (node
|
|
65269
|
+
if (isBinaryExpression(node)) {
|
|
65270
|
+
const rightType = checkNonNullExpression(node.right);
|
|
65271
|
+
funcType = getSymbolHasInstanceMethodOfObjectType(rightType);
|
|
65272
|
+
} else if (node.parent.kind === 244 /* ExpressionStatement */) {
|
|
65265
65273
|
funcType = getTypeOfDottedName(
|
|
65266
65274
|
node.expression,
|
|
65267
65275
|
/*diagnostic*/
|
|
@@ -66285,7 +66293,22 @@ function createTypeChecker(host) {
|
|
|
66285
66293
|
}
|
|
66286
66294
|
return type;
|
|
66287
66295
|
}
|
|
66288
|
-
const
|
|
66296
|
+
const right = expr.right;
|
|
66297
|
+
const rightType = getTypeOfExpression(right);
|
|
66298
|
+
if (!isTypeDerivedFrom(rightType, globalObjectType)) {
|
|
66299
|
+
return type;
|
|
66300
|
+
}
|
|
66301
|
+
const signature = getEffectsSignature(expr);
|
|
66302
|
+
const predicate = signature && getTypePredicateOfSignature(signature);
|
|
66303
|
+
if (predicate && predicate.kind === 1 /* Identifier */ && predicate.parameterIndex === 0) {
|
|
66304
|
+
return getNarrowedType(
|
|
66305
|
+
type,
|
|
66306
|
+
predicate.type,
|
|
66307
|
+
assumeTrue,
|
|
66308
|
+
/*checkDerived*/
|
|
66309
|
+
true
|
|
66310
|
+
);
|
|
66311
|
+
}
|
|
66289
66312
|
if (!isTypeDerivedFrom(rightType, globalFunctionType)) {
|
|
66290
66313
|
return type;
|
|
66291
66314
|
}
|
|
@@ -66537,7 +66560,7 @@ function createTypeChecker(host) {
|
|
|
66537
66560
|
return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithoutNullableConstraint) : !!(type.flags & 465829888 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */));
|
|
66538
66561
|
}
|
|
66539
66562
|
function hasContextualTypeWithNoGenericTypes(node, checkMode) {
|
|
66540
|
-
const contextualType = (isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node)) && !((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode &
|
|
66563
|
+
const contextualType = (isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node)) && !((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode & 32 /* RestBindingElement */ ? getContextualType(node, 8 /* SkipBindingPatterns */) : getContextualType(
|
|
66541
66564
|
node,
|
|
66542
66565
|
/*contextFlags*/
|
|
66543
66566
|
void 0
|
|
@@ -67297,7 +67320,7 @@ function createTypeChecker(host) {
|
|
|
67297
67320
|
function getContextualTypeForBindingElement(declaration, contextFlags) {
|
|
67298
67321
|
const parent = declaration.parent.parent;
|
|
67299
67322
|
const name = declaration.propertyName || declaration.name;
|
|
67300
|
-
const parentType = getContextualTypeForVariableLikeDeclaration(parent, contextFlags) || parent.kind !== 208 /* BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ?
|
|
67323
|
+
const parentType = getContextualTypeForVariableLikeDeclaration(parent, contextFlags) || parent.kind !== 208 /* BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 32 /* RestBindingElement */ : 0 /* Normal */);
|
|
67301
67324
|
if (!parentType || isBindingPattern(name) || isComputedNonLiteralName(name))
|
|
67302
67325
|
return void 0;
|
|
67303
67326
|
if (parent.name.kind === 207 /* ArrayBindingPattern */) {
|
|
@@ -69920,8 +69943,6 @@ function createTypeChecker(host) {
|
|
|
69920
69943
|
false,
|
|
69921
69944
|
/*getSpellingSuggestions*/
|
|
69922
69945
|
true,
|
|
69923
|
-
/*isWritten*/
|
|
69924
|
-
false,
|
|
69925
69946
|
(symbols, name, meaning2) => {
|
|
69926
69947
|
Debug.assertEqual(outerName, name, "name should equal outerName");
|
|
69927
69948
|
const symbol = getSymbol(symbols, name, meaning2);
|
|
@@ -70145,7 +70166,9 @@ function createTypeChecker(host) {
|
|
|
70145
70166
|
checkExpression(node.template);
|
|
70146
70167
|
} else if (isJsxOpeningLikeElement(node)) {
|
|
70147
70168
|
checkExpression(node.attributes);
|
|
70148
|
-
} else if (node
|
|
70169
|
+
} else if (isBinaryExpression(node)) {
|
|
70170
|
+
checkExpression(node.left);
|
|
70171
|
+
} else if (isCallOrNewExpression(node)) {
|
|
70149
70172
|
forEach(node.arguments, (argument) => {
|
|
70150
70173
|
checkExpression(argument);
|
|
70151
70174
|
});
|
|
@@ -70218,6 +70241,8 @@ function createTypeChecker(host) {
|
|
|
70218
70241
|
}
|
|
70219
70242
|
} else if (node.kind === 170 /* Decorator */) {
|
|
70220
70243
|
argCount = getDecoratorArgumentCount(node, signature);
|
|
70244
|
+
} else if (node.kind === 226 /* BinaryExpression */) {
|
|
70245
|
+
argCount = 1;
|
|
70221
70246
|
} else if (isJsxOpeningLikeElement(node)) {
|
|
70222
70247
|
callIsIncomplete = node.attributes.end === node.end;
|
|
70223
70248
|
if (callIsIncomplete) {
|
|
@@ -70317,13 +70342,13 @@ function createTypeChecker(host) {
|
|
|
70317
70342
|
return voidType;
|
|
70318
70343
|
}
|
|
70319
70344
|
const thisArgumentType = checkExpression(thisArgumentNode);
|
|
70320
|
-
return isOptionalChainRoot(thisArgumentNode.parent) ? getNonNullableType(thisArgumentType) : isOptionalChain(thisArgumentNode.parent) ? removeOptionalTypeMarker(thisArgumentType) : thisArgumentType;
|
|
70345
|
+
return isRightSideOfInstanceofExpression(thisArgumentNode) ? thisArgumentType : isOptionalChainRoot(thisArgumentNode.parent) ? getNonNullableType(thisArgumentType) : isOptionalChain(thisArgumentNode.parent) ? removeOptionalTypeMarker(thisArgumentType) : thisArgumentType;
|
|
70321
70346
|
}
|
|
70322
70347
|
function inferTypeArguments(node, signature, args, checkMode, context) {
|
|
70323
70348
|
if (isJsxOpeningLikeElement(node)) {
|
|
70324
70349
|
return inferJsxTypeArguments(node, signature, checkMode, context);
|
|
70325
70350
|
}
|
|
70326
|
-
if (node.kind !== 170 /* Decorator */) {
|
|
70351
|
+
if (node.kind !== 170 /* Decorator */ && node.kind !== 226 /* BinaryExpression */) {
|
|
70327
70352
|
const skipBindingPatterns = every(signature.typeParameters, (p) => !!getDefaultFromTypeParameter(p));
|
|
70328
70353
|
const contextualType = getContextualType(node, skipBindingPatterns ? 8 /* SkipBindingPatterns */ : 0 /* None */);
|
|
70329
70354
|
if (contextualType) {
|
|
@@ -70360,7 +70385,7 @@ function createTypeChecker(host) {
|
|
|
70360
70385
|
}
|
|
70361
70386
|
for (let i = 0; i < argCount; i++) {
|
|
70362
70387
|
const arg = args[i];
|
|
70363
|
-
if (arg.kind !== 232 /* OmittedExpression */
|
|
70388
|
+
if (arg.kind !== 232 /* OmittedExpression */) {
|
|
70364
70389
|
const paramType = getTypeAtPosition(signature, i);
|
|
70365
70390
|
if (couldContainTypeVariables(paramType)) {
|
|
70366
70391
|
const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
|
|
@@ -70652,6 +70677,9 @@ function createTypeChecker(host) {
|
|
|
70652
70677
|
}
|
|
70653
70678
|
}
|
|
70654
70679
|
function getThisArgumentOfCall(node) {
|
|
70680
|
+
if (node.kind === 226 /* BinaryExpression */) {
|
|
70681
|
+
return node.right;
|
|
70682
|
+
}
|
|
70655
70683
|
const expression = node.kind === 213 /* CallExpression */ ? node.expression : node.kind === 215 /* TaggedTemplateExpression */ ? node.tag : node.kind === 170 /* Decorator */ && !legacyDecorators ? node.expression : void 0;
|
|
70656
70684
|
if (expression) {
|
|
70657
70685
|
const callee = skipOuterExpressions(expression);
|
|
@@ -70680,6 +70708,9 @@ function createTypeChecker(host) {
|
|
|
70680
70708
|
if (node.kind === 170 /* Decorator */) {
|
|
70681
70709
|
return getEffectiveDecoratorArguments(node);
|
|
70682
70710
|
}
|
|
70711
|
+
if (node.kind === 226 /* BinaryExpression */) {
|
|
70712
|
+
return [node.left];
|
|
70713
|
+
}
|
|
70683
70714
|
if (isJsxOpeningLikeElement(node)) {
|
|
70684
70715
|
return node.attributes.properties.length > 0 || isJsxOpeningElement(node) && node.parent.children.length > 0 ? [node.attributes] : emptyArray;
|
|
70685
70716
|
}
|
|
@@ -70949,9 +70980,10 @@ function createTypeChecker(host) {
|
|
|
70949
70980
|
const isTaggedTemplate = node.kind === 215 /* TaggedTemplateExpression */;
|
|
70950
70981
|
const isDecorator2 = node.kind === 170 /* Decorator */;
|
|
70951
70982
|
const isJsxOpeningOrSelfClosingElement = isJsxOpeningLikeElement(node);
|
|
70983
|
+
const isInstanceof = node.kind === 226 /* BinaryExpression */;
|
|
70952
70984
|
const reportErrors2 = !isInferencePartiallyBlocked && !candidatesOutArray;
|
|
70953
70985
|
let typeArguments;
|
|
70954
|
-
if (!isDecorator2 && !isSuperCall(node)) {
|
|
70986
|
+
if (!isDecorator2 && !isInstanceof && !isSuperCall(node)) {
|
|
70955
70987
|
typeArguments = node.typeArguments;
|
|
70956
70988
|
if (isTaggedTemplate || isJsxOpeningOrSelfClosingElement || node.expression.kind !== 108 /* SuperKeyword */) {
|
|
70957
70989
|
forEach(typeArguments, checkSourceElement);
|
|
@@ -70963,7 +70995,6 @@ function createTypeChecker(host) {
|
|
|
70963
70995
|
const args = getEffectiveCallArguments(node);
|
|
70964
70996
|
const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
|
|
70965
70997
|
let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
|
|
70966
|
-
argCheckMode |= checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
|
|
70967
70998
|
let candidatesForArgumentError;
|
|
70968
70999
|
let candidateForArgumentArityError;
|
|
70969
71000
|
let candidateForTypeArgumentError;
|
|
@@ -70981,6 +71012,9 @@ function createTypeChecker(host) {
|
|
|
70981
71012
|
result = getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray, checkMode);
|
|
70982
71013
|
getNodeLinks(node).resolvedSignature = result;
|
|
70983
71014
|
if (reportErrors2) {
|
|
71015
|
+
if (!headMessage && isInstanceof) {
|
|
71016
|
+
headMessage = Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_assignable_to_the_first_argument_of_the_right_hand_side_s_Symbol_hasInstance_method;
|
|
71017
|
+
}
|
|
70984
71018
|
if (candidatesForArgumentError) {
|
|
70985
71019
|
if (candidatesForArgumentError.length === 1 || candidatesForArgumentError.length > 3) {
|
|
70986
71020
|
const last2 = candidatesForArgumentError[candidatesForArgumentError.length - 1];
|
|
@@ -71767,6 +71801,30 @@ function createTypeChecker(host) {
|
|
|
71767
71801
|
}
|
|
71768
71802
|
return resolveCall(node, signatures, candidatesOutArray, checkMode, 0 /* None */);
|
|
71769
71803
|
}
|
|
71804
|
+
function resolveInstanceofExpression(node, candidatesOutArray, checkMode) {
|
|
71805
|
+
const rightType = checkExpression(node.right);
|
|
71806
|
+
if (!isTypeAny(rightType)) {
|
|
71807
|
+
const hasInstanceMethodType = getSymbolHasInstanceMethodOfObjectType(rightType);
|
|
71808
|
+
if (hasInstanceMethodType) {
|
|
71809
|
+
const apparentType = getApparentType(hasInstanceMethodType);
|
|
71810
|
+
if (isErrorType(apparentType)) {
|
|
71811
|
+
return resolveErrorCall(node);
|
|
71812
|
+
}
|
|
71813
|
+
const callSignatures = getSignaturesOfType(apparentType, 0 /* Call */);
|
|
71814
|
+
const constructSignatures = getSignaturesOfType(apparentType, 1 /* Construct */);
|
|
71815
|
+
if (isUntypedFunctionCall(hasInstanceMethodType, apparentType, callSignatures.length, constructSignatures.length)) {
|
|
71816
|
+
return resolveUntypedCall(node);
|
|
71817
|
+
}
|
|
71818
|
+
if (callSignatures.length) {
|
|
71819
|
+
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, 0 /* None */);
|
|
71820
|
+
}
|
|
71821
|
+
} else if (!(typeHasCallOrConstructSignatures(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
|
|
71822
|
+
error(node.right, Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_either_of_type_any_a_class_function_or_other_type_assignable_to_the_Function_interface_type_or_an_object_type_with_a_Symbol_hasInstance_method);
|
|
71823
|
+
return resolveErrorCall(node);
|
|
71824
|
+
}
|
|
71825
|
+
}
|
|
71826
|
+
return anySignature;
|
|
71827
|
+
}
|
|
71770
71828
|
function isPotentiallyUncalledDecorator(decorator, signatures) {
|
|
71771
71829
|
return signatures.length && every(signatures, (signature) => signature.minArgumentCount === 0 && !signatureHasRestParameter(signature) && signature.parameters.length < getDecoratorArgumentCount(decorator, signature));
|
|
71772
71830
|
}
|
|
@@ -71783,6 +71841,8 @@ function createTypeChecker(host) {
|
|
|
71783
71841
|
case 286 /* JsxOpeningElement */:
|
|
71784
71842
|
case 285 /* JsxSelfClosingElement */:
|
|
71785
71843
|
return resolveJsxOpeningLikeElement(node, candidatesOutArray, checkMode);
|
|
71844
|
+
case 226 /* BinaryExpression */:
|
|
71845
|
+
return resolveInstanceofExpression(node, candidatesOutArray, checkMode);
|
|
71786
71846
|
}
|
|
71787
71847
|
Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable.");
|
|
71788
71848
|
}
|
|
@@ -73741,16 +73801,35 @@ function createTypeChecker(host) {
|
|
|
73741
73801
|
function isConstEnumSymbol(symbol) {
|
|
73742
73802
|
return (symbol.flags & 128 /* ConstEnum */) !== 0;
|
|
73743
73803
|
}
|
|
73744
|
-
function
|
|
73804
|
+
function getSymbolHasInstanceMethodOfObjectType(type) {
|
|
73805
|
+
const hasInstancePropertyName = getPropertyNameForKnownSymbolName("hasInstance");
|
|
73806
|
+
const hasInstanceProperty = getPropertyOfObjectType(type, hasInstancePropertyName);
|
|
73807
|
+
if (hasInstanceProperty) {
|
|
73808
|
+
const hasInstancePropertyType = getTypeOfSymbol(hasInstanceProperty);
|
|
73809
|
+
if (hasInstancePropertyType && getSignaturesOfType(hasInstancePropertyType, 0 /* Call */).length !== 0) {
|
|
73810
|
+
return hasInstancePropertyType;
|
|
73811
|
+
}
|
|
73812
|
+
}
|
|
73813
|
+
}
|
|
73814
|
+
function checkInstanceOfExpression(left, right, leftType, rightType, checkMode) {
|
|
73745
73815
|
if (leftType === silentNeverType || rightType === silentNeverType) {
|
|
73746
73816
|
return silentNeverType;
|
|
73747
73817
|
}
|
|
73748
73818
|
if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 402784252 /* Primitive */)) {
|
|
73749
73819
|
error(left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
|
|
73750
73820
|
}
|
|
73751
|
-
|
|
73752
|
-
|
|
73821
|
+
Debug.assert(isInstanceOfExpression(left.parent));
|
|
73822
|
+
const signature = getResolvedSignature(
|
|
73823
|
+
left.parent,
|
|
73824
|
+
/*candidatesOutArray*/
|
|
73825
|
+
void 0,
|
|
73826
|
+
checkMode
|
|
73827
|
+
);
|
|
73828
|
+
if (signature === resolvingSignature) {
|
|
73829
|
+
return silentNeverType;
|
|
73753
73830
|
}
|
|
73831
|
+
const returnType = getReturnTypeOfSignature(signature);
|
|
73832
|
+
checkTypeAssignableTo(returnType, booleanType, right, Diagnostics.An_object_s_Symbol_hasInstance_method_must_return_a_boolean_value_for_it_to_be_used_on_the_right_hand_side_of_an_instanceof_expression);
|
|
73754
73833
|
return booleanType;
|
|
73755
73834
|
}
|
|
73756
73835
|
function hasEmptyObjectIntersection(type) {
|
|
@@ -74288,7 +74367,7 @@ function createTypeChecker(host) {
|
|
|
74288
74367
|
case 36 /* ExclamationEqualsToken */:
|
|
74289
74368
|
case 37 /* EqualsEqualsEqualsToken */:
|
|
74290
74369
|
case 38 /* ExclamationEqualsEqualsToken */:
|
|
74291
|
-
if (!(checkMode && checkMode &
|
|
74370
|
+
if (!(checkMode && checkMode & 64 /* TypeOnly */)) {
|
|
74292
74371
|
if ((isLiteralExpressionOfObject(left) || isLiteralExpressionOfObject(right)) && // only report for === and !== in JS, not == or !=
|
|
74293
74372
|
(!isInJSFile(left) || (operator === 37 /* EqualsEqualsEqualsToken */ || operator === 38 /* ExclamationEqualsEqualsToken */))) {
|
|
74294
74373
|
const eqType = operator === 35 /* EqualsEqualsToken */ || operator === 37 /* EqualsEqualsEqualsToken */;
|
|
@@ -74299,7 +74378,7 @@ function createTypeChecker(host) {
|
|
|
74299
74378
|
}
|
|
74300
74379
|
return booleanType;
|
|
74301
74380
|
case 104 /* InstanceOfKeyword */:
|
|
74302
|
-
return checkInstanceOfExpression(left, right, leftType, rightType);
|
|
74381
|
+
return checkInstanceOfExpression(left, right, leftType, rightType, checkMode);
|
|
74303
74382
|
case 103 /* InKeyword */:
|
|
74304
74383
|
return checkInExpression(left, right, leftType, rightType);
|
|
74305
74384
|
case 56 /* AmpersandAmpersandToken */:
|
|
@@ -74936,7 +75015,7 @@ function createTypeChecker(host) {
|
|
|
74936
75015
|
}
|
|
74937
75016
|
}
|
|
74938
75017
|
const startInvocationCount = flowInvocationCount;
|
|
74939
|
-
const type = checkExpression(node,
|
|
75018
|
+
const type = checkExpression(node, 64 /* TypeOnly */);
|
|
74940
75019
|
if (flowInvocationCount !== startInvocationCount) {
|
|
74941
75020
|
const cache = flowTypeCache || (flowTypeCache = []);
|
|
74942
75021
|
cache[getNodeId(node)] = type;
|
|
@@ -75376,7 +75455,7 @@ function createTypeChecker(host) {
|
|
|
75376
75455
|
}
|
|
75377
75456
|
}
|
|
75378
75457
|
if (node.kind !== 181 /* IndexSignature */ && node.kind !== 324 /* JSDocFunctionType */) {
|
|
75379
|
-
|
|
75458
|
+
registerForUnusedIdentifiersCheck(node);
|
|
75380
75459
|
}
|
|
75381
75460
|
}
|
|
75382
75461
|
}
|
|
@@ -75921,7 +76000,7 @@ function createTypeChecker(host) {
|
|
|
75921
76000
|
}
|
|
75922
76001
|
}
|
|
75923
76002
|
}
|
|
75924
|
-
|
|
76003
|
+
registerForUnusedIdentifiersCheck(node);
|
|
75925
76004
|
}
|
|
75926
76005
|
function checkTemplateLiteralType(node) {
|
|
75927
76006
|
for (const span of node.templateSpans) {
|
|
@@ -76907,27 +76986,25 @@ function createTypeChecker(host) {
|
|
|
76907
76986
|
}
|
|
76908
76987
|
}
|
|
76909
76988
|
}
|
|
76910
|
-
function
|
|
76911
|
-
addLazyDiagnostic(
|
|
76912
|
-
function
|
|
76989
|
+
function registerForUnusedIdentifiersCheck(node) {
|
|
76990
|
+
addLazyDiagnostic(registerForUnusedIdentifiersCheckDiagnostics);
|
|
76991
|
+
function registerForUnusedIdentifiersCheckDiagnostics() {
|
|
76913
76992
|
const sourceFile = getSourceFileOfNode(node);
|
|
76914
|
-
let
|
|
76915
|
-
if (!
|
|
76916
|
-
|
|
76917
|
-
|
|
76993
|
+
let potentiallyUnusedIdentifiers = allPotentiallyUnusedIdentifiers.get(sourceFile.path);
|
|
76994
|
+
if (!potentiallyUnusedIdentifiers) {
|
|
76995
|
+
potentiallyUnusedIdentifiers = [];
|
|
76996
|
+
allPotentiallyUnusedIdentifiers.set(sourceFile.path, potentiallyUnusedIdentifiers);
|
|
76918
76997
|
}
|
|
76919
|
-
|
|
76998
|
+
potentiallyUnusedIdentifiers.push(node);
|
|
76920
76999
|
}
|
|
76921
77000
|
}
|
|
76922
|
-
function
|
|
77001
|
+
function checkUnusedIdentifiers(potentiallyUnusedIdentifiers, addDiagnostic) {
|
|
76923
77002
|
for (const node of potentiallyUnusedIdentifiers) {
|
|
76924
77003
|
switch (node.kind) {
|
|
76925
77004
|
case 263 /* ClassDeclaration */:
|
|
76926
77005
|
case 231 /* ClassExpression */:
|
|
76927
|
-
|
|
76928
|
-
|
|
76929
|
-
checkUnusedTypeParameters(node, addDiagnostic);
|
|
76930
|
-
}
|
|
77006
|
+
checkUnusedClassMembers(node, addDiagnostic);
|
|
77007
|
+
checkUnusedTypeParameters(node, addDiagnostic);
|
|
76931
77008
|
break;
|
|
76932
77009
|
case 312 /* SourceFile */:
|
|
76933
77010
|
case 267 /* ModuleDeclaration */:
|
|
@@ -76936,12 +77013,7 @@ function createTypeChecker(host) {
|
|
|
76936
77013
|
case 248 /* ForStatement */:
|
|
76937
77014
|
case 249 /* ForInStatement */:
|
|
76938
77015
|
case 250 /* ForOfStatement */:
|
|
76939
|
-
|
|
76940
|
-
checkUnusedLocalsAndParameters(node, addDiagnostic);
|
|
76941
|
-
}
|
|
76942
|
-
if (checkUninitialized) {
|
|
76943
|
-
checkUninitializedLocals(node);
|
|
76944
|
-
}
|
|
77016
|
+
checkUnusedLocalsAndParameters(node, addDiagnostic);
|
|
76945
77017
|
break;
|
|
76946
77018
|
case 176 /* Constructor */:
|
|
76947
77019
|
case 218 /* FunctionExpression */:
|
|
@@ -76950,15 +77022,10 @@ function createTypeChecker(host) {
|
|
|
76950
77022
|
case 174 /* MethodDeclaration */:
|
|
76951
77023
|
case 177 /* GetAccessor */:
|
|
76952
77024
|
case 178 /* SetAccessor */:
|
|
76953
|
-
if (
|
|
76954
|
-
|
|
76955
|
-
checkUnusedLocalsAndParameters(node, addDiagnostic);
|
|
76956
|
-
}
|
|
76957
|
-
checkUnusedTypeParameters(node, addDiagnostic);
|
|
76958
|
-
}
|
|
76959
|
-
if (checkUninitialized) {
|
|
76960
|
-
checkUninitializedLocals(node);
|
|
77025
|
+
if (node.body) {
|
|
77026
|
+
checkUnusedLocalsAndParameters(node, addDiagnostic);
|
|
76961
77027
|
}
|
|
77028
|
+
checkUnusedTypeParameters(node, addDiagnostic);
|
|
76962
77029
|
break;
|
|
76963
77030
|
case 173 /* MethodSignature */:
|
|
76964
77031
|
case 179 /* CallSignature */:
|
|
@@ -76967,14 +77034,10 @@ function createTypeChecker(host) {
|
|
|
76967
77034
|
case 185 /* ConstructorType */:
|
|
76968
77035
|
case 265 /* TypeAliasDeclaration */:
|
|
76969
77036
|
case 264 /* InterfaceDeclaration */:
|
|
76970
|
-
|
|
76971
|
-
checkUnusedTypeParameters(node, addDiagnostic);
|
|
76972
|
-
}
|
|
77037
|
+
checkUnusedTypeParameters(node, addDiagnostic);
|
|
76973
77038
|
break;
|
|
76974
77039
|
case 195 /* InferType */:
|
|
76975
|
-
|
|
76976
|
-
checkUnusedInferTypeParameter(node, addDiagnostic);
|
|
76977
|
-
}
|
|
77040
|
+
checkUnusedInferTypeParameter(node, addDiagnostic);
|
|
76978
77041
|
break;
|
|
76979
77042
|
default:
|
|
76980
77043
|
Debug.assertNever(node, "Node should not have been registered for unused identifiers check");
|
|
@@ -77164,26 +77227,6 @@ function createTypeChecker(host) {
|
|
|
77164
77227
|
}
|
|
77165
77228
|
});
|
|
77166
77229
|
}
|
|
77167
|
-
function checkUninitializedLocals(nodeWithLocals) {
|
|
77168
|
-
nodeWithLocals.locals.forEach((local) => {
|
|
77169
|
-
if (!(local.flags & 3 /* Variable */) || local.isAssigned || !local.isReferenced) {
|
|
77170
|
-
return;
|
|
77171
|
-
}
|
|
77172
|
-
const declaration = local.valueDeclaration;
|
|
77173
|
-
if (!declaration) {
|
|
77174
|
-
return;
|
|
77175
|
-
}
|
|
77176
|
-
if (isVariableDeclaration(declaration)) {
|
|
77177
|
-
if (getCombinedNodeFlagsCached(declaration) & 33554432 /* Ambient */ || declaration.exclamationToken || declaration.initializer || !declaration.type) {
|
|
77178
|
-
return;
|
|
77179
|
-
}
|
|
77180
|
-
const type = getTypeFromTypeNode(declaration.type);
|
|
77181
|
-
if (!(type.flags & 3 /* AnyOrUnknown */) && !containsUndefinedType(type)) {
|
|
77182
|
-
error(declaration, Diagnostics.Variable_0_is_used_before_being_assigned, idText(declaration.name));
|
|
77183
|
-
}
|
|
77184
|
-
}
|
|
77185
|
-
});
|
|
77186
|
-
}
|
|
77187
77230
|
function checkPotentialUncheckedRenamedBindingElementsInTypes() {
|
|
77188
77231
|
var _a;
|
|
77189
77232
|
for (const node of potentialUnusedRenamedBindingElementsInTypes) {
|
|
@@ -77230,7 +77273,7 @@ function createTypeChecker(host) {
|
|
|
77230
77273
|
forEach(node.statements, checkSourceElement);
|
|
77231
77274
|
}
|
|
77232
77275
|
if (node.locals) {
|
|
77233
|
-
|
|
77276
|
+
registerForUnusedIdentifiersCheck(node);
|
|
77234
77277
|
}
|
|
77235
77278
|
}
|
|
77236
77279
|
function checkCollisionWithArgumentsInGeneratedCode(node) {
|
|
@@ -77438,7 +77481,7 @@ function createTypeChecker(host) {
|
|
|
77438
77481
|
checkComputedPropertyName(node.propertyName);
|
|
77439
77482
|
}
|
|
77440
77483
|
const parent = node.parent.parent;
|
|
77441
|
-
const parentCheckMode = node.dotDotDotToken ?
|
|
77484
|
+
const parentCheckMode = node.dotDotDotToken ? 32 /* RestBindingElement */ : 0 /* Normal */;
|
|
77442
77485
|
const parentType = getTypeForBindingElementParent(parent, parentCheckMode);
|
|
77443
77486
|
const name = node.propertyName || node.name;
|
|
77444
77487
|
if (parentType && !isBindingPattern(name)) {
|
|
@@ -77780,7 +77823,7 @@ function createTypeChecker(host) {
|
|
|
77780
77823
|
checkExpression(node.incrementor);
|
|
77781
77824
|
checkSourceElement(node.statement);
|
|
77782
77825
|
if (node.locals) {
|
|
77783
|
-
|
|
77826
|
+
registerForUnusedIdentifiersCheck(node);
|
|
77784
77827
|
}
|
|
77785
77828
|
}
|
|
77786
77829
|
function checkForOfStatement(node) {
|
|
@@ -77819,7 +77862,7 @@ function createTypeChecker(host) {
|
|
|
77819
77862
|
}
|
|
77820
77863
|
checkSourceElement(node.statement);
|
|
77821
77864
|
if (node.locals) {
|
|
77822
|
-
|
|
77865
|
+
registerForUnusedIdentifiersCheck(node);
|
|
77823
77866
|
}
|
|
77824
77867
|
}
|
|
77825
77868
|
function checkForInStatement(node) {
|
|
@@ -77851,7 +77894,7 @@ function createTypeChecker(host) {
|
|
|
77851
77894
|
}
|
|
77852
77895
|
checkSourceElement(node.statement);
|
|
77853
77896
|
if (node.locals) {
|
|
77854
|
-
|
|
77897
|
+
registerForUnusedIdentifiersCheck(node);
|
|
77855
77898
|
}
|
|
77856
77899
|
}
|
|
77857
77900
|
function checkRightHandSideOfForOf(statement) {
|
|
@@ -78583,7 +78626,7 @@ function createTypeChecker(host) {
|
|
|
78583
78626
|
}
|
|
78584
78627
|
});
|
|
78585
78628
|
if (node.caseBlock.locals) {
|
|
78586
|
-
|
|
78629
|
+
registerForUnusedIdentifiersCheck(node.caseBlock);
|
|
78587
78630
|
}
|
|
78588
78631
|
}
|
|
78589
78632
|
function checkLabeledStatement(node) {
|
|
@@ -78923,7 +78966,7 @@ function createTypeChecker(host) {
|
|
|
78923
78966
|
}
|
|
78924
78967
|
function checkClassExpressionDeferred(node) {
|
|
78925
78968
|
forEach(node.members, checkSourceElement);
|
|
78926
|
-
|
|
78969
|
+
registerForUnusedIdentifiersCheck(node);
|
|
78927
78970
|
}
|
|
78928
78971
|
function checkClassDeclaration(node) {
|
|
78929
78972
|
const firstDecorator = find(node.modifiers, isDecorator);
|
|
@@ -78935,7 +78978,7 @@ function createTypeChecker(host) {
|
|
|
78935
78978
|
}
|
|
78936
78979
|
checkClassLikeDeclaration(node);
|
|
78937
78980
|
forEach(node.members, checkSourceElement);
|
|
78938
|
-
|
|
78981
|
+
registerForUnusedIdentifiersCheck(node);
|
|
78939
78982
|
}
|
|
78940
78983
|
function checkClassLikeDeclaration(node) {
|
|
78941
78984
|
checkGrammarClassLikeDeclaration(node);
|
|
@@ -79496,7 +79539,7 @@ function createTypeChecker(host) {
|
|
|
79496
79539
|
forEach(node.members, checkSourceElement);
|
|
79497
79540
|
addLazyDiagnostic(() => {
|
|
79498
79541
|
checkTypeForDuplicateIndexSignatures(node);
|
|
79499
|
-
|
|
79542
|
+
registerForUnusedIdentifiersCheck(node);
|
|
79500
79543
|
});
|
|
79501
79544
|
}
|
|
79502
79545
|
function checkTypeAliasDeclaration(node) {
|
|
@@ -79510,7 +79553,7 @@ function createTypeChecker(host) {
|
|
|
79510
79553
|
}
|
|
79511
79554
|
} else {
|
|
79512
79555
|
checkSourceElement(node.type);
|
|
79513
|
-
|
|
79556
|
+
registerForUnusedIdentifiersCheck(node);
|
|
79514
79557
|
}
|
|
79515
79558
|
}
|
|
79516
79559
|
function computeEnumMemberValues(node) {
|
|
@@ -79781,7 +79824,7 @@ function createTypeChecker(host) {
|
|
|
79781
79824
|
if (node.body) {
|
|
79782
79825
|
checkSourceElement(node.body);
|
|
79783
79826
|
if (!isGlobalScopeAugmentation(node)) {
|
|
79784
|
-
|
|
79827
|
+
registerForUnusedIdentifiersCheck(node);
|
|
79785
79828
|
}
|
|
79786
79829
|
}
|
|
79787
79830
|
addLazyDiagnostic(checkModuleDeclarationDiagnostics);
|
|
@@ -80747,6 +80790,12 @@ function createTypeChecker(host) {
|
|
|
80747
80790
|
case 234 /* AsExpression */:
|
|
80748
80791
|
case 217 /* ParenthesizedExpression */:
|
|
80749
80792
|
checkAssertionDeferred(node);
|
|
80793
|
+
break;
|
|
80794
|
+
case 226 /* BinaryExpression */:
|
|
80795
|
+
if (isInstanceOfExpression(node)) {
|
|
80796
|
+
resolveUntypedCall(node);
|
|
80797
|
+
}
|
|
80798
|
+
break;
|
|
80750
80799
|
}
|
|
80751
80800
|
currentNode = saveCurrentNode;
|
|
80752
80801
|
(_b = tracing) == null ? void 0 : _b.pop();
|
|
@@ -80779,8 +80828,8 @@ function createTypeChecker(host) {
|
|
|
80779
80828
|
return Debug.assertNever(kind);
|
|
80780
80829
|
}
|
|
80781
80830
|
}
|
|
80782
|
-
function
|
|
80783
|
-
return
|
|
80831
|
+
function getPotentiallyUnusedIdentifiers(sourceFile) {
|
|
80832
|
+
return allPotentiallyUnusedIdentifiers.get(sourceFile.path) || emptyArray;
|
|
80784
80833
|
}
|
|
80785
80834
|
function checkSourceFileWorker(node) {
|
|
80786
80835
|
const links = getNodeLinks(node);
|
|
@@ -80798,21 +80847,15 @@ function createTypeChecker(host) {
|
|
|
80798
80847
|
checkSourceElement(node.endOfFileToken);
|
|
80799
80848
|
checkDeferredNodes(node);
|
|
80800
80849
|
if (isExternalOrCommonJsModule(node)) {
|
|
80801
|
-
|
|
80850
|
+
registerForUnusedIdentifiersCheck(node);
|
|
80802
80851
|
}
|
|
80803
80852
|
addLazyDiagnostic(() => {
|
|
80804
|
-
|
|
80805
|
-
|
|
80806
|
-
|
|
80807
|
-
|
|
80808
|
-
|
|
80809
|
-
|
|
80810
|
-
diagnostics.add(diag2);
|
|
80811
|
-
}
|
|
80812
|
-
},
|
|
80813
|
-
checkUnused,
|
|
80814
|
-
strictNullChecks
|
|
80815
|
-
);
|
|
80853
|
+
if (!node.isDeclarationFile && (compilerOptions.noUnusedLocals || compilerOptions.noUnusedParameters)) {
|
|
80854
|
+
checkUnusedIdentifiers(getPotentiallyUnusedIdentifiers(node), (containingNode, kind, diag2) => {
|
|
80855
|
+
if (!containsParseError(containingNode) && unusedIsError(kind, !!(containingNode.flags & 33554432 /* Ambient */))) {
|
|
80856
|
+
diagnostics.add(diag2);
|
|
80857
|
+
}
|
|
80858
|
+
});
|
|
80816
80859
|
}
|
|
80817
80860
|
if (!node.isDeclarationFile) {
|
|
80818
80861
|
checkPotentialUncheckedRenamedBindingElementsInTypes();
|
|
@@ -81369,6 +81412,13 @@ function createTypeChecker(host) {
|
|
|
81369
81412
|
case 102 /* ImportKeyword */:
|
|
81370
81413
|
case 105 /* NewKeyword */:
|
|
81371
81414
|
return isMetaProperty(node.parent) ? checkMetaPropertyKeyword(node.parent).symbol : void 0;
|
|
81415
|
+
case 104 /* InstanceOfKeyword */:
|
|
81416
|
+
if (isBinaryExpression(node.parent)) {
|
|
81417
|
+
const type = getTypeOfExpression(node.parent.right);
|
|
81418
|
+
const hasInstanceMethodType = getSymbolHasInstanceMethodOfObjectType(type);
|
|
81419
|
+
return (hasInstanceMethodType == null ? void 0 : hasInstanceMethodType.symbol) ?? type.symbol;
|
|
81420
|
+
}
|
|
81421
|
+
return void 0;
|
|
81372
81422
|
case 236 /* MetaProperty */:
|
|
81373
81423
|
return checkExpression(node).symbol;
|
|
81374
81424
|
case 295 /* JsxNamespacedName */:
|