@typescript-deploys/pr-build 5.2.0-pr-52899-20 → 5.2.0-pr-54788-8
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 +56 -57
- package/lib/tsserver.js +65 -105
- package/lib/tsserverlibrary.d.ts +3 -3
- package/lib/tsserverlibrary.js +65 -105
- package/lib/typescript.d.ts +3 -3
- package/lib/typescript.js +65 -105
- package/lib/typingsInstaller.js +1 -4
- package/package.json +2 -2
package/lib/tsserver.js
CHANGED
|
@@ -2327,7 +2327,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2327
2327
|
|
|
2328
2328
|
// src/compiler/corePublic.ts
|
|
2329
2329
|
var versionMajorMinor = "5.2";
|
|
2330
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2330
|
+
var version = `${versionMajorMinor}.0-insiders.20230626`;
|
|
2331
2331
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2332
2332
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2333
2333
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -9733,7 +9733,6 @@ var Diagnostics = {
|
|
|
9733
9733
|
This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_version_of_0: diag(2343, 1 /* Error */, "This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_ve_2343", "This syntax requires an imported helper named '{1}' which does not exist in '{0}'. Consider upgrading your version of '{0}'."),
|
|
9734
9734
|
Type_0_does_not_satisfy_the_constraint_1: diag(2344, 1 /* Error */, "Type_0_does_not_satisfy_the_constraint_1_2344", "Type '{0}' does not satisfy the constraint '{1}'."),
|
|
9735
9735
|
Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: diag(2345, 1 /* Error */, "Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_2345", "Argument of type '{0}' is not assignable to parameter of type '{1}'."),
|
|
9736
|
-
Call_target_does_not_contain_any_signatures: diag(2346, 1 /* Error */, "Call_target_does_not_contain_any_signatures_2346", "Call target does not contain any signatures."),
|
|
9737
9736
|
Untyped_function_calls_may_not_accept_type_arguments: diag(2347, 1 /* Error */, "Untyped_function_calls_may_not_accept_type_arguments_2347", "Untyped function calls may not accept type arguments."),
|
|
9738
9737
|
Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: diag(2348, 1 /* Error */, "Value_of_type_0_is_not_callable_Did_you_mean_to_include_new_2348", "Value of type '{0}' is not callable. Did you mean to include 'new'?"),
|
|
9739
9738
|
This_expression_is_not_callable: diag(2349, 1 /* Error */, "This_expression_is_not_callable_2349", "This expression is not callable."),
|
|
@@ -10343,7 +10342,6 @@ var Diagnostics = {
|
|
|
10343
10342
|
Cannot_find_a_tsconfig_json_file_at_the_current_directory_Colon_0: diag(5081, 1 /* Error */, "Cannot_find_a_tsconfig_json_file_at_the_current_directory_Colon_0_5081", "Cannot find a tsconfig.json file at the current directory: {0}."),
|
|
10344
10343
|
_0_could_be_instantiated_with_an_arbitrary_type_which_could_be_unrelated_to_1: diag(5082, 1 /* Error */, "_0_could_be_instantiated_with_an_arbitrary_type_which_could_be_unrelated_to_1_5082", "'{0}' could be instantiated with an arbitrary type which could be unrelated to '{1}'."),
|
|
10345
10344
|
Cannot_read_file_0: diag(5083, 1 /* Error */, "Cannot_read_file_0_5083", "Cannot read file '{0}'."),
|
|
10346
|
-
Tuple_members_must_all_have_names_or_all_not_have_names: diag(5084, 1 /* Error */, "Tuple_members_must_all_have_names_or_all_not_have_names_5084", "Tuple members must all have names or all not have names."),
|
|
10347
10345
|
A_tuple_member_cannot_be_both_optional_and_rest: diag(5085, 1 /* Error */, "A_tuple_member_cannot_be_both_optional_and_rest_5085", "A tuple member cannot be both optional and rest."),
|
|
10348
10346
|
A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_colon_rather_than_after_the_type: diag(5086, 1 /* Error */, "A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_c_5086", "A labeled tuple element is declared as optional with a question mark after the name and before the colon, rather than after the type."),
|
|
10349
10347
|
A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type: diag(5087, 1 /* Error */, "A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type_5087", "A labeled tuple element is declared as rest with a '...' before the name, rather than before the type."),
|
|
@@ -11269,7 +11267,6 @@ var Diagnostics = {
|
|
|
11269
11267
|
Inline_variable: diag(95184, 3 /* Message */, "Inline_variable_95184", "Inline variable"),
|
|
11270
11268
|
Could_not_find_variable_to_inline: diag(95185, 3 /* Message */, "Could_not_find_variable_to_inline_95185", "Could not find variable to inline."),
|
|
11271
11269
|
Variables_with_multiple_declarations_cannot_be_inlined: diag(95186, 3 /* Message */, "Variables_with_multiple_declarations_cannot_be_inlined_95186", "Variables with multiple declarations cannot be inlined."),
|
|
11272
|
-
Add_missing_comma_for_object_member_completion_0: diag(95187, 3 /* Message */, "Add_missing_comma_for_object_member_completion_0_95187", "Add missing comma for object member completion '{0}'."),
|
|
11273
11270
|
No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, 1 /* Error */, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
|
|
11274
11271
|
Classes_may_not_have_a_field_named_constructor: diag(18006, 1 /* Error */, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
|
|
11275
11272
|
JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, 1 /* Error */, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
|
|
@@ -50846,6 +50843,7 @@ function createTypeChecker(host) {
|
|
|
50846
50843
|
const contextSpecifier = isStringLiteralLike(location) ? location : ((_a = findAncestor(location, isImportCall)) == null ? void 0 : _a.arguments[0]) || ((_b = findAncestor(location, isImportDeclaration)) == null ? void 0 : _b.moduleSpecifier) || ((_c = findAncestor(location, isExternalModuleImportEqualsDeclaration)) == null ? void 0 : _c.moduleReference.expression) || ((_d = findAncestor(location, isExportDeclaration)) == null ? void 0 : _d.moduleSpecifier) || ((_e = isModuleDeclaration(location) ? location : location.parent && isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : void 0) == null ? void 0 : _e.name) || ((_f = isLiteralImportTypeNode(location) ? location : void 0) == null ? void 0 : _f.argument.literal);
|
|
50847
50844
|
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
|
|
50848
50845
|
const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
|
|
50846
|
+
const moduleKind2 = getEmitModuleKind(compilerOptions);
|
|
50849
50847
|
const resolvedModule = getResolvedModule(currentSourceFile, moduleReference, mode);
|
|
50850
50848
|
const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
|
|
50851
50849
|
const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
|
|
@@ -50878,7 +50876,7 @@ function createTypeChecker(host) {
|
|
|
50878
50876
|
moduleReference
|
|
50879
50877
|
);
|
|
50880
50878
|
}
|
|
50881
|
-
if (
|
|
50879
|
+
if (100 /* Node16 */ <= moduleKind2 && moduleKind2 <= 199 /* NodeNext */) {
|
|
50882
50880
|
const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
|
|
50883
50881
|
const overrideClauseHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
|
|
50884
50882
|
const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (_h = overrideClauseHost.assertions) == null ? void 0 : _h.assertClause : overrideClauseHost == null ? void 0 : overrideClauseHost.assertClause;
|
|
@@ -51002,7 +51000,7 @@ function createTypeChecker(host) {
|
|
|
51002
51000
|
return void 0;
|
|
51003
51001
|
function getSuggestedImportSource(tsExtension) {
|
|
51004
51002
|
const importSourceWithoutExtension = removeExtension(moduleReference, tsExtension);
|
|
51005
|
-
if (emitModuleKindIsNonNodeESM(
|
|
51003
|
+
if (emitModuleKindIsNonNodeESM(moduleKind2) || mode === 99 /* ESNext */) {
|
|
51006
51004
|
const preferTs = isDeclarationFileName(moduleReference) && shouldAllowImportingTsExtension(compilerOptions);
|
|
51007
51005
|
const ext = tsExtension === ".mts" /* Mts */ || tsExtension === ".d.mts" /* Dmts */ ? preferTs ? ".mts" : ".mjs" : tsExtension === ".cts" /* Cts */ || tsExtension === ".d.mts" /* Dmts */ ? preferTs ? ".cts" : ".cjs" : preferTs ? ".ts" : ".js";
|
|
51008
51006
|
return importSourceWithoutExtension + ext;
|
|
@@ -52641,19 +52639,18 @@ function createTypeChecker(host) {
|
|
|
52641
52639
|
const arity = getTypeReferenceArity(type2);
|
|
52642
52640
|
const tupleConstituentNodes = mapToTypeNodes(typeArguments.slice(0, arity), context);
|
|
52643
52641
|
if (tupleConstituentNodes) {
|
|
52644
|
-
|
|
52645
|
-
|
|
52646
|
-
|
|
52642
|
+
const { labeledElementDeclarations } = type2.target;
|
|
52643
|
+
for (let i = 0; i < tupleConstituentNodes.length; i++) {
|
|
52644
|
+
const flags = type2.target.elementFlags[i];
|
|
52645
|
+
const labeledElementDeclaration = labeledElementDeclarations == null ? void 0 : labeledElementDeclarations[i];
|
|
52646
|
+
if (labeledElementDeclaration) {
|
|
52647
52647
|
tupleConstituentNodes[i] = factory.createNamedTupleMember(
|
|
52648
52648
|
flags & 12 /* Variable */ ? factory.createToken(26 /* DotDotDotToken */) : void 0,
|
|
52649
|
-
factory.createIdentifier(unescapeLeadingUnderscores(getTupleElementLabel(
|
|
52649
|
+
factory.createIdentifier(unescapeLeadingUnderscores(getTupleElementLabel(labeledElementDeclaration))),
|
|
52650
52650
|
flags & 2 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0,
|
|
52651
52651
|
flags & 4 /* Rest */ ? factory.createArrayTypeNode(tupleConstituentNodes[i]) : tupleConstituentNodes[i]
|
|
52652
52652
|
);
|
|
52653
|
-
}
|
|
52654
|
-
} else {
|
|
52655
|
-
for (let i = 0; i < Math.min(arity, tupleConstituentNodes.length); i++) {
|
|
52656
|
-
const flags = type2.target.elementFlags[i];
|
|
52653
|
+
} else {
|
|
52657
52654
|
tupleConstituentNodes[i] = flags & 12 /* Variable */ ? factory.createRestTypeNode(flags & 4 /* Rest */ ? factory.createArrayTypeNode(tupleConstituentNodes[i]) : tupleConstituentNodes[i]) : flags & 2 /* Optional */ ? factory.createOptionalTypeNode(tupleConstituentNodes[i]) : tupleConstituentNodes[i];
|
|
52658
52655
|
}
|
|
52659
52656
|
}
|
|
@@ -57765,17 +57762,18 @@ function createTypeChecker(host) {
|
|
|
57765
57762
|
function getExpandedParameters(sig, skipUnionExpanding) {
|
|
57766
57763
|
if (signatureHasRestParameter(sig)) {
|
|
57767
57764
|
const restIndex = sig.parameters.length - 1;
|
|
57765
|
+
const restName = sig.parameters[restIndex].escapedName;
|
|
57768
57766
|
const restType = getTypeOfSymbol(sig.parameters[restIndex]);
|
|
57769
57767
|
if (isTupleType(restType)) {
|
|
57770
|
-
return [expandSignatureParametersWithTupleMembers(restType, restIndex)];
|
|
57768
|
+
return [expandSignatureParametersWithTupleMembers(restType, restIndex, restName)];
|
|
57771
57769
|
} else if (!skipUnionExpanding && restType.flags & 1048576 /* Union */ && every(restType.types, isTupleType)) {
|
|
57772
|
-
return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex));
|
|
57770
|
+
return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex, restName));
|
|
57773
57771
|
}
|
|
57774
57772
|
}
|
|
57775
57773
|
return [sig.parameters];
|
|
57776
|
-
function expandSignatureParametersWithTupleMembers(restType, restIndex) {
|
|
57777
|
-
const elementTypes =
|
|
57778
|
-
const associatedNames = getUniqAssociatedNamesFromTupleType(restType);
|
|
57774
|
+
function expandSignatureParametersWithTupleMembers(restType, restIndex, restName) {
|
|
57775
|
+
const elementTypes = getTypeArguments(restType);
|
|
57776
|
+
const associatedNames = getUniqAssociatedNamesFromTupleType(restType, restName);
|
|
57779
57777
|
const restParams = map(elementTypes, (t, i) => {
|
|
57780
57778
|
const name = associatedNames && associatedNames[i] ? associatedNames[i] : getParameterNameAtPosition(sig, restIndex + i, restType);
|
|
57781
57779
|
const flags = restType.target.elementFlags[i];
|
|
@@ -57786,10 +57784,10 @@ function createTypeChecker(host) {
|
|
|
57786
57784
|
});
|
|
57787
57785
|
return concatenate(sig.parameters.slice(0, restIndex), restParams);
|
|
57788
57786
|
}
|
|
57789
|
-
function getUniqAssociatedNamesFromTupleType(type) {
|
|
57787
|
+
function getUniqAssociatedNamesFromTupleType(type, restName) {
|
|
57790
57788
|
const associatedNamesMap = /* @__PURE__ */ new Map();
|
|
57791
|
-
return map(type.target.labeledElementDeclarations, (labeledElement) => {
|
|
57792
|
-
const name = getTupleElementLabel(labeledElement);
|
|
57789
|
+
return map(type.target.labeledElementDeclarations, (labeledElement, i) => {
|
|
57790
|
+
const name = getTupleElementLabel(labeledElement, i, restName);
|
|
57793
57791
|
const prevCounter = associatedNamesMap.get(name);
|
|
57794
57792
|
if (prevCounter === void 0) {
|
|
57795
57793
|
associatedNamesMap.set(name, 1);
|
|
@@ -60723,13 +60721,10 @@ function createTypeChecker(host) {
|
|
|
60723
60721
|
return readonly ? globalReadonlyArrayType : globalArrayType;
|
|
60724
60722
|
}
|
|
60725
60723
|
const elementFlags = map(node.elements, getTupleElementFlags);
|
|
60726
|
-
|
|
60727
|
-
|
|
60728
|
-
|
|
60729
|
-
|
|
60730
|
-
/*associatedNames*/
|
|
60731
|
-
missingName ? void 0 : node.elements
|
|
60732
|
-
);
|
|
60724
|
+
return getTupleTargetType(elementFlags, readonly, map(node.elements, memberIfLabeledElementDeclaration));
|
|
60725
|
+
}
|
|
60726
|
+
function memberIfLabeledElementDeclaration(member) {
|
|
60727
|
+
return isNamedTupleMember(member) || isParameter(member) ? member : void 0;
|
|
60733
60728
|
}
|
|
60734
60729
|
function isDeferredTypeReferenceNode(node, hasDefaultTypeArguments) {
|
|
60735
60730
|
return !!getAliasSymbolForTypeNode(node) || isResolvedByTypeAlias(node) && (node.kind === 188 /* ArrayType */ ? mayResolveTypeAlias(node.elementType) : node.kind === 189 /* TupleType */ ? some(node.elements, mayResolveTypeAlias) : hasDefaultTypeArguments || some(node.typeArguments, mayResolveTypeAlias));
|
|
@@ -60804,7 +60799,7 @@ function createTypeChecker(host) {
|
|
|
60804
60799
|
function isReadonlyTypeOperator(node) {
|
|
60805
60800
|
return isTypeOperatorNode(node) && node.operator === 148 /* ReadonlyKeyword */;
|
|
60806
60801
|
}
|
|
60807
|
-
function createTupleType(elementTypes, elementFlags, readonly = false, namedMemberDeclarations) {
|
|
60802
|
+
function createTupleType(elementTypes, elementFlags, readonly = false, namedMemberDeclarations = []) {
|
|
60808
60803
|
const tupleTarget = getTupleTargetType(elementFlags || map(elementTypes, (_) => 1 /* Required */), readonly, namedMemberDeclarations);
|
|
60809
60804
|
return tupleTarget === emptyGenericType ? emptyObjectType : elementTypes.length ? createNormalizedTypeReference(tupleTarget, elementTypes) : tupleTarget;
|
|
60810
60805
|
}
|
|
@@ -60812,7 +60807,8 @@ function createTypeChecker(host) {
|
|
|
60812
60807
|
if (elementFlags.length === 1 && elementFlags[0] & 4 /* Rest */) {
|
|
60813
60808
|
return readonly ? globalReadonlyArrayType : globalArrayType;
|
|
60814
60809
|
}
|
|
60815
|
-
const
|
|
60810
|
+
const memberIds = mapDefined(namedMemberDeclarations, (node) => node ? getNodeId(node) : void 0);
|
|
60811
|
+
const key = map(elementFlags, (f) => f & 1 /* Required */ ? "#" : f & 2 /* Optional */ ? "?" : f & 4 /* Rest */ ? "." : "*").join() + (readonly ? "R" : "") + (memberIds.length ? "," + memberIds.join(",") : "");
|
|
60816
60812
|
let type = tupleTypes.get(key);
|
|
60817
60813
|
if (!type) {
|
|
60818
60814
|
tupleTypes.set(key, type = createTupleTargetType(elementFlags, readonly, namedMemberDeclarations));
|
|
@@ -60894,7 +60890,7 @@ function createTypeChecker(host) {
|
|
|
60894
60890
|
}
|
|
60895
60891
|
const expandedTypes = [];
|
|
60896
60892
|
const expandedFlags = [];
|
|
60897
|
-
|
|
60893
|
+
const expandedDeclarations = [];
|
|
60898
60894
|
let lastRequiredIndex = -1;
|
|
60899
60895
|
let firstRestIndex = -1;
|
|
60900
60896
|
let lastOptionalOrRestIndex = -1;
|
|
@@ -60932,7 +60928,7 @@ function createTypeChecker(host) {
|
|
|
60932
60928
|
));
|
|
60933
60929
|
expandedTypes.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
|
|
60934
60930
|
expandedFlags.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
|
|
60935
|
-
expandedDeclarations
|
|
60931
|
+
expandedDeclarations.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
|
|
60936
60932
|
}
|
|
60937
60933
|
const tupleTarget = getTupleTargetType(expandedFlags, target.readonly, expandedDeclarations);
|
|
60938
60934
|
return tupleTarget === emptyGenericType ? emptyObjectType : expandedFlags.length ? createTypeReference(tupleTarget, expandedTypes) : tupleTarget;
|
|
@@ -60952,11 +60948,7 @@ function createTypeChecker(host) {
|
|
|
60952
60948
|
true
|
|
60953
60949
|
) : type);
|
|
60954
60950
|
expandedFlags.push(flags);
|
|
60955
|
-
|
|
60956
|
-
expandedDeclarations.push(declaration);
|
|
60957
|
-
} else {
|
|
60958
|
-
expandedDeclarations = void 0;
|
|
60959
|
-
}
|
|
60951
|
+
expandedDeclarations.push(declaration);
|
|
60960
60952
|
}
|
|
60961
60953
|
}
|
|
60962
60954
|
function sliceTupleType(type, index, endSkipCount = 0) {
|
|
@@ -65630,7 +65622,6 @@ function createTypeChecker(host) {
|
|
|
65630
65622
|
} else if (targetFlags & 8388608 /* IndexedAccess */) {
|
|
65631
65623
|
if (sourceFlags & 8388608 /* IndexedAccess */) {
|
|
65632
65624
|
if (result2 = isRelatedTo(source2.objectType, target2.objectType, 3 /* Both */, reportErrors2)) {
|
|
65633
|
-
instantiateType(source2.objectType, reportUnreliableMapper);
|
|
65634
65625
|
result2 &= isRelatedTo(source2.indexType, target2.indexType, 3 /* Both */, reportErrors2);
|
|
65635
65626
|
}
|
|
65636
65627
|
if (result2) {
|
|
@@ -75227,12 +75218,7 @@ function createTypeChecker(host) {
|
|
|
75227
75218
|
}
|
|
75228
75219
|
const candidates = candidatesOutArray || [];
|
|
75229
75220
|
reorderCandidates(signatures, candidates, callChainFlags);
|
|
75230
|
-
|
|
75231
|
-
if (reportErrors2) {
|
|
75232
|
-
diagnostics.add(getDiagnosticForCallNode(node, Diagnostics.Call_target_does_not_contain_any_signatures));
|
|
75233
|
-
}
|
|
75234
|
-
return resolveErrorCall(node);
|
|
75235
|
-
}
|
|
75221
|
+
Debug.assert(candidates.length, "Revert #54442 and add a testcase with whatever triggered this");
|
|
75236
75222
|
const args = getEffectiveCallArguments(node);
|
|
75237
75223
|
const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
|
|
75238
75224
|
let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
|
|
@@ -76684,7 +76670,10 @@ function createTypeChecker(host) {
|
|
|
76684
76670
|
}
|
|
76685
76671
|
return type;
|
|
76686
76672
|
}
|
|
76687
|
-
function getTupleElementLabel(d) {
|
|
76673
|
+
function getTupleElementLabel(d, index, restParameterName = "arg") {
|
|
76674
|
+
if (!d) {
|
|
76675
|
+
return `${restParameterName}_${index}`;
|
|
76676
|
+
}
|
|
76688
76677
|
Debug.assert(isIdentifier(d.name));
|
|
76689
76678
|
return d.name.escapedText;
|
|
76690
76679
|
}
|
|
@@ -76698,7 +76687,7 @@ function createTypeChecker(host) {
|
|
|
76698
76687
|
if (isTupleType(restType)) {
|
|
76699
76688
|
const associatedNames = restType.target.labeledElementDeclarations;
|
|
76700
76689
|
const index = pos - paramCount;
|
|
76701
|
-
return associatedNames
|
|
76690
|
+
return getTupleElementLabel(associatedNames == null ? void 0 : associatedNames[index], index, restParameter.escapedName);
|
|
76702
76691
|
}
|
|
76703
76692
|
return restParameter.escapedName;
|
|
76704
76693
|
}
|
|
@@ -80053,12 +80042,7 @@ function createTypeChecker(host) {
|
|
|
80053
80042
|
const elementTypes = node.elements;
|
|
80054
80043
|
let seenOptionalElement = false;
|
|
80055
80044
|
let seenRestElement = false;
|
|
80056
|
-
const hasNamedElement = some(elementTypes, isNamedTupleMember);
|
|
80057
80045
|
for (const e of elementTypes) {
|
|
80058
|
-
if (e.kind !== 202 /* NamedTupleMember */ && hasNamedElement) {
|
|
80059
|
-
grammarErrorOnNode(e, Diagnostics.Tuple_members_must_all_have_names_or_all_not_have_names);
|
|
80060
|
-
break;
|
|
80061
|
-
}
|
|
80062
80046
|
const flags = getTupleElementFlags(e);
|
|
80063
80047
|
if (flags & 8 /* Variadic */) {
|
|
80064
80048
|
const type = getTypeFromTypeNode(e.type);
|
|
@@ -112384,6 +112368,21 @@ function transformDeclarations(context) {
|
|
|
112384
112368
|
const modifiers = factory2.createModifiersFromModifierFlags(getEffectiveModifierFlags(statement) & (258047 /* All */ ^ 1 /* Export */));
|
|
112385
112369
|
return factory2.updateModifiers(statement, modifiers);
|
|
112386
112370
|
}
|
|
112371
|
+
function updateModuleDeclarationAndKeyword(node, modifiers, name, body) {
|
|
112372
|
+
const updated = factory2.updateModuleDeclaration(node, modifiers, name, body);
|
|
112373
|
+
if (isAmbientModule(updated) || updated.flags & 32 /* Namespace */) {
|
|
112374
|
+
return updated;
|
|
112375
|
+
}
|
|
112376
|
+
const fixed = factory2.createModuleDeclaration(
|
|
112377
|
+
updated.modifiers,
|
|
112378
|
+
updated.name,
|
|
112379
|
+
updated.body,
|
|
112380
|
+
updated.flags | 32 /* Namespace */
|
|
112381
|
+
);
|
|
112382
|
+
setOriginalNode(fixed, updated);
|
|
112383
|
+
setTextRange(fixed, updated);
|
|
112384
|
+
return fixed;
|
|
112385
|
+
}
|
|
112387
112386
|
function transformTopLevelDeclaration(input) {
|
|
112388
112387
|
if (lateMarkedStatements) {
|
|
112389
112388
|
while (orderedRemoveItem(lateMarkedStatements, input))
|
|
@@ -112571,7 +112570,7 @@ function transformDeclarations(context) {
|
|
|
112571
112570
|
needsScopeFixMarker = oldNeedsScopeFix;
|
|
112572
112571
|
resultHasScopeMarker = oldHasScopeFix;
|
|
112573
112572
|
const mods = ensureModifiers(input);
|
|
112574
|
-
return cleanup(
|
|
112573
|
+
return cleanup(updateModuleDeclarationAndKeyword(
|
|
112575
112574
|
input,
|
|
112576
112575
|
mods,
|
|
112577
112576
|
isExternalModuleAugmentation(input) ? rewriteModuleSpecifier(input, input.name) : input.name,
|
|
@@ -112585,7 +112584,7 @@ function transformDeclarations(context) {
|
|
|
112585
112584
|
const id = getOriginalNodeId(inner);
|
|
112586
112585
|
const body = lateStatementReplacementMap.get(id);
|
|
112587
112586
|
lateStatementReplacementMap.delete(id);
|
|
112588
|
-
return cleanup(
|
|
112587
|
+
return cleanup(updateModuleDeclarationAndKeyword(
|
|
112589
112588
|
input,
|
|
112590
112589
|
mods,
|
|
112591
112590
|
input.name,
|
|
@@ -119998,9 +119997,9 @@ function getImpliedNodeFormatForFile(fileName, packageJsonInfoCache, host, optio
|
|
|
119998
119997
|
return typeof result === "object" ? result.impliedNodeFormat : result;
|
|
119999
119998
|
}
|
|
120000
119999
|
function getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host, options) {
|
|
120001
|
-
switch (
|
|
120002
|
-
case
|
|
120003
|
-
case
|
|
120000
|
+
switch (getEmitModuleKind(options)) {
|
|
120001
|
+
case 100 /* Node16 */:
|
|
120002
|
+
case 199 /* NodeNext */:
|
|
120004
120003
|
return fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".mjs" /* Mjs */]) ? 99 /* ESNext */ : fileExtensionIsOneOf(fileName, [".d.cts" /* Dcts */, ".cts" /* Cts */, ".cjs" /* Cjs */]) ? 1 /* CommonJS */ : fileExtensionIsOneOf(fileName, [".d.ts" /* Dts */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".js" /* Js */, ".jsx" /* Jsx */]) ? lookupFromPackageJson() : void 0;
|
|
120005
120004
|
default:
|
|
120006
120005
|
return void 0;
|
|
@@ -156662,7 +156661,6 @@ var CompletionSource = /* @__PURE__ */ ((CompletionSource2) => {
|
|
|
156662
156661
|
CompletionSource2["TypeOnlyAlias"] = "TypeOnlyAlias/";
|
|
156663
156662
|
CompletionSource2["ObjectLiteralMethodSnippet"] = "ObjectLiteralMethodSnippet/";
|
|
156664
156663
|
CompletionSource2["SwitchCases"] = "SwitchCases/";
|
|
156665
|
-
CompletionSource2["ObjectLiteralMemberWithComma"] = "ObjectLiteralMemberWithComma/";
|
|
156666
156664
|
return CompletionSource2;
|
|
156667
156665
|
})(CompletionSource || {});
|
|
156668
156666
|
var SymbolOriginInfoKind = /* @__PURE__ */ ((SymbolOriginInfoKind2) => {
|
|
@@ -157541,7 +157539,6 @@ function createCompletionEntryForLiteral(sourceFile, preferences, literal) {
|
|
|
157541
157539
|
return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* string */, kindModifiers: "" /* none */, sortText: SortText.LocationPriority };
|
|
157542
157540
|
}
|
|
157543
157541
|
function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, position, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag, includeSymbol) {
|
|
157544
|
-
var _a, _b;
|
|
157545
157542
|
let insertText;
|
|
157546
157543
|
let filterText;
|
|
157547
157544
|
let replacementSpan = getReplacementSpanForContextToken(replacementToken);
|
|
@@ -157600,10 +157597,6 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
|
|
|
157600
157597
|
if ((origin == null ? void 0 : origin.kind) === 64 /* TypeOnlyAlias */) {
|
|
157601
157598
|
hasAction = true;
|
|
157602
157599
|
}
|
|
157603
|
-
if (completionKind === 0 /* ObjectPropertyDeclaration */ && contextToken && ((_a = findPrecedingToken(contextToken.pos, sourceFile, contextToken)) == null ? void 0 : _a.kind) !== 28 /* CommaToken */ && (isMethodDeclaration(contextToken.parent.parent) || isSpreadAssignment(contextToken.parent) || ((_b = findAncestor(contextToken.parent, (node) => isPropertyAssignment(node))) == null ? void 0 : _b.getLastToken()) === contextToken || isShorthandPropertyAssignment(contextToken.parent) && getLineAndCharacterOfPosition(contextToken.getSourceFile(), contextToken.getEnd()).line !== getLineAndCharacterOfPosition(contextToken.getSourceFile(), position).line)) {
|
|
157604
|
-
source = "ObjectLiteralMemberWithComma/" /* ObjectLiteralMemberWithComma */;
|
|
157605
|
-
hasAction = true;
|
|
157606
|
-
}
|
|
157607
157600
|
if (preferences.includeCompletionsWithClassMemberSnippets && preferences.includeCompletionsWithInsertText && completionKind === 3 /* MemberLike */ && isClassLikeMemberCompletion(symbol, location, sourceFile)) {
|
|
157608
157601
|
let importAdder;
|
|
157609
157602
|
const memberCompletionEntry = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, position, contextToken, formatContext);
|
|
@@ -158167,7 +158160,7 @@ function getSourceFromOrigin(origin) {
|
|
|
158167
158160
|
}
|
|
158168
158161
|
function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, position, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag, includeSymbol = false) {
|
|
158169
158162
|
const start2 = timestamp();
|
|
158170
|
-
const variableOrParameterDeclaration = getVariableOrParameterDeclaration(contextToken);
|
|
158163
|
+
const variableOrParameterDeclaration = getVariableOrParameterDeclaration(contextToken, location);
|
|
158171
158164
|
const useSemicolons = probablyUsesSemicolons(sourceFile);
|
|
158172
158165
|
const typeChecker = program.getTypeChecker();
|
|
158173
158166
|
const uniques = /* @__PURE__ */ new Map();
|
|
@@ -158334,7 +158327,7 @@ function getSymbolCompletionFromEntryId(program, log, sourceFile, position, entr
|
|
|
158334
158327
|
return firstDefined(symbols, (symbol, index) => {
|
|
158335
158328
|
const origin = symbolToOriginInfoMap[index];
|
|
158336
158329
|
const info = getCompletionEntryDisplayNameForSymbol(symbol, getEmitScriptTarget(compilerOptions), origin, completionKind, completionData.isJsxIdentifierExpected);
|
|
158337
|
-
return info && info.name === entryId.name && (entryId.source === "ClassMemberSnippet/" /* ClassMemberSnippet */ && symbol.flags & 106500 /* ClassMember */ || entryId.source === "ObjectLiteralMethodSnippet/" /* ObjectLiteralMethodSnippet */ && symbol.flags & (4 /* Property */ | 8192 /* Method */) || getSourceFromOrigin(origin) === entryId.source
|
|
158330
|
+
return info && info.name === entryId.name && (entryId.source === "ClassMemberSnippet/" /* ClassMemberSnippet */ && symbol.flags & 106500 /* ClassMember */ || entryId.source === "ObjectLiteralMethodSnippet/" /* ObjectLiteralMethodSnippet */ && symbol.flags & (4 /* Property */ | 8192 /* Method */) || getSourceFromOrigin(origin) === entryId.source) ? { type: "symbol", symbol, location, origin, contextToken, previousToken, isJsxInitializer, isTypeOnlyLocation } : void 0;
|
|
158338
158331
|
}) || { type: "none" };
|
|
158339
158332
|
}
|
|
158340
158333
|
function getCompletionEntryDetails(program, log, sourceFile, position, entryId, host, formatContext, preferences, cancellationToken) {
|
|
@@ -158479,21 +158472,6 @@ function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextTo
|
|
|
158479
158472
|
Debug.assertIsDefined(codeAction2, "Expected to have a code action for promoting type-only alias");
|
|
158480
158473
|
return { codeActions: [codeAction2], sourceDisplay: void 0 };
|
|
158481
158474
|
}
|
|
158482
|
-
if (source === "ObjectLiteralMemberWithComma/" /* ObjectLiteralMemberWithComma */ && contextToken) {
|
|
158483
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(
|
|
158484
|
-
{ host, formatContext, preferences },
|
|
158485
|
-
(tracker) => tracker.insertText(sourceFile, contextToken.end, ",")
|
|
158486
|
-
);
|
|
158487
|
-
if (changes) {
|
|
158488
|
-
return {
|
|
158489
|
-
sourceDisplay: void 0,
|
|
158490
|
-
codeActions: [{
|
|
158491
|
-
changes,
|
|
158492
|
-
description: diagnosticToString([Diagnostics.Add_missing_comma_for_object_member_completion_0, name])
|
|
158493
|
-
}]
|
|
158494
|
-
};
|
|
158495
|
-
}
|
|
158496
|
-
}
|
|
158497
158475
|
if (!origin || !(originIsExport(origin) || originIsResolvedExport(origin))) {
|
|
158498
158476
|
return { codeActions: void 0, sourceDisplay: void 0 };
|
|
158499
158477
|
}
|
|
@@ -159400,7 +159378,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
159400
159378
|
}
|
|
159401
159379
|
function tryGetObjectLikeCompletionSymbols() {
|
|
159402
159380
|
const symbolsStartIndex = symbols.length;
|
|
159403
|
-
const objectLikeContainer = tryGetObjectLikeCompletionContainer(contextToken
|
|
159381
|
+
const objectLikeContainer = tryGetObjectLikeCompletionContainer(contextToken);
|
|
159404
159382
|
if (!objectLikeContainer)
|
|
159405
159383
|
return 0 /* Continue */;
|
|
159406
159384
|
completionKind = 0 /* ObjectPropertyDeclaration */;
|
|
@@ -159886,7 +159864,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
159886
159864
|
return node2.getStart(sourceFile) <= position && position <= node2.getEnd();
|
|
159887
159865
|
}
|
|
159888
159866
|
}
|
|
159889
|
-
function tryGetObjectLikeCompletionContainer(contextToken
|
|
159867
|
+
function tryGetObjectLikeCompletionContainer(contextToken) {
|
|
159890
159868
|
if (contextToken) {
|
|
159891
159869
|
const { parent: parent2 } = contextToken;
|
|
159892
159870
|
switch (contextToken.kind) {
|
|
@@ -159901,26 +159879,7 @@ function tryGetObjectLikeCompletionContainer(contextToken, position) {
|
|
|
159901
159879
|
case 134 /* AsyncKeyword */:
|
|
159902
159880
|
return tryCast(parent2.parent, isObjectLiteralExpression);
|
|
159903
159881
|
case 80 /* Identifier */:
|
|
159904
|
-
|
|
159905
|
-
return contextToken.parent.parent;
|
|
159906
|
-
} else {
|
|
159907
|
-
if (isObjectLiteralExpression(contextToken.parent.parent) && (isSpreadAssignment(contextToken.parent) || isShorthandPropertyAssignment(contextToken.parent) && getLineAndCharacterOfPosition(contextToken.getSourceFile(), contextToken.getEnd()).line !== getLineAndCharacterOfPosition(contextToken.getSourceFile(), position).line)) {
|
|
159908
|
-
return contextToken.parent.parent;
|
|
159909
|
-
}
|
|
159910
|
-
const ancestorNode2 = findAncestor(parent2, (node) => isPropertyAssignment(node));
|
|
159911
|
-
if (ancestorNode2 && ancestorNode2.getLastToken() === contextToken && isObjectLiteralExpression(ancestorNode2.parent)) {
|
|
159912
|
-
return ancestorNode2.parent;
|
|
159913
|
-
}
|
|
159914
|
-
}
|
|
159915
|
-
break;
|
|
159916
|
-
default:
|
|
159917
|
-
if (parent2.parent && parent2.parent.parent && isMethodDeclaration(parent2.parent) && isObjectLiteralExpression(parent2.parent.parent)) {
|
|
159918
|
-
return parent2.parent.parent;
|
|
159919
|
-
}
|
|
159920
|
-
const ancestorNode = findAncestor(parent2, (node) => isPropertyAssignment(node));
|
|
159921
|
-
if (contextToken.kind !== 59 /* ColonToken */ && ancestorNode && ancestorNode.getLastToken() === contextToken && isObjectLiteralExpression(ancestorNode.parent)) {
|
|
159922
|
-
return ancestorNode.parent;
|
|
159923
|
-
}
|
|
159882
|
+
return contextToken.text === "async" && isShorthandPropertyAssignment(contextToken.parent) ? contextToken.parent.parent : void 0;
|
|
159924
159883
|
}
|
|
159925
159884
|
}
|
|
159926
159885
|
return void 0;
|
|
@@ -160387,11 +160346,12 @@ function isModuleSpecifierMissingOrEmpty(specifier) {
|
|
|
160387
160346
|
return true;
|
|
160388
160347
|
return !((_a = tryCast(isExternalModuleReference(specifier) ? specifier.expression : specifier, isStringLiteralLike)) == null ? void 0 : _a.text);
|
|
160389
160348
|
}
|
|
160390
|
-
function getVariableOrParameterDeclaration(contextToken) {
|
|
160349
|
+
function getVariableOrParameterDeclaration(contextToken, location) {
|
|
160391
160350
|
if (!contextToken)
|
|
160392
160351
|
return;
|
|
160393
|
-
const
|
|
160394
|
-
|
|
160352
|
+
const possiblyParameterDeclaration = findAncestor(contextToken, (node) => isFunctionBlock(node) || isArrowFunctionBody(node) || isBindingPattern(node) ? "quit" : (isParameter(node) || isTypeParameterDeclaration(node)) && !isIndexSignatureDeclaration(node.parent));
|
|
160353
|
+
const possiblyVariableDeclaration = findAncestor(location, (node) => isFunctionBlock(node) || isArrowFunctionBody(node) || isBindingPattern(node) ? "quit" : isVariableDeclaration(node));
|
|
160354
|
+
return possiblyParameterDeclaration || possiblyVariableDeclaration;
|
|
160395
160355
|
}
|
|
160396
160356
|
function isArrowFunctionBody(node) {
|
|
160397
160357
|
return node.parent && isArrowFunction(node.parent) && (node.parent.body === node || // const a = () => /**/;
|
package/lib/tsserverlibrary.d.ts
CHANGED
|
@@ -6951,7 +6951,7 @@ declare namespace ts {
|
|
|
6951
6951
|
hasRestElement: boolean;
|
|
6952
6952
|
combinedFlags: ElementFlags;
|
|
6953
6953
|
readonly: boolean;
|
|
6954
|
-
labeledElementDeclarations?: readonly (NamedTupleMember | ParameterDeclaration)[];
|
|
6954
|
+
labeledElementDeclarations?: readonly (NamedTupleMember | ParameterDeclaration | undefined)[];
|
|
6955
6955
|
}
|
|
6956
6956
|
interface TupleTypeReference extends TypeReference {
|
|
6957
6957
|
target: TupleType;
|
|
@@ -9191,7 +9191,7 @@ declare namespace ts {
|
|
|
9191
9191
|
/**
|
|
9192
9192
|
* Controls the format the file is detected as - this can be derived from only the path
|
|
9193
9193
|
* and files on disk, but needs to be done with a module resolution cache in scope to be performant.
|
|
9194
|
-
* This is usually `undefined` for compilations that do not have `
|
|
9194
|
+
* This is usually `undefined` for compilations that do not have `module` values of `node16` or `nodenext`.
|
|
9195
9195
|
*/
|
|
9196
9196
|
impliedNodeFormat?: ResolutionMode;
|
|
9197
9197
|
/**
|
|
@@ -9504,7 +9504,7 @@ declare namespace ts {
|
|
|
9504
9504
|
* Calculates the final resolution mode for a given module reference node. This is generally the explicitly provided resolution mode, if
|
|
9505
9505
|
* one exists, or the mode of the containing source file. (Excepting import=require, which is always commonjs, and dynamic import, which is always esm).
|
|
9506
9506
|
* Notably, this function always returns `undefined` if the containing file has an `undefined` `impliedNodeFormat` - this field is only set when
|
|
9507
|
-
* `
|
|
9507
|
+
* `module` is `node16`+.
|
|
9508
9508
|
* @param file The file the import or import-like reference is contained within
|
|
9509
9509
|
* @param usage The module reference string
|
|
9510
9510
|
* @returns The final resolution mode of the import
|