@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/tsserverlibrary.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.2";
|
|
38
|
-
version = `${versionMajorMinor}.0-insiders.
|
|
38
|
+
version = `${versionMajorMinor}.0-insiders.20230725`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -4576,7 +4576,8 @@ ${lanes.join("\n")}
|
|
|
4576
4576
|
SignatureFlags5[SignatureFlags5["IsOuterCallChain"] = 16] = "IsOuterCallChain";
|
|
4577
4577
|
SignatureFlags5[SignatureFlags5["IsUntypedSignatureInJSFile"] = 32] = "IsUntypedSignatureInJSFile";
|
|
4578
4578
|
SignatureFlags5[SignatureFlags5["IsNonInferrable"] = 64] = "IsNonInferrable";
|
|
4579
|
-
SignatureFlags5[SignatureFlags5["
|
|
4579
|
+
SignatureFlags5[SignatureFlags5["IsSignatureCandidateForOverloadFailure"] = 128] = "IsSignatureCandidateForOverloadFailure";
|
|
4580
|
+
SignatureFlags5[SignatureFlags5["PropagatingFlags"] = 167] = "PropagatingFlags";
|
|
4580
4581
|
SignatureFlags5[SignatureFlags5["CallChainFlags"] = 24] = "CallChainFlags";
|
|
4581
4582
|
return SignatureFlags5;
|
|
4582
4583
|
})(SignatureFlags || {});
|
|
@@ -7972,9 +7973,6 @@ ${lanes.join("\n")}
|
|
|
7972
7973
|
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."),
|
|
7973
7974
|
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."),
|
|
7974
7975
|
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."),
|
|
7975
|
-
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."),
|
|
7976
|
-
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."),
|
|
7977
|
-
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."),
|
|
7978
7976
|
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}'."),
|
|
7979
7977
|
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}'."),
|
|
7980
7978
|
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}'."),
|
|
@@ -12455,7 +12453,6 @@ ${lanes.join("\n")}
|
|
|
12455
12453
|
case 236 /* MetaProperty */:
|
|
12456
12454
|
case 102 /* ImportKeyword */:
|
|
12457
12455
|
case 282 /* MissingDeclaration */:
|
|
12458
|
-
case 237 /* SyntheticExpression */:
|
|
12459
12456
|
return true;
|
|
12460
12457
|
default:
|
|
12461
12458
|
return false;
|
|
@@ -19228,6 +19225,18 @@ ${lanes.join("\n")}
|
|
|
19228
19225
|
function intrinsicTagNameToString(node) {
|
|
19229
19226
|
return isIdentifier(node) ? idText(node) : getTextOfJsxNamespacedName(node);
|
|
19230
19227
|
}
|
|
19228
|
+
function isTypeUsableAsPropertyName(type) {
|
|
19229
|
+
return !!(type.flags & 8576 /* StringOrNumberLiteralOrUnique */);
|
|
19230
|
+
}
|
|
19231
|
+
function getPropertyNameFromType(type) {
|
|
19232
|
+
if (type.flags & 8192 /* UniqueESSymbol */) {
|
|
19233
|
+
return type.escapedName;
|
|
19234
|
+
}
|
|
19235
|
+
if (type.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */)) {
|
|
19236
|
+
return escapeLeadingUnderscores("" + type.value);
|
|
19237
|
+
}
|
|
19238
|
+
return Debug.fail();
|
|
19239
|
+
}
|
|
19231
19240
|
var resolvingEmptyArray, externalHelpersModuleNameText, defaultMaximumTruncationLength, noTruncationMaximumTruncationLength, stringWriter, GetLiteralTextFlags, fullTripleSlashReferencePathRegEx, fullTripleSlashReferenceTypeReferenceDirectiveRegEx, fullTripleSlashLibReferenceRegEx, fullTripleSlashAMDReferencePathRegEx, fullTripleSlashAMDModuleRegEx, defaultLibReferenceRegEx, AssignmentKind, FunctionFlags, Associativity, OperatorPrecedence, templateSubstitutionRegExp, doubleQuoteEscapedCharsRegExp, singleQuoteEscapedCharsRegExp, backtickQuoteEscapedCharsRegExp, escapedCharsMap, nonAsciiCharacters, jsxDoubleQuoteEscapedCharsRegExp, jsxSingleQuoteEscapedCharsRegExp, jsxEscapedCharsMap, indentStrings, base64Digits, carriageReturnLineFeed, lineFeed, objectAllocator, objectAllocatorPatchers, localizedDiagnosticMessages, reservedCharacterPattern, wildcardCharCodes, commonPackageFolders, implicitExcludePathRegexPattern, filesMatcher, directoriesMatcher, excludeMatcher, wildcardMatchers, supportedTSExtensions, supportedTSExtensionsFlat, supportedTSExtensionsWithJson, supportedTSExtensionsForExtractExtension, supportedJSExtensions, supportedJSExtensionsFlat, allSupportedExtensions, allSupportedExtensionsWithJson, supportedDeclarationExtensions, supportedTSImplementationExtensions, extensionsNotSupportingExtensionlessResolution, ModuleSpecifierEnding, extensionsToRemove, emptyFileSystemEntries;
|
|
19232
19241
|
var init_utilities = __esm({
|
|
19233
19242
|
"src/compiler/utilities.ts"() {
|
|
@@ -33185,10 +33194,14 @@ ${lanes.join("\n")}
|
|
|
33185
33194
|
case 124 /* ProtectedKeyword */:
|
|
33186
33195
|
case 125 /* PublicKeyword */:
|
|
33187
33196
|
case 148 /* ReadonlyKeyword */:
|
|
33197
|
+
const previousToken = token();
|
|
33188
33198
|
nextToken();
|
|
33189
33199
|
if (scanner2.hasPrecedingLineBreak()) {
|
|
33190
33200
|
return false;
|
|
33191
33201
|
}
|
|
33202
|
+
if (previousToken === 138 /* DeclareKeyword */ && token() === 156 /* TypeKeyword */) {
|
|
33203
|
+
return true;
|
|
33204
|
+
}
|
|
33192
33205
|
continue;
|
|
33193
33206
|
case 162 /* GlobalKeyword */:
|
|
33194
33207
|
nextToken();
|
|
@@ -33553,14 +33566,14 @@ ${lanes.join("\n")}
|
|
|
33553
33566
|
function parseObjectBindingPattern() {
|
|
33554
33567
|
const pos = getNodePos();
|
|
33555
33568
|
parseExpected(19 /* OpenBraceToken */);
|
|
33556
|
-
const elements = parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement);
|
|
33569
|
+
const elements = allowInAnd(() => parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement));
|
|
33557
33570
|
parseExpected(20 /* CloseBraceToken */);
|
|
33558
33571
|
return finishNode(factory2.createObjectBindingPattern(elements), pos);
|
|
33559
33572
|
}
|
|
33560
33573
|
function parseArrayBindingPattern() {
|
|
33561
33574
|
const pos = getNodePos();
|
|
33562
33575
|
parseExpected(23 /* OpenBracketToken */);
|
|
33563
|
-
const elements = parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement);
|
|
33576
|
+
const elements = allowInAnd(() => parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement));
|
|
33564
33577
|
parseExpected(24 /* CloseBracketToken */);
|
|
33565
33578
|
return finishNode(factory2.createArrayBindingPattern(elements), pos);
|
|
33566
33579
|
}
|
|
@@ -34078,6 +34091,9 @@ ${lanes.join("\n")}
|
|
|
34078
34091
|
}
|
|
34079
34092
|
function parseTypeAliasDeclaration(pos, hasJSDoc, modifiers) {
|
|
34080
34093
|
parseExpected(156 /* TypeKeyword */);
|
|
34094
|
+
if (scanner2.hasPrecedingLineBreak()) {
|
|
34095
|
+
parseErrorAtCurrentToken(Diagnostics.Line_break_not_permitted_here);
|
|
34096
|
+
}
|
|
34081
34097
|
const name = parseIdentifier();
|
|
34082
34098
|
const typeParameters = parseTypeParameters();
|
|
34083
34099
|
parseExpected(64 /* EqualsToken */);
|
|
@@ -35861,7 +35877,7 @@ ${lanes.join("\n")}
|
|
|
35861
35877
|
})(IncrementalParser || (IncrementalParser = {}));
|
|
35862
35878
|
namedArgRegExCache = /* @__PURE__ */ new Map();
|
|
35863
35879
|
tripleSlashXMLCommentStartRegEx = /^\/\/\/\s*<(\S+)\s.*?\/>/im;
|
|
35864
|
-
singleLinePragmaRegEx = /^\/\/\/?\s*@(
|
|
35880
|
+
singleLinePragmaRegEx = /^\/\/\/?\s*@([^\s:]+)(.*)\s*$/im;
|
|
35865
35881
|
}
|
|
35866
35882
|
});
|
|
35867
35883
|
|
|
@@ -41734,6 +41750,9 @@ ${lanes.join("\n")}
|
|
|
41734
41750
|
if (found === 1 /* Instantiated */) {
|
|
41735
41751
|
return found;
|
|
41736
41752
|
}
|
|
41753
|
+
if (statement.kind === 271 /* ImportEqualsDeclaration */) {
|
|
41754
|
+
found = 1 /* Instantiated */;
|
|
41755
|
+
}
|
|
41737
41756
|
}
|
|
41738
41757
|
}
|
|
41739
41758
|
if (found !== void 0) {
|
|
@@ -45588,7 +45607,7 @@ ${lanes.join("\n")}
|
|
|
45588
45607
|
return node ? getTypeFromTypeNode(node) : errorType;
|
|
45589
45608
|
},
|
|
45590
45609
|
getParameterType: getTypeAtPosition,
|
|
45591
|
-
|
|
45610
|
+
getParameterIdentifierInfoAtPosition,
|
|
45592
45611
|
getPromisedTypeOfPromise,
|
|
45593
45612
|
getAwaitedType: (type) => getAwaitedType(type),
|
|
45594
45613
|
getReturnTypeOfSignature,
|
|
@@ -46341,7 +46360,6 @@ ${lanes.join("\n")}
|
|
|
46341
46360
|
var potentialReflectCollisions = [];
|
|
46342
46361
|
var potentialUnusedRenamedBindingElementsInTypes = [];
|
|
46343
46362
|
var awaitedTypeStack = [];
|
|
46344
|
-
var hasGlobalSymbolHasInstanceProperty;
|
|
46345
46363
|
var diagnostics = createDiagnosticCollection();
|
|
46346
46364
|
var suggestionDiagnostics = createDiagnosticCollection();
|
|
46347
46365
|
var typeofType = createTypeofType();
|
|
@@ -47030,7 +47048,7 @@ ${lanes.join("\n")}
|
|
|
47030
47048
|
if (name === "const" && isConstAssertion(location)) {
|
|
47031
47049
|
return void 0;
|
|
47032
47050
|
}
|
|
47033
|
-
if (
|
|
47051
|
+
if (isModuleOrEnumDeclaration(location) && lastLocation && location.name === lastLocation) {
|
|
47034
47052
|
lastLocation = location;
|
|
47035
47053
|
location = location.parent;
|
|
47036
47054
|
}
|
|
@@ -48646,7 +48664,7 @@ ${lanes.join("\n")}
|
|
|
48646
48664
|
return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, moduleReferenceExpression, isForAugmentation) : void 0;
|
|
48647
48665
|
}
|
|
48648
48666
|
function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation = false) {
|
|
48649
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
48667
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
48650
48668
|
if (startsWith(moduleReference, "@types/")) {
|
|
48651
48669
|
const diag2 = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
|
|
48652
48670
|
const withoutAtTypePrefix = removePrefix(moduleReference, "@types/");
|
|
@@ -48681,8 +48699,11 @@ ${lanes.join("\n")}
|
|
|
48681
48699
|
);
|
|
48682
48700
|
}
|
|
48683
48701
|
} else if (resolvedModule.resolvedUsingTsExtension && !shouldAllowImportingTsExtension(compilerOptions, currentSourceFile.fileName)) {
|
|
48684
|
-
const
|
|
48685
|
-
|
|
48702
|
+
const importOrExport = ((_h = findAncestor(location, isImportDeclaration)) == null ? void 0 : _h.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
|
|
48703
|
+
if (!((importOrExport == null ? void 0 : importOrExport.isTypeOnly) || findAncestor(location, isImportTypeNode))) {
|
|
48704
|
+
const tsExtension = Debug.checkDefined(tryExtractTSExtension(moduleReference));
|
|
48705
|
+
error2(errorNode, Diagnostics.An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled, tsExtension);
|
|
48706
|
+
}
|
|
48686
48707
|
}
|
|
48687
48708
|
if (sourceFile.symbol) {
|
|
48688
48709
|
if (resolvedModule.isExternalLibraryImport && !resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
|
|
@@ -48699,7 +48720,7 @@ ${lanes.join("\n")}
|
|
|
48699
48720
|
if (moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */) {
|
|
48700
48721
|
const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
|
|
48701
48722
|
const overrideClauseHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
|
|
48702
|
-
const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (
|
|
48723
|
+
const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (_i = overrideClauseHost.assertions) == null ? void 0 : _i.assertClause : overrideClauseHost == null ? void 0 : overrideClauseHost.assertClause;
|
|
48703
48724
|
if (isSyncImport && sourceFile.impliedNodeFormat === 99 /* ESNext */ && !getResolutionModeOverrideForClause(overrideClause)) {
|
|
48704
48725
|
if (findAncestor(location, isImportEqualsDeclaration)) {
|
|
48705
48726
|
error2(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);
|
|
@@ -48802,7 +48823,7 @@ ${lanes.join("\n")}
|
|
|
48802
48823
|
error2(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
48803
48824
|
} else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
|
|
48804
48825
|
const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
|
|
48805
|
-
const suggestedExt = (
|
|
48826
|
+
const suggestedExt = (_j = suggestedExtensions.find(([actualExt, _importExt]) => host.fileExists(absoluteRef + actualExt))) == null ? void 0 : _j[1];
|
|
48806
48827
|
if (suggestedExt) {
|
|
48807
48828
|
error2(
|
|
48808
48829
|
errorNode,
|
|
@@ -50238,11 +50259,13 @@ ${lanes.join("\n")}
|
|
|
50238
50259
|
return !!type2.target && isMappedTypeHomomorphic(type2.target) && !isMappedTypeHomomorphic(type2);
|
|
50239
50260
|
}
|
|
50240
50261
|
function createMappedTypeNodeFromType(type2) {
|
|
50262
|
+
var _a2;
|
|
50241
50263
|
Debug.assert(!!(type2.flags & 524288 /* Object */));
|
|
50242
50264
|
const readonlyToken = type2.declaration.readonlyToken ? factory.createToken(type2.declaration.readonlyToken.kind) : void 0;
|
|
50243
50265
|
const questionToken = type2.declaration.questionToken ? factory.createToken(type2.declaration.questionToken.kind) : void 0;
|
|
50244
50266
|
let appropriateConstraintTypeNode;
|
|
50245
50267
|
let newTypeVariable;
|
|
50268
|
+
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 */);
|
|
50246
50269
|
if (isMappedTypeWithKeyofConstraintDeclaration(type2)) {
|
|
50247
50270
|
if (isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type2) && context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
|
|
50248
50271
|
const newParam = createTypeParameter(createSymbol(262144 /* TypeParameter */, "T"));
|
|
@@ -50250,6 +50273,11 @@ ${lanes.join("\n")}
|
|
|
50250
50273
|
newTypeVariable = factory.createTypeReferenceNode(name);
|
|
50251
50274
|
}
|
|
50252
50275
|
appropriateConstraintTypeNode = factory.createTypeOperatorNode(143 /* KeyOfKeyword */, newTypeVariable || typeToTypeNodeHelper(getModifiersTypeFromMappedType(type2), context));
|
|
50276
|
+
} else if (needsModifierPreservingWrapper) {
|
|
50277
|
+
const newParam = createTypeParameter(createSymbol(262144 /* TypeParameter */, "T"));
|
|
50278
|
+
const name = typeParameterToName(newParam, context);
|
|
50279
|
+
newTypeVariable = factory.createTypeReferenceNode(name);
|
|
50280
|
+
appropriateConstraintTypeNode = newTypeVariable;
|
|
50253
50281
|
} else {
|
|
50254
50282
|
appropriateConstraintTypeNode = typeToTypeNodeHelper(getConstraintTypeFromMappedType(type2), context);
|
|
50255
50283
|
}
|
|
@@ -50280,6 +50308,18 @@ ${lanes.join("\n")}
|
|
|
50280
50308
|
result,
|
|
50281
50309
|
factory.createKeywordTypeNode(146 /* NeverKeyword */)
|
|
50282
50310
|
);
|
|
50311
|
+
} else if (needsModifierPreservingWrapper) {
|
|
50312
|
+
return factory.createConditionalTypeNode(
|
|
50313
|
+
typeToTypeNodeHelper(getConstraintTypeFromMappedType(type2), context),
|
|
50314
|
+
factory.createInferTypeNode(factory.createTypeParameterDeclaration(
|
|
50315
|
+
/*modifiers*/
|
|
50316
|
+
void 0,
|
|
50317
|
+
factory.cloneNode(newTypeVariable.typeName),
|
|
50318
|
+
factory.createTypeOperatorNode(143 /* KeyOfKeyword */, typeToTypeNodeHelper(getModifiersTypeFromMappedType(type2), context))
|
|
50319
|
+
)),
|
|
50320
|
+
result,
|
|
50321
|
+
factory.createKeywordTypeNode(146 /* NeverKeyword */)
|
|
50322
|
+
);
|
|
50283
50323
|
}
|
|
50284
50324
|
return result;
|
|
50285
50325
|
}
|
|
@@ -54052,7 +54092,7 @@ ${lanes.join("\n")}
|
|
|
54052
54092
|
false,
|
|
54053
54093
|
definedInMethod && !definedInConstructor
|
|
54054
54094
|
));
|
|
54055
|
-
if (symbol.valueDeclaration && filterType(widened, (t) => !!(t.flags & ~98304 /* Nullable */)) === neverType) {
|
|
54095
|
+
if (symbol.valueDeclaration && isInJSFile(symbol.valueDeclaration) && filterType(widened, (t) => !!(t.flags & ~98304 /* Nullable */)) === neverType) {
|
|
54056
54096
|
reportImplicitAny(symbol.valueDeclaration, anyType);
|
|
54057
54097
|
return anyType;
|
|
54058
54098
|
}
|
|
@@ -55331,9 +55371,6 @@ ${lanes.join("\n")}
|
|
|
55331
55371
|
}
|
|
55332
55372
|
return type;
|
|
55333
55373
|
}
|
|
55334
|
-
function isTypeUsableAsPropertyName(type) {
|
|
55335
|
-
return !!(type.flags & 8576 /* StringOrNumberLiteralOrUnique */);
|
|
55336
|
-
}
|
|
55337
55374
|
function isLateBindableName(node) {
|
|
55338
55375
|
if (!isComputedPropertyName(node) && !isElementAccessExpression(node)) {
|
|
55339
55376
|
return false;
|
|
@@ -55354,15 +55391,6 @@ ${lanes.join("\n")}
|
|
|
55354
55391
|
function isNonBindableDynamicName(node) {
|
|
55355
55392
|
return isDynamicName(node) && !isLateBindableName(node);
|
|
55356
55393
|
}
|
|
55357
|
-
function getPropertyNameFromType(type) {
|
|
55358
|
-
if (type.flags & 8192 /* UniqueESSymbol */) {
|
|
55359
|
-
return type.escapedName;
|
|
55360
|
-
}
|
|
55361
|
-
if (type.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */)) {
|
|
55362
|
-
return escapeLeadingUnderscores("" + type.value);
|
|
55363
|
-
}
|
|
55364
|
-
return Debug.fail();
|
|
55365
|
-
}
|
|
55366
55394
|
function addDeclarationToLateBoundSymbol(symbol, member, symbolFlags) {
|
|
55367
55395
|
Debug.assert(!!(getCheckFlags(symbol) & 4096 /* Late */), "Expected a late-bound symbol.");
|
|
55368
55396
|
symbol.flags |= symbolFlags;
|
|
@@ -55412,6 +55440,7 @@ ${lanes.join("\n")}
|
|
|
55412
55440
|
return links.resolvedSymbol;
|
|
55413
55441
|
}
|
|
55414
55442
|
function getResolvedMembersOrExportsOfSymbol(symbol, resolutionKind) {
|
|
55443
|
+
var _a, _b, _c;
|
|
55415
55444
|
const links = getSymbolLinks(symbol);
|
|
55416
55445
|
if (!links[resolutionKind]) {
|
|
55417
55446
|
const isStatic2 = resolutionKind === "resolvedExports" /* resolvedExports */;
|
|
@@ -55430,7 +55459,7 @@ ${lanes.join("\n")}
|
|
|
55430
55459
|
}
|
|
55431
55460
|
}
|
|
55432
55461
|
}
|
|
55433
|
-
const assignments = symbol.assignmentDeclarationMembers;
|
|
55462
|
+
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;
|
|
55434
55463
|
if (assignments) {
|
|
55435
55464
|
const decls = arrayFrom(assignments.values());
|
|
55436
55465
|
for (const member of decls) {
|
|
@@ -55559,7 +55588,7 @@ ${lanes.join("\n")}
|
|
|
55559
55588
|
/*resolvedTypePredicate*/
|
|
55560
55589
|
void 0,
|
|
55561
55590
|
sig.minArgumentCount,
|
|
55562
|
-
sig.flags &
|
|
55591
|
+
sig.flags & 167 /* PropagatingFlags */
|
|
55563
55592
|
);
|
|
55564
55593
|
result.target = sig.target;
|
|
55565
55594
|
result.mapper = sig.mapper;
|
|
@@ -55860,7 +55889,7 @@ ${lanes.join("\n")}
|
|
|
55860
55889
|
/*resolvedTypePredicate*/
|
|
55861
55890
|
void 0,
|
|
55862
55891
|
minArgCount,
|
|
55863
|
-
(left.flags | right.flags) &
|
|
55892
|
+
(left.flags | right.flags) & 167 /* PropagatingFlags */
|
|
55864
55893
|
);
|
|
55865
55894
|
result.compositeKind = 1048576 /* Union */;
|
|
55866
55895
|
result.compositeSignatures = concatenate(left.compositeKind !== 2097152 /* Intersection */ && left.compositeSignatures || [left], [right]);
|
|
@@ -56008,20 +56037,17 @@ ${lanes.join("\n")}
|
|
|
56008
56037
|
setStructuredTypeMembers(type, members2, callSignatures, constructSignatures, indexInfos2);
|
|
56009
56038
|
return;
|
|
56010
56039
|
}
|
|
56011
|
-
let members =
|
|
56040
|
+
let members = getExportsOfSymbol(symbol);
|
|
56012
56041
|
let indexInfos;
|
|
56013
|
-
if (symbol
|
|
56014
|
-
|
|
56015
|
-
|
|
56016
|
-
|
|
56017
|
-
|
|
56018
|
-
|
|
56019
|
-
|
|
56020
|
-
|
|
56021
|
-
|
|
56022
|
-
});
|
|
56023
|
-
members = varsOnly;
|
|
56024
|
-
}
|
|
56042
|
+
if (symbol === globalThisSymbol) {
|
|
56043
|
+
const varsOnly = /* @__PURE__ */ new Map();
|
|
56044
|
+
members.forEach((p) => {
|
|
56045
|
+
var _a;
|
|
56046
|
+
if (!(p.flags & 418 /* BlockScoped */) && !(p.flags & 512 /* ValueModule */ && ((_a = p.declarations) == null ? void 0 : _a.length) && every(p.declarations, isAmbientModule))) {
|
|
56047
|
+
varsOnly.set(p.escapedName, p);
|
|
56048
|
+
}
|
|
56049
|
+
});
|
|
56050
|
+
members = varsOnly;
|
|
56025
56051
|
}
|
|
56026
56052
|
let baseConstructorIndexInfo;
|
|
56027
56053
|
setStructuredTypeMembers(type, members, emptyArray, emptyArray, emptyArray);
|
|
@@ -56070,7 +56096,7 @@ ${lanes.join("\n")}
|
|
|
56070
56096
|
/*resolvedTypePredicate*/
|
|
56071
56097
|
void 0,
|
|
56072
56098
|
sig.minArgumentCount,
|
|
56073
|
-
sig.flags &
|
|
56099
|
+
sig.flags & 167 /* PropagatingFlags */
|
|
56074
56100
|
) : void 0
|
|
56075
56101
|
));
|
|
56076
56102
|
}
|
|
@@ -60853,7 +60879,7 @@ ${lanes.join("\n")}
|
|
|
60853
60879
|
/*resolvedTypePredicate*/
|
|
60854
60880
|
void 0,
|
|
60855
60881
|
signature.minArgumentCount,
|
|
60856
|
-
signature.flags &
|
|
60882
|
+
signature.flags & 167 /* PropagatingFlags */
|
|
60857
60883
|
);
|
|
60858
60884
|
result.target = signature;
|
|
60859
60885
|
result.mapper = mapper;
|
|
@@ -68114,12 +68140,15 @@ ${lanes.join("\n")}
|
|
|
68114
68140
|
return narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue);
|
|
68115
68141
|
}
|
|
68116
68142
|
const target = getReferenceCandidate(expr.right);
|
|
68117
|
-
|
|
68118
|
-
|
|
68119
|
-
if (
|
|
68143
|
+
if (containsMissingType(type) && isAccessExpression(reference) && isMatchingReference(reference.expression, target)) {
|
|
68144
|
+
const leftType = getTypeOfExpression(expr.left);
|
|
68145
|
+
if (isTypeUsableAsPropertyName(leftType) && getAccessedPropertyName(reference) === getPropertyNameFromType(leftType)) {
|
|
68120
68146
|
return getTypeWithFacts(type, assumeTrue ? 524288 /* NEUndefined */ : 65536 /* EQUndefined */);
|
|
68121
68147
|
}
|
|
68122
|
-
|
|
68148
|
+
}
|
|
68149
|
+
if (isMatchingReference(reference, target)) {
|
|
68150
|
+
const leftType = getTypeOfExpression(expr.left);
|
|
68151
|
+
if (isTypeUsableAsPropertyName(leftType)) {
|
|
68123
68152
|
return narrowTypeByInKeyword(type, leftType, assumeTrue);
|
|
68124
68153
|
}
|
|
68125
68154
|
}
|
|
@@ -68384,15 +68413,6 @@ ${lanes.join("\n")}
|
|
|
68384
68413
|
return type;
|
|
68385
68414
|
}
|
|
68386
68415
|
const rightType = getTypeOfExpression(expr.right);
|
|
68387
|
-
const hasInstanceMethodType = getSymbolHasInstanceMethodOfObjectType(rightType);
|
|
68388
|
-
if (hasInstanceMethodType) {
|
|
68389
|
-
const syntheticCall = createSyntheticHasInstanceMethodCall(left, expr.right, type, hasInstanceMethodType);
|
|
68390
|
-
const signature = getEffectsSignature(syntheticCall);
|
|
68391
|
-
const predicate = signature && getTypePredicateOfSignature(signature);
|
|
68392
|
-
if (predicate && (predicate.kind === 0 /* This */ || predicate.kind === 1 /* Identifier */)) {
|
|
68393
|
-
return narrowTypeByTypePredicate(type, predicate, syntheticCall, assumeTrue);
|
|
68394
|
-
}
|
|
68395
|
-
}
|
|
68396
68416
|
if (!isTypeDerivedFrom(rightType, globalFunctionType)) {
|
|
68397
68417
|
return type;
|
|
68398
68418
|
}
|
|
@@ -68472,12 +68492,8 @@ ${lanes.join("\n")}
|
|
|
68472
68492
|
}
|
|
68473
68493
|
function narrowTypeByTypePredicate(type, predicate, callExpression, assumeTrue) {
|
|
68474
68494
|
if (predicate.type && !(isTypeAny(type) && (predicate.type === globalObjectType || predicate.type === globalFunctionType))) {
|
|
68475
|
-
|
|
68495
|
+
const predicateArgument = getTypePredicateArgument(predicate, callExpression);
|
|
68476
68496
|
if (predicateArgument) {
|
|
68477
|
-
if (isSyntheticExpression(predicateArgument) && predicate.parameterIndex === 0 && isSyntheticHasInstanceMethodCall(callExpression)) {
|
|
68478
|
-
Debug.assertNode(predicateArgument.parent, isExpression);
|
|
68479
|
-
predicateArgument = predicateArgument.parent;
|
|
68480
|
-
}
|
|
68481
68497
|
if (isMatchingReference(reference, predicateArgument)) {
|
|
68482
68498
|
return getNarrowedType(
|
|
68483
68499
|
type,
|
|
@@ -69730,41 +69746,75 @@ ${lanes.join("\n")}
|
|
|
69730
69746
|
return mapType(
|
|
69731
69747
|
type,
|
|
69732
69748
|
(t) => {
|
|
69733
|
-
|
|
69734
|
-
|
|
69735
|
-
|
|
69736
|
-
|
|
69737
|
-
const
|
|
69738
|
-
|
|
69739
|
-
|
|
69740
|
-
|
|
69741
|
-
|
|
69742
|
-
|
|
69743
|
-
|
|
69744
|
-
|
|
69745
|
-
|
|
69746
|
-
|
|
69747
|
-
|
|
69748
|
-
|
|
69749
|
-
|
|
69750
|
-
/*endSkipCount*/
|
|
69751
|
-
0,
|
|
69752
|
-
/*writing*/
|
|
69753
|
-
false,
|
|
69754
|
-
/*noReductions*/
|
|
69755
|
-
true
|
|
69756
|
-
);
|
|
69757
|
-
if (restType) {
|
|
69758
|
-
return restType;
|
|
69749
|
+
if (!(t.flags & 3670016 /* StructuredType */)) {
|
|
69750
|
+
return void 0;
|
|
69751
|
+
}
|
|
69752
|
+
if (t.flags & 2097152 /* Intersection */) {
|
|
69753
|
+
const intersection = t;
|
|
69754
|
+
let applicableIndexedMappedTypeSubstitions;
|
|
69755
|
+
let concretePropertyTypes;
|
|
69756
|
+
let applicableIndexInfoCandidates;
|
|
69757
|
+
for (const t2 of intersection.types) {
|
|
69758
|
+
if (isGenericMappedType(t2) && !t2.declaration.nameType) {
|
|
69759
|
+
applicableIndexedMappedTypeSubstitions = append(applicableIndexedMappedTypeSubstitions, getTypeOfApplicableIndexedMappedTypeSubstitutionOfContextualType(t2));
|
|
69760
|
+
continue;
|
|
69761
|
+
}
|
|
69762
|
+
const typeOfConcreteProperty = getTypeOfConcretePropertyOfContextualType(t2);
|
|
69763
|
+
if (typeOfConcreteProperty) {
|
|
69764
|
+
concretePropertyTypes = append(concretePropertyTypes, typeOfConcreteProperty);
|
|
69765
|
+
continue;
|
|
69759
69766
|
}
|
|
69767
|
+
applicableIndexInfoCandidates = append(applicableIndexInfoCandidates, t2);
|
|
69768
|
+
}
|
|
69769
|
+
if (concretePropertyTypes) {
|
|
69770
|
+
return getIntersectionType(concatenate(concretePropertyTypes, applicableIndexedMappedTypeSubstitions));
|
|
69771
|
+
}
|
|
69772
|
+
const types = concatenate(mapDefined(applicableIndexInfoCandidates, getTypeOfApplicableIndexInfoOfContextualType), applicableIndexedMappedTypeSubstitions);
|
|
69773
|
+
if (types.length > 0) {
|
|
69774
|
+
return getIntersectionType(types);
|
|
69760
69775
|
}
|
|
69761
|
-
return
|
|
69776
|
+
return void 0;
|
|
69762
69777
|
}
|
|
69763
|
-
return
|
|
69778
|
+
return isGenericMappedType(t) && !t.declaration.nameType ? getTypeOfApplicableIndexedMappedTypeSubstitutionOfContextualType(t) : getTypeOfConcretePropertyOfContextualType(t) || getTypeOfApplicableIndexInfoOfContextualType(t);
|
|
69764
69779
|
},
|
|
69765
69780
|
/*noReductions*/
|
|
69766
69781
|
true
|
|
69767
69782
|
);
|
|
69783
|
+
function getTypeOfApplicableIndexedMappedTypeSubstitutionOfContextualType(t) {
|
|
69784
|
+
const constraint = getConstraintTypeFromMappedType(t);
|
|
69785
|
+
const constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
|
|
69786
|
+
const propertyNameType = nameType || getStringLiteralType(unescapeLeadingUnderscores(name));
|
|
69787
|
+
if (isTypeAssignableTo(propertyNameType, constraintOfConstraint)) {
|
|
69788
|
+
return substituteIndexedMappedType(t, propertyNameType);
|
|
69789
|
+
}
|
|
69790
|
+
return void 0;
|
|
69791
|
+
}
|
|
69792
|
+
function getTypeOfConcretePropertyOfContextualType(t) {
|
|
69793
|
+
const prop = getPropertyOfType(t, name);
|
|
69794
|
+
if (prop) {
|
|
69795
|
+
return isCircularMappedProperty(prop) ? void 0 : getTypeOfSymbol(prop);
|
|
69796
|
+
}
|
|
69797
|
+
if (isTupleType(t) && isNumericLiteralName(name) && +name >= 0) {
|
|
69798
|
+
const restType = getElementTypeOfSliceOfTupleType(
|
|
69799
|
+
t,
|
|
69800
|
+
t.target.fixedLength,
|
|
69801
|
+
/*endSkipCount*/
|
|
69802
|
+
0,
|
|
69803
|
+
/*writing*/
|
|
69804
|
+
false,
|
|
69805
|
+
/*noReductions*/
|
|
69806
|
+
true
|
|
69807
|
+
);
|
|
69808
|
+
if (restType) {
|
|
69809
|
+
return restType;
|
|
69810
|
+
}
|
|
69811
|
+
}
|
|
69812
|
+
return void 0;
|
|
69813
|
+
}
|
|
69814
|
+
function getTypeOfApplicableIndexInfoOfContextualType(t) {
|
|
69815
|
+
var _a;
|
|
69816
|
+
return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(unescapeLeadingUnderscores(name)))) == null ? void 0 : _a.type;
|
|
69817
|
+
}
|
|
69768
69818
|
}
|
|
69769
69819
|
function getContextualTypeForObjectLiteralMethod(node, contextFlags) {
|
|
69770
69820
|
Debug.assert(isObjectLiteralMethod(node));
|
|
@@ -70315,7 +70365,7 @@ ${lanes.join("\n")}
|
|
|
70315
70365
|
/*resolvedTypePredicate*/
|
|
70316
70366
|
void 0,
|
|
70317
70367
|
minArgCount,
|
|
70318
|
-
(left.flags | right.flags) &
|
|
70368
|
+
(left.flags | right.flags) & 167 /* PropagatingFlags */
|
|
70319
70369
|
);
|
|
70320
70370
|
result.compositeKind = 2097152 /* Intersection */;
|
|
70321
70371
|
result.compositeSignatures = concatenate(left.compositeKind === 2097152 /* Intersection */ && left.compositeSignatures || [left], [right]);
|
|
@@ -73054,7 +73104,7 @@ ${lanes.join("\n")}
|
|
|
73054
73104
|
}
|
|
73055
73105
|
return createDiagnosticForNodeArray(getSourceFileOfNode(node), typeArguments, Diagnostics.Expected_0_type_arguments_but_got_1, belowArgCount === -Infinity ? aboveArgCount : belowArgCount, argCount);
|
|
73056
73106
|
}
|
|
73057
|
-
function resolveCall(node, signatures, candidatesOutArray, checkMode, callChainFlags,
|
|
73107
|
+
function resolveCall(node, signatures, candidatesOutArray, checkMode, callChainFlags, headMessage) {
|
|
73058
73108
|
const isTaggedTemplate = node.kind === 215 /* TaggedTemplateExpression */;
|
|
73059
73109
|
const isDecorator2 = node.kind === 170 /* Decorator */;
|
|
73060
73110
|
const isJsxOpeningOrSelfClosingElement = isJsxOpeningLikeElement(node);
|
|
@@ -73097,7 +73147,6 @@ ${lanes.join("\n")}
|
|
|
73097
73147
|
chain = chainDiagnosticMessages(chain, Diagnostics.The_last_overload_gave_the_following_error);
|
|
73098
73148
|
chain = chainDiagnosticMessages(chain, Diagnostics.No_overload_matches_this_call);
|
|
73099
73149
|
}
|
|
73100
|
-
const headMessage = headMessageCallback == null ? void 0 : headMessageCallback();
|
|
73101
73150
|
if (headMessage) {
|
|
73102
73151
|
chain = chainDiagnosticMessages(chain, headMessage);
|
|
73103
73152
|
}
|
|
@@ -73165,7 +73214,6 @@ ${lanes.join("\n")}
|
|
|
73165
73214
|
map(diags, createDiagnosticMessageChainFromDiagnostic),
|
|
73166
73215
|
Diagnostics.No_overload_matches_this_call
|
|
73167
73216
|
);
|
|
73168
|
-
const headMessage = headMessageCallback == null ? void 0 : headMessageCallback();
|
|
73169
73217
|
if (headMessage) {
|
|
73170
73218
|
chain = chainDiagnosticMessages(chain, headMessage);
|
|
73171
73219
|
}
|
|
@@ -73181,21 +73229,21 @@ ${lanes.join("\n")}
|
|
|
73181
73229
|
diagnostics.add(diag2);
|
|
73182
73230
|
}
|
|
73183
73231
|
} else if (candidateForArgumentArityError) {
|
|
73184
|
-
diagnostics.add(getArgumentArityError(node, [candidateForArgumentArityError], args,
|
|
73232
|
+
diagnostics.add(getArgumentArityError(node, [candidateForArgumentArityError], args, headMessage));
|
|
73185
73233
|
} else if (candidateForTypeArgumentError) {
|
|
73186
73234
|
checkTypeArguments(
|
|
73187
73235
|
candidateForTypeArgumentError,
|
|
73188
73236
|
node.typeArguments,
|
|
73189
73237
|
/*reportErrors*/
|
|
73190
73238
|
true,
|
|
73191
|
-
|
|
73239
|
+
headMessage
|
|
73192
73240
|
);
|
|
73193
73241
|
} else {
|
|
73194
73242
|
const signaturesWithCorrectTypeArgumentArity = filter(signatures, (s) => hasCorrectTypeArgumentArity(s, typeArguments));
|
|
73195
73243
|
if (signaturesWithCorrectTypeArgumentArity.length === 0) {
|
|
73196
|
-
diagnostics.add(getTypeArgumentArityError(node, signatures, typeArguments,
|
|
73244
|
+
diagnostics.add(getTypeArgumentArityError(node, signatures, typeArguments, headMessage));
|
|
73197
73245
|
} else {
|
|
73198
|
-
diagnostics.add(getArgumentArityError(node, signaturesWithCorrectTypeArgumentArity, args,
|
|
73246
|
+
diagnostics.add(getArgumentArityError(node, signaturesWithCorrectTypeArgumentArity, args, headMessage));
|
|
73199
73247
|
}
|
|
73200
73248
|
}
|
|
73201
73249
|
}
|
|
@@ -73346,7 +73394,7 @@ ${lanes.join("\n")}
|
|
|
73346
73394
|
parameters.push(createCombinedSymbolFromTypes(symbols, mapDefined(candidates, (candidate) => tryGetTypeAtPosition(candidate, i))));
|
|
73347
73395
|
}
|
|
73348
73396
|
const restParameterSymbols = mapDefined(candidates, (c) => signatureHasRestParameter(c) ? last(c.parameters) : void 0);
|
|
73349
|
-
let flags =
|
|
73397
|
+
let flags = 128 /* IsSignatureCandidateForOverloadFailure */;
|
|
73350
73398
|
if (restParameterSymbols.length !== 0) {
|
|
73351
73399
|
const type = createArrayType(getUnionType(mapDefined(candidates, tryGetRestTypeOfSignature), 2 /* Subtype */));
|
|
73352
73400
|
parameters.push(createCombinedSymbolForOverloadFailure(restParameterSymbols, type));
|
|
@@ -73503,7 +73551,7 @@ ${lanes.join("\n")}
|
|
|
73503
73551
|
error2(node, Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new, typeToString(funcType));
|
|
73504
73552
|
return resolveErrorCall(node);
|
|
73505
73553
|
}
|
|
73506
|
-
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, callChainFlags
|
|
73554
|
+
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, callChainFlags);
|
|
73507
73555
|
}
|
|
73508
73556
|
function isGenericFunctionReturningFunction(signature) {
|
|
73509
73557
|
return !!(signature.typeParameters && isFunctionType(getReturnTypeOfSignature(signature)));
|
|
@@ -73800,7 +73848,7 @@ ${lanes.join("\n")}
|
|
|
73800
73848
|
invocationErrorRecovery(apparentType, 0 /* Call */, diag2);
|
|
73801
73849
|
return resolveErrorCall(node);
|
|
73802
73850
|
}
|
|
73803
|
-
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, 0 /* None */,
|
|
73851
|
+
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, 0 /* None */, headMessage);
|
|
73804
73852
|
}
|
|
73805
73853
|
function createSignatureForJSXIntrinsic(node, result) {
|
|
73806
73854
|
const namespace = getJsxNamespaceAt(node);
|
|
@@ -74070,6 +74118,8 @@ ${lanes.join("\n")}
|
|
|
74070
74118
|
return returnType;
|
|
74071
74119
|
}
|
|
74072
74120
|
function checkDeprecatedSignature(signature, node) {
|
|
74121
|
+
if (signature.flags & 128 /* IsSignatureCandidateForOverloadFailure */)
|
|
74122
|
+
return;
|
|
74073
74123
|
if (signature.declaration && signature.declaration.flags & 536870912 /* Deprecated */) {
|
|
74074
74124
|
const suggestionNode = getDeprecatedSuggestionNode(node);
|
|
74075
74125
|
const name = tryGetPropertyAccessOrIdentifierToString(getInvokedExpression(node));
|
|
@@ -74543,7 +74593,7 @@ ${lanes.join("\n")}
|
|
|
74543
74593
|
}
|
|
74544
74594
|
return restParameter.escapedName;
|
|
74545
74595
|
}
|
|
74546
|
-
function
|
|
74596
|
+
function getParameterIdentifierInfoAtPosition(signature, pos) {
|
|
74547
74597
|
var _a;
|
|
74548
74598
|
if (((_a = signature.declaration) == null ? void 0 : _a.kind) === 324 /* JSDocFunctionType */) {
|
|
74549
74599
|
return void 0;
|
|
@@ -74551,10 +74601,16 @@ ${lanes.join("\n")}
|
|
|
74551
74601
|
const paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0);
|
|
74552
74602
|
if (pos < paramCount) {
|
|
74553
74603
|
const param = signature.parameters[pos];
|
|
74554
|
-
|
|
74604
|
+
const paramIdent = getParameterDeclarationIdentifier(param);
|
|
74605
|
+
return paramIdent ? {
|
|
74606
|
+
parameter: paramIdent,
|
|
74607
|
+
parameterName: param.escapedName,
|
|
74608
|
+
isRestParameter: false
|
|
74609
|
+
} : void 0;
|
|
74555
74610
|
}
|
|
74556
74611
|
const restParameter = signature.parameters[paramCount] || unknownSymbol;
|
|
74557
|
-
|
|
74612
|
+
const restIdent = getParameterDeclarationIdentifier(restParameter);
|
|
74613
|
+
if (!restIdent) {
|
|
74558
74614
|
return void 0;
|
|
74559
74615
|
}
|
|
74560
74616
|
const restType = getTypeOfSymbol(restParameter);
|
|
@@ -74563,18 +74619,19 @@ ${lanes.join("\n")}
|
|
|
74563
74619
|
const index = pos - paramCount;
|
|
74564
74620
|
const associatedName = associatedNames == null ? void 0 : associatedNames[index];
|
|
74565
74621
|
const isRestTupleElement = !!(associatedName == null ? void 0 : associatedName.dotDotDotToken);
|
|
74566
|
-
|
|
74567
|
-
|
|
74568
|
-
isRestTupleElement
|
|
74569
|
-
|
|
74622
|
+
if (associatedName) {
|
|
74623
|
+
Debug.assert(isIdentifier(associatedName.name));
|
|
74624
|
+
return { parameter: associatedName.name, parameterName: associatedName.name.escapedText, isRestParameter: isRestTupleElement };
|
|
74625
|
+
}
|
|
74626
|
+
return void 0;
|
|
74570
74627
|
}
|
|
74571
74628
|
if (pos === paramCount) {
|
|
74572
|
-
return
|
|
74629
|
+
return { parameter: restIdent, parameterName: restParameter.escapedName, isRestParameter: true };
|
|
74573
74630
|
}
|
|
74574
74631
|
return void 0;
|
|
74575
74632
|
}
|
|
74576
|
-
function
|
|
74577
|
-
return symbol.valueDeclaration && isParameter(symbol.valueDeclaration) && isIdentifier(symbol.valueDeclaration.name);
|
|
74633
|
+
function getParameterDeclarationIdentifier(symbol) {
|
|
74634
|
+
return symbol.valueDeclaration && isParameter(symbol.valueDeclaration) && isIdentifier(symbol.valueDeclaration.name) && symbol.valueDeclaration.name;
|
|
74578
74635
|
}
|
|
74579
74636
|
function isValidDeclarationForTupleLabel(d) {
|
|
74580
74637
|
return d.kind === 202 /* NamedTupleMember */ || isParameter(d) && d.name && isIdentifier(d.name);
|
|
@@ -75833,32 +75890,6 @@ ${lanes.join("\n")}
|
|
|
75833
75890
|
function isConstEnumSymbol(symbol) {
|
|
75834
75891
|
return (symbol.flags & 128 /* ConstEnum */) !== 0;
|
|
75835
75892
|
}
|
|
75836
|
-
function getSymbolHasInstanceMethodOfObjectType(type) {
|
|
75837
|
-
const hasInstancePropertyName = getPropertyNameForKnownSymbolName("hasInstance");
|
|
75838
|
-
const hasInstanceProperty = getPropertyOfObjectType(type, hasInstancePropertyName);
|
|
75839
|
-
if (hasInstanceProperty) {
|
|
75840
|
-
const hasInstancePropertyType = getTypeOfSymbol(hasInstanceProperty);
|
|
75841
|
-
if (hasInstancePropertyType && getSignaturesOfType(hasInstancePropertyType, 0 /* Call */).length !== 0) {
|
|
75842
|
-
return hasInstancePropertyType;
|
|
75843
|
-
}
|
|
75844
|
-
}
|
|
75845
|
-
}
|
|
75846
|
-
function createSyntheticHasInstanceMethodCall(left, right, leftType, hasInstanceMethodType) {
|
|
75847
|
-
const syntheticExpression = createSyntheticExpression(right, hasInstanceMethodType);
|
|
75848
|
-
const syntheticArgument = createSyntheticExpression(left, leftType);
|
|
75849
|
-
const syntheticCall = parseNodeFactory.createCallExpression(
|
|
75850
|
-
syntheticExpression,
|
|
75851
|
-
/*typeArguments*/
|
|
75852
|
-
void 0,
|
|
75853
|
-
[syntheticArgument]
|
|
75854
|
-
);
|
|
75855
|
-
setParent(syntheticCall, left.parent);
|
|
75856
|
-
setTextRange(syntheticCall, left.parent);
|
|
75857
|
-
return syntheticCall;
|
|
75858
|
-
}
|
|
75859
|
-
function isSyntheticHasInstanceMethodCall(node) {
|
|
75860
|
-
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;
|
|
75861
|
-
}
|
|
75862
75893
|
function checkInstanceOfExpression(left, right, leftType, rightType) {
|
|
75863
75894
|
if (leftType === silentNeverType || rightType === silentNeverType) {
|
|
75864
75895
|
return silentNeverType;
|
|
@@ -75866,31 +75897,8 @@ ${lanes.join("\n")}
|
|
|
75866
75897
|
if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 402784252 /* Primitive */)) {
|
|
75867
75898
|
error2(left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
|
|
75868
75899
|
}
|
|
75869
|
-
if (!isTypeAny(rightType)) {
|
|
75870
|
-
|
|
75871
|
-
if (hasInstanceMethodType) {
|
|
75872
|
-
const cache = hasInstanceMethodType;
|
|
75873
|
-
if (cache.hasSimpleUnrestrictedSingleCallSignature === void 0) {
|
|
75874
|
-
const signature = getSingleCallSignature(hasInstanceMethodType);
|
|
75875
|
-
cache.hasSimpleUnrestrictedSingleCallSignature = !!signature && signature.parameters.length === 1 && !!(getTypeOfSymbol(signature.parameters[0]).flags & 3 /* AnyOrUnknown */) && !!signature.resolvedReturnType && !!(signature.resolvedReturnType.flags & 16 /* Boolean */);
|
|
75876
|
-
}
|
|
75877
|
-
if (!cache.hasSimpleUnrestrictedSingleCallSignature) {
|
|
75878
|
-
const syntheticCall = createSyntheticHasInstanceMethodCall(left, right, leftType, hasInstanceMethodType);
|
|
75879
|
-
const returnType = getReturnTypeOfSignature(getResolvedSignature(syntheticCall));
|
|
75880
|
-
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);
|
|
75881
|
-
}
|
|
75882
|
-
}
|
|
75883
|
-
if (!(hasInstanceMethodType || typeHasCallOrConstructSignatures(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
|
|
75884
|
-
if (hasGlobalSymbolHasInstanceProperty === void 0) {
|
|
75885
|
-
const globalESSymbolConstructorSymbol = getGlobalESSymbolConstructorTypeSymbol(
|
|
75886
|
-
/*reportErrors*/
|
|
75887
|
-
false
|
|
75888
|
-
);
|
|
75889
|
-
hasGlobalSymbolHasInstanceProperty = !!globalESSymbolConstructorSymbol && getMembersOfSymbol(globalESSymbolConstructorSymbol).has("hasInstance");
|
|
75890
|
-
}
|
|
75891
|
-
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;
|
|
75892
|
-
error2(right, message);
|
|
75893
|
-
}
|
|
75900
|
+
if (!(isTypeAny(rightType) || typeHasCallOrConstructSignatures(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
|
|
75901
|
+
error2(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);
|
|
75894
75902
|
}
|
|
75895
75903
|
return booleanType;
|
|
75896
75904
|
}
|
|
@@ -125259,7 +125267,6 @@ ${lanes.join("\n")}
|
|
|
125259
125267
|
if (hasChangedCompilerOptions) {
|
|
125260
125268
|
newLine = updateNewLine();
|
|
125261
125269
|
if (program && changesAffectModuleResolution(program.getCompilerOptions(), compilerOptions)) {
|
|
125262
|
-
debugger;
|
|
125263
125270
|
resolutionCache.onChangesAffectModuleResolution();
|
|
125264
125271
|
}
|
|
125265
125272
|
}
|
|
@@ -134462,8 +134469,8 @@ ${lanes.join("\n")}
|
|
|
134462
134469
|
diags.push(createDiagnosticForNode(init, Diagnostics.require_call_may_be_converted_to_an_import));
|
|
134463
134470
|
}
|
|
134464
134471
|
}
|
|
134465
|
-
const
|
|
134466
|
-
|
|
134472
|
+
const jsdocTypedefNodes = ts_codefix_exports.getJSDocTypedefNodes(node);
|
|
134473
|
+
for (const jsdocTypedefNode of jsdocTypedefNodes) {
|
|
134467
134474
|
diags.push(createDiagnosticForNode(jsdocTypedefNode, Diagnostics.JSDoc_typedef_may_be_converted_to_TypeScript_type));
|
|
134468
134475
|
}
|
|
134469
134476
|
if (ts_codefix_exports.parameterShouldGetTypeFromJSDoc(node)) {
|
|
@@ -148391,23 +148398,60 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
148391
148398
|
});
|
|
148392
148399
|
|
|
148393
148400
|
// src/services/codefixes/convertTypedefToType.ts
|
|
148394
|
-
function doChange12(changes, node, sourceFile) {
|
|
148395
|
-
if (isJSDocTypedefTag(node))
|
|
148396
|
-
fixSingleTypeDef(changes, node, sourceFile);
|
|
148397
|
-
}
|
|
148398
|
-
}
|
|
148399
|
-
function fixSingleTypeDef(changes, typeDefNode, sourceFile) {
|
|
148400
|
-
if (!typeDefNode)
|
|
148401
|
+
function doChange12(changes, node, sourceFile, newLine, fixAll = false) {
|
|
148402
|
+
if (!isJSDocTypedefTag(node))
|
|
148401
148403
|
return;
|
|
148402
|
-
const declaration = createDeclaration(
|
|
148404
|
+
const declaration = createDeclaration(node);
|
|
148403
148405
|
if (!declaration)
|
|
148404
148406
|
return;
|
|
148405
|
-
const
|
|
148406
|
-
|
|
148407
|
-
|
|
148408
|
-
|
|
148409
|
-
|
|
148407
|
+
const commentNode = node.parent;
|
|
148408
|
+
const { leftSibling, rightSibling } = getLeftAndRightSiblings(node);
|
|
148409
|
+
let pos = commentNode.getStart();
|
|
148410
|
+
let prefix = "";
|
|
148411
|
+
if (!leftSibling && commentNode.comment) {
|
|
148412
|
+
pos = findEndOfTextBetween(commentNode, commentNode.getStart(), node.getStart());
|
|
148413
|
+
prefix = `${newLine} */${newLine}`;
|
|
148414
|
+
}
|
|
148415
|
+
if (leftSibling) {
|
|
148416
|
+
if (fixAll && isJSDocTypedefTag(leftSibling)) {
|
|
148417
|
+
pos = node.getStart();
|
|
148418
|
+
prefix = "";
|
|
148419
|
+
} else {
|
|
148420
|
+
pos = findEndOfTextBetween(commentNode, leftSibling.getStart(), node.getStart());
|
|
148421
|
+
prefix = `${newLine} */${newLine}`;
|
|
148422
|
+
}
|
|
148423
|
+
}
|
|
148424
|
+
let end = commentNode.getEnd();
|
|
148425
|
+
let suffix = "";
|
|
148426
|
+
if (rightSibling) {
|
|
148427
|
+
if (fixAll && isJSDocTypedefTag(rightSibling)) {
|
|
148428
|
+
end = rightSibling.getStart();
|
|
148429
|
+
suffix = `${newLine}${newLine}`;
|
|
148430
|
+
} else {
|
|
148431
|
+
end = rightSibling.getStart();
|
|
148432
|
+
suffix = `${newLine}/**${newLine} * `;
|
|
148433
|
+
}
|
|
148434
|
+
}
|
|
148435
|
+
changes.replaceRange(sourceFile, { pos, end }, declaration, { prefix, suffix });
|
|
148436
|
+
}
|
|
148437
|
+
function getLeftAndRightSiblings(typedefNode) {
|
|
148438
|
+
const commentNode = typedefNode.parent;
|
|
148439
|
+
const maxChildIndex = commentNode.getChildCount() - 1;
|
|
148440
|
+
const currentNodeIndex = commentNode.getChildren().findIndex(
|
|
148441
|
+
(n) => n.getStart() === typedefNode.getStart() && n.getEnd() === typedefNode.getEnd()
|
|
148410
148442
|
);
|
|
148443
|
+
const leftSibling = currentNodeIndex > 0 ? commentNode.getChildAt(currentNodeIndex - 1) : void 0;
|
|
148444
|
+
const rightSibling = currentNodeIndex < maxChildIndex ? commentNode.getChildAt(currentNodeIndex + 1) : void 0;
|
|
148445
|
+
return { leftSibling, rightSibling };
|
|
148446
|
+
}
|
|
148447
|
+
function findEndOfTextBetween(jsDocComment, from, to) {
|
|
148448
|
+
const comment = jsDocComment.getText().substring(from - jsDocComment.getStart(), to - jsDocComment.getStart());
|
|
148449
|
+
for (let i = comment.length; i > 0; i--) {
|
|
148450
|
+
if (!/[*\/\s]/g.test(comment.substring(i - 1, i))) {
|
|
148451
|
+
return from + i;
|
|
148452
|
+
}
|
|
148453
|
+
}
|
|
148454
|
+
return to;
|
|
148411
148455
|
}
|
|
148412
148456
|
function createDeclaration(tag) {
|
|
148413
148457
|
var _a;
|
|
@@ -148428,7 +148472,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
148428
148472
|
const propertySignatures = createSignatureFromTypeLiteral(typeLiteral);
|
|
148429
148473
|
if (!some(propertySignatures))
|
|
148430
148474
|
return;
|
|
148431
|
-
|
|
148475
|
+
return factory.createInterfaceDeclaration(
|
|
148432
148476
|
/*modifiers*/
|
|
148433
148477
|
void 0,
|
|
148434
148478
|
typeName,
|
|
@@ -148438,13 +148482,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
148438
148482
|
void 0,
|
|
148439
148483
|
propertySignatures
|
|
148440
148484
|
);
|
|
148441
|
-
return interfaceDeclaration;
|
|
148442
148485
|
}
|
|
148443
148486
|
function createTypeAliasForTypeExpression(typeName, typeExpression) {
|
|
148444
148487
|
const typeReference = getSynthesizedDeepClone(typeExpression.type);
|
|
148445
148488
|
if (!typeReference)
|
|
148446
148489
|
return;
|
|
148447
|
-
|
|
148490
|
+
return factory.createTypeAliasDeclaration(
|
|
148448
148491
|
/*modifiers*/
|
|
148449
148492
|
void 0,
|
|
148450
148493
|
factory.createIdentifier(typeName),
|
|
@@ -148452,7 +148495,6 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
148452
148495
|
void 0,
|
|
148453
148496
|
typeReference
|
|
148454
148497
|
);
|
|
148455
|
-
return declaration;
|
|
148456
148498
|
}
|
|
148457
148499
|
function createSignatureFromTypeLiteral(typeLiteral) {
|
|
148458
148500
|
const propertyTags = typeLiteral.jsDocPropertyTags;
|
|
@@ -148472,30 +148514,28 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
148472
148514
|
}
|
|
148473
148515
|
if (typeReference && name) {
|
|
148474
148516
|
const questionToken = isOptional ? factory.createToken(58 /* QuestionToken */) : void 0;
|
|
148475
|
-
|
|
148517
|
+
return factory.createPropertySignature(
|
|
148476
148518
|
/*modifiers*/
|
|
148477
148519
|
void 0,
|
|
148478
148520
|
name,
|
|
148479
148521
|
questionToken,
|
|
148480
148522
|
typeReference
|
|
148481
148523
|
);
|
|
148482
|
-
return prop;
|
|
148483
148524
|
}
|
|
148484
148525
|
};
|
|
148485
|
-
|
|
148486
|
-
return props;
|
|
148526
|
+
return mapDefined(propertyTags, getSignature);
|
|
148487
148527
|
}
|
|
148488
148528
|
function getPropertyName(tag) {
|
|
148489
148529
|
return tag.name.kind === 80 /* Identifier */ ? tag.name.text : tag.name.right.text;
|
|
148490
148530
|
}
|
|
148491
|
-
function
|
|
148531
|
+
function getJSDocTypedefNodes(node) {
|
|
148492
148532
|
if (hasJSDocNodes(node)) {
|
|
148493
|
-
return
|
|
148533
|
+
return flatMap(node.jsDoc, (doc) => {
|
|
148494
148534
|
var _a;
|
|
148495
|
-
return (_a =
|
|
148535
|
+
return (_a = doc.tags) == null ? void 0 : _a.filter((tag) => isJSDocTypedefTag(tag));
|
|
148496
148536
|
});
|
|
148497
148537
|
}
|
|
148498
|
-
return
|
|
148538
|
+
return [];
|
|
148499
148539
|
}
|
|
148500
148540
|
var fixId14, errorCodes15;
|
|
148501
148541
|
var init_convertTypedefToType = __esm({
|
|
@@ -148509,13 +148549,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
148509
148549
|
fixIds: [fixId14],
|
|
148510
148550
|
errorCodes: errorCodes15,
|
|
148511
148551
|
getCodeActions(context) {
|
|
148552
|
+
const newLineCharacter = getNewLineOrDefaultFromHost(context.host, context.formatContext.options);
|
|
148512
148553
|
const node = getTokenAtPosition(
|
|
148513
148554
|
context.sourceFile,
|
|
148514
148555
|
context.span.start
|
|
148515
148556
|
);
|
|
148516
148557
|
if (!node)
|
|
148517
148558
|
return;
|
|
148518
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange12(t, node, context.sourceFile));
|
|
148559
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange12(t, node, context.sourceFile, newLineCharacter));
|
|
148519
148560
|
if (changes.length > 0) {
|
|
148520
148561
|
return [
|
|
148521
148562
|
createCodeFixAction(
|
|
@@ -148528,11 +148569,17 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
148528
148569
|
];
|
|
148529
148570
|
}
|
|
148530
148571
|
},
|
|
148531
|
-
getAllCodeActions: (context) => codeFixAll(
|
|
148532
|
-
|
|
148533
|
-
|
|
148534
|
-
|
|
148535
|
-
|
|
148572
|
+
getAllCodeActions: (context) => codeFixAll(
|
|
148573
|
+
context,
|
|
148574
|
+
errorCodes15,
|
|
148575
|
+
(changes, diag2) => {
|
|
148576
|
+
const newLineCharacter = getNewLineOrDefaultFromHost(context.host, context.formatContext.options);
|
|
148577
|
+
const node = getTokenAtPosition(diag2.file, diag2.start);
|
|
148578
|
+
const fixAll = true;
|
|
148579
|
+
if (node)
|
|
148580
|
+
doChange12(changes, node, diag2.file, newLineCharacter, fixAll);
|
|
148581
|
+
}
|
|
148582
|
+
)
|
|
148536
148583
|
});
|
|
148537
148584
|
}
|
|
148538
148585
|
});
|
|
@@ -149630,6 +149677,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
149630
149677
|
}
|
|
149631
149678
|
function promoteImportClause(importClause) {
|
|
149632
149679
|
changes.delete(sourceFile, getTypeKeywordOfTypeOnlyImport(importClause, sourceFile));
|
|
149680
|
+
if (!compilerOptions.allowImportingTsExtensions) {
|
|
149681
|
+
const moduleSpecifier = tryGetModuleSpecifierFromDeclaration(importClause.parent);
|
|
149682
|
+
const resolvedModule = moduleSpecifier && getResolvedModule(sourceFile, moduleSpecifier.text, getModeForUsageLocation(sourceFile, moduleSpecifier));
|
|
149683
|
+
if (resolvedModule == null ? void 0 : resolvedModule.resolvedUsingTsExtension) {
|
|
149684
|
+
const changedExtension = changeAnyExtension(moduleSpecifier.text, getOutputExtension(moduleSpecifier.text, compilerOptions));
|
|
149685
|
+
changes.replaceNode(sourceFile, moduleSpecifier, factory.createStringLiteral(changedExtension));
|
|
149686
|
+
}
|
|
149687
|
+
}
|
|
149633
149688
|
if (convertExistingToTypeOnly) {
|
|
149634
149689
|
const namedImports = tryCast(importClause.namedBindings, isNamedImports);
|
|
149635
149690
|
if (namedImports && namedImports.elements.length > 1) {
|
|
@@ -150807,6 +150862,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
150807
150862
|
if (!declaration || !isCallExpression(declaration.parent) || !declaration.body)
|
|
150808
150863
|
return void 0;
|
|
150809
150864
|
const pos = declaration.parent.arguments.indexOf(declaration);
|
|
150865
|
+
if (pos === -1)
|
|
150866
|
+
return void 0;
|
|
150810
150867
|
const type = checker.getContextualTypeForArgumentAtIndex(declaration.parent, pos);
|
|
150811
150868
|
if (!type)
|
|
150812
150869
|
return void 0;
|
|
@@ -154232,15 +154289,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154232
154289
|
}
|
|
154233
154290
|
function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, context, preferences, importAdder, addClassElement, body, preserveOptional = 3 /* All */, isAmbient = false) {
|
|
154234
154291
|
const declarations = symbol.getDeclarations();
|
|
154235
|
-
const declaration = declarations
|
|
154292
|
+
const declaration = firstOrUndefined(declarations);
|
|
154236
154293
|
const checker = context.program.getTypeChecker();
|
|
154237
154294
|
const scriptTarget = getEmitScriptTarget(context.program.getCompilerOptions());
|
|
154238
154295
|
const kind = (declaration == null ? void 0 : declaration.kind) ?? 171 /* PropertySignature */;
|
|
154239
|
-
const declarationName =
|
|
154240
|
-
getNameOfDeclaration(declaration),
|
|
154241
|
-
/*includeTrivia*/
|
|
154242
|
-
false
|
|
154243
|
-
);
|
|
154296
|
+
const declarationName = createDeclarationName(symbol, declaration);
|
|
154244
154297
|
const effectiveModifierFlags = declaration ? getEffectiveModifierFlags(declaration) : 0 /* None */;
|
|
154245
154298
|
let modifierFlags = effectiveModifierFlags & 32 /* Static */;
|
|
154246
154299
|
modifierFlags |= effectiveModifierFlags & 4 /* Public */ ? 4 /* Public */ : effectiveModifierFlags & 16 /* Protected */ ? 16 /* Protected */ : 0 /* None */;
|
|
@@ -154391,6 +154444,19 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154391
154444
|
false
|
|
154392
154445
|
);
|
|
154393
154446
|
}
|
|
154447
|
+
function createDeclarationName(symbol2, declaration2) {
|
|
154448
|
+
if (getCheckFlags(symbol2) & 262144 /* Mapped */) {
|
|
154449
|
+
const nameType = symbol2.links.nameType;
|
|
154450
|
+
if (nameType && isTypeUsableAsPropertyName(nameType)) {
|
|
154451
|
+
return factory.createIdentifier(unescapeLeadingUnderscores(getPropertyNameFromType(nameType)));
|
|
154452
|
+
}
|
|
154453
|
+
}
|
|
154454
|
+
return getSynthesizedDeepClone(
|
|
154455
|
+
getNameOfDeclaration(declaration2),
|
|
154456
|
+
/*includeTrivia*/
|
|
154457
|
+
false
|
|
154458
|
+
);
|
|
154459
|
+
}
|
|
154394
154460
|
}
|
|
154395
154461
|
function createSignatureDeclarationFromSignature(kind, context, quotePreference, signature, body, name, modifiers, optional, enclosingDeclaration, importAdder) {
|
|
154396
154462
|
const program = context.program;
|
|
@@ -156046,7 +156112,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
156046
156112
|
getFixes: () => getFixes,
|
|
156047
156113
|
getImportCompletionAction: () => getImportCompletionAction,
|
|
156048
156114
|
getImportKind: () => getImportKind,
|
|
156049
|
-
|
|
156115
|
+
getJSDocTypedefNodes: () => getJSDocTypedefNodes,
|
|
156050
156116
|
getNoopSymbolTrackerWithResolver: () => getNoopSymbolTrackerWithResolver,
|
|
156051
156117
|
getPromoteTypeOnlyCompletionAction: () => getPromoteTypeOnlyCompletionAction,
|
|
156052
156118
|
getSupportedErrorCodes: () => getSupportedErrorCodes,
|
|
@@ -158425,7 +158491,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
158425
158491
|
const leftMostName = getLeftMostName(computedPropertyName.expression);
|
|
158426
158492
|
const nameSymbol = leftMostName && typeChecker.getSymbolAtLocation(leftMostName);
|
|
158427
158493
|
const firstAccessibleSymbol = nameSymbol && getFirstSymbolInChain(nameSymbol, contextToken, typeChecker);
|
|
158428
|
-
|
|
158494
|
+
const firstAccessibleSymbolId = firstAccessibleSymbol && getSymbolId(firstAccessibleSymbol);
|
|
158495
|
+
if (firstAccessibleSymbolId && addToSeen(seenPropertySymbols, firstAccessibleSymbolId)) {
|
|
158429
158496
|
const index = symbols.length;
|
|
158430
158497
|
symbols.push(firstAccessibleSymbol);
|
|
158431
158498
|
const moduleSymbol = firstAccessibleSymbol.parent;
|
|
@@ -158455,6 +158522,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
158455
158522
|
}
|
|
158456
158523
|
}
|
|
158457
158524
|
} else if (preferences.includeCompletionsWithInsertText) {
|
|
158525
|
+
if (firstAccessibleSymbolId && seenPropertySymbols.has(firstAccessibleSymbolId)) {
|
|
158526
|
+
return;
|
|
158527
|
+
}
|
|
158458
158528
|
addSymbolOriginInfo(symbol);
|
|
158459
158529
|
addSymbolSortInfo(symbol);
|
|
158460
158530
|
symbols.push(symbol);
|
|
@@ -163918,6 +163988,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
163918
163988
|
function shouldShowLiteralParameterNameHintsOnly(preferences) {
|
|
163919
163989
|
return preferences.includeInlayParameterNameHints === "literals";
|
|
163920
163990
|
}
|
|
163991
|
+
function shouldUseInteractiveInlayHints(preferences) {
|
|
163992
|
+
return preferences.interactiveInlayHints === true;
|
|
163993
|
+
}
|
|
163921
163994
|
function provideInlayHints(context) {
|
|
163922
163995
|
const { file, program, span, cancellationToken, preferences } = context;
|
|
163923
163996
|
const sourceFileText = file.text;
|
|
@@ -163968,9 +164041,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
163968
164041
|
function isSignatureSupportingReturnAnnotation(node) {
|
|
163969
164042
|
return isArrowFunction(node) || isFunctionExpression(node) || isFunctionDeclaration(node) || isMethodDeclaration(node) || isGetAccessorDeclaration(node);
|
|
163970
164043
|
}
|
|
163971
|
-
function addParameterHints(text, position, isFirstVariadicArgument) {
|
|
164044
|
+
function addParameterHints(text, parameter, position, isFirstVariadicArgument, sourceFile) {
|
|
164045
|
+
let hintText = `${isFirstVariadicArgument ? "..." : ""}${text}`;
|
|
164046
|
+
if (shouldUseInteractiveInlayHints(preferences)) {
|
|
164047
|
+
hintText = [getNodeDisplayPart(hintText, parameter, sourceFile), { text: ":" }];
|
|
164048
|
+
} else {
|
|
164049
|
+
hintText += ":";
|
|
164050
|
+
}
|
|
163972
164051
|
result.push({
|
|
163973
|
-
text:
|
|
164052
|
+
text: hintText,
|
|
163974
164053
|
position,
|
|
163975
164054
|
kind: "Parameter" /* Parameter */,
|
|
163976
164055
|
whitespaceAfter: true
|
|
@@ -163978,7 +164057,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
163978
164057
|
}
|
|
163979
164058
|
function addTypeHints(text, position) {
|
|
163980
164059
|
result.push({
|
|
163981
|
-
text: `: ${
|
|
164060
|
+
text: `: ${text.length > maxTypeHintLength ? text.substr(0, maxTypeHintLength - "...".length) + "..." : text}`,
|
|
163982
164061
|
position,
|
|
163983
164062
|
kind: "Type" /* Type */,
|
|
163984
164063
|
whitespaceBefore: true
|
|
@@ -163986,7 +164065,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
163986
164065
|
}
|
|
163987
164066
|
function addEnumMemberValueHints(text, position) {
|
|
163988
164067
|
result.push({
|
|
163989
|
-
text: `= ${
|
|
164068
|
+
text: `= ${text}`,
|
|
163990
164069
|
position,
|
|
163991
164070
|
kind: "Enum" /* Enum */,
|
|
163992
164071
|
whitespaceBefore: true
|
|
@@ -164036,6 +164115,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
164036
164115
|
return;
|
|
164037
164116
|
}
|
|
164038
164117
|
let signatureParamPos = 0;
|
|
164118
|
+
const sourceFile = shouldUseInteractiveInlayHints(preferences) ? expr.getSourceFile() : void 0;
|
|
164039
164119
|
for (const originalArg of args) {
|
|
164040
164120
|
const arg = skipParentheses(originalArg);
|
|
164041
164121
|
if (shouldShowLiteralParameterNameHintsOnly(preferences) && !isHintableLiteral(arg)) {
|
|
@@ -164056,10 +164136,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
164056
164136
|
}
|
|
164057
164137
|
}
|
|
164058
164138
|
}
|
|
164059
|
-
const
|
|
164139
|
+
const identifierInfo = checker.getParameterIdentifierInfoAtPosition(signature, signatureParamPos);
|
|
164060
164140
|
signatureParamPos = signatureParamPos + (spreadArgs || 1);
|
|
164061
|
-
if (
|
|
164062
|
-
const
|
|
164141
|
+
if (identifierInfo) {
|
|
164142
|
+
const { parameter, parameterName, isRestParameter: isFirstVariadicArgument } = identifierInfo;
|
|
164063
164143
|
const isParameterNameNotSameAsArgument = preferences.includeInlayParameterNameHintsWhenArgumentMatchesName || !identifierOrAccessExpressionPostfixMatchesParameterName(arg, parameterName);
|
|
164064
164144
|
if (!isParameterNameNotSameAsArgument && !isFirstVariadicArgument) {
|
|
164065
164145
|
continue;
|
|
@@ -164068,7 +164148,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
164068
164148
|
if (leadingCommentsContainsParameterName(arg, name)) {
|
|
164069
164149
|
continue;
|
|
164070
164150
|
}
|
|
164071
|
-
addParameterHints(name, originalArg.getStart(), isFirstVariadicArgument);
|
|
164151
|
+
addParameterHints(name, parameter, originalArg.getStart(), isFirstVariadicArgument, sourceFile);
|
|
164072
164152
|
}
|
|
164073
164153
|
}
|
|
164074
164154
|
}
|
|
@@ -164174,12 +164254,6 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
164174
164254
|
}
|
|
164175
164255
|
return printTypeInSingleLine(signatureParamType);
|
|
164176
164256
|
}
|
|
164177
|
-
function truncation(text, maxLength2) {
|
|
164178
|
-
if (text.length > maxLength2) {
|
|
164179
|
-
return text.substr(0, maxLength2 - "...".length) + "...";
|
|
164180
|
-
}
|
|
164181
|
-
return text;
|
|
164182
|
-
}
|
|
164183
164257
|
function printTypeInSingleLine(type) {
|
|
164184
164258
|
const flags = 70221824 /* IgnoreErrors */ | 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */;
|
|
164185
164259
|
const printer = createPrinterWithRemoveComments();
|
|
@@ -164210,13 +164284,20 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
164210
164284
|
}
|
|
164211
164285
|
return true;
|
|
164212
164286
|
}
|
|
164287
|
+
function getNodeDisplayPart(text, node, sourceFile) {
|
|
164288
|
+
return {
|
|
164289
|
+
text,
|
|
164290
|
+
span: createTextSpanFromNode(node, sourceFile),
|
|
164291
|
+
file: sourceFile.fileName
|
|
164292
|
+
};
|
|
164293
|
+
}
|
|
164213
164294
|
}
|
|
164214
|
-
var
|
|
164295
|
+
var maxTypeHintLength, leadingParameterNameCommentRegexFactory;
|
|
164215
164296
|
var init_inlayHints = __esm({
|
|
164216
164297
|
"src/services/inlayHints.ts"() {
|
|
164217
164298
|
"use strict";
|
|
164218
164299
|
init_ts4();
|
|
164219
|
-
|
|
164300
|
+
maxTypeHintLength = 30;
|
|
164220
164301
|
leadingParameterNameCommentRegexFactory = (name) => {
|
|
164221
164302
|
return new RegExp(`^\\s?/\\*\\*?\\s?${name}\\s?\\*\\/\\s?$`);
|
|
164222
164303
|
};
|
|
@@ -166718,7 +166799,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
166718
166799
|
}
|
|
166719
166800
|
return modifiers.size > 0 ? arrayFrom(modifiers.values()).join(",") : "" /* none */;
|
|
166720
166801
|
}
|
|
166721
|
-
function
|
|
166802
|
+
function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symbol, sourceFile, enclosingDeclaration, location, type, semanticMeaning, alias) {
|
|
166722
166803
|
var _a;
|
|
166723
166804
|
const displayParts = [];
|
|
166724
166805
|
let documentation = [];
|
|
@@ -166727,7 +166808,6 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
166727
166808
|
let symbolKind = semanticMeaning & 1 /* Value */ ? getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, location) : "" /* unknown */;
|
|
166728
166809
|
let hasAddedSymbolInfo = false;
|
|
166729
166810
|
const isThisExpression = location.kind === 110 /* ThisKeyword */ && isInExpressionContext(location) || isThisInTypeQuery(location);
|
|
166730
|
-
let type;
|
|
166731
166811
|
let documentationFromAlias;
|
|
166732
166812
|
let tagsFromAlias;
|
|
166733
166813
|
let hasMultipleSignatures = false;
|
|
@@ -166756,7 +166836,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
166756
166836
|
}
|
|
166757
166837
|
}
|
|
166758
166838
|
let signature;
|
|
166759
|
-
type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location);
|
|
166839
|
+
type ?? (type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location));
|
|
166760
166840
|
if (location.parent && location.parent.kind === 211 /* PropertyAccessExpression */) {
|
|
166761
166841
|
const right = location.parent.name;
|
|
166762
166842
|
if (right === location || right && right.getFullWidth() === 0) {
|
|
@@ -166971,12 +167051,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
166971
167051
|
if (declarationName && !hasAddedSymbolInfo) {
|
|
166972
167052
|
const isExternalModuleDeclaration = isModuleWithStringLiteralName(resolvedNode) && hasSyntacticModifier(resolvedNode, 2 /* Ambient */);
|
|
166973
167053
|
const shouldUseAliasName = symbol.name !== "default" && !isExternalModuleDeclaration;
|
|
166974
|
-
const resolvedInfo =
|
|
167054
|
+
const resolvedInfo = getSymbolDisplayPartsDocumentationAndSymbolKindWorker(
|
|
166975
167055
|
typeChecker,
|
|
166976
167056
|
resolvedSymbol,
|
|
166977
167057
|
getSourceFileOfNode(resolvedNode),
|
|
166978
167058
|
resolvedNode,
|
|
166979
167059
|
declarationName,
|
|
167060
|
+
type,
|
|
166980
167061
|
semanticMeaning,
|
|
166981
167062
|
shouldUseAliasName ? symbol : resolvedSymbol
|
|
166982
167063
|
);
|
|
@@ -167231,6 +167312,19 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
167231
167312
|
addRange(displayParts, typeParameterParts);
|
|
167232
167313
|
}
|
|
167233
167314
|
}
|
|
167315
|
+
function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, enclosingDeclaration, location, semanticMeaning = getMeaningFromLocation(location), alias) {
|
|
167316
|
+
return getSymbolDisplayPartsDocumentationAndSymbolKindWorker(
|
|
167317
|
+
typeChecker,
|
|
167318
|
+
symbol,
|
|
167319
|
+
sourceFile,
|
|
167320
|
+
enclosingDeclaration,
|
|
167321
|
+
location,
|
|
167322
|
+
/*type*/
|
|
167323
|
+
void 0,
|
|
167324
|
+
semanticMeaning,
|
|
167325
|
+
alias
|
|
167326
|
+
);
|
|
167327
|
+
}
|
|
167234
167328
|
function isLocalVariableOrFunction(symbol) {
|
|
167235
167329
|
if (symbol.parent) {
|
|
167236
167330
|
return false;
|
|
@@ -180904,10 +180998,22 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
180904
180998
|
const { file, project } = this.getFileAndProject(args);
|
|
180905
180999
|
const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file);
|
|
180906
181000
|
const hints = project.getLanguageService().provideInlayHints(file, args, this.getPreferences(file));
|
|
180907
|
-
return hints.map((hint) =>
|
|
180908
|
-
|
|
180909
|
-
|
|
180910
|
-
|
|
181001
|
+
return hints.map((hint) => {
|
|
181002
|
+
const { text, position } = hint;
|
|
181003
|
+
const hintText = typeof text === "string" ? text : text.map(({ text: text2, span, file: file2 }) => ({
|
|
181004
|
+
text: text2,
|
|
181005
|
+
span: span && {
|
|
181006
|
+
start: scriptInfo.positionToLineOffset(span.start),
|
|
181007
|
+
end: scriptInfo.positionToLineOffset(span.start + span.length),
|
|
181008
|
+
file: file2
|
|
181009
|
+
}
|
|
181010
|
+
}));
|
|
181011
|
+
return {
|
|
181012
|
+
...hint,
|
|
181013
|
+
position: scriptInfo.positionToLineOffset(position),
|
|
181014
|
+
text: hintText
|
|
181015
|
+
};
|
|
181016
|
+
});
|
|
180911
181017
|
}
|
|
180912
181018
|
setCompilerOptionsForInferredProjects(args) {
|
|
180913
181019
|
this.projectService.setCompilerOptionsForInferredProjects(args.options, args.projectRootPath);
|
|
@@ -183940,6 +184046,7 @@ ${e.message}`;
|
|
|
183940
184046
|
getPropertyAssignmentAliasLikeExpression: () => getPropertyAssignmentAliasLikeExpression,
|
|
183941
184047
|
getPropertyNameForPropertyNameNode: () => getPropertyNameForPropertyNameNode,
|
|
183942
184048
|
getPropertyNameForUniqueESSymbol: () => getPropertyNameForUniqueESSymbol,
|
|
184049
|
+
getPropertyNameFromType: () => getPropertyNameFromType,
|
|
183943
184050
|
getPropertyNameOfBindingOrAssignmentElement: () => getPropertyNameOfBindingOrAssignmentElement,
|
|
183944
184051
|
getPropertySymbolFromBindingElement: () => getPropertySymbolFromBindingElement,
|
|
183945
184052
|
getPropertySymbolsFromContextualType: () => getPropertySymbolsFromContextualType,
|
|
@@ -184772,6 +184879,7 @@ ${e.message}`;
|
|
|
184772
184879
|
isTypeQueryNode: () => isTypeQueryNode,
|
|
184773
184880
|
isTypeReferenceNode: () => isTypeReferenceNode,
|
|
184774
184881
|
isTypeReferenceType: () => isTypeReferenceType,
|
|
184882
|
+
isTypeUsableAsPropertyName: () => isTypeUsableAsPropertyName,
|
|
184775
184883
|
isUMDExportSymbol: () => isUMDExportSymbol,
|
|
184776
184884
|
isUnaryExpression: () => isUnaryExpression,
|
|
184777
184885
|
isUnaryExpressionWithWrite: () => isUnaryExpressionWithWrite,
|
|
@@ -186343,6 +186451,7 @@ ${e.message}`;
|
|
|
186343
186451
|
getPropertyAssignmentAliasLikeExpression: () => getPropertyAssignmentAliasLikeExpression,
|
|
186344
186452
|
getPropertyNameForPropertyNameNode: () => getPropertyNameForPropertyNameNode,
|
|
186345
186453
|
getPropertyNameForUniqueESSymbol: () => getPropertyNameForUniqueESSymbol,
|
|
186454
|
+
getPropertyNameFromType: () => getPropertyNameFromType,
|
|
186346
186455
|
getPropertyNameOfBindingOrAssignmentElement: () => getPropertyNameOfBindingOrAssignmentElement,
|
|
186347
186456
|
getPropertySymbolFromBindingElement: () => getPropertySymbolFromBindingElement,
|
|
186348
186457
|
getPropertySymbolsFromContextualType: () => getPropertySymbolsFromContextualType,
|
|
@@ -187175,6 +187284,7 @@ ${e.message}`;
|
|
|
187175
187284
|
isTypeQueryNode: () => isTypeQueryNode,
|
|
187176
187285
|
isTypeReferenceNode: () => isTypeReferenceNode,
|
|
187177
187286
|
isTypeReferenceType: () => isTypeReferenceType,
|
|
187287
|
+
isTypeUsableAsPropertyName: () => isTypeUsableAsPropertyName,
|
|
187178
187288
|
isUMDExportSymbol: () => isUMDExportSymbol,
|
|
187179
187289
|
isUnaryExpression: () => isUnaryExpression,
|
|
187180
187290
|
isUnaryExpressionWithWrite: () => isUnaryExpressionWithWrite,
|