@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/tsserver.js
CHANGED
|
@@ -970,6 +970,7 @@ __export(server_exports, {
|
|
|
970
970
|
getPropertyAssignmentAliasLikeExpression: () => getPropertyAssignmentAliasLikeExpression,
|
|
971
971
|
getPropertyNameForPropertyNameNode: () => getPropertyNameForPropertyNameNode,
|
|
972
972
|
getPropertyNameForUniqueESSymbol: () => getPropertyNameForUniqueESSymbol,
|
|
973
|
+
getPropertyNameFromType: () => getPropertyNameFromType,
|
|
973
974
|
getPropertyNameOfBindingOrAssignmentElement: () => getPropertyNameOfBindingOrAssignmentElement,
|
|
974
975
|
getPropertySymbolFromBindingElement: () => getPropertySymbolFromBindingElement,
|
|
975
976
|
getPropertySymbolsFromContextualType: () => getPropertySymbolsFromContextualType,
|
|
@@ -1802,6 +1803,7 @@ __export(server_exports, {
|
|
|
1802
1803
|
isTypeQueryNode: () => isTypeQueryNode,
|
|
1803
1804
|
isTypeReferenceNode: () => isTypeReferenceNode,
|
|
1804
1805
|
isTypeReferenceType: () => isTypeReferenceType,
|
|
1806
|
+
isTypeUsableAsPropertyName: () => isTypeUsableAsPropertyName,
|
|
1805
1807
|
isUMDExportSymbol: () => isUMDExportSymbol,
|
|
1806
1808
|
isUnaryExpression: () => isUnaryExpression,
|
|
1807
1809
|
isUnaryExpressionWithWrite: () => isUnaryExpressionWithWrite,
|
|
@@ -2327,7 +2329,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2327
2329
|
|
|
2328
2330
|
// src/compiler/corePublic.ts
|
|
2329
2331
|
var versionMajorMinor = "5.2";
|
|
2330
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2332
|
+
var version = `${versionMajorMinor}.0-insiders.20230725`;
|
|
2331
2333
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2332
2334
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2333
2335
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -6810,7 +6812,8 @@ var SignatureFlags = /* @__PURE__ */ ((SignatureFlags5) => {
|
|
|
6810
6812
|
SignatureFlags5[SignatureFlags5["IsOuterCallChain"] = 16] = "IsOuterCallChain";
|
|
6811
6813
|
SignatureFlags5[SignatureFlags5["IsUntypedSignatureInJSFile"] = 32] = "IsUntypedSignatureInJSFile";
|
|
6812
6814
|
SignatureFlags5[SignatureFlags5["IsNonInferrable"] = 64] = "IsNonInferrable";
|
|
6813
|
-
SignatureFlags5[SignatureFlags5["
|
|
6815
|
+
SignatureFlags5[SignatureFlags5["IsSignatureCandidateForOverloadFailure"] = 128] = "IsSignatureCandidateForOverloadFailure";
|
|
6816
|
+
SignatureFlags5[SignatureFlags5["PropagatingFlags"] = 167] = "PropagatingFlags";
|
|
6814
6817
|
SignatureFlags5[SignatureFlags5["CallChainFlags"] = 24] = "CallChainFlags";
|
|
6815
6818
|
return SignatureFlags5;
|
|
6816
6819
|
})(SignatureFlags || {});
|
|
@@ -10189,9 +10192,6 @@ var Diagnostics = {
|
|
|
10189
10192
|
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."),
|
|
10190
10193
|
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."),
|
|
10191
10194
|
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."),
|
|
10192
|
-
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."),
|
|
10193
|
-
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."),
|
|
10194
|
-
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."),
|
|
10195
10195
|
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}'."),
|
|
10196
10196
|
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}'."),
|
|
10197
10197
|
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}'."),
|
|
@@ -14665,7 +14665,6 @@ function isLeftHandSideExpressionKind(kind) {
|
|
|
14665
14665
|
case 236 /* MetaProperty */:
|
|
14666
14666
|
case 102 /* ImportKeyword */:
|
|
14667
14667
|
case 282 /* MissingDeclaration */:
|
|
14668
|
-
case 237 /* SyntheticExpression */:
|
|
14669
14668
|
return true;
|
|
14670
14669
|
default:
|
|
14671
14670
|
return false;
|
|
@@ -21604,6 +21603,18 @@ function getTextOfJsxNamespacedName(node) {
|
|
|
21604
21603
|
function intrinsicTagNameToString(node) {
|
|
21605
21604
|
return isIdentifier(node) ? idText(node) : getTextOfJsxNamespacedName(node);
|
|
21606
21605
|
}
|
|
21606
|
+
function isTypeUsableAsPropertyName(type) {
|
|
21607
|
+
return !!(type.flags & 8576 /* StringOrNumberLiteralOrUnique */);
|
|
21608
|
+
}
|
|
21609
|
+
function getPropertyNameFromType(type) {
|
|
21610
|
+
if (type.flags & 8192 /* UniqueESSymbol */) {
|
|
21611
|
+
return type.escapedName;
|
|
21612
|
+
}
|
|
21613
|
+
if (type.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */)) {
|
|
21614
|
+
return escapeLeadingUnderscores("" + type.value);
|
|
21615
|
+
}
|
|
21616
|
+
return Debug.fail();
|
|
21617
|
+
}
|
|
21607
21618
|
|
|
21608
21619
|
// src/compiler/factory/baseNodeFactory.ts
|
|
21609
21620
|
function createBaseNodeFactory() {
|
|
@@ -35112,10 +35123,14 @@ var Parser;
|
|
|
35112
35123
|
case 124 /* ProtectedKeyword */:
|
|
35113
35124
|
case 125 /* PublicKeyword */:
|
|
35114
35125
|
case 148 /* ReadonlyKeyword */:
|
|
35126
|
+
const previousToken = token();
|
|
35115
35127
|
nextToken();
|
|
35116
35128
|
if (scanner2.hasPrecedingLineBreak()) {
|
|
35117
35129
|
return false;
|
|
35118
35130
|
}
|
|
35131
|
+
if (previousToken === 138 /* DeclareKeyword */ && token() === 156 /* TypeKeyword */) {
|
|
35132
|
+
return true;
|
|
35133
|
+
}
|
|
35119
35134
|
continue;
|
|
35120
35135
|
case 162 /* GlobalKeyword */:
|
|
35121
35136
|
nextToken();
|
|
@@ -35480,14 +35495,14 @@ var Parser;
|
|
|
35480
35495
|
function parseObjectBindingPattern() {
|
|
35481
35496
|
const pos = getNodePos();
|
|
35482
35497
|
parseExpected(19 /* OpenBraceToken */);
|
|
35483
|
-
const elements = parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement);
|
|
35498
|
+
const elements = allowInAnd(() => parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement));
|
|
35484
35499
|
parseExpected(20 /* CloseBraceToken */);
|
|
35485
35500
|
return finishNode(factory2.createObjectBindingPattern(elements), pos);
|
|
35486
35501
|
}
|
|
35487
35502
|
function parseArrayBindingPattern() {
|
|
35488
35503
|
const pos = getNodePos();
|
|
35489
35504
|
parseExpected(23 /* OpenBracketToken */);
|
|
35490
|
-
const elements = parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement);
|
|
35505
|
+
const elements = allowInAnd(() => parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement));
|
|
35491
35506
|
parseExpected(24 /* CloseBracketToken */);
|
|
35492
35507
|
return finishNode(factory2.createArrayBindingPattern(elements), pos);
|
|
35493
35508
|
}
|
|
@@ -36005,6 +36020,9 @@ var Parser;
|
|
|
36005
36020
|
}
|
|
36006
36021
|
function parseTypeAliasDeclaration(pos, hasJSDoc, modifiers) {
|
|
36007
36022
|
parseExpected(156 /* TypeKeyword */);
|
|
36023
|
+
if (scanner2.hasPrecedingLineBreak()) {
|
|
36024
|
+
parseErrorAtCurrentToken(Diagnostics.Line_break_not_permitted_here);
|
|
36025
|
+
}
|
|
36008
36026
|
const name = parseIdentifier();
|
|
36009
36027
|
const typeParameters = parseTypeParameters();
|
|
36010
36028
|
parseExpected(64 /* EqualsToken */);
|
|
@@ -37906,7 +37924,7 @@ function getNamedArgRegEx(name) {
|
|
|
37906
37924
|
return result;
|
|
37907
37925
|
}
|
|
37908
37926
|
var tripleSlashXMLCommentStartRegEx = /^\/\/\/\s*<(\S+)\s.*?\/>/im;
|
|
37909
|
-
var singleLinePragmaRegEx = /^\/\/\/?\s*@(
|
|
37927
|
+
var singleLinePragmaRegEx = /^\/\/\/?\s*@([^\s:]+)(.*)\s*$/im;
|
|
37910
37928
|
function extractPragmas(pragmas, range, text) {
|
|
37911
37929
|
const tripleSlash = range.kind === 2 /* SingleLineCommentTrivia */ && tripleSlashXMLCommentStartRegEx.exec(text);
|
|
37912
37930
|
if (tripleSlash) {
|
|
@@ -43873,6 +43891,9 @@ function getModuleInstanceStateForAliasTarget(specifier, visited) {
|
|
|
43873
43891
|
if (found === 1 /* Instantiated */) {
|
|
43874
43892
|
return found;
|
|
43875
43893
|
}
|
|
43894
|
+
if (statement.kind === 271 /* ImportEqualsDeclaration */) {
|
|
43895
|
+
found = 1 /* Instantiated */;
|
|
43896
|
+
}
|
|
43876
43897
|
}
|
|
43877
43898
|
}
|
|
43878
43899
|
if (found !== void 0) {
|
|
@@ -47821,7 +47842,7 @@ function createTypeChecker(host) {
|
|
|
47821
47842
|
return node ? getTypeFromTypeNode(node) : errorType;
|
|
47822
47843
|
},
|
|
47823
47844
|
getParameterType: getTypeAtPosition,
|
|
47824
|
-
|
|
47845
|
+
getParameterIdentifierInfoAtPosition,
|
|
47825
47846
|
getPromisedTypeOfPromise,
|
|
47826
47847
|
getAwaitedType: (type) => getAwaitedType(type),
|
|
47827
47848
|
getReturnTypeOfSignature,
|
|
@@ -48574,7 +48595,6 @@ function createTypeChecker(host) {
|
|
|
48574
48595
|
var potentialReflectCollisions = [];
|
|
48575
48596
|
var potentialUnusedRenamedBindingElementsInTypes = [];
|
|
48576
48597
|
var awaitedTypeStack = [];
|
|
48577
|
-
var hasGlobalSymbolHasInstanceProperty;
|
|
48578
48598
|
var diagnostics = createDiagnosticCollection();
|
|
48579
48599
|
var suggestionDiagnostics = createDiagnosticCollection();
|
|
48580
48600
|
var typeofType = createTypeofType();
|
|
@@ -49263,7 +49283,7 @@ function createTypeChecker(host) {
|
|
|
49263
49283
|
if (name === "const" && isConstAssertion(location)) {
|
|
49264
49284
|
return void 0;
|
|
49265
49285
|
}
|
|
49266
|
-
if (
|
|
49286
|
+
if (isModuleOrEnumDeclaration(location) && lastLocation && location.name === lastLocation) {
|
|
49267
49287
|
lastLocation = location;
|
|
49268
49288
|
location = location.parent;
|
|
49269
49289
|
}
|
|
@@ -50879,7 +50899,7 @@ function createTypeChecker(host) {
|
|
|
50879
50899
|
return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, moduleReferenceExpression, isForAugmentation) : void 0;
|
|
50880
50900
|
}
|
|
50881
50901
|
function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation = false) {
|
|
50882
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
50902
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
50883
50903
|
if (startsWith(moduleReference, "@types/")) {
|
|
50884
50904
|
const diag2 = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
|
|
50885
50905
|
const withoutAtTypePrefix = removePrefix(moduleReference, "@types/");
|
|
@@ -50914,8 +50934,11 @@ function createTypeChecker(host) {
|
|
|
50914
50934
|
);
|
|
50915
50935
|
}
|
|
50916
50936
|
} else if (resolvedModule.resolvedUsingTsExtension && !shouldAllowImportingTsExtension(compilerOptions, currentSourceFile.fileName)) {
|
|
50917
|
-
const
|
|
50918
|
-
|
|
50937
|
+
const importOrExport = ((_h = findAncestor(location, isImportDeclaration)) == null ? void 0 : _h.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
|
|
50938
|
+
if (!((importOrExport == null ? void 0 : importOrExport.isTypeOnly) || findAncestor(location, isImportTypeNode))) {
|
|
50939
|
+
const tsExtension = Debug.checkDefined(tryExtractTSExtension(moduleReference));
|
|
50940
|
+
error2(errorNode, Diagnostics.An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled, tsExtension);
|
|
50941
|
+
}
|
|
50919
50942
|
}
|
|
50920
50943
|
if (sourceFile.symbol) {
|
|
50921
50944
|
if (resolvedModule.isExternalLibraryImport && !resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
|
|
@@ -50932,7 +50955,7 @@ function createTypeChecker(host) {
|
|
|
50932
50955
|
if (moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */) {
|
|
50933
50956
|
const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
|
|
50934
50957
|
const overrideClauseHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
|
|
50935
|
-
const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (
|
|
50958
|
+
const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (_i = overrideClauseHost.assertions) == null ? void 0 : _i.assertClause : overrideClauseHost == null ? void 0 : overrideClauseHost.assertClause;
|
|
50936
50959
|
if (isSyncImport && sourceFile.impliedNodeFormat === 99 /* ESNext */ && !getResolutionModeOverrideForClause(overrideClause)) {
|
|
50937
50960
|
if (findAncestor(location, isImportEqualsDeclaration)) {
|
|
50938
50961
|
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);
|
|
@@ -51035,7 +51058,7 @@ function createTypeChecker(host) {
|
|
|
51035
51058
|
error2(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
51036
51059
|
} else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
|
|
51037
51060
|
const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
|
|
51038
|
-
const suggestedExt = (
|
|
51061
|
+
const suggestedExt = (_j = suggestedExtensions.find(([actualExt, _importExt]) => host.fileExists(absoluteRef + actualExt))) == null ? void 0 : _j[1];
|
|
51039
51062
|
if (suggestedExt) {
|
|
51040
51063
|
error2(
|
|
51041
51064
|
errorNode,
|
|
@@ -52471,11 +52494,13 @@ function createTypeChecker(host) {
|
|
|
52471
52494
|
return !!type2.target && isMappedTypeHomomorphic(type2.target) && !isMappedTypeHomomorphic(type2);
|
|
52472
52495
|
}
|
|
52473
52496
|
function createMappedTypeNodeFromType(type2) {
|
|
52497
|
+
var _a2;
|
|
52474
52498
|
Debug.assert(!!(type2.flags & 524288 /* Object */));
|
|
52475
52499
|
const readonlyToken = type2.declaration.readonlyToken ? factory.createToken(type2.declaration.readonlyToken.kind) : void 0;
|
|
52476
52500
|
const questionToken = type2.declaration.questionToken ? factory.createToken(type2.declaration.questionToken.kind) : void 0;
|
|
52477
52501
|
let appropriateConstraintTypeNode;
|
|
52478
52502
|
let newTypeVariable;
|
|
52503
|
+
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 */);
|
|
52479
52504
|
if (isMappedTypeWithKeyofConstraintDeclaration(type2)) {
|
|
52480
52505
|
if (isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type2) && context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
|
|
52481
52506
|
const newParam = createTypeParameter(createSymbol(262144 /* TypeParameter */, "T"));
|
|
@@ -52483,6 +52508,11 @@ function createTypeChecker(host) {
|
|
|
52483
52508
|
newTypeVariable = factory.createTypeReferenceNode(name);
|
|
52484
52509
|
}
|
|
52485
52510
|
appropriateConstraintTypeNode = factory.createTypeOperatorNode(143 /* KeyOfKeyword */, newTypeVariable || typeToTypeNodeHelper(getModifiersTypeFromMappedType(type2), context));
|
|
52511
|
+
} else if (needsModifierPreservingWrapper) {
|
|
52512
|
+
const newParam = createTypeParameter(createSymbol(262144 /* TypeParameter */, "T"));
|
|
52513
|
+
const name = typeParameterToName(newParam, context);
|
|
52514
|
+
newTypeVariable = factory.createTypeReferenceNode(name);
|
|
52515
|
+
appropriateConstraintTypeNode = newTypeVariable;
|
|
52486
52516
|
} else {
|
|
52487
52517
|
appropriateConstraintTypeNode = typeToTypeNodeHelper(getConstraintTypeFromMappedType(type2), context);
|
|
52488
52518
|
}
|
|
@@ -52513,6 +52543,18 @@ function createTypeChecker(host) {
|
|
|
52513
52543
|
result,
|
|
52514
52544
|
factory.createKeywordTypeNode(146 /* NeverKeyword */)
|
|
52515
52545
|
);
|
|
52546
|
+
} else if (needsModifierPreservingWrapper) {
|
|
52547
|
+
return factory.createConditionalTypeNode(
|
|
52548
|
+
typeToTypeNodeHelper(getConstraintTypeFromMappedType(type2), context),
|
|
52549
|
+
factory.createInferTypeNode(factory.createTypeParameterDeclaration(
|
|
52550
|
+
/*modifiers*/
|
|
52551
|
+
void 0,
|
|
52552
|
+
factory.cloneNode(newTypeVariable.typeName),
|
|
52553
|
+
factory.createTypeOperatorNode(143 /* KeyOfKeyword */, typeToTypeNodeHelper(getModifiersTypeFromMappedType(type2), context))
|
|
52554
|
+
)),
|
|
52555
|
+
result,
|
|
52556
|
+
factory.createKeywordTypeNode(146 /* NeverKeyword */)
|
|
52557
|
+
);
|
|
52516
52558
|
}
|
|
52517
52559
|
return result;
|
|
52518
52560
|
}
|
|
@@ -56285,7 +56327,7 @@ function createTypeChecker(host) {
|
|
|
56285
56327
|
false,
|
|
56286
56328
|
definedInMethod && !definedInConstructor
|
|
56287
56329
|
));
|
|
56288
|
-
if (symbol.valueDeclaration && filterType(widened, (t) => !!(t.flags & ~98304 /* Nullable */)) === neverType) {
|
|
56330
|
+
if (symbol.valueDeclaration && isInJSFile(symbol.valueDeclaration) && filterType(widened, (t) => !!(t.flags & ~98304 /* Nullable */)) === neverType) {
|
|
56289
56331
|
reportImplicitAny(symbol.valueDeclaration, anyType);
|
|
56290
56332
|
return anyType;
|
|
56291
56333
|
}
|
|
@@ -57564,9 +57606,6 @@ function createTypeChecker(host) {
|
|
|
57564
57606
|
}
|
|
57565
57607
|
return type;
|
|
57566
57608
|
}
|
|
57567
|
-
function isTypeUsableAsPropertyName(type) {
|
|
57568
|
-
return !!(type.flags & 8576 /* StringOrNumberLiteralOrUnique */);
|
|
57569
|
-
}
|
|
57570
57609
|
function isLateBindableName(node) {
|
|
57571
57610
|
if (!isComputedPropertyName(node) && !isElementAccessExpression(node)) {
|
|
57572
57611
|
return false;
|
|
@@ -57587,15 +57626,6 @@ function createTypeChecker(host) {
|
|
|
57587
57626
|
function isNonBindableDynamicName(node) {
|
|
57588
57627
|
return isDynamicName(node) && !isLateBindableName(node);
|
|
57589
57628
|
}
|
|
57590
|
-
function getPropertyNameFromType(type) {
|
|
57591
|
-
if (type.flags & 8192 /* UniqueESSymbol */) {
|
|
57592
|
-
return type.escapedName;
|
|
57593
|
-
}
|
|
57594
|
-
if (type.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */)) {
|
|
57595
|
-
return escapeLeadingUnderscores("" + type.value);
|
|
57596
|
-
}
|
|
57597
|
-
return Debug.fail();
|
|
57598
|
-
}
|
|
57599
57629
|
function addDeclarationToLateBoundSymbol(symbol, member, symbolFlags) {
|
|
57600
57630
|
Debug.assert(!!(getCheckFlags(symbol) & 4096 /* Late */), "Expected a late-bound symbol.");
|
|
57601
57631
|
symbol.flags |= symbolFlags;
|
|
@@ -57645,6 +57675,7 @@ function createTypeChecker(host) {
|
|
|
57645
57675
|
return links.resolvedSymbol;
|
|
57646
57676
|
}
|
|
57647
57677
|
function getResolvedMembersOrExportsOfSymbol(symbol, resolutionKind) {
|
|
57678
|
+
var _a, _b, _c;
|
|
57648
57679
|
const links = getSymbolLinks(symbol);
|
|
57649
57680
|
if (!links[resolutionKind]) {
|
|
57650
57681
|
const isStatic2 = resolutionKind === "resolvedExports" /* resolvedExports */;
|
|
@@ -57663,7 +57694,7 @@ function createTypeChecker(host) {
|
|
|
57663
57694
|
}
|
|
57664
57695
|
}
|
|
57665
57696
|
}
|
|
57666
|
-
const assignments = symbol.assignmentDeclarationMembers;
|
|
57697
|
+
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;
|
|
57667
57698
|
if (assignments) {
|
|
57668
57699
|
const decls = arrayFrom(assignments.values());
|
|
57669
57700
|
for (const member of decls) {
|
|
@@ -57792,7 +57823,7 @@ function createTypeChecker(host) {
|
|
|
57792
57823
|
/*resolvedTypePredicate*/
|
|
57793
57824
|
void 0,
|
|
57794
57825
|
sig.minArgumentCount,
|
|
57795
|
-
sig.flags &
|
|
57826
|
+
sig.flags & 167 /* PropagatingFlags */
|
|
57796
57827
|
);
|
|
57797
57828
|
result.target = sig.target;
|
|
57798
57829
|
result.mapper = sig.mapper;
|
|
@@ -58093,7 +58124,7 @@ function createTypeChecker(host) {
|
|
|
58093
58124
|
/*resolvedTypePredicate*/
|
|
58094
58125
|
void 0,
|
|
58095
58126
|
minArgCount,
|
|
58096
|
-
(left.flags | right.flags) &
|
|
58127
|
+
(left.flags | right.flags) & 167 /* PropagatingFlags */
|
|
58097
58128
|
);
|
|
58098
58129
|
result.compositeKind = 1048576 /* Union */;
|
|
58099
58130
|
result.compositeSignatures = concatenate(left.compositeKind !== 2097152 /* Intersection */ && left.compositeSignatures || [left], [right]);
|
|
@@ -58241,20 +58272,17 @@ function createTypeChecker(host) {
|
|
|
58241
58272
|
setStructuredTypeMembers(type, members2, callSignatures, constructSignatures, indexInfos2);
|
|
58242
58273
|
return;
|
|
58243
58274
|
}
|
|
58244
|
-
let members =
|
|
58275
|
+
let members = getExportsOfSymbol(symbol);
|
|
58245
58276
|
let indexInfos;
|
|
58246
|
-
if (symbol
|
|
58247
|
-
|
|
58248
|
-
|
|
58249
|
-
|
|
58250
|
-
|
|
58251
|
-
|
|
58252
|
-
|
|
58253
|
-
|
|
58254
|
-
|
|
58255
|
-
});
|
|
58256
|
-
members = varsOnly;
|
|
58257
|
-
}
|
|
58277
|
+
if (symbol === globalThisSymbol) {
|
|
58278
|
+
const varsOnly = /* @__PURE__ */ new Map();
|
|
58279
|
+
members.forEach((p) => {
|
|
58280
|
+
var _a;
|
|
58281
|
+
if (!(p.flags & 418 /* BlockScoped */) && !(p.flags & 512 /* ValueModule */ && ((_a = p.declarations) == null ? void 0 : _a.length) && every(p.declarations, isAmbientModule))) {
|
|
58282
|
+
varsOnly.set(p.escapedName, p);
|
|
58283
|
+
}
|
|
58284
|
+
});
|
|
58285
|
+
members = varsOnly;
|
|
58258
58286
|
}
|
|
58259
58287
|
let baseConstructorIndexInfo;
|
|
58260
58288
|
setStructuredTypeMembers(type, members, emptyArray, emptyArray, emptyArray);
|
|
@@ -58303,7 +58331,7 @@ function createTypeChecker(host) {
|
|
|
58303
58331
|
/*resolvedTypePredicate*/
|
|
58304
58332
|
void 0,
|
|
58305
58333
|
sig.minArgumentCount,
|
|
58306
|
-
sig.flags &
|
|
58334
|
+
sig.flags & 167 /* PropagatingFlags */
|
|
58307
58335
|
) : void 0
|
|
58308
58336
|
));
|
|
58309
58337
|
}
|
|
@@ -63086,7 +63114,7 @@ function createTypeChecker(host) {
|
|
|
63086
63114
|
/*resolvedTypePredicate*/
|
|
63087
63115
|
void 0,
|
|
63088
63116
|
signature.minArgumentCount,
|
|
63089
|
-
signature.flags &
|
|
63117
|
+
signature.flags & 167 /* PropagatingFlags */
|
|
63090
63118
|
);
|
|
63091
63119
|
result.target = signature;
|
|
63092
63120
|
result.mapper = mapper;
|
|
@@ -70347,12 +70375,15 @@ function createTypeChecker(host) {
|
|
|
70347
70375
|
return narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue);
|
|
70348
70376
|
}
|
|
70349
70377
|
const target = getReferenceCandidate(expr.right);
|
|
70350
|
-
|
|
70351
|
-
|
|
70352
|
-
if (
|
|
70378
|
+
if (containsMissingType(type) && isAccessExpression(reference) && isMatchingReference(reference.expression, target)) {
|
|
70379
|
+
const leftType = getTypeOfExpression(expr.left);
|
|
70380
|
+
if (isTypeUsableAsPropertyName(leftType) && getAccessedPropertyName(reference) === getPropertyNameFromType(leftType)) {
|
|
70353
70381
|
return getTypeWithFacts(type, assumeTrue ? 524288 /* NEUndefined */ : 65536 /* EQUndefined */);
|
|
70354
70382
|
}
|
|
70355
|
-
|
|
70383
|
+
}
|
|
70384
|
+
if (isMatchingReference(reference, target)) {
|
|
70385
|
+
const leftType = getTypeOfExpression(expr.left);
|
|
70386
|
+
if (isTypeUsableAsPropertyName(leftType)) {
|
|
70356
70387
|
return narrowTypeByInKeyword(type, leftType, assumeTrue);
|
|
70357
70388
|
}
|
|
70358
70389
|
}
|
|
@@ -70617,15 +70648,6 @@ function createTypeChecker(host) {
|
|
|
70617
70648
|
return type;
|
|
70618
70649
|
}
|
|
70619
70650
|
const rightType = getTypeOfExpression(expr.right);
|
|
70620
|
-
const hasInstanceMethodType = getSymbolHasInstanceMethodOfObjectType(rightType);
|
|
70621
|
-
if (hasInstanceMethodType) {
|
|
70622
|
-
const syntheticCall = createSyntheticHasInstanceMethodCall(left, expr.right, type, hasInstanceMethodType);
|
|
70623
|
-
const signature = getEffectsSignature(syntheticCall);
|
|
70624
|
-
const predicate = signature && getTypePredicateOfSignature(signature);
|
|
70625
|
-
if (predicate && (predicate.kind === 0 /* This */ || predicate.kind === 1 /* Identifier */)) {
|
|
70626
|
-
return narrowTypeByTypePredicate(type, predicate, syntheticCall, assumeTrue);
|
|
70627
|
-
}
|
|
70628
|
-
}
|
|
70629
70651
|
if (!isTypeDerivedFrom(rightType, globalFunctionType)) {
|
|
70630
70652
|
return type;
|
|
70631
70653
|
}
|
|
@@ -70705,12 +70727,8 @@ function createTypeChecker(host) {
|
|
|
70705
70727
|
}
|
|
70706
70728
|
function narrowTypeByTypePredicate(type, predicate, callExpression, assumeTrue) {
|
|
70707
70729
|
if (predicate.type && !(isTypeAny(type) && (predicate.type === globalObjectType || predicate.type === globalFunctionType))) {
|
|
70708
|
-
|
|
70730
|
+
const predicateArgument = getTypePredicateArgument(predicate, callExpression);
|
|
70709
70731
|
if (predicateArgument) {
|
|
70710
|
-
if (isSyntheticExpression(predicateArgument) && predicate.parameterIndex === 0 && isSyntheticHasInstanceMethodCall(callExpression)) {
|
|
70711
|
-
Debug.assertNode(predicateArgument.parent, isExpression);
|
|
70712
|
-
predicateArgument = predicateArgument.parent;
|
|
70713
|
-
}
|
|
70714
70732
|
if (isMatchingReference(reference, predicateArgument)) {
|
|
70715
70733
|
return getNarrowedType(
|
|
70716
70734
|
type,
|
|
@@ -71963,41 +71981,75 @@ function createTypeChecker(host) {
|
|
|
71963
71981
|
return mapType(
|
|
71964
71982
|
type,
|
|
71965
71983
|
(t) => {
|
|
71966
|
-
|
|
71967
|
-
|
|
71968
|
-
|
|
71969
|
-
|
|
71970
|
-
const
|
|
71971
|
-
|
|
71972
|
-
|
|
71973
|
-
|
|
71974
|
-
|
|
71975
|
-
|
|
71976
|
-
|
|
71977
|
-
|
|
71978
|
-
|
|
71979
|
-
|
|
71980
|
-
|
|
71981
|
-
|
|
71982
|
-
|
|
71983
|
-
/*endSkipCount*/
|
|
71984
|
-
0,
|
|
71985
|
-
/*writing*/
|
|
71986
|
-
false,
|
|
71987
|
-
/*noReductions*/
|
|
71988
|
-
true
|
|
71989
|
-
);
|
|
71990
|
-
if (restType) {
|
|
71991
|
-
return restType;
|
|
71984
|
+
if (!(t.flags & 3670016 /* StructuredType */)) {
|
|
71985
|
+
return void 0;
|
|
71986
|
+
}
|
|
71987
|
+
if (t.flags & 2097152 /* Intersection */) {
|
|
71988
|
+
const intersection = t;
|
|
71989
|
+
let applicableIndexedMappedTypeSubstitions;
|
|
71990
|
+
let concretePropertyTypes;
|
|
71991
|
+
let applicableIndexInfoCandidates;
|
|
71992
|
+
for (const t2 of intersection.types) {
|
|
71993
|
+
if (isGenericMappedType(t2) && !t2.declaration.nameType) {
|
|
71994
|
+
applicableIndexedMappedTypeSubstitions = append(applicableIndexedMappedTypeSubstitions, getTypeOfApplicableIndexedMappedTypeSubstitutionOfContextualType(t2));
|
|
71995
|
+
continue;
|
|
71996
|
+
}
|
|
71997
|
+
const typeOfConcreteProperty = getTypeOfConcretePropertyOfContextualType(t2);
|
|
71998
|
+
if (typeOfConcreteProperty) {
|
|
71999
|
+
concretePropertyTypes = append(concretePropertyTypes, typeOfConcreteProperty);
|
|
72000
|
+
continue;
|
|
71992
72001
|
}
|
|
72002
|
+
applicableIndexInfoCandidates = append(applicableIndexInfoCandidates, t2);
|
|
72003
|
+
}
|
|
72004
|
+
if (concretePropertyTypes) {
|
|
72005
|
+
return getIntersectionType(concatenate(concretePropertyTypes, applicableIndexedMappedTypeSubstitions));
|
|
72006
|
+
}
|
|
72007
|
+
const types = concatenate(mapDefined(applicableIndexInfoCandidates, getTypeOfApplicableIndexInfoOfContextualType), applicableIndexedMappedTypeSubstitions);
|
|
72008
|
+
if (types.length > 0) {
|
|
72009
|
+
return getIntersectionType(types);
|
|
71993
72010
|
}
|
|
71994
|
-
return
|
|
72011
|
+
return void 0;
|
|
71995
72012
|
}
|
|
71996
|
-
return
|
|
72013
|
+
return isGenericMappedType(t) && !t.declaration.nameType ? getTypeOfApplicableIndexedMappedTypeSubstitutionOfContextualType(t) : getTypeOfConcretePropertyOfContextualType(t) || getTypeOfApplicableIndexInfoOfContextualType(t);
|
|
71997
72014
|
},
|
|
71998
72015
|
/*noReductions*/
|
|
71999
72016
|
true
|
|
72000
72017
|
);
|
|
72018
|
+
function getTypeOfApplicableIndexedMappedTypeSubstitutionOfContextualType(t) {
|
|
72019
|
+
const constraint = getConstraintTypeFromMappedType(t);
|
|
72020
|
+
const constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
|
|
72021
|
+
const propertyNameType = nameType || getStringLiteralType(unescapeLeadingUnderscores(name));
|
|
72022
|
+
if (isTypeAssignableTo(propertyNameType, constraintOfConstraint)) {
|
|
72023
|
+
return substituteIndexedMappedType(t, propertyNameType);
|
|
72024
|
+
}
|
|
72025
|
+
return void 0;
|
|
72026
|
+
}
|
|
72027
|
+
function getTypeOfConcretePropertyOfContextualType(t) {
|
|
72028
|
+
const prop = getPropertyOfType(t, name);
|
|
72029
|
+
if (prop) {
|
|
72030
|
+
return isCircularMappedProperty(prop) ? void 0 : getTypeOfSymbol(prop);
|
|
72031
|
+
}
|
|
72032
|
+
if (isTupleType(t) && isNumericLiteralName(name) && +name >= 0) {
|
|
72033
|
+
const restType = getElementTypeOfSliceOfTupleType(
|
|
72034
|
+
t,
|
|
72035
|
+
t.target.fixedLength,
|
|
72036
|
+
/*endSkipCount*/
|
|
72037
|
+
0,
|
|
72038
|
+
/*writing*/
|
|
72039
|
+
false,
|
|
72040
|
+
/*noReductions*/
|
|
72041
|
+
true
|
|
72042
|
+
);
|
|
72043
|
+
if (restType) {
|
|
72044
|
+
return restType;
|
|
72045
|
+
}
|
|
72046
|
+
}
|
|
72047
|
+
return void 0;
|
|
72048
|
+
}
|
|
72049
|
+
function getTypeOfApplicableIndexInfoOfContextualType(t) {
|
|
72050
|
+
var _a;
|
|
72051
|
+
return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(unescapeLeadingUnderscores(name)))) == null ? void 0 : _a.type;
|
|
72052
|
+
}
|
|
72001
72053
|
}
|
|
72002
72054
|
function getContextualTypeForObjectLiteralMethod(node, contextFlags) {
|
|
72003
72055
|
Debug.assert(isObjectLiteralMethod(node));
|
|
@@ -72548,7 +72600,7 @@ function createTypeChecker(host) {
|
|
|
72548
72600
|
/*resolvedTypePredicate*/
|
|
72549
72601
|
void 0,
|
|
72550
72602
|
minArgCount,
|
|
72551
|
-
(left.flags | right.flags) &
|
|
72603
|
+
(left.flags | right.flags) & 167 /* PropagatingFlags */
|
|
72552
72604
|
);
|
|
72553
72605
|
result.compositeKind = 2097152 /* Intersection */;
|
|
72554
72606
|
result.compositeSignatures = concatenate(left.compositeKind === 2097152 /* Intersection */ && left.compositeSignatures || [left], [right]);
|
|
@@ -75287,7 +75339,7 @@ function createTypeChecker(host) {
|
|
|
75287
75339
|
}
|
|
75288
75340
|
return createDiagnosticForNodeArray(getSourceFileOfNode(node), typeArguments, Diagnostics.Expected_0_type_arguments_but_got_1, belowArgCount === -Infinity ? aboveArgCount : belowArgCount, argCount);
|
|
75289
75341
|
}
|
|
75290
|
-
function resolveCall(node, signatures, candidatesOutArray, checkMode, callChainFlags,
|
|
75342
|
+
function resolveCall(node, signatures, candidatesOutArray, checkMode, callChainFlags, headMessage) {
|
|
75291
75343
|
const isTaggedTemplate = node.kind === 215 /* TaggedTemplateExpression */;
|
|
75292
75344
|
const isDecorator2 = node.kind === 170 /* Decorator */;
|
|
75293
75345
|
const isJsxOpeningOrSelfClosingElement = isJsxOpeningLikeElement(node);
|
|
@@ -75330,7 +75382,6 @@ function createTypeChecker(host) {
|
|
|
75330
75382
|
chain = chainDiagnosticMessages(chain, Diagnostics.The_last_overload_gave_the_following_error);
|
|
75331
75383
|
chain = chainDiagnosticMessages(chain, Diagnostics.No_overload_matches_this_call);
|
|
75332
75384
|
}
|
|
75333
|
-
const headMessage = headMessageCallback == null ? void 0 : headMessageCallback();
|
|
75334
75385
|
if (headMessage) {
|
|
75335
75386
|
chain = chainDiagnosticMessages(chain, headMessage);
|
|
75336
75387
|
}
|
|
@@ -75398,7 +75449,6 @@ function createTypeChecker(host) {
|
|
|
75398
75449
|
map(diags, createDiagnosticMessageChainFromDiagnostic),
|
|
75399
75450
|
Diagnostics.No_overload_matches_this_call
|
|
75400
75451
|
);
|
|
75401
|
-
const headMessage = headMessageCallback == null ? void 0 : headMessageCallback();
|
|
75402
75452
|
if (headMessage) {
|
|
75403
75453
|
chain = chainDiagnosticMessages(chain, headMessage);
|
|
75404
75454
|
}
|
|
@@ -75414,21 +75464,21 @@ function createTypeChecker(host) {
|
|
|
75414
75464
|
diagnostics.add(diag2);
|
|
75415
75465
|
}
|
|
75416
75466
|
} else if (candidateForArgumentArityError) {
|
|
75417
|
-
diagnostics.add(getArgumentArityError(node, [candidateForArgumentArityError], args,
|
|
75467
|
+
diagnostics.add(getArgumentArityError(node, [candidateForArgumentArityError], args, headMessage));
|
|
75418
75468
|
} else if (candidateForTypeArgumentError) {
|
|
75419
75469
|
checkTypeArguments(
|
|
75420
75470
|
candidateForTypeArgumentError,
|
|
75421
75471
|
node.typeArguments,
|
|
75422
75472
|
/*reportErrors*/
|
|
75423
75473
|
true,
|
|
75424
|
-
|
|
75474
|
+
headMessage
|
|
75425
75475
|
);
|
|
75426
75476
|
} else {
|
|
75427
75477
|
const signaturesWithCorrectTypeArgumentArity = filter(signatures, (s) => hasCorrectTypeArgumentArity(s, typeArguments));
|
|
75428
75478
|
if (signaturesWithCorrectTypeArgumentArity.length === 0) {
|
|
75429
|
-
diagnostics.add(getTypeArgumentArityError(node, signatures, typeArguments,
|
|
75479
|
+
diagnostics.add(getTypeArgumentArityError(node, signatures, typeArguments, headMessage));
|
|
75430
75480
|
} else {
|
|
75431
|
-
diagnostics.add(getArgumentArityError(node, signaturesWithCorrectTypeArgumentArity, args,
|
|
75481
|
+
diagnostics.add(getArgumentArityError(node, signaturesWithCorrectTypeArgumentArity, args, headMessage));
|
|
75432
75482
|
}
|
|
75433
75483
|
}
|
|
75434
75484
|
}
|
|
@@ -75579,7 +75629,7 @@ function createTypeChecker(host) {
|
|
|
75579
75629
|
parameters.push(createCombinedSymbolFromTypes(symbols, mapDefined(candidates, (candidate) => tryGetTypeAtPosition(candidate, i))));
|
|
75580
75630
|
}
|
|
75581
75631
|
const restParameterSymbols = mapDefined(candidates, (c) => signatureHasRestParameter(c) ? last(c.parameters) : void 0);
|
|
75582
|
-
let flags =
|
|
75632
|
+
let flags = 128 /* IsSignatureCandidateForOverloadFailure */;
|
|
75583
75633
|
if (restParameterSymbols.length !== 0) {
|
|
75584
75634
|
const type = createArrayType(getUnionType(mapDefined(candidates, tryGetRestTypeOfSignature), 2 /* Subtype */));
|
|
75585
75635
|
parameters.push(createCombinedSymbolForOverloadFailure(restParameterSymbols, type));
|
|
@@ -75736,7 +75786,7 @@ function createTypeChecker(host) {
|
|
|
75736
75786
|
error2(node, Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new, typeToString(funcType));
|
|
75737
75787
|
return resolveErrorCall(node);
|
|
75738
75788
|
}
|
|
75739
|
-
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, callChainFlags
|
|
75789
|
+
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, callChainFlags);
|
|
75740
75790
|
}
|
|
75741
75791
|
function isGenericFunctionReturningFunction(signature) {
|
|
75742
75792
|
return !!(signature.typeParameters && isFunctionType(getReturnTypeOfSignature(signature)));
|
|
@@ -76033,7 +76083,7 @@ function createTypeChecker(host) {
|
|
|
76033
76083
|
invocationErrorRecovery(apparentType, 0 /* Call */, diag2);
|
|
76034
76084
|
return resolveErrorCall(node);
|
|
76035
76085
|
}
|
|
76036
|
-
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, 0 /* None */,
|
|
76086
|
+
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, 0 /* None */, headMessage);
|
|
76037
76087
|
}
|
|
76038
76088
|
function createSignatureForJSXIntrinsic(node, result) {
|
|
76039
76089
|
const namespace = getJsxNamespaceAt(node);
|
|
@@ -76303,6 +76353,8 @@ function createTypeChecker(host) {
|
|
|
76303
76353
|
return returnType;
|
|
76304
76354
|
}
|
|
76305
76355
|
function checkDeprecatedSignature(signature, node) {
|
|
76356
|
+
if (signature.flags & 128 /* IsSignatureCandidateForOverloadFailure */)
|
|
76357
|
+
return;
|
|
76306
76358
|
if (signature.declaration && signature.declaration.flags & 536870912 /* Deprecated */) {
|
|
76307
76359
|
const suggestionNode = getDeprecatedSuggestionNode(node);
|
|
76308
76360
|
const name = tryGetPropertyAccessOrIdentifierToString(getInvokedExpression(node));
|
|
@@ -76776,7 +76828,7 @@ function createTypeChecker(host) {
|
|
|
76776
76828
|
}
|
|
76777
76829
|
return restParameter.escapedName;
|
|
76778
76830
|
}
|
|
76779
|
-
function
|
|
76831
|
+
function getParameterIdentifierInfoAtPosition(signature, pos) {
|
|
76780
76832
|
var _a;
|
|
76781
76833
|
if (((_a = signature.declaration) == null ? void 0 : _a.kind) === 324 /* JSDocFunctionType */) {
|
|
76782
76834
|
return void 0;
|
|
@@ -76784,10 +76836,16 @@ function createTypeChecker(host) {
|
|
|
76784
76836
|
const paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0);
|
|
76785
76837
|
if (pos < paramCount) {
|
|
76786
76838
|
const param = signature.parameters[pos];
|
|
76787
|
-
|
|
76839
|
+
const paramIdent = getParameterDeclarationIdentifier(param);
|
|
76840
|
+
return paramIdent ? {
|
|
76841
|
+
parameter: paramIdent,
|
|
76842
|
+
parameterName: param.escapedName,
|
|
76843
|
+
isRestParameter: false
|
|
76844
|
+
} : void 0;
|
|
76788
76845
|
}
|
|
76789
76846
|
const restParameter = signature.parameters[paramCount] || unknownSymbol;
|
|
76790
|
-
|
|
76847
|
+
const restIdent = getParameterDeclarationIdentifier(restParameter);
|
|
76848
|
+
if (!restIdent) {
|
|
76791
76849
|
return void 0;
|
|
76792
76850
|
}
|
|
76793
76851
|
const restType = getTypeOfSymbol(restParameter);
|
|
@@ -76796,18 +76854,19 @@ function createTypeChecker(host) {
|
|
|
76796
76854
|
const index = pos - paramCount;
|
|
76797
76855
|
const associatedName = associatedNames == null ? void 0 : associatedNames[index];
|
|
76798
76856
|
const isRestTupleElement = !!(associatedName == null ? void 0 : associatedName.dotDotDotToken);
|
|
76799
|
-
|
|
76800
|
-
|
|
76801
|
-
isRestTupleElement
|
|
76802
|
-
|
|
76857
|
+
if (associatedName) {
|
|
76858
|
+
Debug.assert(isIdentifier(associatedName.name));
|
|
76859
|
+
return { parameter: associatedName.name, parameterName: associatedName.name.escapedText, isRestParameter: isRestTupleElement };
|
|
76860
|
+
}
|
|
76861
|
+
return void 0;
|
|
76803
76862
|
}
|
|
76804
76863
|
if (pos === paramCount) {
|
|
76805
|
-
return
|
|
76864
|
+
return { parameter: restIdent, parameterName: restParameter.escapedName, isRestParameter: true };
|
|
76806
76865
|
}
|
|
76807
76866
|
return void 0;
|
|
76808
76867
|
}
|
|
76809
|
-
function
|
|
76810
|
-
return symbol.valueDeclaration && isParameter(symbol.valueDeclaration) && isIdentifier(symbol.valueDeclaration.name);
|
|
76868
|
+
function getParameterDeclarationIdentifier(symbol) {
|
|
76869
|
+
return symbol.valueDeclaration && isParameter(symbol.valueDeclaration) && isIdentifier(symbol.valueDeclaration.name) && symbol.valueDeclaration.name;
|
|
76811
76870
|
}
|
|
76812
76871
|
function isValidDeclarationForTupleLabel(d) {
|
|
76813
76872
|
return d.kind === 202 /* NamedTupleMember */ || isParameter(d) && d.name && isIdentifier(d.name);
|
|
@@ -78066,32 +78125,6 @@ function createTypeChecker(host) {
|
|
|
78066
78125
|
function isConstEnumSymbol(symbol) {
|
|
78067
78126
|
return (symbol.flags & 128 /* ConstEnum */) !== 0;
|
|
78068
78127
|
}
|
|
78069
|
-
function getSymbolHasInstanceMethodOfObjectType(type) {
|
|
78070
|
-
const hasInstancePropertyName = getPropertyNameForKnownSymbolName("hasInstance");
|
|
78071
|
-
const hasInstanceProperty = getPropertyOfObjectType(type, hasInstancePropertyName);
|
|
78072
|
-
if (hasInstanceProperty) {
|
|
78073
|
-
const hasInstancePropertyType = getTypeOfSymbol(hasInstanceProperty);
|
|
78074
|
-
if (hasInstancePropertyType && getSignaturesOfType(hasInstancePropertyType, 0 /* Call */).length !== 0) {
|
|
78075
|
-
return hasInstancePropertyType;
|
|
78076
|
-
}
|
|
78077
|
-
}
|
|
78078
|
-
}
|
|
78079
|
-
function createSyntheticHasInstanceMethodCall(left, right, leftType, hasInstanceMethodType) {
|
|
78080
|
-
const syntheticExpression = createSyntheticExpression(right, hasInstanceMethodType);
|
|
78081
|
-
const syntheticArgument = createSyntheticExpression(left, leftType);
|
|
78082
|
-
const syntheticCall = parseNodeFactory.createCallExpression(
|
|
78083
|
-
syntheticExpression,
|
|
78084
|
-
/*typeArguments*/
|
|
78085
|
-
void 0,
|
|
78086
|
-
[syntheticArgument]
|
|
78087
|
-
);
|
|
78088
|
-
setParent(syntheticCall, left.parent);
|
|
78089
|
-
setTextRange(syntheticCall, left.parent);
|
|
78090
|
-
return syntheticCall;
|
|
78091
|
-
}
|
|
78092
|
-
function isSyntheticHasInstanceMethodCall(node) {
|
|
78093
|
-
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;
|
|
78094
|
-
}
|
|
78095
78128
|
function checkInstanceOfExpression(left, right, leftType, rightType) {
|
|
78096
78129
|
if (leftType === silentNeverType || rightType === silentNeverType) {
|
|
78097
78130
|
return silentNeverType;
|
|
@@ -78099,31 +78132,8 @@ function createTypeChecker(host) {
|
|
|
78099
78132
|
if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 402784252 /* Primitive */)) {
|
|
78100
78133
|
error2(left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
|
|
78101
78134
|
}
|
|
78102
|
-
if (!isTypeAny(rightType)) {
|
|
78103
|
-
|
|
78104
|
-
if (hasInstanceMethodType) {
|
|
78105
|
-
const cache = hasInstanceMethodType;
|
|
78106
|
-
if (cache.hasSimpleUnrestrictedSingleCallSignature === void 0) {
|
|
78107
|
-
const signature = getSingleCallSignature(hasInstanceMethodType);
|
|
78108
|
-
cache.hasSimpleUnrestrictedSingleCallSignature = !!signature && signature.parameters.length === 1 && !!(getTypeOfSymbol(signature.parameters[0]).flags & 3 /* AnyOrUnknown */) && !!signature.resolvedReturnType && !!(signature.resolvedReturnType.flags & 16 /* Boolean */);
|
|
78109
|
-
}
|
|
78110
|
-
if (!cache.hasSimpleUnrestrictedSingleCallSignature) {
|
|
78111
|
-
const syntheticCall = createSyntheticHasInstanceMethodCall(left, right, leftType, hasInstanceMethodType);
|
|
78112
|
-
const returnType = getReturnTypeOfSignature(getResolvedSignature(syntheticCall));
|
|
78113
|
-
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);
|
|
78114
|
-
}
|
|
78115
|
-
}
|
|
78116
|
-
if (!(hasInstanceMethodType || typeHasCallOrConstructSignatures(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
|
|
78117
|
-
if (hasGlobalSymbolHasInstanceProperty === void 0) {
|
|
78118
|
-
const globalESSymbolConstructorSymbol = getGlobalESSymbolConstructorTypeSymbol(
|
|
78119
|
-
/*reportErrors*/
|
|
78120
|
-
false
|
|
78121
|
-
);
|
|
78122
|
-
hasGlobalSymbolHasInstanceProperty = !!globalESSymbolConstructorSymbol && getMembersOfSymbol(globalESSymbolConstructorSymbol).has("hasInstance");
|
|
78123
|
-
}
|
|
78124
|
-
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;
|
|
78125
|
-
error2(right, message);
|
|
78126
|
-
}
|
|
78135
|
+
if (!(isTypeAny(rightType) || typeHasCallOrConstructSignatures(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
|
|
78136
|
+
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);
|
|
78127
78137
|
}
|
|
78128
78138
|
return booleanType;
|
|
78129
78139
|
}
|
|
@@ -127102,7 +127112,6 @@ function createWatchProgram(host) {
|
|
|
127102
127112
|
if (hasChangedCompilerOptions) {
|
|
127103
127113
|
newLine = updateNewLine();
|
|
127104
127114
|
if (program && changesAffectModuleResolution(program.getCompilerOptions(), compilerOptions)) {
|
|
127105
|
-
debugger;
|
|
127106
127115
|
resolutionCache.onChangesAffectModuleResolution();
|
|
127107
127116
|
}
|
|
127108
127117
|
}
|
|
@@ -136096,8 +136105,8 @@ function computeSuggestionDiagnostics(sourceFile, program, cancellationToken) {
|
|
|
136096
136105
|
diags.push(createDiagnosticForNode(init, Diagnostics.require_call_may_be_converted_to_an_import));
|
|
136097
136106
|
}
|
|
136098
136107
|
}
|
|
136099
|
-
const
|
|
136100
|
-
|
|
136108
|
+
const jsdocTypedefNodes = ts_codefix_exports.getJSDocTypedefNodes(node);
|
|
136109
|
+
for (const jsdocTypedefNode of jsdocTypedefNodes) {
|
|
136101
136110
|
diags.push(createDiagnosticForNode(jsdocTypedefNode, Diagnostics.JSDoc_typedef_may_be_converted_to_TypeScript_type));
|
|
136102
136111
|
}
|
|
136103
136112
|
if (ts_codefix_exports.parameterShouldGetTypeFromJSDoc(node)) {
|
|
@@ -146916,7 +146925,7 @@ __export(ts_codefix_exports, {
|
|
|
146916
146925
|
getFixes: () => getFixes,
|
|
146917
146926
|
getImportCompletionAction: () => getImportCompletionAction,
|
|
146918
146927
|
getImportKind: () => getImportKind,
|
|
146919
|
-
|
|
146928
|
+
getJSDocTypedefNodes: () => getJSDocTypedefNodes,
|
|
146920
146929
|
getNoopSymbolTrackerWithResolver: () => getNoopSymbolTrackerWithResolver,
|
|
146921
146930
|
getPromoteTypeOnlyCompletionAction: () => getPromoteTypeOnlyCompletionAction,
|
|
146922
146931
|
getSupportedErrorCodes: () => getSupportedErrorCodes,
|
|
@@ -149638,13 +149647,14 @@ registerCodeFix({
|
|
|
149638
149647
|
fixIds: [fixId14],
|
|
149639
149648
|
errorCodes: errorCodes15,
|
|
149640
149649
|
getCodeActions(context) {
|
|
149650
|
+
const newLineCharacter = getNewLineOrDefaultFromHost(context.host, context.formatContext.options);
|
|
149641
149651
|
const node = getTokenAtPosition(
|
|
149642
149652
|
context.sourceFile,
|
|
149643
149653
|
context.span.start
|
|
149644
149654
|
);
|
|
149645
149655
|
if (!node)
|
|
149646
149656
|
return;
|
|
149647
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange12(t, node, context.sourceFile));
|
|
149657
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange12(t, node, context.sourceFile, newLineCharacter));
|
|
149648
149658
|
if (changes.length > 0) {
|
|
149649
149659
|
return [
|
|
149650
149660
|
createCodeFixAction(
|
|
@@ -149657,29 +149667,72 @@ registerCodeFix({
|
|
|
149657
149667
|
];
|
|
149658
149668
|
}
|
|
149659
149669
|
},
|
|
149660
|
-
getAllCodeActions: (context) => codeFixAll(
|
|
149661
|
-
|
|
149662
|
-
|
|
149663
|
-
|
|
149664
|
-
|
|
149670
|
+
getAllCodeActions: (context) => codeFixAll(
|
|
149671
|
+
context,
|
|
149672
|
+
errorCodes15,
|
|
149673
|
+
(changes, diag2) => {
|
|
149674
|
+
const newLineCharacter = getNewLineOrDefaultFromHost(context.host, context.formatContext.options);
|
|
149675
|
+
const node = getTokenAtPosition(diag2.file, diag2.start);
|
|
149676
|
+
const fixAll = true;
|
|
149677
|
+
if (node)
|
|
149678
|
+
doChange12(changes, node, diag2.file, newLineCharacter, fixAll);
|
|
149679
|
+
}
|
|
149680
|
+
)
|
|
149665
149681
|
});
|
|
149666
|
-
function doChange12(changes, node, sourceFile) {
|
|
149667
|
-
if (isJSDocTypedefTag(node))
|
|
149668
|
-
fixSingleTypeDef(changes, node, sourceFile);
|
|
149669
|
-
}
|
|
149670
|
-
}
|
|
149671
|
-
function fixSingleTypeDef(changes, typeDefNode, sourceFile) {
|
|
149672
|
-
if (!typeDefNode)
|
|
149682
|
+
function doChange12(changes, node, sourceFile, newLine, fixAll = false) {
|
|
149683
|
+
if (!isJSDocTypedefTag(node))
|
|
149673
149684
|
return;
|
|
149674
|
-
const declaration = createDeclaration(
|
|
149685
|
+
const declaration = createDeclaration(node);
|
|
149675
149686
|
if (!declaration)
|
|
149676
149687
|
return;
|
|
149677
|
-
const
|
|
149678
|
-
|
|
149679
|
-
|
|
149680
|
-
|
|
149681
|
-
|
|
149688
|
+
const commentNode = node.parent;
|
|
149689
|
+
const { leftSibling, rightSibling } = getLeftAndRightSiblings(node);
|
|
149690
|
+
let pos = commentNode.getStart();
|
|
149691
|
+
let prefix = "";
|
|
149692
|
+
if (!leftSibling && commentNode.comment) {
|
|
149693
|
+
pos = findEndOfTextBetween(commentNode, commentNode.getStart(), node.getStart());
|
|
149694
|
+
prefix = `${newLine} */${newLine}`;
|
|
149695
|
+
}
|
|
149696
|
+
if (leftSibling) {
|
|
149697
|
+
if (fixAll && isJSDocTypedefTag(leftSibling)) {
|
|
149698
|
+
pos = node.getStart();
|
|
149699
|
+
prefix = "";
|
|
149700
|
+
} else {
|
|
149701
|
+
pos = findEndOfTextBetween(commentNode, leftSibling.getStart(), node.getStart());
|
|
149702
|
+
prefix = `${newLine} */${newLine}`;
|
|
149703
|
+
}
|
|
149704
|
+
}
|
|
149705
|
+
let end = commentNode.getEnd();
|
|
149706
|
+
let suffix = "";
|
|
149707
|
+
if (rightSibling) {
|
|
149708
|
+
if (fixAll && isJSDocTypedefTag(rightSibling)) {
|
|
149709
|
+
end = rightSibling.getStart();
|
|
149710
|
+
suffix = `${newLine}${newLine}`;
|
|
149711
|
+
} else {
|
|
149712
|
+
end = rightSibling.getStart();
|
|
149713
|
+
suffix = `${newLine}/**${newLine} * `;
|
|
149714
|
+
}
|
|
149715
|
+
}
|
|
149716
|
+
changes.replaceRange(sourceFile, { pos, end }, declaration, { prefix, suffix });
|
|
149717
|
+
}
|
|
149718
|
+
function getLeftAndRightSiblings(typedefNode) {
|
|
149719
|
+
const commentNode = typedefNode.parent;
|
|
149720
|
+
const maxChildIndex = commentNode.getChildCount() - 1;
|
|
149721
|
+
const currentNodeIndex = commentNode.getChildren().findIndex(
|
|
149722
|
+
(n) => n.getStart() === typedefNode.getStart() && n.getEnd() === typedefNode.getEnd()
|
|
149682
149723
|
);
|
|
149724
|
+
const leftSibling = currentNodeIndex > 0 ? commentNode.getChildAt(currentNodeIndex - 1) : void 0;
|
|
149725
|
+
const rightSibling = currentNodeIndex < maxChildIndex ? commentNode.getChildAt(currentNodeIndex + 1) : void 0;
|
|
149726
|
+
return { leftSibling, rightSibling };
|
|
149727
|
+
}
|
|
149728
|
+
function findEndOfTextBetween(jsDocComment, from, to) {
|
|
149729
|
+
const comment = jsDocComment.getText().substring(from - jsDocComment.getStart(), to - jsDocComment.getStart());
|
|
149730
|
+
for (let i = comment.length; i > 0; i--) {
|
|
149731
|
+
if (!/[*\/\s]/g.test(comment.substring(i - 1, i))) {
|
|
149732
|
+
return from + i;
|
|
149733
|
+
}
|
|
149734
|
+
}
|
|
149735
|
+
return to;
|
|
149683
149736
|
}
|
|
149684
149737
|
function createDeclaration(tag) {
|
|
149685
149738
|
var _a;
|
|
@@ -149700,7 +149753,7 @@ function createInterfaceForTypeLiteral(typeName, typeLiteral) {
|
|
|
149700
149753
|
const propertySignatures = createSignatureFromTypeLiteral(typeLiteral);
|
|
149701
149754
|
if (!some(propertySignatures))
|
|
149702
149755
|
return;
|
|
149703
|
-
|
|
149756
|
+
return factory.createInterfaceDeclaration(
|
|
149704
149757
|
/*modifiers*/
|
|
149705
149758
|
void 0,
|
|
149706
149759
|
typeName,
|
|
@@ -149710,13 +149763,12 @@ function createInterfaceForTypeLiteral(typeName, typeLiteral) {
|
|
|
149710
149763
|
void 0,
|
|
149711
149764
|
propertySignatures
|
|
149712
149765
|
);
|
|
149713
|
-
return interfaceDeclaration;
|
|
149714
149766
|
}
|
|
149715
149767
|
function createTypeAliasForTypeExpression(typeName, typeExpression) {
|
|
149716
149768
|
const typeReference = getSynthesizedDeepClone(typeExpression.type);
|
|
149717
149769
|
if (!typeReference)
|
|
149718
149770
|
return;
|
|
149719
|
-
|
|
149771
|
+
return factory.createTypeAliasDeclaration(
|
|
149720
149772
|
/*modifiers*/
|
|
149721
149773
|
void 0,
|
|
149722
149774
|
factory.createIdentifier(typeName),
|
|
@@ -149724,7 +149776,6 @@ function createTypeAliasForTypeExpression(typeName, typeExpression) {
|
|
|
149724
149776
|
void 0,
|
|
149725
149777
|
typeReference
|
|
149726
149778
|
);
|
|
149727
|
-
return declaration;
|
|
149728
149779
|
}
|
|
149729
149780
|
function createSignatureFromTypeLiteral(typeLiteral) {
|
|
149730
149781
|
const propertyTags = typeLiteral.jsDocPropertyTags;
|
|
@@ -149744,30 +149795,28 @@ function createSignatureFromTypeLiteral(typeLiteral) {
|
|
|
149744
149795
|
}
|
|
149745
149796
|
if (typeReference && name) {
|
|
149746
149797
|
const questionToken = isOptional ? factory.createToken(58 /* QuestionToken */) : void 0;
|
|
149747
|
-
|
|
149798
|
+
return factory.createPropertySignature(
|
|
149748
149799
|
/*modifiers*/
|
|
149749
149800
|
void 0,
|
|
149750
149801
|
name,
|
|
149751
149802
|
questionToken,
|
|
149752
149803
|
typeReference
|
|
149753
149804
|
);
|
|
149754
|
-
return prop;
|
|
149755
149805
|
}
|
|
149756
149806
|
};
|
|
149757
|
-
|
|
149758
|
-
return props;
|
|
149807
|
+
return mapDefined(propertyTags, getSignature);
|
|
149759
149808
|
}
|
|
149760
149809
|
function getPropertyName(tag) {
|
|
149761
149810
|
return tag.name.kind === 80 /* Identifier */ ? tag.name.text : tag.name.right.text;
|
|
149762
149811
|
}
|
|
149763
|
-
function
|
|
149812
|
+
function getJSDocTypedefNodes(node) {
|
|
149764
149813
|
if (hasJSDocNodes(node)) {
|
|
149765
|
-
return
|
|
149814
|
+
return flatMap(node.jsDoc, (doc) => {
|
|
149766
149815
|
var _a;
|
|
149767
|
-
return (_a =
|
|
149816
|
+
return (_a = doc.tags) == null ? void 0 : _a.filter((tag) => isJSDocTypedefTag(tag));
|
|
149768
149817
|
});
|
|
149769
149818
|
}
|
|
149770
|
-
return
|
|
149819
|
+
return [];
|
|
149771
149820
|
}
|
|
149772
149821
|
|
|
149773
149822
|
// src/services/codefixes/convertLiteralTypeToMappedType.ts
|
|
@@ -150900,6 +150949,14 @@ function promoteFromTypeOnly(changes, aliasDeclaration, compilerOptions, sourceF
|
|
|
150900
150949
|
}
|
|
150901
150950
|
function promoteImportClause(importClause) {
|
|
150902
150951
|
changes.delete(sourceFile, getTypeKeywordOfTypeOnlyImport(importClause, sourceFile));
|
|
150952
|
+
if (!compilerOptions.allowImportingTsExtensions) {
|
|
150953
|
+
const moduleSpecifier = tryGetModuleSpecifierFromDeclaration(importClause.parent);
|
|
150954
|
+
const resolvedModule = moduleSpecifier && getResolvedModule(sourceFile, moduleSpecifier.text, getModeForUsageLocation(sourceFile, moduleSpecifier));
|
|
150955
|
+
if (resolvedModule == null ? void 0 : resolvedModule.resolvedUsingTsExtension) {
|
|
150956
|
+
const changedExtension = changeAnyExtension(moduleSpecifier.text, getOutputExtension(moduleSpecifier.text, compilerOptions));
|
|
150957
|
+
changes.replaceNode(sourceFile, moduleSpecifier, factory.createStringLiteral(changedExtension));
|
|
150958
|
+
}
|
|
150959
|
+
}
|
|
150903
150960
|
if (convertExistingToTypeOnly) {
|
|
150904
150961
|
const namedImports = tryCast(importClause.namedBindings, isNamedImports);
|
|
150905
150962
|
if (namedImports && namedImports.elements.length > 1) {
|
|
@@ -152017,6 +152074,8 @@ function getInfo9(checker, sourceFile, position, errorCode) {
|
|
|
152017
152074
|
if (!declaration || !isCallExpression(declaration.parent) || !declaration.body)
|
|
152018
152075
|
return void 0;
|
|
152019
152076
|
const pos = declaration.parent.arguments.indexOf(declaration);
|
|
152077
|
+
if (pos === -1)
|
|
152078
|
+
return void 0;
|
|
152020
152079
|
const type = checker.getContextualTypeForArgumentAtIndex(declaration.parent, pos);
|
|
152021
152080
|
if (!type)
|
|
152022
152081
|
return void 0;
|
|
@@ -155184,15 +155243,11 @@ var PreserveOptionalFlags = /* @__PURE__ */ ((PreserveOptionalFlags2) => {
|
|
|
155184
155243
|
})(PreserveOptionalFlags || {});
|
|
155185
155244
|
function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, context, preferences, importAdder, addClassElement, body, preserveOptional = 3 /* All */, isAmbient = false) {
|
|
155186
155245
|
const declarations = symbol.getDeclarations();
|
|
155187
|
-
const declaration = declarations
|
|
155246
|
+
const declaration = firstOrUndefined(declarations);
|
|
155188
155247
|
const checker = context.program.getTypeChecker();
|
|
155189
155248
|
const scriptTarget = getEmitScriptTarget(context.program.getCompilerOptions());
|
|
155190
155249
|
const kind = (declaration == null ? void 0 : declaration.kind) ?? 171 /* PropertySignature */;
|
|
155191
|
-
const declarationName =
|
|
155192
|
-
getNameOfDeclaration(declaration),
|
|
155193
|
-
/*includeTrivia*/
|
|
155194
|
-
false
|
|
155195
|
-
);
|
|
155250
|
+
const declarationName = createDeclarationName(symbol, declaration);
|
|
155196
155251
|
const effectiveModifierFlags = declaration ? getEffectiveModifierFlags(declaration) : 0 /* None */;
|
|
155197
155252
|
let modifierFlags = effectiveModifierFlags & 32 /* Static */;
|
|
155198
155253
|
modifierFlags |= effectiveModifierFlags & 4 /* Public */ ? 4 /* Public */ : effectiveModifierFlags & 16 /* Protected */ ? 16 /* Protected */ : 0 /* None */;
|
|
@@ -155343,6 +155398,19 @@ function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, con
|
|
|
155343
155398
|
false
|
|
155344
155399
|
);
|
|
155345
155400
|
}
|
|
155401
|
+
function createDeclarationName(symbol2, declaration2) {
|
|
155402
|
+
if (getCheckFlags(symbol2) & 262144 /* Mapped */) {
|
|
155403
|
+
const nameType = symbol2.links.nameType;
|
|
155404
|
+
if (nameType && isTypeUsableAsPropertyName(nameType)) {
|
|
155405
|
+
return factory.createIdentifier(unescapeLeadingUnderscores(getPropertyNameFromType(nameType)));
|
|
155406
|
+
}
|
|
155407
|
+
}
|
|
155408
|
+
return getSynthesizedDeepClone(
|
|
155409
|
+
getNameOfDeclaration(declaration2),
|
|
155410
|
+
/*includeTrivia*/
|
|
155411
|
+
false
|
|
155412
|
+
);
|
|
155413
|
+
}
|
|
155346
155414
|
}
|
|
155347
155415
|
function createSignatureDeclarationFromSignature(kind, context, quotePreference, signature, body, name, modifiers, optional, enclosingDeclaration, importAdder) {
|
|
155348
155416
|
const program = context.program;
|
|
@@ -159202,7 +159270,8 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
159202
159270
|
const leftMostName = getLeftMostName(computedPropertyName.expression);
|
|
159203
159271
|
const nameSymbol = leftMostName && typeChecker.getSymbolAtLocation(leftMostName);
|
|
159204
159272
|
const firstAccessibleSymbol = nameSymbol && getFirstSymbolInChain(nameSymbol, contextToken, typeChecker);
|
|
159205
|
-
|
|
159273
|
+
const firstAccessibleSymbolId = firstAccessibleSymbol && getSymbolId(firstAccessibleSymbol);
|
|
159274
|
+
if (firstAccessibleSymbolId && addToSeen(seenPropertySymbols, firstAccessibleSymbolId)) {
|
|
159206
159275
|
const index = symbols.length;
|
|
159207
159276
|
symbols.push(firstAccessibleSymbol);
|
|
159208
159277
|
const moduleSymbol = firstAccessibleSymbol.parent;
|
|
@@ -159232,6 +159301,9 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
159232
159301
|
}
|
|
159233
159302
|
}
|
|
159234
159303
|
} else if (preferences.includeCompletionsWithInsertText) {
|
|
159304
|
+
if (firstAccessibleSymbolId && seenPropertySymbols.has(firstAccessibleSymbolId)) {
|
|
159305
|
+
return;
|
|
159306
|
+
}
|
|
159235
159307
|
addSymbolOriginInfo(symbol);
|
|
159236
159308
|
addSymbolSortInfo(symbol);
|
|
159237
159309
|
symbols.push(symbol);
|
|
@@ -164556,7 +164628,7 @@ __export(ts_InlayHints_exports, {
|
|
|
164556
164628
|
});
|
|
164557
164629
|
|
|
164558
164630
|
// src/services/inlayHints.ts
|
|
164559
|
-
var
|
|
164631
|
+
var maxTypeHintLength = 30;
|
|
164560
164632
|
var leadingParameterNameCommentRegexFactory = (name) => {
|
|
164561
164633
|
return new RegExp(`^\\s?/\\*\\*?\\s?${name}\\s?\\*\\/\\s?$`);
|
|
164562
164634
|
};
|
|
@@ -164566,6 +164638,9 @@ function shouldShowParameterNameHints(preferences) {
|
|
|
164566
164638
|
function shouldShowLiteralParameterNameHintsOnly(preferences) {
|
|
164567
164639
|
return preferences.includeInlayParameterNameHints === "literals";
|
|
164568
164640
|
}
|
|
164641
|
+
function shouldUseInteractiveInlayHints(preferences) {
|
|
164642
|
+
return preferences.interactiveInlayHints === true;
|
|
164643
|
+
}
|
|
164569
164644
|
function provideInlayHints(context) {
|
|
164570
164645
|
const { file, program, span, cancellationToken, preferences } = context;
|
|
164571
164646
|
const sourceFileText = file.text;
|
|
@@ -164616,9 +164691,15 @@ function provideInlayHints(context) {
|
|
|
164616
164691
|
function isSignatureSupportingReturnAnnotation(node) {
|
|
164617
164692
|
return isArrowFunction(node) || isFunctionExpression(node) || isFunctionDeclaration(node) || isMethodDeclaration(node) || isGetAccessorDeclaration(node);
|
|
164618
164693
|
}
|
|
164619
|
-
function addParameterHints(text, position, isFirstVariadicArgument) {
|
|
164694
|
+
function addParameterHints(text, parameter, position, isFirstVariadicArgument, sourceFile) {
|
|
164695
|
+
let hintText = `${isFirstVariadicArgument ? "..." : ""}${text}`;
|
|
164696
|
+
if (shouldUseInteractiveInlayHints(preferences)) {
|
|
164697
|
+
hintText = [getNodeDisplayPart(hintText, parameter, sourceFile), { text: ":" }];
|
|
164698
|
+
} else {
|
|
164699
|
+
hintText += ":";
|
|
164700
|
+
}
|
|
164620
164701
|
result.push({
|
|
164621
|
-
text:
|
|
164702
|
+
text: hintText,
|
|
164622
164703
|
position,
|
|
164623
164704
|
kind: "Parameter" /* Parameter */,
|
|
164624
164705
|
whitespaceAfter: true
|
|
@@ -164626,7 +164707,7 @@ function provideInlayHints(context) {
|
|
|
164626
164707
|
}
|
|
164627
164708
|
function addTypeHints(text, position) {
|
|
164628
164709
|
result.push({
|
|
164629
|
-
text: `: ${
|
|
164710
|
+
text: `: ${text.length > maxTypeHintLength ? text.substr(0, maxTypeHintLength - "...".length) + "..." : text}`,
|
|
164630
164711
|
position,
|
|
164631
164712
|
kind: "Type" /* Type */,
|
|
164632
164713
|
whitespaceBefore: true
|
|
@@ -164634,7 +164715,7 @@ function provideInlayHints(context) {
|
|
|
164634
164715
|
}
|
|
164635
164716
|
function addEnumMemberValueHints(text, position) {
|
|
164636
164717
|
result.push({
|
|
164637
|
-
text: `= ${
|
|
164718
|
+
text: `= ${text}`,
|
|
164638
164719
|
position,
|
|
164639
164720
|
kind: "Enum" /* Enum */,
|
|
164640
164721
|
whitespaceBefore: true
|
|
@@ -164684,6 +164765,7 @@ function provideInlayHints(context) {
|
|
|
164684
164765
|
return;
|
|
164685
164766
|
}
|
|
164686
164767
|
let signatureParamPos = 0;
|
|
164768
|
+
const sourceFile = shouldUseInteractiveInlayHints(preferences) ? expr.getSourceFile() : void 0;
|
|
164687
164769
|
for (const originalArg of args) {
|
|
164688
164770
|
const arg = skipParentheses(originalArg);
|
|
164689
164771
|
if (shouldShowLiteralParameterNameHintsOnly(preferences) && !isHintableLiteral(arg)) {
|
|
@@ -164704,10 +164786,10 @@ function provideInlayHints(context) {
|
|
|
164704
164786
|
}
|
|
164705
164787
|
}
|
|
164706
164788
|
}
|
|
164707
|
-
const
|
|
164789
|
+
const identifierInfo = checker.getParameterIdentifierInfoAtPosition(signature, signatureParamPos);
|
|
164708
164790
|
signatureParamPos = signatureParamPos + (spreadArgs || 1);
|
|
164709
|
-
if (
|
|
164710
|
-
const
|
|
164791
|
+
if (identifierInfo) {
|
|
164792
|
+
const { parameter, parameterName, isRestParameter: isFirstVariadicArgument } = identifierInfo;
|
|
164711
164793
|
const isParameterNameNotSameAsArgument = preferences.includeInlayParameterNameHintsWhenArgumentMatchesName || !identifierOrAccessExpressionPostfixMatchesParameterName(arg, parameterName);
|
|
164712
164794
|
if (!isParameterNameNotSameAsArgument && !isFirstVariadicArgument) {
|
|
164713
164795
|
continue;
|
|
@@ -164716,7 +164798,7 @@ function provideInlayHints(context) {
|
|
|
164716
164798
|
if (leadingCommentsContainsParameterName(arg, name)) {
|
|
164717
164799
|
continue;
|
|
164718
164800
|
}
|
|
164719
|
-
addParameterHints(name, originalArg.getStart(), isFirstVariadicArgument);
|
|
164801
|
+
addParameterHints(name, parameter, originalArg.getStart(), isFirstVariadicArgument, sourceFile);
|
|
164720
164802
|
}
|
|
164721
164803
|
}
|
|
164722
164804
|
}
|
|
@@ -164822,12 +164904,6 @@ function provideInlayHints(context) {
|
|
|
164822
164904
|
}
|
|
164823
164905
|
return printTypeInSingleLine(signatureParamType);
|
|
164824
164906
|
}
|
|
164825
|
-
function truncation(text, maxLength2) {
|
|
164826
|
-
if (text.length > maxLength2) {
|
|
164827
|
-
return text.substr(0, maxLength2 - "...".length) + "...";
|
|
164828
|
-
}
|
|
164829
|
-
return text;
|
|
164830
|
-
}
|
|
164831
164907
|
function printTypeInSingleLine(type) {
|
|
164832
164908
|
const flags = 70221824 /* IgnoreErrors */ | 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */;
|
|
164833
164909
|
const printer = createPrinterWithRemoveComments();
|
|
@@ -164858,6 +164934,13 @@ function provideInlayHints(context) {
|
|
|
164858
164934
|
}
|
|
164859
164935
|
return true;
|
|
164860
164936
|
}
|
|
164937
|
+
function getNodeDisplayPart(text, node, sourceFile) {
|
|
164938
|
+
return {
|
|
164939
|
+
text,
|
|
164940
|
+
span: createTextSpanFromNode(node, sourceFile),
|
|
164941
|
+
file: sourceFile.fileName
|
|
164942
|
+
};
|
|
164943
|
+
}
|
|
164861
164944
|
}
|
|
164862
164945
|
|
|
164863
164946
|
// src/services/_namespaces/ts.JsDoc.ts
|
|
@@ -167277,7 +167360,7 @@ function getSymbolModifiers(typeChecker, symbol) {
|
|
|
167277
167360
|
}
|
|
167278
167361
|
return modifiers.size > 0 ? arrayFrom(modifiers.values()).join(",") : "" /* none */;
|
|
167279
167362
|
}
|
|
167280
|
-
function
|
|
167363
|
+
function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symbol, sourceFile, enclosingDeclaration, location, type, semanticMeaning, alias) {
|
|
167281
167364
|
var _a;
|
|
167282
167365
|
const displayParts = [];
|
|
167283
167366
|
let documentation = [];
|
|
@@ -167286,7 +167369,6 @@ function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, so
|
|
|
167286
167369
|
let symbolKind = semanticMeaning & 1 /* Value */ ? getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, location) : "" /* unknown */;
|
|
167287
167370
|
let hasAddedSymbolInfo = false;
|
|
167288
167371
|
const isThisExpression = location.kind === 110 /* ThisKeyword */ && isInExpressionContext(location) || isThisInTypeQuery(location);
|
|
167289
|
-
let type;
|
|
167290
167372
|
let documentationFromAlias;
|
|
167291
167373
|
let tagsFromAlias;
|
|
167292
167374
|
let hasMultipleSignatures = false;
|
|
@@ -167315,7 +167397,7 @@ function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, so
|
|
|
167315
167397
|
}
|
|
167316
167398
|
}
|
|
167317
167399
|
let signature;
|
|
167318
|
-
type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location);
|
|
167400
|
+
type ?? (type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location));
|
|
167319
167401
|
if (location.parent && location.parent.kind === 211 /* PropertyAccessExpression */) {
|
|
167320
167402
|
const right = location.parent.name;
|
|
167321
167403
|
if (right === location || right && right.getFullWidth() === 0) {
|
|
@@ -167530,12 +167612,13 @@ function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, so
|
|
|
167530
167612
|
if (declarationName && !hasAddedSymbolInfo) {
|
|
167531
167613
|
const isExternalModuleDeclaration = isModuleWithStringLiteralName(resolvedNode) && hasSyntacticModifier(resolvedNode, 2 /* Ambient */);
|
|
167532
167614
|
const shouldUseAliasName = symbol.name !== "default" && !isExternalModuleDeclaration;
|
|
167533
|
-
const resolvedInfo =
|
|
167615
|
+
const resolvedInfo = getSymbolDisplayPartsDocumentationAndSymbolKindWorker(
|
|
167534
167616
|
typeChecker,
|
|
167535
167617
|
resolvedSymbol,
|
|
167536
167618
|
getSourceFileOfNode(resolvedNode),
|
|
167537
167619
|
resolvedNode,
|
|
167538
167620
|
declarationName,
|
|
167621
|
+
type,
|
|
167539
167622
|
semanticMeaning,
|
|
167540
167623
|
shouldUseAliasName ? symbol : resolvedSymbol
|
|
167541
167624
|
);
|
|
@@ -167790,6 +167873,19 @@ function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, so
|
|
|
167790
167873
|
addRange(displayParts, typeParameterParts);
|
|
167791
167874
|
}
|
|
167792
167875
|
}
|
|
167876
|
+
function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, enclosingDeclaration, location, semanticMeaning = getMeaningFromLocation(location), alias) {
|
|
167877
|
+
return getSymbolDisplayPartsDocumentationAndSymbolKindWorker(
|
|
167878
|
+
typeChecker,
|
|
167879
|
+
symbol,
|
|
167880
|
+
sourceFile,
|
|
167881
|
+
enclosingDeclaration,
|
|
167882
|
+
location,
|
|
167883
|
+
/*type*/
|
|
167884
|
+
void 0,
|
|
167885
|
+
semanticMeaning,
|
|
167886
|
+
alias
|
|
167887
|
+
);
|
|
167888
|
+
}
|
|
167793
167889
|
function isLocalVariableOrFunction(symbol) {
|
|
167794
167890
|
if (symbol.parent) {
|
|
167795
167891
|
return false;
|
|
@@ -172799,6 +172895,7 @@ __export(ts_exports2, {
|
|
|
172799
172895
|
getPropertyAssignmentAliasLikeExpression: () => getPropertyAssignmentAliasLikeExpression,
|
|
172800
172896
|
getPropertyNameForPropertyNameNode: () => getPropertyNameForPropertyNameNode,
|
|
172801
172897
|
getPropertyNameForUniqueESSymbol: () => getPropertyNameForUniqueESSymbol,
|
|
172898
|
+
getPropertyNameFromType: () => getPropertyNameFromType,
|
|
172802
172899
|
getPropertyNameOfBindingOrAssignmentElement: () => getPropertyNameOfBindingOrAssignmentElement,
|
|
172803
172900
|
getPropertySymbolFromBindingElement: () => getPropertySymbolFromBindingElement,
|
|
172804
172901
|
getPropertySymbolsFromContextualType: () => getPropertySymbolsFromContextualType,
|
|
@@ -173631,6 +173728,7 @@ __export(ts_exports2, {
|
|
|
173631
173728
|
isTypeQueryNode: () => isTypeQueryNode,
|
|
173632
173729
|
isTypeReferenceNode: () => isTypeReferenceNode,
|
|
173633
173730
|
isTypeReferenceType: () => isTypeReferenceType,
|
|
173731
|
+
isTypeUsableAsPropertyName: () => isTypeUsableAsPropertyName,
|
|
173634
173732
|
isUMDExportSymbol: () => isUMDExportSymbol,
|
|
173635
173733
|
isUnaryExpression: () => isUnaryExpression,
|
|
173636
173734
|
isUnaryExpressionWithWrite: () => isUnaryExpressionWithWrite,
|
|
@@ -183489,10 +183587,22 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
183489
183587
|
const { file, project } = this.getFileAndProject(args);
|
|
183490
183588
|
const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file);
|
|
183491
183589
|
const hints = project.getLanguageService().provideInlayHints(file, args, this.getPreferences(file));
|
|
183492
|
-
return hints.map((hint) =>
|
|
183493
|
-
|
|
183494
|
-
|
|
183495
|
-
|
|
183590
|
+
return hints.map((hint) => {
|
|
183591
|
+
const { text, position } = hint;
|
|
183592
|
+
const hintText = typeof text === "string" ? text : text.map(({ text: text2, span, file: file2 }) => ({
|
|
183593
|
+
text: text2,
|
|
183594
|
+
span: span && {
|
|
183595
|
+
start: scriptInfo.positionToLineOffset(span.start),
|
|
183596
|
+
end: scriptInfo.positionToLineOffset(span.start + span.length),
|
|
183597
|
+
file: file2
|
|
183598
|
+
}
|
|
183599
|
+
}));
|
|
183600
|
+
return {
|
|
183601
|
+
...hint,
|
|
183602
|
+
position: scriptInfo.positionToLineOffset(position),
|
|
183603
|
+
text: hintText
|
|
183604
|
+
};
|
|
183605
|
+
});
|
|
183496
183606
|
}
|
|
183497
183607
|
setCompilerOptionsForInferredProjects(args) {
|
|
183498
183608
|
this.projectService.setCompilerOptionsForInferredProjects(args.options, args.projectRootPath);
|
|
@@ -187313,6 +187423,7 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
187313
187423
|
getPropertyAssignmentAliasLikeExpression,
|
|
187314
187424
|
getPropertyNameForPropertyNameNode,
|
|
187315
187425
|
getPropertyNameForUniqueESSymbol,
|
|
187426
|
+
getPropertyNameFromType,
|
|
187316
187427
|
getPropertyNameOfBindingOrAssignmentElement,
|
|
187317
187428
|
getPropertySymbolFromBindingElement,
|
|
187318
187429
|
getPropertySymbolsFromContextualType,
|
|
@@ -188145,6 +188256,7 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
188145
188256
|
isTypeQueryNode,
|
|
188146
188257
|
isTypeReferenceNode,
|
|
188147
188258
|
isTypeReferenceType,
|
|
188259
|
+
isTypeUsableAsPropertyName,
|
|
188148
188260
|
isUMDExportSymbol,
|
|
188149
188261
|
isUnaryExpression,
|
|
188150
188262
|
isUnaryExpressionWithWrite,
|