@typescript-deploys/pr-build 5.2.0-pr-55052-3 → 5.2.0-pr-52095-16
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 +174 -170
- package/lib/tsserver.js +343 -231
- package/lib/tsserverlibrary.d.ts +14 -3
- package/lib/tsserverlibrary.js +342 -232
- package/lib/typescript.d.ts +8 -2
- package/lib/typescript.js +324 -228
- package/lib/typingsInstaller.js +13 -9
- 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.2";
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20230725`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -3762,7 +3762,8 @@ var SignatureFlags = /* @__PURE__ */ ((SignatureFlags4) => {
|
|
|
3762
3762
|
SignatureFlags4[SignatureFlags4["IsOuterCallChain"] = 16] = "IsOuterCallChain";
|
|
3763
3763
|
SignatureFlags4[SignatureFlags4["IsUntypedSignatureInJSFile"] = 32] = "IsUntypedSignatureInJSFile";
|
|
3764
3764
|
SignatureFlags4[SignatureFlags4["IsNonInferrable"] = 64] = "IsNonInferrable";
|
|
3765
|
-
SignatureFlags4[SignatureFlags4["
|
|
3765
|
+
SignatureFlags4[SignatureFlags4["IsSignatureCandidateForOverloadFailure"] = 128] = "IsSignatureCandidateForOverloadFailure";
|
|
3766
|
+
SignatureFlags4[SignatureFlags4["PropagatingFlags"] = 167] = "PropagatingFlags";
|
|
3766
3767
|
SignatureFlags4[SignatureFlags4["CallChainFlags"] = 24] = "CallChainFlags";
|
|
3767
3768
|
return SignatureFlags4;
|
|
3768
3769
|
})(SignatureFlags || {});
|
|
@@ -6668,9 +6669,6 @@ var Diagnostics = {
|
|
|
6668
6669
|
await_using_statements_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(2852, 1 /* Error */, "await_using_statements_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_2852", "'await using' statements are only allowed within async functions and at the top levels of modules."),
|
|
6669
6670
|
await_using_statements_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module: diag(2853, 1 /* Error */, "await_using_statements_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_th_2853", "'await using' statements are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."),
|
|
6670
6671
|
Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher: diag(2854, 1 /* Error */, "Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_sys_2854", "Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher."),
|
|
6671
|
-
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(2855, 1 /* Error */, "The_left_hand_side_of_an_instanceof_expression_must_be_assignable_to_the_first_argument_of_the_right_2855", "The left-hand side of an 'instanceof' expression must be assignable to the first argument of the right-hand side's '[Symbol.hasInstance]' method."),
|
|
6672
|
-
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(2856, 1 /* Error */, "An_object_s_Symbol_hasInstance_method_must_return_a_boolean_value_for_it_to_be_used_on_the_right_han_2856", "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."),
|
|
6673
|
-
The_right_hand_side_of_an_instanceof_expression_must_be_either_of_type_any_an_object_type_with_a_Symbol_hasInstance_method_or_a_type_assignable_to_the_Function_interface_type: diag(2857, 1 /* Error */, "The_right_hand_side_of_an_instanceof_expression_must_be_either_of_type_any_an_object_type_with_a_Sym_2857", "The right-hand side of an 'instanceof' expression must be either of type 'any', an object type with a '[Symbol.hasInstance]()' method, or a type assignable to the 'Function' interface type."),
|
|
6674
6672
|
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}'."),
|
|
6675
6673
|
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}'."),
|
|
6676
6674
|
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}'."),
|
|
@@ -10994,7 +10992,6 @@ function isLeftHandSideExpressionKind(kind) {
|
|
|
10994
10992
|
case 236 /* MetaProperty */:
|
|
10995
10993
|
case 102 /* ImportKeyword */:
|
|
10996
10994
|
case 282 /* MissingDeclaration */:
|
|
10997
|
-
case 237 /* SyntheticExpression */:
|
|
10998
10995
|
return true;
|
|
10999
10996
|
default:
|
|
11000
10997
|
return false;
|
|
@@ -17407,6 +17404,18 @@ function getTextOfJsxNamespacedName(node) {
|
|
|
17407
17404
|
function intrinsicTagNameToString(node) {
|
|
17408
17405
|
return isIdentifier(node) ? idText(node) : getTextOfJsxNamespacedName(node);
|
|
17409
17406
|
}
|
|
17407
|
+
function isTypeUsableAsPropertyName(type) {
|
|
17408
|
+
return !!(type.flags & 8576 /* StringOrNumberLiteralOrUnique */);
|
|
17409
|
+
}
|
|
17410
|
+
function getPropertyNameFromType(type) {
|
|
17411
|
+
if (type.flags & 8192 /* UniqueESSymbol */) {
|
|
17412
|
+
return type.escapedName;
|
|
17413
|
+
}
|
|
17414
|
+
if (type.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */)) {
|
|
17415
|
+
return escapeLeadingUnderscores("" + type.value);
|
|
17416
|
+
}
|
|
17417
|
+
return Debug.fail();
|
|
17418
|
+
}
|
|
17410
17419
|
|
|
17411
17420
|
// src/compiler/factory/baseNodeFactory.ts
|
|
17412
17421
|
function createBaseNodeFactory() {
|
|
@@ -24275,9 +24284,6 @@ function isNonNullExpression(node) {
|
|
|
24275
24284
|
function isMetaProperty(node) {
|
|
24276
24285
|
return node.kind === 236 /* MetaProperty */;
|
|
24277
24286
|
}
|
|
24278
|
-
function isSyntheticExpression(node) {
|
|
24279
|
-
return node.kind === 237 /* SyntheticExpression */;
|
|
24280
|
-
}
|
|
24281
24287
|
function isPartiallyEmittedExpression(node) {
|
|
24282
24288
|
return node.kind === 360 /* PartiallyEmittedExpression */;
|
|
24283
24289
|
}
|
|
@@ -30717,10 +30723,14 @@ var Parser;
|
|
|
30717
30723
|
case 124 /* ProtectedKeyword */:
|
|
30718
30724
|
case 125 /* PublicKeyword */:
|
|
30719
30725
|
case 148 /* ReadonlyKeyword */:
|
|
30726
|
+
const previousToken = token();
|
|
30720
30727
|
nextToken();
|
|
30721
30728
|
if (scanner.hasPrecedingLineBreak()) {
|
|
30722
30729
|
return false;
|
|
30723
30730
|
}
|
|
30731
|
+
if (previousToken === 138 /* DeclareKeyword */ && token() === 156 /* TypeKeyword */) {
|
|
30732
|
+
return true;
|
|
30733
|
+
}
|
|
30724
30734
|
continue;
|
|
30725
30735
|
case 162 /* GlobalKeyword */:
|
|
30726
30736
|
nextToken();
|
|
@@ -31085,14 +31095,14 @@ var Parser;
|
|
|
31085
31095
|
function parseObjectBindingPattern() {
|
|
31086
31096
|
const pos = getNodePos();
|
|
31087
31097
|
parseExpected(19 /* OpenBraceToken */);
|
|
31088
|
-
const elements = parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement);
|
|
31098
|
+
const elements = allowInAnd(() => parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement));
|
|
31089
31099
|
parseExpected(20 /* CloseBraceToken */);
|
|
31090
31100
|
return finishNode(factory2.createObjectBindingPattern(elements), pos);
|
|
31091
31101
|
}
|
|
31092
31102
|
function parseArrayBindingPattern() {
|
|
31093
31103
|
const pos = getNodePos();
|
|
31094
31104
|
parseExpected(23 /* OpenBracketToken */);
|
|
31095
|
-
const elements = parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement);
|
|
31105
|
+
const elements = allowInAnd(() => parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement));
|
|
31096
31106
|
parseExpected(24 /* CloseBracketToken */);
|
|
31097
31107
|
return finishNode(factory2.createArrayBindingPattern(elements), pos);
|
|
31098
31108
|
}
|
|
@@ -31610,6 +31620,9 @@ var Parser;
|
|
|
31610
31620
|
}
|
|
31611
31621
|
function parseTypeAliasDeclaration(pos, hasJSDoc, modifiers) {
|
|
31612
31622
|
parseExpected(156 /* TypeKeyword */);
|
|
31623
|
+
if (scanner.hasPrecedingLineBreak()) {
|
|
31624
|
+
parseErrorAtCurrentToken(Diagnostics.Line_break_not_permitted_here);
|
|
31625
|
+
}
|
|
31613
31626
|
const name = parseIdentifier();
|
|
31614
31627
|
const typeParameters = parseTypeParameters();
|
|
31615
31628
|
parseExpected(64 /* EqualsToken */);
|
|
@@ -33511,7 +33524,7 @@ function getNamedArgRegEx(name) {
|
|
|
33511
33524
|
return result;
|
|
33512
33525
|
}
|
|
33513
33526
|
var tripleSlashXMLCommentStartRegEx = /^\/\/\/\s*<(\S+)\s.*?\/>/im;
|
|
33514
|
-
var singleLinePragmaRegEx = /^\/\/\/?\s*@(
|
|
33527
|
+
var singleLinePragmaRegEx = /^\/\/\/?\s*@([^\s:]+)(.*)\s*$/im;
|
|
33515
33528
|
function extractPragmas(pragmas, range, text) {
|
|
33516
33529
|
const tripleSlash = range.kind === 2 /* SingleLineCommentTrivia */ && tripleSlashXMLCommentStartRegEx.exec(text);
|
|
33517
33530
|
if (tripleSlash) {
|
|
@@ -39229,6 +39242,9 @@ function getModuleInstanceStateForAliasTarget(specifier, visited) {
|
|
|
39229
39242
|
if (found === 1 /* Instantiated */) {
|
|
39230
39243
|
return found;
|
|
39231
39244
|
}
|
|
39245
|
+
if (statement.kind === 271 /* ImportEqualsDeclaration */) {
|
|
39246
|
+
found = 1 /* Instantiated */;
|
|
39247
|
+
}
|
|
39232
39248
|
}
|
|
39233
39249
|
}
|
|
39234
39250
|
if (found !== void 0) {
|
|
@@ -43117,7 +43133,7 @@ function createTypeChecker(host) {
|
|
|
43117
43133
|
return node ? getTypeFromTypeNode(node) : errorType;
|
|
43118
43134
|
},
|
|
43119
43135
|
getParameterType: getTypeAtPosition,
|
|
43120
|
-
|
|
43136
|
+
getParameterIdentifierInfoAtPosition,
|
|
43121
43137
|
getPromisedTypeOfPromise,
|
|
43122
43138
|
getAwaitedType: (type) => getAwaitedType(type),
|
|
43123
43139
|
getReturnTypeOfSignature,
|
|
@@ -43870,7 +43886,6 @@ function createTypeChecker(host) {
|
|
|
43870
43886
|
var potentialReflectCollisions = [];
|
|
43871
43887
|
var potentialUnusedRenamedBindingElementsInTypes = [];
|
|
43872
43888
|
var awaitedTypeStack = [];
|
|
43873
|
-
var hasGlobalSymbolHasInstanceProperty;
|
|
43874
43889
|
var diagnostics = createDiagnosticCollection();
|
|
43875
43890
|
var suggestionDiagnostics = createDiagnosticCollection();
|
|
43876
43891
|
var typeofType = createTypeofType();
|
|
@@ -44559,7 +44574,7 @@ function createTypeChecker(host) {
|
|
|
44559
44574
|
if (name === "const" && isConstAssertion(location)) {
|
|
44560
44575
|
return void 0;
|
|
44561
44576
|
}
|
|
44562
|
-
if (
|
|
44577
|
+
if (isModuleOrEnumDeclaration(location) && lastLocation && location.name === lastLocation) {
|
|
44563
44578
|
lastLocation = location;
|
|
44564
44579
|
location = location.parent;
|
|
44565
44580
|
}
|
|
@@ -46175,7 +46190,7 @@ function createTypeChecker(host) {
|
|
|
46175
46190
|
return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, moduleReferenceExpression, isForAugmentation) : void 0;
|
|
46176
46191
|
}
|
|
46177
46192
|
function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation = false) {
|
|
46178
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
46193
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
46179
46194
|
if (startsWith(moduleReference, "@types/")) {
|
|
46180
46195
|
const diag2 = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
|
|
46181
46196
|
const withoutAtTypePrefix = removePrefix(moduleReference, "@types/");
|
|
@@ -46210,8 +46225,11 @@ function createTypeChecker(host) {
|
|
|
46210
46225
|
);
|
|
46211
46226
|
}
|
|
46212
46227
|
} else if (resolvedModule.resolvedUsingTsExtension && !shouldAllowImportingTsExtension(compilerOptions, currentSourceFile.fileName)) {
|
|
46213
|
-
const
|
|
46214
|
-
|
|
46228
|
+
const importOrExport = ((_h = findAncestor(location, isImportDeclaration)) == null ? void 0 : _h.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
|
|
46229
|
+
if (!((importOrExport == null ? void 0 : importOrExport.isTypeOnly) || findAncestor(location, isImportTypeNode))) {
|
|
46230
|
+
const tsExtension = Debug.checkDefined(tryExtractTSExtension(moduleReference));
|
|
46231
|
+
error(errorNode, Diagnostics.An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled, tsExtension);
|
|
46232
|
+
}
|
|
46215
46233
|
}
|
|
46216
46234
|
if (sourceFile.symbol) {
|
|
46217
46235
|
if (resolvedModule.isExternalLibraryImport && !resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
|
|
@@ -46228,7 +46246,7 @@ function createTypeChecker(host) {
|
|
|
46228
46246
|
if (moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */) {
|
|
46229
46247
|
const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
|
|
46230
46248
|
const overrideClauseHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
|
|
46231
|
-
const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (
|
|
46249
|
+
const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (_i = overrideClauseHost.assertions) == null ? void 0 : _i.assertClause : overrideClauseHost == null ? void 0 : overrideClauseHost.assertClause;
|
|
46232
46250
|
if (isSyncImport && sourceFile.impliedNodeFormat === 99 /* ESNext */ && !getResolutionModeOverrideForClause(overrideClause)) {
|
|
46233
46251
|
if (findAncestor(location, isImportEqualsDeclaration)) {
|
|
46234
46252
|
error(errorNode, Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_with_require_Use_an_ECMAScript_import_instead, moduleReference);
|
|
@@ -46331,7 +46349,7 @@ function createTypeChecker(host) {
|
|
|
46331
46349
|
error(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
46332
46350
|
} else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
|
|
46333
46351
|
const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
|
|
46334
|
-
const suggestedExt = (
|
|
46352
|
+
const suggestedExt = (_j = suggestedExtensions.find(([actualExt, _importExt]) => host.fileExists(absoluteRef + actualExt))) == null ? void 0 : _j[1];
|
|
46335
46353
|
if (suggestedExt) {
|
|
46336
46354
|
error(
|
|
46337
46355
|
errorNode,
|
|
@@ -47767,11 +47785,13 @@ function createTypeChecker(host) {
|
|
|
47767
47785
|
return !!type2.target && isMappedTypeHomomorphic(type2.target) && !isMappedTypeHomomorphic(type2);
|
|
47768
47786
|
}
|
|
47769
47787
|
function createMappedTypeNodeFromType(type2) {
|
|
47788
|
+
var _a2;
|
|
47770
47789
|
Debug.assert(!!(type2.flags & 524288 /* Object */));
|
|
47771
47790
|
const readonlyToken = type2.declaration.readonlyToken ? factory.createToken(type2.declaration.readonlyToken.kind) : void 0;
|
|
47772
47791
|
const questionToken = type2.declaration.questionToken ? factory.createToken(type2.declaration.questionToken.kind) : void 0;
|
|
47773
47792
|
let appropriateConstraintTypeNode;
|
|
47774
47793
|
let newTypeVariable;
|
|
47794
|
+
const needsModifierPreservingWrapper = !isMappedTypeWithKeyofConstraintDeclaration(type2) && !(getModifiersTypeFromMappedType(type2).flags & 2 /* Unknown */) && context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && !(getConstraintTypeFromMappedType(type2).flags & 262144 /* TypeParameter */ && ((_a2 = getConstraintOfTypeParameter(getConstraintTypeFromMappedType(type2))) == null ? void 0 : _a2.flags) & 4194304 /* Index */);
|
|
47775
47795
|
if (isMappedTypeWithKeyofConstraintDeclaration(type2)) {
|
|
47776
47796
|
if (isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type2) && context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
|
|
47777
47797
|
const newParam = createTypeParameter(createSymbol(262144 /* TypeParameter */, "T"));
|
|
@@ -47779,6 +47799,11 @@ function createTypeChecker(host) {
|
|
|
47779
47799
|
newTypeVariable = factory.createTypeReferenceNode(name);
|
|
47780
47800
|
}
|
|
47781
47801
|
appropriateConstraintTypeNode = factory.createTypeOperatorNode(143 /* KeyOfKeyword */, newTypeVariable || typeToTypeNodeHelper(getModifiersTypeFromMappedType(type2), context));
|
|
47802
|
+
} else if (needsModifierPreservingWrapper) {
|
|
47803
|
+
const newParam = createTypeParameter(createSymbol(262144 /* TypeParameter */, "T"));
|
|
47804
|
+
const name = typeParameterToName(newParam, context);
|
|
47805
|
+
newTypeVariable = factory.createTypeReferenceNode(name);
|
|
47806
|
+
appropriateConstraintTypeNode = newTypeVariable;
|
|
47782
47807
|
} else {
|
|
47783
47808
|
appropriateConstraintTypeNode = typeToTypeNodeHelper(getConstraintTypeFromMappedType(type2), context);
|
|
47784
47809
|
}
|
|
@@ -47809,6 +47834,18 @@ function createTypeChecker(host) {
|
|
|
47809
47834
|
result,
|
|
47810
47835
|
factory.createKeywordTypeNode(146 /* NeverKeyword */)
|
|
47811
47836
|
);
|
|
47837
|
+
} else if (needsModifierPreservingWrapper) {
|
|
47838
|
+
return factory.createConditionalTypeNode(
|
|
47839
|
+
typeToTypeNodeHelper(getConstraintTypeFromMappedType(type2), context),
|
|
47840
|
+
factory.createInferTypeNode(factory.createTypeParameterDeclaration(
|
|
47841
|
+
/*modifiers*/
|
|
47842
|
+
void 0,
|
|
47843
|
+
factory.cloneNode(newTypeVariable.typeName),
|
|
47844
|
+
factory.createTypeOperatorNode(143 /* KeyOfKeyword */, typeToTypeNodeHelper(getModifiersTypeFromMappedType(type2), context))
|
|
47845
|
+
)),
|
|
47846
|
+
result,
|
|
47847
|
+
factory.createKeywordTypeNode(146 /* NeverKeyword */)
|
|
47848
|
+
);
|
|
47812
47849
|
}
|
|
47813
47850
|
return result;
|
|
47814
47851
|
}
|
|
@@ -51581,7 +51618,7 @@ function createTypeChecker(host) {
|
|
|
51581
51618
|
false,
|
|
51582
51619
|
definedInMethod && !definedInConstructor
|
|
51583
51620
|
));
|
|
51584
|
-
if (symbol.valueDeclaration && filterType(widened, (t) => !!(t.flags & ~98304 /* Nullable */)) === neverType) {
|
|
51621
|
+
if (symbol.valueDeclaration && isInJSFile(symbol.valueDeclaration) && filterType(widened, (t) => !!(t.flags & ~98304 /* Nullable */)) === neverType) {
|
|
51585
51622
|
reportImplicitAny(symbol.valueDeclaration, anyType);
|
|
51586
51623
|
return anyType;
|
|
51587
51624
|
}
|
|
@@ -52860,9 +52897,6 @@ function createTypeChecker(host) {
|
|
|
52860
52897
|
}
|
|
52861
52898
|
return type;
|
|
52862
52899
|
}
|
|
52863
|
-
function isTypeUsableAsPropertyName(type) {
|
|
52864
|
-
return !!(type.flags & 8576 /* StringOrNumberLiteralOrUnique */);
|
|
52865
|
-
}
|
|
52866
52900
|
function isLateBindableName(node) {
|
|
52867
52901
|
if (!isComputedPropertyName(node) && !isElementAccessExpression(node)) {
|
|
52868
52902
|
return false;
|
|
@@ -52883,15 +52917,6 @@ function createTypeChecker(host) {
|
|
|
52883
52917
|
function isNonBindableDynamicName(node) {
|
|
52884
52918
|
return isDynamicName(node) && !isLateBindableName(node);
|
|
52885
52919
|
}
|
|
52886
|
-
function getPropertyNameFromType(type) {
|
|
52887
|
-
if (type.flags & 8192 /* UniqueESSymbol */) {
|
|
52888
|
-
return type.escapedName;
|
|
52889
|
-
}
|
|
52890
|
-
if (type.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */)) {
|
|
52891
|
-
return escapeLeadingUnderscores("" + type.value);
|
|
52892
|
-
}
|
|
52893
|
-
return Debug.fail();
|
|
52894
|
-
}
|
|
52895
52920
|
function addDeclarationToLateBoundSymbol(symbol, member, symbolFlags) {
|
|
52896
52921
|
Debug.assert(!!(getCheckFlags(symbol) & 4096 /* Late */), "Expected a late-bound symbol.");
|
|
52897
52922
|
symbol.flags |= symbolFlags;
|
|
@@ -52941,6 +52966,7 @@ function createTypeChecker(host) {
|
|
|
52941
52966
|
return links.resolvedSymbol;
|
|
52942
52967
|
}
|
|
52943
52968
|
function getResolvedMembersOrExportsOfSymbol(symbol, resolutionKind) {
|
|
52969
|
+
var _a, _b, _c;
|
|
52944
52970
|
const links = getSymbolLinks(symbol);
|
|
52945
52971
|
if (!links[resolutionKind]) {
|
|
52946
52972
|
const isStatic2 = resolutionKind === "resolvedExports" /* resolvedExports */;
|
|
@@ -52959,7 +52985,7 @@ function createTypeChecker(host) {
|
|
|
52959
52985
|
}
|
|
52960
52986
|
}
|
|
52961
52987
|
}
|
|
52962
|
-
const assignments = symbol.assignmentDeclarationMembers;
|
|
52988
|
+
const assignments = (((_a = symbol.valueDeclaration) == null ? void 0 : _a.kind) === 219 /* ArrowFunction */ || ((_b = symbol.valueDeclaration) == null ? void 0 : _b.kind) === 218 /* FunctionExpression */) && ((_c = getSymbolOfNode(symbol.valueDeclaration.parent)) == null ? void 0 : _c.assignmentDeclarationMembers) || symbol.assignmentDeclarationMembers;
|
|
52963
52989
|
if (assignments) {
|
|
52964
52990
|
const decls = arrayFrom(assignments.values());
|
|
52965
52991
|
for (const member of decls) {
|
|
@@ -53088,7 +53114,7 @@ function createTypeChecker(host) {
|
|
|
53088
53114
|
/*resolvedTypePredicate*/
|
|
53089
53115
|
void 0,
|
|
53090
53116
|
sig.minArgumentCount,
|
|
53091
|
-
sig.flags &
|
|
53117
|
+
sig.flags & 167 /* PropagatingFlags */
|
|
53092
53118
|
);
|
|
53093
53119
|
result.target = sig.target;
|
|
53094
53120
|
result.mapper = sig.mapper;
|
|
@@ -53389,7 +53415,7 @@ function createTypeChecker(host) {
|
|
|
53389
53415
|
/*resolvedTypePredicate*/
|
|
53390
53416
|
void 0,
|
|
53391
53417
|
minArgCount,
|
|
53392
|
-
(left.flags | right.flags) &
|
|
53418
|
+
(left.flags | right.flags) & 167 /* PropagatingFlags */
|
|
53393
53419
|
);
|
|
53394
53420
|
result.compositeKind = 1048576 /* Union */;
|
|
53395
53421
|
result.compositeSignatures = concatenate(left.compositeKind !== 2097152 /* Intersection */ && left.compositeSignatures || [left], [right]);
|
|
@@ -53537,20 +53563,17 @@ function createTypeChecker(host) {
|
|
|
53537
53563
|
setStructuredTypeMembers(type, members2, callSignatures, constructSignatures, indexInfos2);
|
|
53538
53564
|
return;
|
|
53539
53565
|
}
|
|
53540
|
-
let members =
|
|
53566
|
+
let members = getExportsOfSymbol(symbol);
|
|
53541
53567
|
let indexInfos;
|
|
53542
|
-
if (symbol
|
|
53543
|
-
|
|
53544
|
-
|
|
53545
|
-
|
|
53546
|
-
|
|
53547
|
-
|
|
53548
|
-
|
|
53549
|
-
|
|
53550
|
-
|
|
53551
|
-
});
|
|
53552
|
-
members = varsOnly;
|
|
53553
|
-
}
|
|
53568
|
+
if (symbol === globalThisSymbol) {
|
|
53569
|
+
const varsOnly = /* @__PURE__ */ new Map();
|
|
53570
|
+
members.forEach((p) => {
|
|
53571
|
+
var _a;
|
|
53572
|
+
if (!(p.flags & 418 /* BlockScoped */) && !(p.flags & 512 /* ValueModule */ && ((_a = p.declarations) == null ? void 0 : _a.length) && every(p.declarations, isAmbientModule))) {
|
|
53573
|
+
varsOnly.set(p.escapedName, p);
|
|
53574
|
+
}
|
|
53575
|
+
});
|
|
53576
|
+
members = varsOnly;
|
|
53554
53577
|
}
|
|
53555
53578
|
let baseConstructorIndexInfo;
|
|
53556
53579
|
setStructuredTypeMembers(type, members, emptyArray, emptyArray, emptyArray);
|
|
@@ -53599,7 +53622,7 @@ function createTypeChecker(host) {
|
|
|
53599
53622
|
/*resolvedTypePredicate*/
|
|
53600
53623
|
void 0,
|
|
53601
53624
|
sig.minArgumentCount,
|
|
53602
|
-
sig.flags &
|
|
53625
|
+
sig.flags & 167 /* PropagatingFlags */
|
|
53603
53626
|
) : void 0
|
|
53604
53627
|
));
|
|
53605
53628
|
}
|
|
@@ -58382,7 +58405,7 @@ function createTypeChecker(host) {
|
|
|
58382
58405
|
/*resolvedTypePredicate*/
|
|
58383
58406
|
void 0,
|
|
58384
58407
|
signature.minArgumentCount,
|
|
58385
|
-
signature.flags &
|
|
58408
|
+
signature.flags & 167 /* PropagatingFlags */
|
|
58386
58409
|
);
|
|
58387
58410
|
result.target = signature;
|
|
58388
58411
|
result.mapper = mapper;
|
|
@@ -65643,12 +65666,15 @@ function createTypeChecker(host) {
|
|
|
65643
65666
|
return narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue);
|
|
65644
65667
|
}
|
|
65645
65668
|
const target = getReferenceCandidate(expr.right);
|
|
65646
|
-
|
|
65647
|
-
|
|
65648
|
-
if (
|
|
65669
|
+
if (containsMissingType(type) && isAccessExpression(reference) && isMatchingReference(reference.expression, target)) {
|
|
65670
|
+
const leftType = getTypeOfExpression(expr.left);
|
|
65671
|
+
if (isTypeUsableAsPropertyName(leftType) && getAccessedPropertyName(reference) === getPropertyNameFromType(leftType)) {
|
|
65649
65672
|
return getTypeWithFacts(type, assumeTrue ? 524288 /* NEUndefined */ : 65536 /* EQUndefined */);
|
|
65650
65673
|
}
|
|
65651
|
-
|
|
65674
|
+
}
|
|
65675
|
+
if (isMatchingReference(reference, target)) {
|
|
65676
|
+
const leftType = getTypeOfExpression(expr.left);
|
|
65677
|
+
if (isTypeUsableAsPropertyName(leftType)) {
|
|
65652
65678
|
return narrowTypeByInKeyword(type, leftType, assumeTrue);
|
|
65653
65679
|
}
|
|
65654
65680
|
}
|
|
@@ -65913,15 +65939,6 @@ function createTypeChecker(host) {
|
|
|
65913
65939
|
return type;
|
|
65914
65940
|
}
|
|
65915
65941
|
const rightType = getTypeOfExpression(expr.right);
|
|
65916
|
-
const hasInstanceMethodType = getSymbolHasInstanceMethodOfObjectType(rightType);
|
|
65917
|
-
if (hasInstanceMethodType) {
|
|
65918
|
-
const syntheticCall = createSyntheticHasInstanceMethodCall(left, expr.right, type, hasInstanceMethodType);
|
|
65919
|
-
const signature = getEffectsSignature(syntheticCall);
|
|
65920
|
-
const predicate = signature && getTypePredicateOfSignature(signature);
|
|
65921
|
-
if (predicate && (predicate.kind === 0 /* This */ || predicate.kind === 1 /* Identifier */)) {
|
|
65922
|
-
return narrowTypeByTypePredicate(type, predicate, syntheticCall, assumeTrue);
|
|
65923
|
-
}
|
|
65924
|
-
}
|
|
65925
65942
|
if (!isTypeDerivedFrom(rightType, globalFunctionType)) {
|
|
65926
65943
|
return type;
|
|
65927
65944
|
}
|
|
@@ -66001,12 +66018,8 @@ function createTypeChecker(host) {
|
|
|
66001
66018
|
}
|
|
66002
66019
|
function narrowTypeByTypePredicate(type, predicate, callExpression, assumeTrue) {
|
|
66003
66020
|
if (predicate.type && !(isTypeAny(type) && (predicate.type === globalObjectType || predicate.type === globalFunctionType))) {
|
|
66004
|
-
|
|
66021
|
+
const predicateArgument = getTypePredicateArgument(predicate, callExpression);
|
|
66005
66022
|
if (predicateArgument) {
|
|
66006
|
-
if (isSyntheticExpression(predicateArgument) && predicate.parameterIndex === 0 && isSyntheticHasInstanceMethodCall(callExpression)) {
|
|
66007
|
-
Debug.assertNode(predicateArgument.parent, isExpression);
|
|
66008
|
-
predicateArgument = predicateArgument.parent;
|
|
66009
|
-
}
|
|
66010
66023
|
if (isMatchingReference(reference, predicateArgument)) {
|
|
66011
66024
|
return getNarrowedType(
|
|
66012
66025
|
type,
|
|
@@ -67259,41 +67272,75 @@ function createTypeChecker(host) {
|
|
|
67259
67272
|
return mapType(
|
|
67260
67273
|
type,
|
|
67261
67274
|
(t) => {
|
|
67262
|
-
|
|
67263
|
-
|
|
67264
|
-
|
|
67265
|
-
|
|
67266
|
-
const
|
|
67267
|
-
|
|
67268
|
-
|
|
67269
|
-
|
|
67270
|
-
|
|
67271
|
-
|
|
67272
|
-
|
|
67273
|
-
|
|
67274
|
-
|
|
67275
|
-
|
|
67276
|
-
|
|
67277
|
-
|
|
67278
|
-
|
|
67279
|
-
/*endSkipCount*/
|
|
67280
|
-
0,
|
|
67281
|
-
/*writing*/
|
|
67282
|
-
false,
|
|
67283
|
-
/*noReductions*/
|
|
67284
|
-
true
|
|
67285
|
-
);
|
|
67286
|
-
if (restType) {
|
|
67287
|
-
return restType;
|
|
67275
|
+
if (!(t.flags & 3670016 /* StructuredType */)) {
|
|
67276
|
+
return void 0;
|
|
67277
|
+
}
|
|
67278
|
+
if (t.flags & 2097152 /* Intersection */) {
|
|
67279
|
+
const intersection = t;
|
|
67280
|
+
let applicableIndexedMappedTypeSubstitions;
|
|
67281
|
+
let concretePropertyTypes;
|
|
67282
|
+
let applicableIndexInfoCandidates;
|
|
67283
|
+
for (const t2 of intersection.types) {
|
|
67284
|
+
if (isGenericMappedType(t2) && !t2.declaration.nameType) {
|
|
67285
|
+
applicableIndexedMappedTypeSubstitions = append(applicableIndexedMappedTypeSubstitions, getTypeOfApplicableIndexedMappedTypeSubstitutionOfContextualType(t2));
|
|
67286
|
+
continue;
|
|
67287
|
+
}
|
|
67288
|
+
const typeOfConcreteProperty = getTypeOfConcretePropertyOfContextualType(t2);
|
|
67289
|
+
if (typeOfConcreteProperty) {
|
|
67290
|
+
concretePropertyTypes = append(concretePropertyTypes, typeOfConcreteProperty);
|
|
67291
|
+
continue;
|
|
67288
67292
|
}
|
|
67293
|
+
applicableIndexInfoCandidates = append(applicableIndexInfoCandidates, t2);
|
|
67289
67294
|
}
|
|
67290
|
-
|
|
67295
|
+
if (concretePropertyTypes) {
|
|
67296
|
+
return getIntersectionType(concatenate(concretePropertyTypes, applicableIndexedMappedTypeSubstitions));
|
|
67297
|
+
}
|
|
67298
|
+
const types = concatenate(mapDefined(applicableIndexInfoCandidates, getTypeOfApplicableIndexInfoOfContextualType), applicableIndexedMappedTypeSubstitions);
|
|
67299
|
+
if (types.length > 0) {
|
|
67300
|
+
return getIntersectionType(types);
|
|
67301
|
+
}
|
|
67302
|
+
return void 0;
|
|
67291
67303
|
}
|
|
67292
|
-
return
|
|
67304
|
+
return isGenericMappedType(t) && !t.declaration.nameType ? getTypeOfApplicableIndexedMappedTypeSubstitutionOfContextualType(t) : getTypeOfConcretePropertyOfContextualType(t) || getTypeOfApplicableIndexInfoOfContextualType(t);
|
|
67293
67305
|
},
|
|
67294
67306
|
/*noReductions*/
|
|
67295
67307
|
true
|
|
67296
67308
|
);
|
|
67309
|
+
function getTypeOfApplicableIndexedMappedTypeSubstitutionOfContextualType(t) {
|
|
67310
|
+
const constraint = getConstraintTypeFromMappedType(t);
|
|
67311
|
+
const constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
|
|
67312
|
+
const propertyNameType = nameType || getStringLiteralType(unescapeLeadingUnderscores(name));
|
|
67313
|
+
if (isTypeAssignableTo(propertyNameType, constraintOfConstraint)) {
|
|
67314
|
+
return substituteIndexedMappedType(t, propertyNameType);
|
|
67315
|
+
}
|
|
67316
|
+
return void 0;
|
|
67317
|
+
}
|
|
67318
|
+
function getTypeOfConcretePropertyOfContextualType(t) {
|
|
67319
|
+
const prop = getPropertyOfType(t, name);
|
|
67320
|
+
if (prop) {
|
|
67321
|
+
return isCircularMappedProperty(prop) ? void 0 : getTypeOfSymbol(prop);
|
|
67322
|
+
}
|
|
67323
|
+
if (isTupleType(t) && isNumericLiteralName(name) && +name >= 0) {
|
|
67324
|
+
const restType = getElementTypeOfSliceOfTupleType(
|
|
67325
|
+
t,
|
|
67326
|
+
t.target.fixedLength,
|
|
67327
|
+
/*endSkipCount*/
|
|
67328
|
+
0,
|
|
67329
|
+
/*writing*/
|
|
67330
|
+
false,
|
|
67331
|
+
/*noReductions*/
|
|
67332
|
+
true
|
|
67333
|
+
);
|
|
67334
|
+
if (restType) {
|
|
67335
|
+
return restType;
|
|
67336
|
+
}
|
|
67337
|
+
}
|
|
67338
|
+
return void 0;
|
|
67339
|
+
}
|
|
67340
|
+
function getTypeOfApplicableIndexInfoOfContextualType(t) {
|
|
67341
|
+
var _a;
|
|
67342
|
+
return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(unescapeLeadingUnderscores(name)))) == null ? void 0 : _a.type;
|
|
67343
|
+
}
|
|
67297
67344
|
}
|
|
67298
67345
|
function getContextualTypeForObjectLiteralMethod(node, contextFlags) {
|
|
67299
67346
|
Debug.assert(isObjectLiteralMethod(node));
|
|
@@ -67844,7 +67891,7 @@ function createTypeChecker(host) {
|
|
|
67844
67891
|
/*resolvedTypePredicate*/
|
|
67845
67892
|
void 0,
|
|
67846
67893
|
minArgCount,
|
|
67847
|
-
(left.flags | right.flags) &
|
|
67894
|
+
(left.flags | right.flags) & 167 /* PropagatingFlags */
|
|
67848
67895
|
);
|
|
67849
67896
|
result.compositeKind = 2097152 /* Intersection */;
|
|
67850
67897
|
result.compositeSignatures = concatenate(left.compositeKind === 2097152 /* Intersection */ && left.compositeSignatures || [left], [right]);
|
|
@@ -70583,7 +70630,7 @@ function createTypeChecker(host) {
|
|
|
70583
70630
|
}
|
|
70584
70631
|
return createDiagnosticForNodeArray(getSourceFileOfNode(node), typeArguments, Diagnostics.Expected_0_type_arguments_but_got_1, belowArgCount === -Infinity ? aboveArgCount : belowArgCount, argCount);
|
|
70585
70632
|
}
|
|
70586
|
-
function resolveCall(node, signatures, candidatesOutArray, checkMode, callChainFlags,
|
|
70633
|
+
function resolveCall(node, signatures, candidatesOutArray, checkMode, callChainFlags, headMessage) {
|
|
70587
70634
|
const isTaggedTemplate = node.kind === 215 /* TaggedTemplateExpression */;
|
|
70588
70635
|
const isDecorator2 = node.kind === 170 /* Decorator */;
|
|
70589
70636
|
const isJsxOpeningOrSelfClosingElement = isJsxOpeningLikeElement(node);
|
|
@@ -70626,7 +70673,6 @@ function createTypeChecker(host) {
|
|
|
70626
70673
|
chain = chainDiagnosticMessages(chain, Diagnostics.The_last_overload_gave_the_following_error);
|
|
70627
70674
|
chain = chainDiagnosticMessages(chain, Diagnostics.No_overload_matches_this_call);
|
|
70628
70675
|
}
|
|
70629
|
-
const headMessage = headMessageCallback == null ? void 0 : headMessageCallback();
|
|
70630
70676
|
if (headMessage) {
|
|
70631
70677
|
chain = chainDiagnosticMessages(chain, headMessage);
|
|
70632
70678
|
}
|
|
@@ -70694,7 +70740,6 @@ function createTypeChecker(host) {
|
|
|
70694
70740
|
map(diags, createDiagnosticMessageChainFromDiagnostic),
|
|
70695
70741
|
Diagnostics.No_overload_matches_this_call
|
|
70696
70742
|
);
|
|
70697
|
-
const headMessage = headMessageCallback == null ? void 0 : headMessageCallback();
|
|
70698
70743
|
if (headMessage) {
|
|
70699
70744
|
chain = chainDiagnosticMessages(chain, headMessage);
|
|
70700
70745
|
}
|
|
@@ -70710,21 +70755,21 @@ function createTypeChecker(host) {
|
|
|
70710
70755
|
diagnostics.add(diag2);
|
|
70711
70756
|
}
|
|
70712
70757
|
} else if (candidateForArgumentArityError) {
|
|
70713
|
-
diagnostics.add(getArgumentArityError(node, [candidateForArgumentArityError], args,
|
|
70758
|
+
diagnostics.add(getArgumentArityError(node, [candidateForArgumentArityError], args, headMessage));
|
|
70714
70759
|
} else if (candidateForTypeArgumentError) {
|
|
70715
70760
|
checkTypeArguments(
|
|
70716
70761
|
candidateForTypeArgumentError,
|
|
70717
70762
|
node.typeArguments,
|
|
70718
70763
|
/*reportErrors*/
|
|
70719
70764
|
true,
|
|
70720
|
-
|
|
70765
|
+
headMessage
|
|
70721
70766
|
);
|
|
70722
70767
|
} else {
|
|
70723
70768
|
const signaturesWithCorrectTypeArgumentArity = filter(signatures, (s) => hasCorrectTypeArgumentArity(s, typeArguments));
|
|
70724
70769
|
if (signaturesWithCorrectTypeArgumentArity.length === 0) {
|
|
70725
|
-
diagnostics.add(getTypeArgumentArityError(node, signatures, typeArguments,
|
|
70770
|
+
diagnostics.add(getTypeArgumentArityError(node, signatures, typeArguments, headMessage));
|
|
70726
70771
|
} else {
|
|
70727
|
-
diagnostics.add(getArgumentArityError(node, signaturesWithCorrectTypeArgumentArity, args,
|
|
70772
|
+
diagnostics.add(getArgumentArityError(node, signaturesWithCorrectTypeArgumentArity, args, headMessage));
|
|
70728
70773
|
}
|
|
70729
70774
|
}
|
|
70730
70775
|
}
|
|
@@ -70875,7 +70920,7 @@ function createTypeChecker(host) {
|
|
|
70875
70920
|
parameters.push(createCombinedSymbolFromTypes(symbols, mapDefined(candidates, (candidate) => tryGetTypeAtPosition(candidate, i))));
|
|
70876
70921
|
}
|
|
70877
70922
|
const restParameterSymbols = mapDefined(candidates, (c) => signatureHasRestParameter(c) ? last(c.parameters) : void 0);
|
|
70878
|
-
let flags =
|
|
70923
|
+
let flags = 128 /* IsSignatureCandidateForOverloadFailure */;
|
|
70879
70924
|
if (restParameterSymbols.length !== 0) {
|
|
70880
70925
|
const type = createArrayType(getUnionType(mapDefined(candidates, tryGetRestTypeOfSignature), 2 /* Subtype */));
|
|
70881
70926
|
parameters.push(createCombinedSymbolForOverloadFailure(restParameterSymbols, type));
|
|
@@ -71032,7 +71077,7 @@ function createTypeChecker(host) {
|
|
|
71032
71077
|
error(node, Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new, typeToString(funcType));
|
|
71033
71078
|
return resolveErrorCall(node);
|
|
71034
71079
|
}
|
|
71035
|
-
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, callChainFlags
|
|
71080
|
+
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, callChainFlags);
|
|
71036
71081
|
}
|
|
71037
71082
|
function isGenericFunctionReturningFunction(signature) {
|
|
71038
71083
|
return !!(signature.typeParameters && isFunctionType(getReturnTypeOfSignature(signature)));
|
|
@@ -71329,7 +71374,7 @@ function createTypeChecker(host) {
|
|
|
71329
71374
|
invocationErrorRecovery(apparentType, 0 /* Call */, diag2);
|
|
71330
71375
|
return resolveErrorCall(node);
|
|
71331
71376
|
}
|
|
71332
|
-
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, 0 /* None */,
|
|
71377
|
+
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, 0 /* None */, headMessage);
|
|
71333
71378
|
}
|
|
71334
71379
|
function createSignatureForJSXIntrinsic(node, result) {
|
|
71335
71380
|
const namespace = getJsxNamespaceAt(node);
|
|
@@ -71599,6 +71644,8 @@ function createTypeChecker(host) {
|
|
|
71599
71644
|
return returnType;
|
|
71600
71645
|
}
|
|
71601
71646
|
function checkDeprecatedSignature(signature, node) {
|
|
71647
|
+
if (signature.flags & 128 /* IsSignatureCandidateForOverloadFailure */)
|
|
71648
|
+
return;
|
|
71602
71649
|
if (signature.declaration && signature.declaration.flags & 536870912 /* Deprecated */) {
|
|
71603
71650
|
const suggestionNode = getDeprecatedSuggestionNode(node);
|
|
71604
71651
|
const name = tryGetPropertyAccessOrIdentifierToString(getInvokedExpression(node));
|
|
@@ -72072,7 +72119,7 @@ function createTypeChecker(host) {
|
|
|
72072
72119
|
}
|
|
72073
72120
|
return restParameter.escapedName;
|
|
72074
72121
|
}
|
|
72075
|
-
function
|
|
72122
|
+
function getParameterIdentifierInfoAtPosition(signature, pos) {
|
|
72076
72123
|
var _a;
|
|
72077
72124
|
if (((_a = signature.declaration) == null ? void 0 : _a.kind) === 324 /* JSDocFunctionType */) {
|
|
72078
72125
|
return void 0;
|
|
@@ -72080,10 +72127,16 @@ function createTypeChecker(host) {
|
|
|
72080
72127
|
const paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0);
|
|
72081
72128
|
if (pos < paramCount) {
|
|
72082
72129
|
const param = signature.parameters[pos];
|
|
72083
|
-
|
|
72130
|
+
const paramIdent = getParameterDeclarationIdentifier(param);
|
|
72131
|
+
return paramIdent ? {
|
|
72132
|
+
parameter: paramIdent,
|
|
72133
|
+
parameterName: param.escapedName,
|
|
72134
|
+
isRestParameter: false
|
|
72135
|
+
} : void 0;
|
|
72084
72136
|
}
|
|
72085
72137
|
const restParameter = signature.parameters[paramCount] || unknownSymbol;
|
|
72086
|
-
|
|
72138
|
+
const restIdent = getParameterDeclarationIdentifier(restParameter);
|
|
72139
|
+
if (!restIdent) {
|
|
72087
72140
|
return void 0;
|
|
72088
72141
|
}
|
|
72089
72142
|
const restType = getTypeOfSymbol(restParameter);
|
|
@@ -72092,18 +72145,19 @@ function createTypeChecker(host) {
|
|
|
72092
72145
|
const index = pos - paramCount;
|
|
72093
72146
|
const associatedName = associatedNames == null ? void 0 : associatedNames[index];
|
|
72094
72147
|
const isRestTupleElement = !!(associatedName == null ? void 0 : associatedName.dotDotDotToken);
|
|
72095
|
-
|
|
72096
|
-
|
|
72097
|
-
isRestTupleElement
|
|
72098
|
-
|
|
72148
|
+
if (associatedName) {
|
|
72149
|
+
Debug.assert(isIdentifier(associatedName.name));
|
|
72150
|
+
return { parameter: associatedName.name, parameterName: associatedName.name.escapedText, isRestParameter: isRestTupleElement };
|
|
72151
|
+
}
|
|
72152
|
+
return void 0;
|
|
72099
72153
|
}
|
|
72100
72154
|
if (pos === paramCount) {
|
|
72101
|
-
return
|
|
72155
|
+
return { parameter: restIdent, parameterName: restParameter.escapedName, isRestParameter: true };
|
|
72102
72156
|
}
|
|
72103
72157
|
return void 0;
|
|
72104
72158
|
}
|
|
72105
|
-
function
|
|
72106
|
-
return symbol.valueDeclaration && isParameter(symbol.valueDeclaration) && isIdentifier(symbol.valueDeclaration.name);
|
|
72159
|
+
function getParameterDeclarationIdentifier(symbol) {
|
|
72160
|
+
return symbol.valueDeclaration && isParameter(symbol.valueDeclaration) && isIdentifier(symbol.valueDeclaration.name) && symbol.valueDeclaration.name;
|
|
72107
72161
|
}
|
|
72108
72162
|
function isValidDeclarationForTupleLabel(d) {
|
|
72109
72163
|
return d.kind === 202 /* NamedTupleMember */ || isParameter(d) && d.name && isIdentifier(d.name);
|
|
@@ -73362,32 +73416,6 @@ function createTypeChecker(host) {
|
|
|
73362
73416
|
function isConstEnumSymbol(symbol) {
|
|
73363
73417
|
return (symbol.flags & 128 /* ConstEnum */) !== 0;
|
|
73364
73418
|
}
|
|
73365
|
-
function getSymbolHasInstanceMethodOfObjectType(type) {
|
|
73366
|
-
const hasInstancePropertyName = getPropertyNameForKnownSymbolName("hasInstance");
|
|
73367
|
-
const hasInstanceProperty = getPropertyOfObjectType(type, hasInstancePropertyName);
|
|
73368
|
-
if (hasInstanceProperty) {
|
|
73369
|
-
const hasInstancePropertyType = getTypeOfSymbol(hasInstanceProperty);
|
|
73370
|
-
if (hasInstancePropertyType && getSignaturesOfType(hasInstancePropertyType, 0 /* Call */).length !== 0) {
|
|
73371
|
-
return hasInstancePropertyType;
|
|
73372
|
-
}
|
|
73373
|
-
}
|
|
73374
|
-
}
|
|
73375
|
-
function createSyntheticHasInstanceMethodCall(left, right, leftType, hasInstanceMethodType) {
|
|
73376
|
-
const syntheticExpression = createSyntheticExpression(right, hasInstanceMethodType);
|
|
73377
|
-
const syntheticArgument = createSyntheticExpression(left, leftType);
|
|
73378
|
-
const syntheticCall = parseNodeFactory.createCallExpression(
|
|
73379
|
-
syntheticExpression,
|
|
73380
|
-
/*typeArguments*/
|
|
73381
|
-
void 0,
|
|
73382
|
-
[syntheticArgument]
|
|
73383
|
-
);
|
|
73384
|
-
setParent(syntheticCall, left.parent);
|
|
73385
|
-
setTextRange(syntheticCall, left.parent);
|
|
73386
|
-
return syntheticCall;
|
|
73387
|
-
}
|
|
73388
|
-
function isSyntheticHasInstanceMethodCall(node) {
|
|
73389
|
-
return isSyntheticExpression(node.expression) && node.arguments.length === 1 && isSyntheticExpression(node.arguments[0]) && isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 104 /* InstanceOfKeyword */ && node.parent.right === node.expression.parent && node.parent.left === node.arguments[0].parent;
|
|
73390
|
-
}
|
|
73391
73419
|
function checkInstanceOfExpression(left, right, leftType, rightType) {
|
|
73392
73420
|
if (leftType === silentNeverType || rightType === silentNeverType) {
|
|
73393
73421
|
return silentNeverType;
|
|
@@ -73395,31 +73423,8 @@ function createTypeChecker(host) {
|
|
|
73395
73423
|
if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 402784252 /* Primitive */)) {
|
|
73396
73424
|
error(left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
|
|
73397
73425
|
}
|
|
73398
|
-
if (!isTypeAny(rightType)) {
|
|
73399
|
-
|
|
73400
|
-
if (hasInstanceMethodType) {
|
|
73401
|
-
const cache = hasInstanceMethodType;
|
|
73402
|
-
if (cache.hasSimpleUnrestrictedSingleCallSignature === void 0) {
|
|
73403
|
-
const signature = getSingleCallSignature(hasInstanceMethodType);
|
|
73404
|
-
cache.hasSimpleUnrestrictedSingleCallSignature = !!signature && signature.parameters.length === 1 && !!(getTypeOfSymbol(signature.parameters[0]).flags & 3 /* AnyOrUnknown */) && !!signature.resolvedReturnType && !!(signature.resolvedReturnType.flags & 16 /* Boolean */);
|
|
73405
|
-
}
|
|
73406
|
-
if (!cache.hasSimpleUnrestrictedSingleCallSignature) {
|
|
73407
|
-
const syntheticCall = createSyntheticHasInstanceMethodCall(left, right, leftType, hasInstanceMethodType);
|
|
73408
|
-
const returnType = getReturnTypeOfSignature(getResolvedSignature(syntheticCall));
|
|
73409
|
-
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);
|
|
73410
|
-
}
|
|
73411
|
-
}
|
|
73412
|
-
if (!(hasInstanceMethodType || typeHasCallOrConstructSignatures(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
|
|
73413
|
-
if (hasGlobalSymbolHasInstanceProperty === void 0) {
|
|
73414
|
-
const globalESSymbolConstructorSymbol = getGlobalESSymbolConstructorTypeSymbol(
|
|
73415
|
-
/*reportErrors*/
|
|
73416
|
-
false
|
|
73417
|
-
);
|
|
73418
|
-
hasGlobalSymbolHasInstanceProperty = !!globalESSymbolConstructorSymbol && getMembersOfSymbol(globalESSymbolConstructorSymbol).has("hasInstance");
|
|
73419
|
-
}
|
|
73420
|
-
const message = hasGlobalSymbolHasInstanceProperty ? Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_either_of_type_any_an_object_type_with_a_Symbol_hasInstance_method_or_a_type_assignable_to_the_Function_interface_type : Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type;
|
|
73421
|
-
error(right, message);
|
|
73422
|
-
}
|
|
73426
|
+
if (!(isTypeAny(rightType) || typeHasCallOrConstructSignatures(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
|
|
73427
|
+
error(right, Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type);
|
|
73423
73428
|
}
|
|
73424
73429
|
return booleanType;
|
|
73425
73430
|
}
|
|
@@ -122102,7 +122107,6 @@ function createWatchProgram(host) {
|
|
|
122102
122107
|
if (hasChangedCompilerOptions) {
|
|
122103
122108
|
newLine = updateNewLine();
|
|
122104
122109
|
if (program && changesAffectModuleResolution(program.getCompilerOptions(), compilerOptions)) {
|
|
122105
|
-
debugger;
|
|
122106
122110
|
resolutionCache.onChangesAffectModuleResolution();
|
|
122107
122111
|
}
|
|
122108
122112
|
}
|