@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/typescript.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);
|
|
69760
69768
|
}
|
|
69761
|
-
|
|
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);
|
|
69775
|
+
}
|
|
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
|
}
|
|
@@ -134477,8 +134484,8 @@ ${lanes.join("\n")}
|
|
|
134477
134484
|
diags.push(createDiagnosticForNode(init, Diagnostics.require_call_may_be_converted_to_an_import));
|
|
134478
134485
|
}
|
|
134479
134486
|
}
|
|
134480
|
-
const
|
|
134481
|
-
|
|
134487
|
+
const jsdocTypedefNodes = ts_codefix_exports.getJSDocTypedefNodes(node);
|
|
134488
|
+
for (const jsdocTypedefNode of jsdocTypedefNodes) {
|
|
134482
134489
|
diags.push(createDiagnosticForNode(jsdocTypedefNode, Diagnostics.JSDoc_typedef_may_be_converted_to_TypeScript_type));
|
|
134483
134490
|
}
|
|
134484
134491
|
if (ts_codefix_exports.parameterShouldGetTypeFromJSDoc(node)) {
|
|
@@ -148406,23 +148413,60 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
148406
148413
|
});
|
|
148407
148414
|
|
|
148408
148415
|
// src/services/codefixes/convertTypedefToType.ts
|
|
148409
|
-
function doChange12(changes, node, sourceFile) {
|
|
148410
|
-
if (isJSDocTypedefTag(node))
|
|
148411
|
-
fixSingleTypeDef(changes, node, sourceFile);
|
|
148412
|
-
}
|
|
148413
|
-
}
|
|
148414
|
-
function fixSingleTypeDef(changes, typeDefNode, sourceFile) {
|
|
148415
|
-
if (!typeDefNode)
|
|
148416
|
+
function doChange12(changes, node, sourceFile, newLine, fixAll = false) {
|
|
148417
|
+
if (!isJSDocTypedefTag(node))
|
|
148416
148418
|
return;
|
|
148417
|
-
const declaration = createDeclaration(
|
|
148419
|
+
const declaration = createDeclaration(node);
|
|
148418
148420
|
if (!declaration)
|
|
148419
148421
|
return;
|
|
148420
|
-
const
|
|
148421
|
-
|
|
148422
|
-
|
|
148423
|
-
|
|
148424
|
-
|
|
148422
|
+
const commentNode = node.parent;
|
|
148423
|
+
const { leftSibling, rightSibling } = getLeftAndRightSiblings(node);
|
|
148424
|
+
let pos = commentNode.getStart();
|
|
148425
|
+
let prefix = "";
|
|
148426
|
+
if (!leftSibling && commentNode.comment) {
|
|
148427
|
+
pos = findEndOfTextBetween(commentNode, commentNode.getStart(), node.getStart());
|
|
148428
|
+
prefix = `${newLine} */${newLine}`;
|
|
148429
|
+
}
|
|
148430
|
+
if (leftSibling) {
|
|
148431
|
+
if (fixAll && isJSDocTypedefTag(leftSibling)) {
|
|
148432
|
+
pos = node.getStart();
|
|
148433
|
+
prefix = "";
|
|
148434
|
+
} else {
|
|
148435
|
+
pos = findEndOfTextBetween(commentNode, leftSibling.getStart(), node.getStart());
|
|
148436
|
+
prefix = `${newLine} */${newLine}`;
|
|
148437
|
+
}
|
|
148438
|
+
}
|
|
148439
|
+
let end = commentNode.getEnd();
|
|
148440
|
+
let suffix = "";
|
|
148441
|
+
if (rightSibling) {
|
|
148442
|
+
if (fixAll && isJSDocTypedefTag(rightSibling)) {
|
|
148443
|
+
end = rightSibling.getStart();
|
|
148444
|
+
suffix = `${newLine}${newLine}`;
|
|
148445
|
+
} else {
|
|
148446
|
+
end = rightSibling.getStart();
|
|
148447
|
+
suffix = `${newLine}/**${newLine} * `;
|
|
148448
|
+
}
|
|
148449
|
+
}
|
|
148450
|
+
changes.replaceRange(sourceFile, { pos, end }, declaration, { prefix, suffix });
|
|
148451
|
+
}
|
|
148452
|
+
function getLeftAndRightSiblings(typedefNode) {
|
|
148453
|
+
const commentNode = typedefNode.parent;
|
|
148454
|
+
const maxChildIndex = commentNode.getChildCount() - 1;
|
|
148455
|
+
const currentNodeIndex = commentNode.getChildren().findIndex(
|
|
148456
|
+
(n) => n.getStart() === typedefNode.getStart() && n.getEnd() === typedefNode.getEnd()
|
|
148425
148457
|
);
|
|
148458
|
+
const leftSibling = currentNodeIndex > 0 ? commentNode.getChildAt(currentNodeIndex - 1) : void 0;
|
|
148459
|
+
const rightSibling = currentNodeIndex < maxChildIndex ? commentNode.getChildAt(currentNodeIndex + 1) : void 0;
|
|
148460
|
+
return { leftSibling, rightSibling };
|
|
148461
|
+
}
|
|
148462
|
+
function findEndOfTextBetween(jsDocComment, from, to) {
|
|
148463
|
+
const comment = jsDocComment.getText().substring(from - jsDocComment.getStart(), to - jsDocComment.getStart());
|
|
148464
|
+
for (let i = comment.length; i > 0; i--) {
|
|
148465
|
+
if (!/[*\/\s]/g.test(comment.substring(i - 1, i))) {
|
|
148466
|
+
return from + i;
|
|
148467
|
+
}
|
|
148468
|
+
}
|
|
148469
|
+
return to;
|
|
148426
148470
|
}
|
|
148427
148471
|
function createDeclaration(tag) {
|
|
148428
148472
|
var _a;
|
|
@@ -148443,7 +148487,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
148443
148487
|
const propertySignatures = createSignatureFromTypeLiteral(typeLiteral);
|
|
148444
148488
|
if (!some(propertySignatures))
|
|
148445
148489
|
return;
|
|
148446
|
-
|
|
148490
|
+
return factory.createInterfaceDeclaration(
|
|
148447
148491
|
/*modifiers*/
|
|
148448
148492
|
void 0,
|
|
148449
148493
|
typeName,
|
|
@@ -148453,13 +148497,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
148453
148497
|
void 0,
|
|
148454
148498
|
propertySignatures
|
|
148455
148499
|
);
|
|
148456
|
-
return interfaceDeclaration;
|
|
148457
148500
|
}
|
|
148458
148501
|
function createTypeAliasForTypeExpression(typeName, typeExpression) {
|
|
148459
148502
|
const typeReference = getSynthesizedDeepClone(typeExpression.type);
|
|
148460
148503
|
if (!typeReference)
|
|
148461
148504
|
return;
|
|
148462
|
-
|
|
148505
|
+
return factory.createTypeAliasDeclaration(
|
|
148463
148506
|
/*modifiers*/
|
|
148464
148507
|
void 0,
|
|
148465
148508
|
factory.createIdentifier(typeName),
|
|
@@ -148467,7 +148510,6 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
148467
148510
|
void 0,
|
|
148468
148511
|
typeReference
|
|
148469
148512
|
);
|
|
148470
|
-
return declaration;
|
|
148471
148513
|
}
|
|
148472
148514
|
function createSignatureFromTypeLiteral(typeLiteral) {
|
|
148473
148515
|
const propertyTags = typeLiteral.jsDocPropertyTags;
|
|
@@ -148487,30 +148529,28 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
148487
148529
|
}
|
|
148488
148530
|
if (typeReference && name) {
|
|
148489
148531
|
const questionToken = isOptional ? factory.createToken(58 /* QuestionToken */) : void 0;
|
|
148490
|
-
|
|
148532
|
+
return factory.createPropertySignature(
|
|
148491
148533
|
/*modifiers*/
|
|
148492
148534
|
void 0,
|
|
148493
148535
|
name,
|
|
148494
148536
|
questionToken,
|
|
148495
148537
|
typeReference
|
|
148496
148538
|
);
|
|
148497
|
-
return prop;
|
|
148498
148539
|
}
|
|
148499
148540
|
};
|
|
148500
|
-
|
|
148501
|
-
return props;
|
|
148541
|
+
return mapDefined(propertyTags, getSignature);
|
|
148502
148542
|
}
|
|
148503
148543
|
function getPropertyName(tag) {
|
|
148504
148544
|
return tag.name.kind === 80 /* Identifier */ ? tag.name.text : tag.name.right.text;
|
|
148505
148545
|
}
|
|
148506
|
-
function
|
|
148546
|
+
function getJSDocTypedefNodes(node) {
|
|
148507
148547
|
if (hasJSDocNodes(node)) {
|
|
148508
|
-
return
|
|
148548
|
+
return flatMap(node.jsDoc, (doc) => {
|
|
148509
148549
|
var _a;
|
|
148510
|
-
return (_a =
|
|
148550
|
+
return (_a = doc.tags) == null ? void 0 : _a.filter((tag) => isJSDocTypedefTag(tag));
|
|
148511
148551
|
});
|
|
148512
148552
|
}
|
|
148513
|
-
return
|
|
148553
|
+
return [];
|
|
148514
148554
|
}
|
|
148515
148555
|
var fixId14, errorCodes15;
|
|
148516
148556
|
var init_convertTypedefToType = __esm({
|
|
@@ -148524,13 +148564,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
148524
148564
|
fixIds: [fixId14],
|
|
148525
148565
|
errorCodes: errorCodes15,
|
|
148526
148566
|
getCodeActions(context) {
|
|
148567
|
+
const newLineCharacter = getNewLineOrDefaultFromHost(context.host, context.formatContext.options);
|
|
148527
148568
|
const node = getTokenAtPosition(
|
|
148528
148569
|
context.sourceFile,
|
|
148529
148570
|
context.span.start
|
|
148530
148571
|
);
|
|
148531
148572
|
if (!node)
|
|
148532
148573
|
return;
|
|
148533
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange12(t, node, context.sourceFile));
|
|
148574
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange12(t, node, context.sourceFile, newLineCharacter));
|
|
148534
148575
|
if (changes.length > 0) {
|
|
148535
148576
|
return [
|
|
148536
148577
|
createCodeFixAction(
|
|
@@ -148543,11 +148584,17 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
148543
148584
|
];
|
|
148544
148585
|
}
|
|
148545
148586
|
},
|
|
148546
|
-
getAllCodeActions: (context) => codeFixAll(
|
|
148547
|
-
|
|
148548
|
-
|
|
148549
|
-
|
|
148550
|
-
|
|
148587
|
+
getAllCodeActions: (context) => codeFixAll(
|
|
148588
|
+
context,
|
|
148589
|
+
errorCodes15,
|
|
148590
|
+
(changes, diag2) => {
|
|
148591
|
+
const newLineCharacter = getNewLineOrDefaultFromHost(context.host, context.formatContext.options);
|
|
148592
|
+
const node = getTokenAtPosition(diag2.file, diag2.start);
|
|
148593
|
+
const fixAll = true;
|
|
148594
|
+
if (node)
|
|
148595
|
+
doChange12(changes, node, diag2.file, newLineCharacter, fixAll);
|
|
148596
|
+
}
|
|
148597
|
+
)
|
|
148551
148598
|
});
|
|
148552
148599
|
}
|
|
148553
148600
|
});
|
|
@@ -149645,6 +149692,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
149645
149692
|
}
|
|
149646
149693
|
function promoteImportClause(importClause) {
|
|
149647
149694
|
changes.delete(sourceFile, getTypeKeywordOfTypeOnlyImport(importClause, sourceFile));
|
|
149695
|
+
if (!compilerOptions.allowImportingTsExtensions) {
|
|
149696
|
+
const moduleSpecifier = tryGetModuleSpecifierFromDeclaration(importClause.parent);
|
|
149697
|
+
const resolvedModule = moduleSpecifier && getResolvedModule(sourceFile, moduleSpecifier.text, getModeForUsageLocation(sourceFile, moduleSpecifier));
|
|
149698
|
+
if (resolvedModule == null ? void 0 : resolvedModule.resolvedUsingTsExtension) {
|
|
149699
|
+
const changedExtension = changeAnyExtension(moduleSpecifier.text, getOutputExtension(moduleSpecifier.text, compilerOptions));
|
|
149700
|
+
changes.replaceNode(sourceFile, moduleSpecifier, factory.createStringLiteral(changedExtension));
|
|
149701
|
+
}
|
|
149702
|
+
}
|
|
149648
149703
|
if (convertExistingToTypeOnly) {
|
|
149649
149704
|
const namedImports = tryCast(importClause.namedBindings, isNamedImports);
|
|
149650
149705
|
if (namedImports && namedImports.elements.length > 1) {
|
|
@@ -150822,6 +150877,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
150822
150877
|
if (!declaration || !isCallExpression(declaration.parent) || !declaration.body)
|
|
150823
150878
|
return void 0;
|
|
150824
150879
|
const pos = declaration.parent.arguments.indexOf(declaration);
|
|
150880
|
+
if (pos === -1)
|
|
150881
|
+
return void 0;
|
|
150825
150882
|
const type = checker.getContextualTypeForArgumentAtIndex(declaration.parent, pos);
|
|
150826
150883
|
if (!type)
|
|
150827
150884
|
return void 0;
|
|
@@ -154247,15 +154304,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154247
154304
|
}
|
|
154248
154305
|
function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, context, preferences, importAdder, addClassElement, body, preserveOptional = 3 /* All */, isAmbient = false) {
|
|
154249
154306
|
const declarations = symbol.getDeclarations();
|
|
154250
|
-
const declaration = declarations
|
|
154307
|
+
const declaration = firstOrUndefined(declarations);
|
|
154251
154308
|
const checker = context.program.getTypeChecker();
|
|
154252
154309
|
const scriptTarget = getEmitScriptTarget(context.program.getCompilerOptions());
|
|
154253
154310
|
const kind = (declaration == null ? void 0 : declaration.kind) ?? 171 /* PropertySignature */;
|
|
154254
|
-
const declarationName =
|
|
154255
|
-
getNameOfDeclaration(declaration),
|
|
154256
|
-
/*includeTrivia*/
|
|
154257
|
-
false
|
|
154258
|
-
);
|
|
154311
|
+
const declarationName = createDeclarationName(symbol, declaration);
|
|
154259
154312
|
const effectiveModifierFlags = declaration ? getEffectiveModifierFlags(declaration) : 0 /* None */;
|
|
154260
154313
|
let modifierFlags = effectiveModifierFlags & 32 /* Static */;
|
|
154261
154314
|
modifierFlags |= effectiveModifierFlags & 4 /* Public */ ? 4 /* Public */ : effectiveModifierFlags & 16 /* Protected */ ? 16 /* Protected */ : 0 /* None */;
|
|
@@ -154406,6 +154459,19 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154406
154459
|
false
|
|
154407
154460
|
);
|
|
154408
154461
|
}
|
|
154462
|
+
function createDeclarationName(symbol2, declaration2) {
|
|
154463
|
+
if (getCheckFlags(symbol2) & 262144 /* Mapped */) {
|
|
154464
|
+
const nameType = symbol2.links.nameType;
|
|
154465
|
+
if (nameType && isTypeUsableAsPropertyName(nameType)) {
|
|
154466
|
+
return factory.createIdentifier(unescapeLeadingUnderscores(getPropertyNameFromType(nameType)));
|
|
154467
|
+
}
|
|
154468
|
+
}
|
|
154469
|
+
return getSynthesizedDeepClone(
|
|
154470
|
+
getNameOfDeclaration(declaration2),
|
|
154471
|
+
/*includeTrivia*/
|
|
154472
|
+
false
|
|
154473
|
+
);
|
|
154474
|
+
}
|
|
154409
154475
|
}
|
|
154410
154476
|
function createSignatureDeclarationFromSignature(kind, context, quotePreference, signature, body, name, modifiers, optional, enclosingDeclaration, importAdder) {
|
|
154411
154477
|
const program = context.program;
|
|
@@ -156061,7 +156127,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
156061
156127
|
getFixes: () => getFixes,
|
|
156062
156128
|
getImportCompletionAction: () => getImportCompletionAction,
|
|
156063
156129
|
getImportKind: () => getImportKind,
|
|
156064
|
-
|
|
156130
|
+
getJSDocTypedefNodes: () => getJSDocTypedefNodes,
|
|
156065
156131
|
getNoopSymbolTrackerWithResolver: () => getNoopSymbolTrackerWithResolver,
|
|
156066
156132
|
getPromoteTypeOnlyCompletionAction: () => getPromoteTypeOnlyCompletionAction,
|
|
156067
156133
|
getSupportedErrorCodes: () => getSupportedErrorCodes,
|
|
@@ -158440,7 +158506,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
158440
158506
|
const leftMostName = getLeftMostName(computedPropertyName.expression);
|
|
158441
158507
|
const nameSymbol = leftMostName && typeChecker.getSymbolAtLocation(leftMostName);
|
|
158442
158508
|
const firstAccessibleSymbol = nameSymbol && getFirstSymbolInChain(nameSymbol, contextToken, typeChecker);
|
|
158443
|
-
|
|
158509
|
+
const firstAccessibleSymbolId = firstAccessibleSymbol && getSymbolId(firstAccessibleSymbol);
|
|
158510
|
+
if (firstAccessibleSymbolId && addToSeen(seenPropertySymbols, firstAccessibleSymbolId)) {
|
|
158444
158511
|
const index = symbols.length;
|
|
158445
158512
|
symbols.push(firstAccessibleSymbol);
|
|
158446
158513
|
const moduleSymbol = firstAccessibleSymbol.parent;
|
|
@@ -158470,6 +158537,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
158470
158537
|
}
|
|
158471
158538
|
}
|
|
158472
158539
|
} else if (preferences.includeCompletionsWithInsertText) {
|
|
158540
|
+
if (firstAccessibleSymbolId && seenPropertySymbols.has(firstAccessibleSymbolId)) {
|
|
158541
|
+
return;
|
|
158542
|
+
}
|
|
158473
158543
|
addSymbolOriginInfo(symbol);
|
|
158474
158544
|
addSymbolSortInfo(symbol);
|
|
158475
158545
|
symbols.push(symbol);
|
|
@@ -163933,6 +164003,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
163933
164003
|
function shouldShowLiteralParameterNameHintsOnly(preferences) {
|
|
163934
164004
|
return preferences.includeInlayParameterNameHints === "literals";
|
|
163935
164005
|
}
|
|
164006
|
+
function shouldUseInteractiveInlayHints(preferences) {
|
|
164007
|
+
return preferences.interactiveInlayHints === true;
|
|
164008
|
+
}
|
|
163936
164009
|
function provideInlayHints(context) {
|
|
163937
164010
|
const { file, program, span, cancellationToken, preferences } = context;
|
|
163938
164011
|
const sourceFileText = file.text;
|
|
@@ -163983,9 +164056,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
163983
164056
|
function isSignatureSupportingReturnAnnotation(node) {
|
|
163984
164057
|
return isArrowFunction(node) || isFunctionExpression(node) || isFunctionDeclaration(node) || isMethodDeclaration(node) || isGetAccessorDeclaration(node);
|
|
163985
164058
|
}
|
|
163986
|
-
function addParameterHints(text, position, isFirstVariadicArgument) {
|
|
164059
|
+
function addParameterHints(text, parameter, position, isFirstVariadicArgument, sourceFile) {
|
|
164060
|
+
let hintText = `${isFirstVariadicArgument ? "..." : ""}${text}`;
|
|
164061
|
+
if (shouldUseInteractiveInlayHints(preferences)) {
|
|
164062
|
+
hintText = [getNodeDisplayPart(hintText, parameter, sourceFile), { text: ":" }];
|
|
164063
|
+
} else {
|
|
164064
|
+
hintText += ":";
|
|
164065
|
+
}
|
|
163987
164066
|
result.push({
|
|
163988
|
-
text:
|
|
164067
|
+
text: hintText,
|
|
163989
164068
|
position,
|
|
163990
164069
|
kind: "Parameter" /* Parameter */,
|
|
163991
164070
|
whitespaceAfter: true
|
|
@@ -163993,7 +164072,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
163993
164072
|
}
|
|
163994
164073
|
function addTypeHints(text, position) {
|
|
163995
164074
|
result.push({
|
|
163996
|
-
text: `: ${
|
|
164075
|
+
text: `: ${text.length > maxTypeHintLength ? text.substr(0, maxTypeHintLength - "...".length) + "..." : text}`,
|
|
163997
164076
|
position,
|
|
163998
164077
|
kind: "Type" /* Type */,
|
|
163999
164078
|
whitespaceBefore: true
|
|
@@ -164001,7 +164080,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
164001
164080
|
}
|
|
164002
164081
|
function addEnumMemberValueHints(text, position) {
|
|
164003
164082
|
result.push({
|
|
164004
|
-
text: `= ${
|
|
164083
|
+
text: `= ${text}`,
|
|
164005
164084
|
position,
|
|
164006
164085
|
kind: "Enum" /* Enum */,
|
|
164007
164086
|
whitespaceBefore: true
|
|
@@ -164051,6 +164130,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
164051
164130
|
return;
|
|
164052
164131
|
}
|
|
164053
164132
|
let signatureParamPos = 0;
|
|
164133
|
+
const sourceFile = shouldUseInteractiveInlayHints(preferences) ? expr.getSourceFile() : void 0;
|
|
164054
164134
|
for (const originalArg of args) {
|
|
164055
164135
|
const arg = skipParentheses(originalArg);
|
|
164056
164136
|
if (shouldShowLiteralParameterNameHintsOnly(preferences) && !isHintableLiteral(arg)) {
|
|
@@ -164071,10 +164151,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
164071
164151
|
}
|
|
164072
164152
|
}
|
|
164073
164153
|
}
|
|
164074
|
-
const
|
|
164154
|
+
const identifierInfo = checker.getParameterIdentifierInfoAtPosition(signature, signatureParamPos);
|
|
164075
164155
|
signatureParamPos = signatureParamPos + (spreadArgs || 1);
|
|
164076
|
-
if (
|
|
164077
|
-
const
|
|
164156
|
+
if (identifierInfo) {
|
|
164157
|
+
const { parameter, parameterName, isRestParameter: isFirstVariadicArgument } = identifierInfo;
|
|
164078
164158
|
const isParameterNameNotSameAsArgument = preferences.includeInlayParameterNameHintsWhenArgumentMatchesName || !identifierOrAccessExpressionPostfixMatchesParameterName(arg, parameterName);
|
|
164079
164159
|
if (!isParameterNameNotSameAsArgument && !isFirstVariadicArgument) {
|
|
164080
164160
|
continue;
|
|
@@ -164083,7 +164163,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
164083
164163
|
if (leadingCommentsContainsParameterName(arg, name)) {
|
|
164084
164164
|
continue;
|
|
164085
164165
|
}
|
|
164086
|
-
addParameterHints(name, originalArg.getStart(), isFirstVariadicArgument);
|
|
164166
|
+
addParameterHints(name, parameter, originalArg.getStart(), isFirstVariadicArgument, sourceFile);
|
|
164087
164167
|
}
|
|
164088
164168
|
}
|
|
164089
164169
|
}
|
|
@@ -164189,12 +164269,6 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
164189
164269
|
}
|
|
164190
164270
|
return printTypeInSingleLine(signatureParamType);
|
|
164191
164271
|
}
|
|
164192
|
-
function truncation(text, maxLength2) {
|
|
164193
|
-
if (text.length > maxLength2) {
|
|
164194
|
-
return text.substr(0, maxLength2 - "...".length) + "...";
|
|
164195
|
-
}
|
|
164196
|
-
return text;
|
|
164197
|
-
}
|
|
164198
164272
|
function printTypeInSingleLine(type) {
|
|
164199
164273
|
const flags = 70221824 /* IgnoreErrors */ | 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */;
|
|
164200
164274
|
const printer = createPrinterWithRemoveComments();
|
|
@@ -164225,13 +164299,20 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
164225
164299
|
}
|
|
164226
164300
|
return true;
|
|
164227
164301
|
}
|
|
164302
|
+
function getNodeDisplayPart(text, node, sourceFile) {
|
|
164303
|
+
return {
|
|
164304
|
+
text,
|
|
164305
|
+
span: createTextSpanFromNode(node, sourceFile),
|
|
164306
|
+
file: sourceFile.fileName
|
|
164307
|
+
};
|
|
164308
|
+
}
|
|
164228
164309
|
}
|
|
164229
|
-
var
|
|
164310
|
+
var maxTypeHintLength, leadingParameterNameCommentRegexFactory;
|
|
164230
164311
|
var init_inlayHints = __esm({
|
|
164231
164312
|
"src/services/inlayHints.ts"() {
|
|
164232
164313
|
"use strict";
|
|
164233
164314
|
init_ts4();
|
|
164234
|
-
|
|
164315
|
+
maxTypeHintLength = 30;
|
|
164235
164316
|
leadingParameterNameCommentRegexFactory = (name) => {
|
|
164236
164317
|
return new RegExp(`^\\s?/\\*\\*?\\s?${name}\\s?\\*\\/\\s?$`);
|
|
164237
164318
|
};
|
|
@@ -166733,7 +166814,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
166733
166814
|
}
|
|
166734
166815
|
return modifiers.size > 0 ? arrayFrom(modifiers.values()).join(",") : "" /* none */;
|
|
166735
166816
|
}
|
|
166736
|
-
function
|
|
166817
|
+
function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symbol, sourceFile, enclosingDeclaration, location, type, semanticMeaning, alias) {
|
|
166737
166818
|
var _a;
|
|
166738
166819
|
const displayParts = [];
|
|
166739
166820
|
let documentation = [];
|
|
@@ -166742,7 +166823,6 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
166742
166823
|
let symbolKind = semanticMeaning & 1 /* Value */ ? getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, location) : "" /* unknown */;
|
|
166743
166824
|
let hasAddedSymbolInfo = false;
|
|
166744
166825
|
const isThisExpression = location.kind === 110 /* ThisKeyword */ && isInExpressionContext(location) || isThisInTypeQuery(location);
|
|
166745
|
-
let type;
|
|
166746
166826
|
let documentationFromAlias;
|
|
166747
166827
|
let tagsFromAlias;
|
|
166748
166828
|
let hasMultipleSignatures = false;
|
|
@@ -166771,7 +166851,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
166771
166851
|
}
|
|
166772
166852
|
}
|
|
166773
166853
|
let signature;
|
|
166774
|
-
type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location);
|
|
166854
|
+
type ?? (type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location));
|
|
166775
166855
|
if (location.parent && location.parent.kind === 211 /* PropertyAccessExpression */) {
|
|
166776
166856
|
const right = location.parent.name;
|
|
166777
166857
|
if (right === location || right && right.getFullWidth() === 0) {
|
|
@@ -166986,12 +167066,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
166986
167066
|
if (declarationName && !hasAddedSymbolInfo) {
|
|
166987
167067
|
const isExternalModuleDeclaration = isModuleWithStringLiteralName(resolvedNode) && hasSyntacticModifier(resolvedNode, 2 /* Ambient */);
|
|
166988
167068
|
const shouldUseAliasName = symbol.name !== "default" && !isExternalModuleDeclaration;
|
|
166989
|
-
const resolvedInfo =
|
|
167069
|
+
const resolvedInfo = getSymbolDisplayPartsDocumentationAndSymbolKindWorker(
|
|
166990
167070
|
typeChecker,
|
|
166991
167071
|
resolvedSymbol,
|
|
166992
167072
|
getSourceFileOfNode(resolvedNode),
|
|
166993
167073
|
resolvedNode,
|
|
166994
167074
|
declarationName,
|
|
167075
|
+
type,
|
|
166995
167076
|
semanticMeaning,
|
|
166996
167077
|
shouldUseAliasName ? symbol : resolvedSymbol
|
|
166997
167078
|
);
|
|
@@ -167246,6 +167327,19 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
167246
167327
|
addRange(displayParts, typeParameterParts);
|
|
167247
167328
|
}
|
|
167248
167329
|
}
|
|
167330
|
+
function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, enclosingDeclaration, location, semanticMeaning = getMeaningFromLocation(location), alias) {
|
|
167331
|
+
return getSymbolDisplayPartsDocumentationAndSymbolKindWorker(
|
|
167332
|
+
typeChecker,
|
|
167333
|
+
symbol,
|
|
167334
|
+
sourceFile,
|
|
167335
|
+
enclosingDeclaration,
|
|
167336
|
+
location,
|
|
167337
|
+
/*type*/
|
|
167338
|
+
void 0,
|
|
167339
|
+
semanticMeaning,
|
|
167340
|
+
alias
|
|
167341
|
+
);
|
|
167342
|
+
}
|
|
167249
167343
|
function isLocalVariableOrFunction(symbol) {
|
|
167250
167344
|
if (symbol.parent) {
|
|
167251
167345
|
return false;
|
|
@@ -172561,6 +172655,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
172561
172655
|
getPropertyAssignmentAliasLikeExpression: () => getPropertyAssignmentAliasLikeExpression,
|
|
172562
172656
|
getPropertyNameForPropertyNameNode: () => getPropertyNameForPropertyNameNode,
|
|
172563
172657
|
getPropertyNameForUniqueESSymbol: () => getPropertyNameForUniqueESSymbol,
|
|
172658
|
+
getPropertyNameFromType: () => getPropertyNameFromType,
|
|
172564
172659
|
getPropertyNameOfBindingOrAssignmentElement: () => getPropertyNameOfBindingOrAssignmentElement,
|
|
172565
172660
|
getPropertySymbolFromBindingElement: () => getPropertySymbolFromBindingElement,
|
|
172566
172661
|
getPropertySymbolsFromContextualType: () => getPropertySymbolsFromContextualType,
|
|
@@ -173393,6 +173488,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
173393
173488
|
isTypeQueryNode: () => isTypeQueryNode,
|
|
173394
173489
|
isTypeReferenceNode: () => isTypeReferenceNode,
|
|
173395
173490
|
isTypeReferenceType: () => isTypeReferenceType,
|
|
173491
|
+
isTypeUsableAsPropertyName: () => isTypeUsableAsPropertyName,
|
|
173396
173492
|
isUMDExportSymbol: () => isUMDExportSymbol,
|
|
173397
173493
|
isUnaryExpression: () => isUnaryExpression,
|
|
173398
173494
|
isUnaryExpressionWithWrite: () => isUnaryExpressionWithWrite,
|