@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/tsserverlibrary.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.2";
|
|
38
|
-
version = `${versionMajorMinor}.0-insiders.
|
|
38
|
+
version = `${versionMajorMinor}.0-insiders.20230626`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -7516,7 +7516,6 @@ ${lanes.join("\n")}
|
|
|
7516
7516
|
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}'."),
|
|
7517
7517
|
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}'."),
|
|
7518
7518
|
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}'."),
|
|
7519
|
-
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."),
|
|
7520
7519
|
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."),
|
|
7521
7520
|
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'?"),
|
|
7522
7521
|
This_expression_is_not_callable: diag(2349, 1 /* Error */, "This_expression_is_not_callable_2349", "This expression is not callable."),
|
|
@@ -8126,7 +8125,6 @@ ${lanes.join("\n")}
|
|
|
8126
8125
|
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}."),
|
|
8127
8126
|
_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}'."),
|
|
8128
8127
|
Cannot_read_file_0: diag(5083, 1 /* Error */, "Cannot_read_file_0_5083", "Cannot read file '{0}'."),
|
|
8129
|
-
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."),
|
|
8130
8128
|
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."),
|
|
8131
8129
|
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."),
|
|
8132
8130
|
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."),
|
|
@@ -9052,7 +9050,6 @@ ${lanes.join("\n")}
|
|
|
9052
9050
|
Inline_variable: diag(95184, 3 /* Message */, "Inline_variable_95184", "Inline variable"),
|
|
9053
9051
|
Could_not_find_variable_to_inline: diag(95185, 3 /* Message */, "Could_not_find_variable_to_inline_95185", "Could not find variable to inline."),
|
|
9054
9052
|
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."),
|
|
9055
|
-
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}'."),
|
|
9056
9053
|
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."),
|
|
9057
9054
|
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'."),
|
|
9058
9055
|
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?"),
|
|
@@ -48613,6 +48610,7 @@ ${lanes.join("\n")}
|
|
|
48613
48610
|
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);
|
|
48614
48611
|
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
|
|
48615
48612
|
const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
|
|
48613
|
+
const moduleKind2 = getEmitModuleKind(compilerOptions);
|
|
48616
48614
|
const resolvedModule = getResolvedModule(currentSourceFile, moduleReference, mode);
|
|
48617
48615
|
const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
|
|
48618
48616
|
const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
|
|
@@ -48645,7 +48643,7 @@ ${lanes.join("\n")}
|
|
|
48645
48643
|
moduleReference
|
|
48646
48644
|
);
|
|
48647
48645
|
}
|
|
48648
|
-
if (
|
|
48646
|
+
if (100 /* Node16 */ <= moduleKind2 && moduleKind2 <= 199 /* NodeNext */) {
|
|
48649
48647
|
const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
|
|
48650
48648
|
const overrideClauseHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
|
|
48651
48649
|
const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (_h = overrideClauseHost.assertions) == null ? void 0 : _h.assertClause : overrideClauseHost == null ? void 0 : overrideClauseHost.assertClause;
|
|
@@ -48769,7 +48767,7 @@ ${lanes.join("\n")}
|
|
|
48769
48767
|
return void 0;
|
|
48770
48768
|
function getSuggestedImportSource(tsExtension) {
|
|
48771
48769
|
const importSourceWithoutExtension = removeExtension(moduleReference, tsExtension);
|
|
48772
|
-
if (emitModuleKindIsNonNodeESM(
|
|
48770
|
+
if (emitModuleKindIsNonNodeESM(moduleKind2) || mode === 99 /* ESNext */) {
|
|
48773
48771
|
const preferTs = isDeclarationFileName(moduleReference) && shouldAllowImportingTsExtension(compilerOptions);
|
|
48774
48772
|
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";
|
|
48775
48773
|
return importSourceWithoutExtension + ext;
|
|
@@ -50408,19 +50406,18 @@ ${lanes.join("\n")}
|
|
|
50408
50406
|
const arity = getTypeReferenceArity(type2);
|
|
50409
50407
|
const tupleConstituentNodes = mapToTypeNodes(typeArguments.slice(0, arity), context);
|
|
50410
50408
|
if (tupleConstituentNodes) {
|
|
50411
|
-
|
|
50412
|
-
|
|
50413
|
-
|
|
50409
|
+
const { labeledElementDeclarations } = type2.target;
|
|
50410
|
+
for (let i = 0; i < tupleConstituentNodes.length; i++) {
|
|
50411
|
+
const flags = type2.target.elementFlags[i];
|
|
50412
|
+
const labeledElementDeclaration = labeledElementDeclarations == null ? void 0 : labeledElementDeclarations[i];
|
|
50413
|
+
if (labeledElementDeclaration) {
|
|
50414
50414
|
tupleConstituentNodes[i] = factory.createNamedTupleMember(
|
|
50415
50415
|
flags & 12 /* Variable */ ? factory.createToken(26 /* DotDotDotToken */) : void 0,
|
|
50416
|
-
factory.createIdentifier(unescapeLeadingUnderscores(getTupleElementLabel(
|
|
50416
|
+
factory.createIdentifier(unescapeLeadingUnderscores(getTupleElementLabel(labeledElementDeclaration))),
|
|
50417
50417
|
flags & 2 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0,
|
|
50418
50418
|
flags & 4 /* Rest */ ? factory.createArrayTypeNode(tupleConstituentNodes[i]) : tupleConstituentNodes[i]
|
|
50419
50419
|
);
|
|
50420
|
-
}
|
|
50421
|
-
} else {
|
|
50422
|
-
for (let i = 0; i < Math.min(arity, tupleConstituentNodes.length); i++) {
|
|
50423
|
-
const flags = type2.target.elementFlags[i];
|
|
50420
|
+
} else {
|
|
50424
50421
|
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];
|
|
50425
50422
|
}
|
|
50426
50423
|
}
|
|
@@ -55532,17 +55529,18 @@ ${lanes.join("\n")}
|
|
|
55532
55529
|
function getExpandedParameters(sig, skipUnionExpanding) {
|
|
55533
55530
|
if (signatureHasRestParameter(sig)) {
|
|
55534
55531
|
const restIndex = sig.parameters.length - 1;
|
|
55532
|
+
const restName = sig.parameters[restIndex].escapedName;
|
|
55535
55533
|
const restType = getTypeOfSymbol(sig.parameters[restIndex]);
|
|
55536
55534
|
if (isTupleType(restType)) {
|
|
55537
|
-
return [expandSignatureParametersWithTupleMembers(restType, restIndex)];
|
|
55535
|
+
return [expandSignatureParametersWithTupleMembers(restType, restIndex, restName)];
|
|
55538
55536
|
} else if (!skipUnionExpanding && restType.flags & 1048576 /* Union */ && every(restType.types, isTupleType)) {
|
|
55539
|
-
return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex));
|
|
55537
|
+
return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex, restName));
|
|
55540
55538
|
}
|
|
55541
55539
|
}
|
|
55542
55540
|
return [sig.parameters];
|
|
55543
|
-
function expandSignatureParametersWithTupleMembers(restType, restIndex) {
|
|
55544
|
-
const elementTypes =
|
|
55545
|
-
const associatedNames = getUniqAssociatedNamesFromTupleType(restType);
|
|
55541
|
+
function expandSignatureParametersWithTupleMembers(restType, restIndex, restName) {
|
|
55542
|
+
const elementTypes = getTypeArguments(restType);
|
|
55543
|
+
const associatedNames = getUniqAssociatedNamesFromTupleType(restType, restName);
|
|
55546
55544
|
const restParams = map(elementTypes, (t, i) => {
|
|
55547
55545
|
const name = associatedNames && associatedNames[i] ? associatedNames[i] : getParameterNameAtPosition(sig, restIndex + i, restType);
|
|
55548
55546
|
const flags = restType.target.elementFlags[i];
|
|
@@ -55553,10 +55551,10 @@ ${lanes.join("\n")}
|
|
|
55553
55551
|
});
|
|
55554
55552
|
return concatenate(sig.parameters.slice(0, restIndex), restParams);
|
|
55555
55553
|
}
|
|
55556
|
-
function getUniqAssociatedNamesFromTupleType(type) {
|
|
55554
|
+
function getUniqAssociatedNamesFromTupleType(type, restName) {
|
|
55557
55555
|
const associatedNamesMap = /* @__PURE__ */ new Map();
|
|
55558
|
-
return map(type.target.labeledElementDeclarations, (labeledElement) => {
|
|
55559
|
-
const name = getTupleElementLabel(labeledElement);
|
|
55556
|
+
return map(type.target.labeledElementDeclarations, (labeledElement, i) => {
|
|
55557
|
+
const name = getTupleElementLabel(labeledElement, i, restName);
|
|
55560
55558
|
const prevCounter = associatedNamesMap.get(name);
|
|
55561
55559
|
if (prevCounter === void 0) {
|
|
55562
55560
|
associatedNamesMap.set(name, 1);
|
|
@@ -58490,13 +58488,10 @@ ${lanes.join("\n")}
|
|
|
58490
58488
|
return readonly ? globalReadonlyArrayType : globalArrayType;
|
|
58491
58489
|
}
|
|
58492
58490
|
const elementFlags = map(node.elements, getTupleElementFlags);
|
|
58493
|
-
|
|
58494
|
-
|
|
58495
|
-
|
|
58496
|
-
|
|
58497
|
-
/*associatedNames*/
|
|
58498
|
-
missingName ? void 0 : node.elements
|
|
58499
|
-
);
|
|
58491
|
+
return getTupleTargetType(elementFlags, readonly, map(node.elements, memberIfLabeledElementDeclaration));
|
|
58492
|
+
}
|
|
58493
|
+
function memberIfLabeledElementDeclaration(member) {
|
|
58494
|
+
return isNamedTupleMember(member) || isParameter(member) ? member : void 0;
|
|
58500
58495
|
}
|
|
58501
58496
|
function isDeferredTypeReferenceNode(node, hasDefaultTypeArguments) {
|
|
58502
58497
|
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));
|
|
@@ -58571,7 +58566,7 @@ ${lanes.join("\n")}
|
|
|
58571
58566
|
function isReadonlyTypeOperator(node) {
|
|
58572
58567
|
return isTypeOperatorNode(node) && node.operator === 148 /* ReadonlyKeyword */;
|
|
58573
58568
|
}
|
|
58574
|
-
function createTupleType(elementTypes, elementFlags, readonly = false, namedMemberDeclarations) {
|
|
58569
|
+
function createTupleType(elementTypes, elementFlags, readonly = false, namedMemberDeclarations = []) {
|
|
58575
58570
|
const tupleTarget = getTupleTargetType(elementFlags || map(elementTypes, (_) => 1 /* Required */), readonly, namedMemberDeclarations);
|
|
58576
58571
|
return tupleTarget === emptyGenericType ? emptyObjectType : elementTypes.length ? createNormalizedTypeReference(tupleTarget, elementTypes) : tupleTarget;
|
|
58577
58572
|
}
|
|
@@ -58579,7 +58574,8 @@ ${lanes.join("\n")}
|
|
|
58579
58574
|
if (elementFlags.length === 1 && elementFlags[0] & 4 /* Rest */) {
|
|
58580
58575
|
return readonly ? globalReadonlyArrayType : globalArrayType;
|
|
58581
58576
|
}
|
|
58582
|
-
const
|
|
58577
|
+
const memberIds = mapDefined(namedMemberDeclarations, (node) => node ? getNodeId(node) : void 0);
|
|
58578
|
+
const key = map(elementFlags, (f) => f & 1 /* Required */ ? "#" : f & 2 /* Optional */ ? "?" : f & 4 /* Rest */ ? "." : "*").join() + (readonly ? "R" : "") + (memberIds.length ? "," + memberIds.join(",") : "");
|
|
58583
58579
|
let type = tupleTypes.get(key);
|
|
58584
58580
|
if (!type) {
|
|
58585
58581
|
tupleTypes.set(key, type = createTupleTargetType(elementFlags, readonly, namedMemberDeclarations));
|
|
@@ -58661,7 +58657,7 @@ ${lanes.join("\n")}
|
|
|
58661
58657
|
}
|
|
58662
58658
|
const expandedTypes = [];
|
|
58663
58659
|
const expandedFlags = [];
|
|
58664
|
-
|
|
58660
|
+
const expandedDeclarations = [];
|
|
58665
58661
|
let lastRequiredIndex = -1;
|
|
58666
58662
|
let firstRestIndex = -1;
|
|
58667
58663
|
let lastOptionalOrRestIndex = -1;
|
|
@@ -58699,7 +58695,7 @@ ${lanes.join("\n")}
|
|
|
58699
58695
|
));
|
|
58700
58696
|
expandedTypes.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
|
|
58701
58697
|
expandedFlags.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
|
|
58702
|
-
expandedDeclarations
|
|
58698
|
+
expandedDeclarations.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
|
|
58703
58699
|
}
|
|
58704
58700
|
const tupleTarget = getTupleTargetType(expandedFlags, target.readonly, expandedDeclarations);
|
|
58705
58701
|
return tupleTarget === emptyGenericType ? emptyObjectType : expandedFlags.length ? createTypeReference(tupleTarget, expandedTypes) : tupleTarget;
|
|
@@ -58719,11 +58715,7 @@ ${lanes.join("\n")}
|
|
|
58719
58715
|
true
|
|
58720
58716
|
) : type);
|
|
58721
58717
|
expandedFlags.push(flags);
|
|
58722
|
-
|
|
58723
|
-
expandedDeclarations.push(declaration);
|
|
58724
|
-
} else {
|
|
58725
|
-
expandedDeclarations = void 0;
|
|
58726
|
-
}
|
|
58718
|
+
expandedDeclarations.push(declaration);
|
|
58727
58719
|
}
|
|
58728
58720
|
}
|
|
58729
58721
|
function sliceTupleType(type, index, endSkipCount = 0) {
|
|
@@ -63397,7 +63389,6 @@ ${lanes.join("\n")}
|
|
|
63397
63389
|
} else if (targetFlags & 8388608 /* IndexedAccess */) {
|
|
63398
63390
|
if (sourceFlags & 8388608 /* IndexedAccess */) {
|
|
63399
63391
|
if (result2 = isRelatedTo(source2.objectType, target2.objectType, 3 /* Both */, reportErrors2)) {
|
|
63400
|
-
instantiateType(source2.objectType, reportUnreliableMapper);
|
|
63401
63392
|
result2 &= isRelatedTo(source2.indexType, target2.indexType, 3 /* Both */, reportErrors2);
|
|
63402
63393
|
}
|
|
63403
63394
|
if (result2) {
|
|
@@ -72994,12 +72985,7 @@ ${lanes.join("\n")}
|
|
|
72994
72985
|
}
|
|
72995
72986
|
const candidates = candidatesOutArray || [];
|
|
72996
72987
|
reorderCandidates(signatures, candidates, callChainFlags);
|
|
72997
|
-
|
|
72998
|
-
if (reportErrors2) {
|
|
72999
|
-
diagnostics.add(getDiagnosticForCallNode(node, Diagnostics.Call_target_does_not_contain_any_signatures));
|
|
73000
|
-
}
|
|
73001
|
-
return resolveErrorCall(node);
|
|
73002
|
-
}
|
|
72988
|
+
Debug.assert(candidates.length, "Revert #54442 and add a testcase with whatever triggered this");
|
|
73003
72989
|
const args = getEffectiveCallArguments(node);
|
|
73004
72990
|
const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
|
|
73005
72991
|
let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
|
|
@@ -74451,7 +74437,10 @@ ${lanes.join("\n")}
|
|
|
74451
74437
|
}
|
|
74452
74438
|
return type;
|
|
74453
74439
|
}
|
|
74454
|
-
function getTupleElementLabel(d) {
|
|
74440
|
+
function getTupleElementLabel(d, index, restParameterName = "arg") {
|
|
74441
|
+
if (!d) {
|
|
74442
|
+
return `${restParameterName}_${index}`;
|
|
74443
|
+
}
|
|
74455
74444
|
Debug.assert(isIdentifier(d.name));
|
|
74456
74445
|
return d.name.escapedText;
|
|
74457
74446
|
}
|
|
@@ -74465,7 +74454,7 @@ ${lanes.join("\n")}
|
|
|
74465
74454
|
if (isTupleType(restType)) {
|
|
74466
74455
|
const associatedNames = restType.target.labeledElementDeclarations;
|
|
74467
74456
|
const index = pos - paramCount;
|
|
74468
|
-
return associatedNames
|
|
74457
|
+
return getTupleElementLabel(associatedNames == null ? void 0 : associatedNames[index], index, restParameter.escapedName);
|
|
74469
74458
|
}
|
|
74470
74459
|
return restParameter.escapedName;
|
|
74471
74460
|
}
|
|
@@ -77820,12 +77809,7 @@ ${lanes.join("\n")}
|
|
|
77820
77809
|
const elementTypes = node.elements;
|
|
77821
77810
|
let seenOptionalElement = false;
|
|
77822
77811
|
let seenRestElement = false;
|
|
77823
|
-
const hasNamedElement = some(elementTypes, isNamedTupleMember);
|
|
77824
77812
|
for (const e of elementTypes) {
|
|
77825
|
-
if (e.kind !== 202 /* NamedTupleMember */ && hasNamedElement) {
|
|
77826
|
-
grammarErrorOnNode(e, Diagnostics.Tuple_members_must_all_have_names_or_all_not_have_names);
|
|
77827
|
-
break;
|
|
77828
|
-
}
|
|
77829
77813
|
const flags = getTupleElementFlags(e);
|
|
77830
77814
|
if (flags & 8 /* Variadic */) {
|
|
77831
77815
|
const type = getTypeFromTypeNode(e.type);
|
|
@@ -110461,6 +110445,21 @@ ${lanes.join("\n")}
|
|
|
110461
110445
|
const modifiers = factory2.createModifiersFromModifierFlags(getEffectiveModifierFlags(statement) & (258047 /* All */ ^ 1 /* Export */));
|
|
110462
110446
|
return factory2.updateModifiers(statement, modifiers);
|
|
110463
110447
|
}
|
|
110448
|
+
function updateModuleDeclarationAndKeyword(node, modifiers, name, body) {
|
|
110449
|
+
const updated = factory2.updateModuleDeclaration(node, modifiers, name, body);
|
|
110450
|
+
if (isAmbientModule(updated) || updated.flags & 32 /* Namespace */) {
|
|
110451
|
+
return updated;
|
|
110452
|
+
}
|
|
110453
|
+
const fixed = factory2.createModuleDeclaration(
|
|
110454
|
+
updated.modifiers,
|
|
110455
|
+
updated.name,
|
|
110456
|
+
updated.body,
|
|
110457
|
+
updated.flags | 32 /* Namespace */
|
|
110458
|
+
);
|
|
110459
|
+
setOriginalNode(fixed, updated);
|
|
110460
|
+
setTextRange(fixed, updated);
|
|
110461
|
+
return fixed;
|
|
110462
|
+
}
|
|
110464
110463
|
function transformTopLevelDeclaration(input) {
|
|
110465
110464
|
if (lateMarkedStatements) {
|
|
110466
110465
|
while (orderedRemoveItem(lateMarkedStatements, input))
|
|
@@ -110648,7 +110647,7 @@ ${lanes.join("\n")}
|
|
|
110648
110647
|
needsScopeFixMarker = oldNeedsScopeFix;
|
|
110649
110648
|
resultHasScopeMarker = oldHasScopeFix;
|
|
110650
110649
|
const mods = ensureModifiers(input);
|
|
110651
|
-
return cleanup(
|
|
110650
|
+
return cleanup(updateModuleDeclarationAndKeyword(
|
|
110652
110651
|
input,
|
|
110653
110652
|
mods,
|
|
110654
110653
|
isExternalModuleAugmentation(input) ? rewriteModuleSpecifier(input, input.name) : input.name,
|
|
@@ -110662,7 +110661,7 @@ ${lanes.join("\n")}
|
|
|
110662
110661
|
const id = getOriginalNodeId(inner);
|
|
110663
110662
|
const body = lateStatementReplacementMap.get(id);
|
|
110664
110663
|
lateStatementReplacementMap.delete(id);
|
|
110665
|
-
return cleanup(
|
|
110664
|
+
return cleanup(updateModuleDeclarationAndKeyword(
|
|
110666
110665
|
input,
|
|
110667
110666
|
mods,
|
|
110668
110667
|
input.name,
|
|
@@ -118081,9 +118080,9 @@ ${lanes.join("\n")}
|
|
|
118081
118080
|
return typeof result === "object" ? result.impliedNodeFormat : result;
|
|
118082
118081
|
}
|
|
118083
118082
|
function getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host, options) {
|
|
118084
|
-
switch (
|
|
118085
|
-
case
|
|
118086
|
-
case
|
|
118083
|
+
switch (getEmitModuleKind(options)) {
|
|
118084
|
+
case 100 /* Node16 */:
|
|
118085
|
+
case 199 /* NodeNext */:
|
|
118087
118086
|
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;
|
|
118088
118087
|
default:
|
|
118089
118088
|
return void 0;
|
|
@@ -156773,7 +156772,6 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
156773
156772
|
return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* string */, kindModifiers: "" /* none */, sortText: SortText.LocationPriority };
|
|
156774
156773
|
}
|
|
156775
156774
|
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) {
|
|
156776
|
-
var _a, _b;
|
|
156777
156775
|
let insertText;
|
|
156778
156776
|
let filterText;
|
|
156779
156777
|
let replacementSpan = getReplacementSpanForContextToken(replacementToken);
|
|
@@ -156832,10 +156830,6 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
156832
156830
|
if ((origin == null ? void 0 : origin.kind) === 64 /* TypeOnlyAlias */) {
|
|
156833
156831
|
hasAction = true;
|
|
156834
156832
|
}
|
|
156835
|
-
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)) {
|
|
156836
|
-
source = "ObjectLiteralMemberWithComma/" /* ObjectLiteralMemberWithComma */;
|
|
156837
|
-
hasAction = true;
|
|
156838
|
-
}
|
|
156839
156833
|
if (preferences.includeCompletionsWithClassMemberSnippets && preferences.includeCompletionsWithInsertText && completionKind === 3 /* MemberLike */ && isClassLikeMemberCompletion(symbol, location, sourceFile)) {
|
|
156840
156834
|
let importAdder;
|
|
156841
156835
|
const memberCompletionEntry = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, position, contextToken, formatContext);
|
|
@@ -157399,7 +157393,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157399
157393
|
}
|
|
157400
157394
|
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) {
|
|
157401
157395
|
const start = timestamp();
|
|
157402
|
-
const variableOrParameterDeclaration = getVariableOrParameterDeclaration(contextToken);
|
|
157396
|
+
const variableOrParameterDeclaration = getVariableOrParameterDeclaration(contextToken, location);
|
|
157403
157397
|
const useSemicolons = probablyUsesSemicolons(sourceFile);
|
|
157404
157398
|
const typeChecker = program.getTypeChecker();
|
|
157405
157399
|
const uniques = /* @__PURE__ */ new Map();
|
|
@@ -157566,7 +157560,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157566
157560
|
return firstDefined(symbols, (symbol, index) => {
|
|
157567
157561
|
const origin = symbolToOriginInfoMap[index];
|
|
157568
157562
|
const info = getCompletionEntryDisplayNameForSymbol(symbol, getEmitScriptTarget(compilerOptions), origin, completionKind, completionData.isJsxIdentifierExpected);
|
|
157569
|
-
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
|
|
157563
|
+
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;
|
|
157570
157564
|
}) || { type: "none" };
|
|
157571
157565
|
}
|
|
157572
157566
|
function getCompletionEntryDetails(program, log, sourceFile, position, entryId, host, formatContext, preferences, cancellationToken) {
|
|
@@ -157711,21 +157705,6 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157711
157705
|
Debug.assertIsDefined(codeAction2, "Expected to have a code action for promoting type-only alias");
|
|
157712
157706
|
return { codeActions: [codeAction2], sourceDisplay: void 0 };
|
|
157713
157707
|
}
|
|
157714
|
-
if (source === "ObjectLiteralMemberWithComma/" /* ObjectLiteralMemberWithComma */ && contextToken) {
|
|
157715
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(
|
|
157716
|
-
{ host, formatContext, preferences },
|
|
157717
|
-
(tracker) => tracker.insertText(sourceFile, contextToken.end, ",")
|
|
157718
|
-
);
|
|
157719
|
-
if (changes) {
|
|
157720
|
-
return {
|
|
157721
|
-
sourceDisplay: void 0,
|
|
157722
|
-
codeActions: [{
|
|
157723
|
-
changes,
|
|
157724
|
-
description: diagnosticToString([Diagnostics.Add_missing_comma_for_object_member_completion_0, name])
|
|
157725
|
-
}]
|
|
157726
|
-
};
|
|
157727
|
-
}
|
|
157728
|
-
}
|
|
157729
157708
|
if (!origin || !(originIsExport(origin) || originIsResolvedExport(origin))) {
|
|
157730
157709
|
return { codeActions: void 0, sourceDisplay: void 0 };
|
|
157731
157710
|
}
|
|
@@ -158623,7 +158602,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
158623
158602
|
}
|
|
158624
158603
|
function tryGetObjectLikeCompletionSymbols() {
|
|
158625
158604
|
const symbolsStartIndex = symbols.length;
|
|
158626
|
-
const objectLikeContainer = tryGetObjectLikeCompletionContainer(contextToken
|
|
158605
|
+
const objectLikeContainer = tryGetObjectLikeCompletionContainer(contextToken);
|
|
158627
158606
|
if (!objectLikeContainer)
|
|
158628
158607
|
return 0 /* Continue */;
|
|
158629
158608
|
completionKind = 0 /* ObjectPropertyDeclaration */;
|
|
@@ -159109,7 +159088,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159109
159088
|
return node2.getStart(sourceFile) <= position && position <= node2.getEnd();
|
|
159110
159089
|
}
|
|
159111
159090
|
}
|
|
159112
|
-
function tryGetObjectLikeCompletionContainer(contextToken
|
|
159091
|
+
function tryGetObjectLikeCompletionContainer(contextToken) {
|
|
159113
159092
|
if (contextToken) {
|
|
159114
159093
|
const { parent: parent2 } = contextToken;
|
|
159115
159094
|
switch (contextToken.kind) {
|
|
@@ -159124,26 +159103,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159124
159103
|
case 134 /* AsyncKeyword */:
|
|
159125
159104
|
return tryCast(parent2.parent, isObjectLiteralExpression);
|
|
159126
159105
|
case 80 /* Identifier */:
|
|
159127
|
-
|
|
159128
|
-
return contextToken.parent.parent;
|
|
159129
|
-
} else {
|
|
159130
|
-
if (isObjectLiteralExpression(contextToken.parent.parent) && (isSpreadAssignment(contextToken.parent) || isShorthandPropertyAssignment(contextToken.parent) && getLineAndCharacterOfPosition(contextToken.getSourceFile(), contextToken.getEnd()).line !== getLineAndCharacterOfPosition(contextToken.getSourceFile(), position).line)) {
|
|
159131
|
-
return contextToken.parent.parent;
|
|
159132
|
-
}
|
|
159133
|
-
const ancestorNode2 = findAncestor(parent2, (node) => isPropertyAssignment(node));
|
|
159134
|
-
if (ancestorNode2 && ancestorNode2.getLastToken() === contextToken && isObjectLiteralExpression(ancestorNode2.parent)) {
|
|
159135
|
-
return ancestorNode2.parent;
|
|
159136
|
-
}
|
|
159137
|
-
}
|
|
159138
|
-
break;
|
|
159139
|
-
default:
|
|
159140
|
-
if (parent2.parent && parent2.parent.parent && isMethodDeclaration(parent2.parent) && isObjectLiteralExpression(parent2.parent.parent)) {
|
|
159141
|
-
return parent2.parent.parent;
|
|
159142
|
-
}
|
|
159143
|
-
const ancestorNode = findAncestor(parent2, (node) => isPropertyAssignment(node));
|
|
159144
|
-
if (contextToken.kind !== 59 /* ColonToken */ && ancestorNode && ancestorNode.getLastToken() === contextToken && isObjectLiteralExpression(ancestorNode.parent)) {
|
|
159145
|
-
return ancestorNode.parent;
|
|
159146
|
-
}
|
|
159106
|
+
return contextToken.text === "async" && isShorthandPropertyAssignment(contextToken.parent) ? contextToken.parent.parent : void 0;
|
|
159147
159107
|
}
|
|
159148
159108
|
}
|
|
159149
159109
|
return void 0;
|
|
@@ -159597,11 +159557,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159597
159557
|
return true;
|
|
159598
159558
|
return !((_a = tryCast(isExternalModuleReference(specifier) ? specifier.expression : specifier, isStringLiteralLike)) == null ? void 0 : _a.text);
|
|
159599
159559
|
}
|
|
159600
|
-
function getVariableOrParameterDeclaration(contextToken) {
|
|
159560
|
+
function getVariableOrParameterDeclaration(contextToken, location) {
|
|
159601
159561
|
if (!contextToken)
|
|
159602
159562
|
return;
|
|
159603
|
-
const
|
|
159604
|
-
|
|
159563
|
+
const possiblyParameterDeclaration = findAncestor(contextToken, (node) => isFunctionBlock(node) || isArrowFunctionBody(node) || isBindingPattern(node) ? "quit" : (isParameter(node) || isTypeParameterDeclaration(node)) && !isIndexSignatureDeclaration(node.parent));
|
|
159564
|
+
const possiblyVariableDeclaration = findAncestor(location, (node) => isFunctionBlock(node) || isArrowFunctionBody(node) || isBindingPattern(node) ? "quit" : isVariableDeclaration(node));
|
|
159565
|
+
return possiblyParameterDeclaration || possiblyVariableDeclaration;
|
|
159605
159566
|
}
|
|
159606
159567
|
function isArrowFunctionBody(node) {
|
|
159607
159568
|
return node.parent && isArrowFunction(node.parent) && (node.parent.body === node || // const a = () => /**/;
|
|
@@ -159685,7 +159646,6 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159685
159646
|
CompletionSource2["TypeOnlyAlias"] = "TypeOnlyAlias/";
|
|
159686
159647
|
CompletionSource2["ObjectLiteralMethodSnippet"] = "ObjectLiteralMethodSnippet/";
|
|
159687
159648
|
CompletionSource2["SwitchCases"] = "SwitchCases/";
|
|
159688
|
-
CompletionSource2["ObjectLiteralMemberWithComma"] = "ObjectLiteralMemberWithComma/";
|
|
159689
159649
|
return CompletionSource2;
|
|
159690
159650
|
})(CompletionSource || {});
|
|
159691
159651
|
SymbolOriginInfoKind = /* @__PURE__ */ ((SymbolOriginInfoKind2) => {
|
package/lib/typescript.d.ts
CHANGED
|
@@ -2898,7 +2898,7 @@ declare namespace ts {
|
|
|
2898
2898
|
hasRestElement: boolean;
|
|
2899
2899
|
combinedFlags: ElementFlags;
|
|
2900
2900
|
readonly: boolean;
|
|
2901
|
-
labeledElementDeclarations?: readonly (NamedTupleMember | ParameterDeclaration)[];
|
|
2901
|
+
labeledElementDeclarations?: readonly (NamedTupleMember | ParameterDeclaration | undefined)[];
|
|
2902
2902
|
}
|
|
2903
2903
|
interface TupleTypeReference extends TypeReference {
|
|
2904
2904
|
target: TupleType;
|
|
@@ -5138,7 +5138,7 @@ declare namespace ts {
|
|
|
5138
5138
|
/**
|
|
5139
5139
|
* Controls the format the file is detected as - this can be derived from only the path
|
|
5140
5140
|
* and files on disk, but needs to be done with a module resolution cache in scope to be performant.
|
|
5141
|
-
* This is usually `undefined` for compilations that do not have `
|
|
5141
|
+
* This is usually `undefined` for compilations that do not have `module` values of `node16` or `nodenext`.
|
|
5142
5142
|
*/
|
|
5143
5143
|
impliedNodeFormat?: ResolutionMode;
|
|
5144
5144
|
/**
|
|
@@ -5451,7 +5451,7 @@ declare namespace ts {
|
|
|
5451
5451
|
* Calculates the final resolution mode for a given module reference node. This is generally the explicitly provided resolution mode, if
|
|
5452
5452
|
* one exists, or the mode of the containing source file. (Excepting import=require, which is always commonjs, and dynamic import, which is always esm).
|
|
5453
5453
|
* Notably, this function always returns `undefined` if the containing file has an `undefined` `impliedNodeFormat` - this field is only set when
|
|
5454
|
-
* `
|
|
5454
|
+
* `module` is `node16`+.
|
|
5455
5455
|
* @param file The file the import or import-like reference is contained within
|
|
5456
5456
|
* @param usage The module reference string
|
|
5457
5457
|
* @returns The final resolution mode of the import
|