@typescript-deploys/pr-build 5.2.0-pr-54781-9 → 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 +38 -52
- package/lib/tsserver.js +43 -56
- package/lib/tsserverlibrary.d.ts +3 -3
- package/lib/tsserverlibrary.js +43 -56
- package/lib/typescript.d.ts +3 -3
- package/lib/typescript.js +43 -56
- package/lib/typingsInstaller.js +0 -2
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -6212,7 +6212,6 @@ var Diagnostics = {
|
|
|
6212
6212
|
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}'."),
|
|
6213
6213
|
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}'."),
|
|
6214
6214
|
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}'."),
|
|
6215
|
-
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."),
|
|
6216
6215
|
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."),
|
|
6217
6216
|
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'?"),
|
|
6218
6217
|
This_expression_is_not_callable: diag(2349, 1 /* Error */, "This_expression_is_not_callable_2349", "This expression is not callable."),
|
|
@@ -6822,7 +6821,6 @@ var Diagnostics = {
|
|
|
6822
6821
|
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}."),
|
|
6823
6822
|
_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}'."),
|
|
6824
6823
|
Cannot_read_file_0: diag(5083, 1 /* Error */, "Cannot_read_file_0_5083", "Cannot read file '{0}'."),
|
|
6825
|
-
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."),
|
|
6826
6824
|
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."),
|
|
6827
6825
|
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."),
|
|
6828
6826
|
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."),
|
|
@@ -46169,6 +46167,7 @@ function createTypeChecker(host) {
|
|
|
46169
46167
|
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);
|
|
46170
46168
|
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
|
|
46171
46169
|
const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
|
|
46170
|
+
const moduleKind2 = getEmitModuleKind(compilerOptions);
|
|
46172
46171
|
const resolvedModule = getResolvedModule(currentSourceFile, moduleReference, mode);
|
|
46173
46172
|
const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
|
|
46174
46173
|
const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
|
|
@@ -46201,7 +46200,7 @@ function createTypeChecker(host) {
|
|
|
46201
46200
|
moduleReference
|
|
46202
46201
|
);
|
|
46203
46202
|
}
|
|
46204
|
-
if (
|
|
46203
|
+
if (100 /* Node16 */ <= moduleKind2 && moduleKind2 <= 199 /* NodeNext */) {
|
|
46205
46204
|
const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
|
|
46206
46205
|
const overrideClauseHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
|
|
46207
46206
|
const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (_h = overrideClauseHost.assertions) == null ? void 0 : _h.assertClause : overrideClauseHost == null ? void 0 : overrideClauseHost.assertClause;
|
|
@@ -46325,7 +46324,7 @@ function createTypeChecker(host) {
|
|
|
46325
46324
|
return void 0;
|
|
46326
46325
|
function getSuggestedImportSource(tsExtension) {
|
|
46327
46326
|
const importSourceWithoutExtension = removeExtension(moduleReference, tsExtension);
|
|
46328
|
-
if (emitModuleKindIsNonNodeESM(
|
|
46327
|
+
if (emitModuleKindIsNonNodeESM(moduleKind2) || mode === 99 /* ESNext */) {
|
|
46329
46328
|
const preferTs = isDeclarationFileName(moduleReference) && shouldAllowImportingTsExtension(compilerOptions);
|
|
46330
46329
|
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";
|
|
46331
46330
|
return importSourceWithoutExtension + ext;
|
|
@@ -47964,19 +47963,18 @@ function createTypeChecker(host) {
|
|
|
47964
47963
|
const arity = getTypeReferenceArity(type2);
|
|
47965
47964
|
const tupleConstituentNodes = mapToTypeNodes(typeArguments.slice(0, arity), context);
|
|
47966
47965
|
if (tupleConstituentNodes) {
|
|
47967
|
-
|
|
47968
|
-
|
|
47969
|
-
|
|
47966
|
+
const { labeledElementDeclarations } = type2.target;
|
|
47967
|
+
for (let i = 0; i < tupleConstituentNodes.length; i++) {
|
|
47968
|
+
const flags = type2.target.elementFlags[i];
|
|
47969
|
+
const labeledElementDeclaration = labeledElementDeclarations == null ? void 0 : labeledElementDeclarations[i];
|
|
47970
|
+
if (labeledElementDeclaration) {
|
|
47970
47971
|
tupleConstituentNodes[i] = factory.createNamedTupleMember(
|
|
47971
47972
|
flags & 12 /* Variable */ ? factory.createToken(26 /* DotDotDotToken */) : void 0,
|
|
47972
|
-
factory.createIdentifier(unescapeLeadingUnderscores(getTupleElementLabel(
|
|
47973
|
+
factory.createIdentifier(unescapeLeadingUnderscores(getTupleElementLabel(labeledElementDeclaration))),
|
|
47973
47974
|
flags & 2 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0,
|
|
47974
47975
|
flags & 4 /* Rest */ ? factory.createArrayTypeNode(tupleConstituentNodes[i]) : tupleConstituentNodes[i]
|
|
47975
47976
|
);
|
|
47976
|
-
}
|
|
47977
|
-
} else {
|
|
47978
|
-
for (let i = 0; i < Math.min(arity, tupleConstituentNodes.length); i++) {
|
|
47979
|
-
const flags = type2.target.elementFlags[i];
|
|
47977
|
+
} else {
|
|
47980
47978
|
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];
|
|
47981
47979
|
}
|
|
47982
47980
|
}
|
|
@@ -53088,17 +53086,18 @@ function createTypeChecker(host) {
|
|
|
53088
53086
|
function getExpandedParameters(sig, skipUnionExpanding) {
|
|
53089
53087
|
if (signatureHasRestParameter(sig)) {
|
|
53090
53088
|
const restIndex = sig.parameters.length - 1;
|
|
53089
|
+
const restName = sig.parameters[restIndex].escapedName;
|
|
53091
53090
|
const restType = getTypeOfSymbol(sig.parameters[restIndex]);
|
|
53092
53091
|
if (isTupleType(restType)) {
|
|
53093
|
-
return [expandSignatureParametersWithTupleMembers(restType, restIndex)];
|
|
53092
|
+
return [expandSignatureParametersWithTupleMembers(restType, restIndex, restName)];
|
|
53094
53093
|
} else if (!skipUnionExpanding && restType.flags & 1048576 /* Union */ && every(restType.types, isTupleType)) {
|
|
53095
|
-
return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex));
|
|
53094
|
+
return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex, restName));
|
|
53096
53095
|
}
|
|
53097
53096
|
}
|
|
53098
53097
|
return [sig.parameters];
|
|
53099
|
-
function expandSignatureParametersWithTupleMembers(restType, restIndex) {
|
|
53100
|
-
const elementTypes =
|
|
53101
|
-
const associatedNames = getUniqAssociatedNamesFromTupleType(restType);
|
|
53098
|
+
function expandSignatureParametersWithTupleMembers(restType, restIndex, restName) {
|
|
53099
|
+
const elementTypes = getTypeArguments(restType);
|
|
53100
|
+
const associatedNames = getUniqAssociatedNamesFromTupleType(restType, restName);
|
|
53102
53101
|
const restParams = map(elementTypes, (t, i) => {
|
|
53103
53102
|
const name = associatedNames && associatedNames[i] ? associatedNames[i] : getParameterNameAtPosition(sig, restIndex + i, restType);
|
|
53104
53103
|
const flags = restType.target.elementFlags[i];
|
|
@@ -53109,10 +53108,10 @@ function createTypeChecker(host) {
|
|
|
53109
53108
|
});
|
|
53110
53109
|
return concatenate(sig.parameters.slice(0, restIndex), restParams);
|
|
53111
53110
|
}
|
|
53112
|
-
function getUniqAssociatedNamesFromTupleType(type) {
|
|
53111
|
+
function getUniqAssociatedNamesFromTupleType(type, restName) {
|
|
53113
53112
|
const associatedNamesMap = /* @__PURE__ */ new Map();
|
|
53114
|
-
return map(type.target.labeledElementDeclarations, (labeledElement) => {
|
|
53115
|
-
const name = getTupleElementLabel(labeledElement);
|
|
53113
|
+
return map(type.target.labeledElementDeclarations, (labeledElement, i) => {
|
|
53114
|
+
const name = getTupleElementLabel(labeledElement, i, restName);
|
|
53116
53115
|
const prevCounter = associatedNamesMap.get(name);
|
|
53117
53116
|
if (prevCounter === void 0) {
|
|
53118
53117
|
associatedNamesMap.set(name, 1);
|
|
@@ -56046,13 +56045,10 @@ function createTypeChecker(host) {
|
|
|
56046
56045
|
return readonly ? globalReadonlyArrayType : globalArrayType;
|
|
56047
56046
|
}
|
|
56048
56047
|
const elementFlags = map(node.elements, getTupleElementFlags);
|
|
56049
|
-
|
|
56050
|
-
|
|
56051
|
-
|
|
56052
|
-
|
|
56053
|
-
/*associatedNames*/
|
|
56054
|
-
missingName ? void 0 : node.elements
|
|
56055
|
-
);
|
|
56048
|
+
return getTupleTargetType(elementFlags, readonly, map(node.elements, memberIfLabeledElementDeclaration));
|
|
56049
|
+
}
|
|
56050
|
+
function memberIfLabeledElementDeclaration(member) {
|
|
56051
|
+
return isNamedTupleMember(member) || isParameter(member) ? member : void 0;
|
|
56056
56052
|
}
|
|
56057
56053
|
function isDeferredTypeReferenceNode(node, hasDefaultTypeArguments) {
|
|
56058
56054
|
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));
|
|
@@ -56127,7 +56123,7 @@ function createTypeChecker(host) {
|
|
|
56127
56123
|
function isReadonlyTypeOperator(node) {
|
|
56128
56124
|
return isTypeOperatorNode(node) && node.operator === 148 /* ReadonlyKeyword */;
|
|
56129
56125
|
}
|
|
56130
|
-
function createTupleType(elementTypes, elementFlags, readonly = false, namedMemberDeclarations) {
|
|
56126
|
+
function createTupleType(elementTypes, elementFlags, readonly = false, namedMemberDeclarations = []) {
|
|
56131
56127
|
const tupleTarget = getTupleTargetType(elementFlags || map(elementTypes, (_) => 1 /* Required */), readonly, namedMemberDeclarations);
|
|
56132
56128
|
return tupleTarget === emptyGenericType ? emptyObjectType : elementTypes.length ? createNormalizedTypeReference(tupleTarget, elementTypes) : tupleTarget;
|
|
56133
56129
|
}
|
|
@@ -56135,7 +56131,8 @@ function createTypeChecker(host) {
|
|
|
56135
56131
|
if (elementFlags.length === 1 && elementFlags[0] & 4 /* Rest */) {
|
|
56136
56132
|
return readonly ? globalReadonlyArrayType : globalArrayType;
|
|
56137
56133
|
}
|
|
56138
|
-
const
|
|
56134
|
+
const memberIds = mapDefined(namedMemberDeclarations, (node) => node ? getNodeId(node) : void 0);
|
|
56135
|
+
const key = map(elementFlags, (f) => f & 1 /* Required */ ? "#" : f & 2 /* Optional */ ? "?" : f & 4 /* Rest */ ? "." : "*").join() + (readonly ? "R" : "") + (memberIds.length ? "," + memberIds.join(",") : "");
|
|
56139
56136
|
let type = tupleTypes.get(key);
|
|
56140
56137
|
if (!type) {
|
|
56141
56138
|
tupleTypes.set(key, type = createTupleTargetType(elementFlags, readonly, namedMemberDeclarations));
|
|
@@ -56217,7 +56214,7 @@ function createTypeChecker(host) {
|
|
|
56217
56214
|
}
|
|
56218
56215
|
const expandedTypes = [];
|
|
56219
56216
|
const expandedFlags = [];
|
|
56220
|
-
|
|
56217
|
+
const expandedDeclarations = [];
|
|
56221
56218
|
let lastRequiredIndex = -1;
|
|
56222
56219
|
let firstRestIndex = -1;
|
|
56223
56220
|
let lastOptionalOrRestIndex = -1;
|
|
@@ -56255,7 +56252,7 @@ function createTypeChecker(host) {
|
|
|
56255
56252
|
));
|
|
56256
56253
|
expandedTypes.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
|
|
56257
56254
|
expandedFlags.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
|
|
56258
|
-
expandedDeclarations
|
|
56255
|
+
expandedDeclarations.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
|
|
56259
56256
|
}
|
|
56260
56257
|
const tupleTarget = getTupleTargetType(expandedFlags, target.readonly, expandedDeclarations);
|
|
56261
56258
|
return tupleTarget === emptyGenericType ? emptyObjectType : expandedFlags.length ? createTypeReference(tupleTarget, expandedTypes) : tupleTarget;
|
|
@@ -56275,11 +56272,7 @@ function createTypeChecker(host) {
|
|
|
56275
56272
|
true
|
|
56276
56273
|
) : type);
|
|
56277
56274
|
expandedFlags.push(flags);
|
|
56278
|
-
|
|
56279
|
-
expandedDeclarations.push(declaration);
|
|
56280
|
-
} else {
|
|
56281
|
-
expandedDeclarations = void 0;
|
|
56282
|
-
}
|
|
56275
|
+
expandedDeclarations.push(declaration);
|
|
56283
56276
|
}
|
|
56284
56277
|
}
|
|
56285
56278
|
function sliceTupleType(type, index, endSkipCount = 0) {
|
|
@@ -70549,12 +70542,7 @@ function createTypeChecker(host) {
|
|
|
70549
70542
|
}
|
|
70550
70543
|
const candidates = candidatesOutArray || [];
|
|
70551
70544
|
reorderCandidates(signatures, candidates, callChainFlags);
|
|
70552
|
-
|
|
70553
|
-
if (reportErrors2) {
|
|
70554
|
-
diagnostics.add(getDiagnosticForCallNode(node, Diagnostics.Call_target_does_not_contain_any_signatures));
|
|
70555
|
-
}
|
|
70556
|
-
return resolveErrorCall(node);
|
|
70557
|
-
}
|
|
70545
|
+
Debug.assert(candidates.length, "Revert #54442 and add a testcase with whatever triggered this");
|
|
70558
70546
|
const args = getEffectiveCallArguments(node);
|
|
70559
70547
|
const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
|
|
70560
70548
|
let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
|
|
@@ -72006,7 +71994,10 @@ function createTypeChecker(host) {
|
|
|
72006
71994
|
}
|
|
72007
71995
|
return type;
|
|
72008
71996
|
}
|
|
72009
|
-
function getTupleElementLabel(d) {
|
|
71997
|
+
function getTupleElementLabel(d, index, restParameterName = "arg") {
|
|
71998
|
+
if (!d) {
|
|
71999
|
+
return `${restParameterName}_${index}`;
|
|
72000
|
+
}
|
|
72010
72001
|
Debug.assert(isIdentifier(d.name));
|
|
72011
72002
|
return d.name.escapedText;
|
|
72012
72003
|
}
|
|
@@ -72020,7 +72011,7 @@ function createTypeChecker(host) {
|
|
|
72020
72011
|
if (isTupleType(restType)) {
|
|
72021
72012
|
const associatedNames = restType.target.labeledElementDeclarations;
|
|
72022
72013
|
const index = pos - paramCount;
|
|
72023
|
-
return associatedNames
|
|
72014
|
+
return getTupleElementLabel(associatedNames == null ? void 0 : associatedNames[index], index, restParameter.escapedName);
|
|
72024
72015
|
}
|
|
72025
72016
|
return restParameter.escapedName;
|
|
72026
72017
|
}
|
|
@@ -75375,12 +75366,7 @@ function createTypeChecker(host) {
|
|
|
75375
75366
|
const elementTypes = node.elements;
|
|
75376
75367
|
let seenOptionalElement = false;
|
|
75377
75368
|
let seenRestElement = false;
|
|
75378
|
-
const hasNamedElement = some(elementTypes, isNamedTupleMember);
|
|
75379
75369
|
for (const e of elementTypes) {
|
|
75380
|
-
if (e.kind !== 202 /* NamedTupleMember */ && hasNamedElement) {
|
|
75381
|
-
grammarErrorOnNode(e, Diagnostics.Tuple_members_must_all_have_names_or_all_not_have_names);
|
|
75382
|
-
break;
|
|
75383
|
-
}
|
|
75384
75370
|
const flags = getTupleElementFlags(e);
|
|
75385
75371
|
if (flags & 8 /* Variadic */) {
|
|
75386
75372
|
const type = getTypeFromTypeNode(e.type);
|
|
@@ -115099,9 +115085,9 @@ function getConfigFileParsingDiagnostics(configFileParseResult) {
|
|
|
115099
115085
|
return configFileParseResult.options.configFile ? [...configFileParseResult.options.configFile.parseDiagnostics, ...configFileParseResult.errors] : configFileParseResult.errors;
|
|
115100
115086
|
}
|
|
115101
115087
|
function getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host, options) {
|
|
115102
|
-
switch (
|
|
115103
|
-
case
|
|
115104
|
-
case
|
|
115088
|
+
switch (getEmitModuleKind(options)) {
|
|
115089
|
+
case 100 /* Node16 */:
|
|
115090
|
+
case 199 /* NodeNext */:
|
|
115105
115091
|
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;
|
|
115106
115092
|
default:
|
|
115107
115093
|
return void 0;
|
package/lib/tsserver.js
CHANGED
|
@@ -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."),
|
|
@@ -50845,6 +50843,7 @@ function createTypeChecker(host) {
|
|
|
50845
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);
|
|
50846
50844
|
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
|
|
50847
50845
|
const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
|
|
50846
|
+
const moduleKind2 = getEmitModuleKind(compilerOptions);
|
|
50848
50847
|
const resolvedModule = getResolvedModule(currentSourceFile, moduleReference, mode);
|
|
50849
50848
|
const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
|
|
50850
50849
|
const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
|
|
@@ -50877,7 +50876,7 @@ function createTypeChecker(host) {
|
|
|
50877
50876
|
moduleReference
|
|
50878
50877
|
);
|
|
50879
50878
|
}
|
|
50880
|
-
if (
|
|
50879
|
+
if (100 /* Node16 */ <= moduleKind2 && moduleKind2 <= 199 /* NodeNext */) {
|
|
50881
50880
|
const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
|
|
50882
50881
|
const overrideClauseHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
|
|
50883
50882
|
const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (_h = overrideClauseHost.assertions) == null ? void 0 : _h.assertClause : overrideClauseHost == null ? void 0 : overrideClauseHost.assertClause;
|
|
@@ -51001,7 +51000,7 @@ function createTypeChecker(host) {
|
|
|
51001
51000
|
return void 0;
|
|
51002
51001
|
function getSuggestedImportSource(tsExtension) {
|
|
51003
51002
|
const importSourceWithoutExtension = removeExtension(moduleReference, tsExtension);
|
|
51004
|
-
if (emitModuleKindIsNonNodeESM(
|
|
51003
|
+
if (emitModuleKindIsNonNodeESM(moduleKind2) || mode === 99 /* ESNext */) {
|
|
51005
51004
|
const preferTs = isDeclarationFileName(moduleReference) && shouldAllowImportingTsExtension(compilerOptions);
|
|
51006
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";
|
|
51007
51006
|
return importSourceWithoutExtension + ext;
|
|
@@ -52640,19 +52639,18 @@ function createTypeChecker(host) {
|
|
|
52640
52639
|
const arity = getTypeReferenceArity(type2);
|
|
52641
52640
|
const tupleConstituentNodes = mapToTypeNodes(typeArguments.slice(0, arity), context);
|
|
52642
52641
|
if (tupleConstituentNodes) {
|
|
52643
|
-
|
|
52644
|
-
|
|
52645
|
-
|
|
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) {
|
|
52646
52647
|
tupleConstituentNodes[i] = factory.createNamedTupleMember(
|
|
52647
52648
|
flags & 12 /* Variable */ ? factory.createToken(26 /* DotDotDotToken */) : void 0,
|
|
52648
|
-
factory.createIdentifier(unescapeLeadingUnderscores(getTupleElementLabel(
|
|
52649
|
+
factory.createIdentifier(unescapeLeadingUnderscores(getTupleElementLabel(labeledElementDeclaration))),
|
|
52649
52650
|
flags & 2 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0,
|
|
52650
52651
|
flags & 4 /* Rest */ ? factory.createArrayTypeNode(tupleConstituentNodes[i]) : tupleConstituentNodes[i]
|
|
52651
52652
|
);
|
|
52652
|
-
}
|
|
52653
|
-
} else {
|
|
52654
|
-
for (let i = 0; i < Math.min(arity, tupleConstituentNodes.length); i++) {
|
|
52655
|
-
const flags = type2.target.elementFlags[i];
|
|
52653
|
+
} else {
|
|
52656
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];
|
|
52657
52655
|
}
|
|
52658
52656
|
}
|
|
@@ -57764,17 +57762,18 @@ function createTypeChecker(host) {
|
|
|
57764
57762
|
function getExpandedParameters(sig, skipUnionExpanding) {
|
|
57765
57763
|
if (signatureHasRestParameter(sig)) {
|
|
57766
57764
|
const restIndex = sig.parameters.length - 1;
|
|
57765
|
+
const restName = sig.parameters[restIndex].escapedName;
|
|
57767
57766
|
const restType = getTypeOfSymbol(sig.parameters[restIndex]);
|
|
57768
57767
|
if (isTupleType(restType)) {
|
|
57769
|
-
return [expandSignatureParametersWithTupleMembers(restType, restIndex)];
|
|
57768
|
+
return [expandSignatureParametersWithTupleMembers(restType, restIndex, restName)];
|
|
57770
57769
|
} else if (!skipUnionExpanding && restType.flags & 1048576 /* Union */ && every(restType.types, isTupleType)) {
|
|
57771
|
-
return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex));
|
|
57770
|
+
return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex, restName));
|
|
57772
57771
|
}
|
|
57773
57772
|
}
|
|
57774
57773
|
return [sig.parameters];
|
|
57775
|
-
function expandSignatureParametersWithTupleMembers(restType, restIndex) {
|
|
57776
|
-
const elementTypes =
|
|
57777
|
-
const associatedNames = getUniqAssociatedNamesFromTupleType(restType);
|
|
57774
|
+
function expandSignatureParametersWithTupleMembers(restType, restIndex, restName) {
|
|
57775
|
+
const elementTypes = getTypeArguments(restType);
|
|
57776
|
+
const associatedNames = getUniqAssociatedNamesFromTupleType(restType, restName);
|
|
57778
57777
|
const restParams = map(elementTypes, (t, i) => {
|
|
57779
57778
|
const name = associatedNames && associatedNames[i] ? associatedNames[i] : getParameterNameAtPosition(sig, restIndex + i, restType);
|
|
57780
57779
|
const flags = restType.target.elementFlags[i];
|
|
@@ -57785,10 +57784,10 @@ function createTypeChecker(host) {
|
|
|
57785
57784
|
});
|
|
57786
57785
|
return concatenate(sig.parameters.slice(0, restIndex), restParams);
|
|
57787
57786
|
}
|
|
57788
|
-
function getUniqAssociatedNamesFromTupleType(type) {
|
|
57787
|
+
function getUniqAssociatedNamesFromTupleType(type, restName) {
|
|
57789
57788
|
const associatedNamesMap = /* @__PURE__ */ new Map();
|
|
57790
|
-
return map(type.target.labeledElementDeclarations, (labeledElement) => {
|
|
57791
|
-
const name = getTupleElementLabel(labeledElement);
|
|
57789
|
+
return map(type.target.labeledElementDeclarations, (labeledElement, i) => {
|
|
57790
|
+
const name = getTupleElementLabel(labeledElement, i, restName);
|
|
57792
57791
|
const prevCounter = associatedNamesMap.get(name);
|
|
57793
57792
|
if (prevCounter === void 0) {
|
|
57794
57793
|
associatedNamesMap.set(name, 1);
|
|
@@ -60722,13 +60721,10 @@ function createTypeChecker(host) {
|
|
|
60722
60721
|
return readonly ? globalReadonlyArrayType : globalArrayType;
|
|
60723
60722
|
}
|
|
60724
60723
|
const elementFlags = map(node.elements, getTupleElementFlags);
|
|
60725
|
-
|
|
60726
|
-
|
|
60727
|
-
|
|
60728
|
-
|
|
60729
|
-
/*associatedNames*/
|
|
60730
|
-
missingName ? void 0 : node.elements
|
|
60731
|
-
);
|
|
60724
|
+
return getTupleTargetType(elementFlags, readonly, map(node.elements, memberIfLabeledElementDeclaration));
|
|
60725
|
+
}
|
|
60726
|
+
function memberIfLabeledElementDeclaration(member) {
|
|
60727
|
+
return isNamedTupleMember(member) || isParameter(member) ? member : void 0;
|
|
60732
60728
|
}
|
|
60733
60729
|
function isDeferredTypeReferenceNode(node, hasDefaultTypeArguments) {
|
|
60734
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));
|
|
@@ -60803,7 +60799,7 @@ function createTypeChecker(host) {
|
|
|
60803
60799
|
function isReadonlyTypeOperator(node) {
|
|
60804
60800
|
return isTypeOperatorNode(node) && node.operator === 148 /* ReadonlyKeyword */;
|
|
60805
60801
|
}
|
|
60806
|
-
function createTupleType(elementTypes, elementFlags, readonly = false, namedMemberDeclarations) {
|
|
60802
|
+
function createTupleType(elementTypes, elementFlags, readonly = false, namedMemberDeclarations = []) {
|
|
60807
60803
|
const tupleTarget = getTupleTargetType(elementFlags || map(elementTypes, (_) => 1 /* Required */), readonly, namedMemberDeclarations);
|
|
60808
60804
|
return tupleTarget === emptyGenericType ? emptyObjectType : elementTypes.length ? createNormalizedTypeReference(tupleTarget, elementTypes) : tupleTarget;
|
|
60809
60805
|
}
|
|
@@ -60811,7 +60807,8 @@ function createTypeChecker(host) {
|
|
|
60811
60807
|
if (elementFlags.length === 1 && elementFlags[0] & 4 /* Rest */) {
|
|
60812
60808
|
return readonly ? globalReadonlyArrayType : globalArrayType;
|
|
60813
60809
|
}
|
|
60814
|
-
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(",") : "");
|
|
60815
60812
|
let type = tupleTypes.get(key);
|
|
60816
60813
|
if (!type) {
|
|
60817
60814
|
tupleTypes.set(key, type = createTupleTargetType(elementFlags, readonly, namedMemberDeclarations));
|
|
@@ -60893,7 +60890,7 @@ function createTypeChecker(host) {
|
|
|
60893
60890
|
}
|
|
60894
60891
|
const expandedTypes = [];
|
|
60895
60892
|
const expandedFlags = [];
|
|
60896
|
-
|
|
60893
|
+
const expandedDeclarations = [];
|
|
60897
60894
|
let lastRequiredIndex = -1;
|
|
60898
60895
|
let firstRestIndex = -1;
|
|
60899
60896
|
let lastOptionalOrRestIndex = -1;
|
|
@@ -60931,7 +60928,7 @@ function createTypeChecker(host) {
|
|
|
60931
60928
|
));
|
|
60932
60929
|
expandedTypes.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
|
|
60933
60930
|
expandedFlags.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
|
|
60934
|
-
expandedDeclarations
|
|
60931
|
+
expandedDeclarations.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
|
|
60935
60932
|
}
|
|
60936
60933
|
const tupleTarget = getTupleTargetType(expandedFlags, target.readonly, expandedDeclarations);
|
|
60937
60934
|
return tupleTarget === emptyGenericType ? emptyObjectType : expandedFlags.length ? createTypeReference(tupleTarget, expandedTypes) : tupleTarget;
|
|
@@ -60951,11 +60948,7 @@ function createTypeChecker(host) {
|
|
|
60951
60948
|
true
|
|
60952
60949
|
) : type);
|
|
60953
60950
|
expandedFlags.push(flags);
|
|
60954
|
-
|
|
60955
|
-
expandedDeclarations.push(declaration);
|
|
60956
|
-
} else {
|
|
60957
|
-
expandedDeclarations = void 0;
|
|
60958
|
-
}
|
|
60951
|
+
expandedDeclarations.push(declaration);
|
|
60959
60952
|
}
|
|
60960
60953
|
}
|
|
60961
60954
|
function sliceTupleType(type, index, endSkipCount = 0) {
|
|
@@ -75225,12 +75218,7 @@ function createTypeChecker(host) {
|
|
|
75225
75218
|
}
|
|
75226
75219
|
const candidates = candidatesOutArray || [];
|
|
75227
75220
|
reorderCandidates(signatures, candidates, callChainFlags);
|
|
75228
|
-
|
|
75229
|
-
if (reportErrors2) {
|
|
75230
|
-
diagnostics.add(getDiagnosticForCallNode(node, Diagnostics.Call_target_does_not_contain_any_signatures));
|
|
75231
|
-
}
|
|
75232
|
-
return resolveErrorCall(node);
|
|
75233
|
-
}
|
|
75221
|
+
Debug.assert(candidates.length, "Revert #54442 and add a testcase with whatever triggered this");
|
|
75234
75222
|
const args = getEffectiveCallArguments(node);
|
|
75235
75223
|
const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
|
|
75236
75224
|
let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
|
|
@@ -76682,7 +76670,10 @@ function createTypeChecker(host) {
|
|
|
76682
76670
|
}
|
|
76683
76671
|
return type;
|
|
76684
76672
|
}
|
|
76685
|
-
function getTupleElementLabel(d) {
|
|
76673
|
+
function getTupleElementLabel(d, index, restParameterName = "arg") {
|
|
76674
|
+
if (!d) {
|
|
76675
|
+
return `${restParameterName}_${index}`;
|
|
76676
|
+
}
|
|
76686
76677
|
Debug.assert(isIdentifier(d.name));
|
|
76687
76678
|
return d.name.escapedText;
|
|
76688
76679
|
}
|
|
@@ -76696,7 +76687,7 @@ function createTypeChecker(host) {
|
|
|
76696
76687
|
if (isTupleType(restType)) {
|
|
76697
76688
|
const associatedNames = restType.target.labeledElementDeclarations;
|
|
76698
76689
|
const index = pos - paramCount;
|
|
76699
|
-
return associatedNames
|
|
76690
|
+
return getTupleElementLabel(associatedNames == null ? void 0 : associatedNames[index], index, restParameter.escapedName);
|
|
76700
76691
|
}
|
|
76701
76692
|
return restParameter.escapedName;
|
|
76702
76693
|
}
|
|
@@ -80051,12 +80042,7 @@ function createTypeChecker(host) {
|
|
|
80051
80042
|
const elementTypes = node.elements;
|
|
80052
80043
|
let seenOptionalElement = false;
|
|
80053
80044
|
let seenRestElement = false;
|
|
80054
|
-
const hasNamedElement = some(elementTypes, isNamedTupleMember);
|
|
80055
80045
|
for (const e of elementTypes) {
|
|
80056
|
-
if (e.kind !== 202 /* NamedTupleMember */ && hasNamedElement) {
|
|
80057
|
-
grammarErrorOnNode(e, Diagnostics.Tuple_members_must_all_have_names_or_all_not_have_names);
|
|
80058
|
-
break;
|
|
80059
|
-
}
|
|
80060
80046
|
const flags = getTupleElementFlags(e);
|
|
80061
80047
|
if (flags & 8 /* Variadic */) {
|
|
80062
80048
|
const type = getTypeFromTypeNode(e.type);
|
|
@@ -120011,9 +119997,9 @@ function getImpliedNodeFormatForFile(fileName, packageJsonInfoCache, host, optio
|
|
|
120011
119997
|
return typeof result === "object" ? result.impliedNodeFormat : result;
|
|
120012
119998
|
}
|
|
120013
119999
|
function getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host, options) {
|
|
120014
|
-
switch (
|
|
120015
|
-
case
|
|
120016
|
-
case
|
|
120000
|
+
switch (getEmitModuleKind(options)) {
|
|
120001
|
+
case 100 /* Node16 */:
|
|
120002
|
+
case 199 /* NodeNext */:
|
|
120017
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;
|
|
120018
120004
|
default:
|
|
120019
120005
|
return void 0;
|
|
@@ -158174,7 +158160,7 @@ function getSourceFromOrigin(origin) {
|
|
|
158174
158160
|
}
|
|
158175
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) {
|
|
158176
158162
|
const start2 = timestamp();
|
|
158177
|
-
const variableOrParameterDeclaration = getVariableOrParameterDeclaration(contextToken);
|
|
158163
|
+
const variableOrParameterDeclaration = getVariableOrParameterDeclaration(contextToken, location);
|
|
158178
158164
|
const useSemicolons = probablyUsesSemicolons(sourceFile);
|
|
158179
158165
|
const typeChecker = program.getTypeChecker();
|
|
158180
158166
|
const uniques = /* @__PURE__ */ new Map();
|
|
@@ -160360,11 +160346,12 @@ function isModuleSpecifierMissingOrEmpty(specifier) {
|
|
|
160360
160346
|
return true;
|
|
160361
160347
|
return !((_a = tryCast(isExternalModuleReference(specifier) ? specifier.expression : specifier, isStringLiteralLike)) == null ? void 0 : _a.text);
|
|
160362
160348
|
}
|
|
160363
|
-
function getVariableOrParameterDeclaration(contextToken) {
|
|
160349
|
+
function getVariableOrParameterDeclaration(contextToken, location) {
|
|
160364
160350
|
if (!contextToken)
|
|
160365
160351
|
return;
|
|
160366
|
-
const
|
|
160367
|
-
|
|
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;
|
|
160368
160355
|
}
|
|
160369
160356
|
function isArrowFunctionBody(node) {
|
|
160370
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
|
package/lib/tsserverlibrary.js
CHANGED
|
@@ -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."),
|
|
@@ -48612,6 +48610,7 @@ ${lanes.join("\n")}
|
|
|
48612
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);
|
|
48613
48611
|
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
|
|
48614
48612
|
const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
|
|
48613
|
+
const moduleKind2 = getEmitModuleKind(compilerOptions);
|
|
48615
48614
|
const resolvedModule = getResolvedModule(currentSourceFile, moduleReference, mode);
|
|
48616
48615
|
const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
|
|
48617
48616
|
const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
|
|
@@ -48644,7 +48643,7 @@ ${lanes.join("\n")}
|
|
|
48644
48643
|
moduleReference
|
|
48645
48644
|
);
|
|
48646
48645
|
}
|
|
48647
|
-
if (
|
|
48646
|
+
if (100 /* Node16 */ <= moduleKind2 && moduleKind2 <= 199 /* NodeNext */) {
|
|
48648
48647
|
const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
|
|
48649
48648
|
const overrideClauseHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
|
|
48650
48649
|
const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (_h = overrideClauseHost.assertions) == null ? void 0 : _h.assertClause : overrideClauseHost == null ? void 0 : overrideClauseHost.assertClause;
|
|
@@ -48768,7 +48767,7 @@ ${lanes.join("\n")}
|
|
|
48768
48767
|
return void 0;
|
|
48769
48768
|
function getSuggestedImportSource(tsExtension) {
|
|
48770
48769
|
const importSourceWithoutExtension = removeExtension(moduleReference, tsExtension);
|
|
48771
|
-
if (emitModuleKindIsNonNodeESM(
|
|
48770
|
+
if (emitModuleKindIsNonNodeESM(moduleKind2) || mode === 99 /* ESNext */) {
|
|
48772
48771
|
const preferTs = isDeclarationFileName(moduleReference) && shouldAllowImportingTsExtension(compilerOptions);
|
|
48773
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";
|
|
48774
48773
|
return importSourceWithoutExtension + ext;
|
|
@@ -50407,19 +50406,18 @@ ${lanes.join("\n")}
|
|
|
50407
50406
|
const arity = getTypeReferenceArity(type2);
|
|
50408
50407
|
const tupleConstituentNodes = mapToTypeNodes(typeArguments.slice(0, arity), context);
|
|
50409
50408
|
if (tupleConstituentNodes) {
|
|
50410
|
-
|
|
50411
|
-
|
|
50412
|
-
|
|
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) {
|
|
50413
50414
|
tupleConstituentNodes[i] = factory.createNamedTupleMember(
|
|
50414
50415
|
flags & 12 /* Variable */ ? factory.createToken(26 /* DotDotDotToken */) : void 0,
|
|
50415
|
-
factory.createIdentifier(unescapeLeadingUnderscores(getTupleElementLabel(
|
|
50416
|
+
factory.createIdentifier(unescapeLeadingUnderscores(getTupleElementLabel(labeledElementDeclaration))),
|
|
50416
50417
|
flags & 2 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0,
|
|
50417
50418
|
flags & 4 /* Rest */ ? factory.createArrayTypeNode(tupleConstituentNodes[i]) : tupleConstituentNodes[i]
|
|
50418
50419
|
);
|
|
50419
|
-
}
|
|
50420
|
-
} else {
|
|
50421
|
-
for (let i = 0; i < Math.min(arity, tupleConstituentNodes.length); i++) {
|
|
50422
|
-
const flags = type2.target.elementFlags[i];
|
|
50420
|
+
} else {
|
|
50423
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];
|
|
50424
50422
|
}
|
|
50425
50423
|
}
|
|
@@ -55531,17 +55529,18 @@ ${lanes.join("\n")}
|
|
|
55531
55529
|
function getExpandedParameters(sig, skipUnionExpanding) {
|
|
55532
55530
|
if (signatureHasRestParameter(sig)) {
|
|
55533
55531
|
const restIndex = sig.parameters.length - 1;
|
|
55532
|
+
const restName = sig.parameters[restIndex].escapedName;
|
|
55534
55533
|
const restType = getTypeOfSymbol(sig.parameters[restIndex]);
|
|
55535
55534
|
if (isTupleType(restType)) {
|
|
55536
|
-
return [expandSignatureParametersWithTupleMembers(restType, restIndex)];
|
|
55535
|
+
return [expandSignatureParametersWithTupleMembers(restType, restIndex, restName)];
|
|
55537
55536
|
} else if (!skipUnionExpanding && restType.flags & 1048576 /* Union */ && every(restType.types, isTupleType)) {
|
|
55538
|
-
return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex));
|
|
55537
|
+
return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex, restName));
|
|
55539
55538
|
}
|
|
55540
55539
|
}
|
|
55541
55540
|
return [sig.parameters];
|
|
55542
|
-
function expandSignatureParametersWithTupleMembers(restType, restIndex) {
|
|
55543
|
-
const elementTypes =
|
|
55544
|
-
const associatedNames = getUniqAssociatedNamesFromTupleType(restType);
|
|
55541
|
+
function expandSignatureParametersWithTupleMembers(restType, restIndex, restName) {
|
|
55542
|
+
const elementTypes = getTypeArguments(restType);
|
|
55543
|
+
const associatedNames = getUniqAssociatedNamesFromTupleType(restType, restName);
|
|
55545
55544
|
const restParams = map(elementTypes, (t, i) => {
|
|
55546
55545
|
const name = associatedNames && associatedNames[i] ? associatedNames[i] : getParameterNameAtPosition(sig, restIndex + i, restType);
|
|
55547
55546
|
const flags = restType.target.elementFlags[i];
|
|
@@ -55552,10 +55551,10 @@ ${lanes.join("\n")}
|
|
|
55552
55551
|
});
|
|
55553
55552
|
return concatenate(sig.parameters.slice(0, restIndex), restParams);
|
|
55554
55553
|
}
|
|
55555
|
-
function getUniqAssociatedNamesFromTupleType(type) {
|
|
55554
|
+
function getUniqAssociatedNamesFromTupleType(type, restName) {
|
|
55556
55555
|
const associatedNamesMap = /* @__PURE__ */ new Map();
|
|
55557
|
-
return map(type.target.labeledElementDeclarations, (labeledElement) => {
|
|
55558
|
-
const name = getTupleElementLabel(labeledElement);
|
|
55556
|
+
return map(type.target.labeledElementDeclarations, (labeledElement, i) => {
|
|
55557
|
+
const name = getTupleElementLabel(labeledElement, i, restName);
|
|
55559
55558
|
const prevCounter = associatedNamesMap.get(name);
|
|
55560
55559
|
if (prevCounter === void 0) {
|
|
55561
55560
|
associatedNamesMap.set(name, 1);
|
|
@@ -58489,13 +58488,10 @@ ${lanes.join("\n")}
|
|
|
58489
58488
|
return readonly ? globalReadonlyArrayType : globalArrayType;
|
|
58490
58489
|
}
|
|
58491
58490
|
const elementFlags = map(node.elements, getTupleElementFlags);
|
|
58492
|
-
|
|
58493
|
-
|
|
58494
|
-
|
|
58495
|
-
|
|
58496
|
-
/*associatedNames*/
|
|
58497
|
-
missingName ? void 0 : node.elements
|
|
58498
|
-
);
|
|
58491
|
+
return getTupleTargetType(elementFlags, readonly, map(node.elements, memberIfLabeledElementDeclaration));
|
|
58492
|
+
}
|
|
58493
|
+
function memberIfLabeledElementDeclaration(member) {
|
|
58494
|
+
return isNamedTupleMember(member) || isParameter(member) ? member : void 0;
|
|
58499
58495
|
}
|
|
58500
58496
|
function isDeferredTypeReferenceNode(node, hasDefaultTypeArguments) {
|
|
58501
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));
|
|
@@ -58570,7 +58566,7 @@ ${lanes.join("\n")}
|
|
|
58570
58566
|
function isReadonlyTypeOperator(node) {
|
|
58571
58567
|
return isTypeOperatorNode(node) && node.operator === 148 /* ReadonlyKeyword */;
|
|
58572
58568
|
}
|
|
58573
|
-
function createTupleType(elementTypes, elementFlags, readonly = false, namedMemberDeclarations) {
|
|
58569
|
+
function createTupleType(elementTypes, elementFlags, readonly = false, namedMemberDeclarations = []) {
|
|
58574
58570
|
const tupleTarget = getTupleTargetType(elementFlags || map(elementTypes, (_) => 1 /* Required */), readonly, namedMemberDeclarations);
|
|
58575
58571
|
return tupleTarget === emptyGenericType ? emptyObjectType : elementTypes.length ? createNormalizedTypeReference(tupleTarget, elementTypes) : tupleTarget;
|
|
58576
58572
|
}
|
|
@@ -58578,7 +58574,8 @@ ${lanes.join("\n")}
|
|
|
58578
58574
|
if (elementFlags.length === 1 && elementFlags[0] & 4 /* Rest */) {
|
|
58579
58575
|
return readonly ? globalReadonlyArrayType : globalArrayType;
|
|
58580
58576
|
}
|
|
58581
|
-
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(",") : "");
|
|
58582
58579
|
let type = tupleTypes.get(key);
|
|
58583
58580
|
if (!type) {
|
|
58584
58581
|
tupleTypes.set(key, type = createTupleTargetType(elementFlags, readonly, namedMemberDeclarations));
|
|
@@ -58660,7 +58657,7 @@ ${lanes.join("\n")}
|
|
|
58660
58657
|
}
|
|
58661
58658
|
const expandedTypes = [];
|
|
58662
58659
|
const expandedFlags = [];
|
|
58663
|
-
|
|
58660
|
+
const expandedDeclarations = [];
|
|
58664
58661
|
let lastRequiredIndex = -1;
|
|
58665
58662
|
let firstRestIndex = -1;
|
|
58666
58663
|
let lastOptionalOrRestIndex = -1;
|
|
@@ -58698,7 +58695,7 @@ ${lanes.join("\n")}
|
|
|
58698
58695
|
));
|
|
58699
58696
|
expandedTypes.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
|
|
58700
58697
|
expandedFlags.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
|
|
58701
|
-
expandedDeclarations
|
|
58698
|
+
expandedDeclarations.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
|
|
58702
58699
|
}
|
|
58703
58700
|
const tupleTarget = getTupleTargetType(expandedFlags, target.readonly, expandedDeclarations);
|
|
58704
58701
|
return tupleTarget === emptyGenericType ? emptyObjectType : expandedFlags.length ? createTypeReference(tupleTarget, expandedTypes) : tupleTarget;
|
|
@@ -58718,11 +58715,7 @@ ${lanes.join("\n")}
|
|
|
58718
58715
|
true
|
|
58719
58716
|
) : type);
|
|
58720
58717
|
expandedFlags.push(flags);
|
|
58721
|
-
|
|
58722
|
-
expandedDeclarations.push(declaration);
|
|
58723
|
-
} else {
|
|
58724
|
-
expandedDeclarations = void 0;
|
|
58725
|
-
}
|
|
58718
|
+
expandedDeclarations.push(declaration);
|
|
58726
58719
|
}
|
|
58727
58720
|
}
|
|
58728
58721
|
function sliceTupleType(type, index, endSkipCount = 0) {
|
|
@@ -72992,12 +72985,7 @@ ${lanes.join("\n")}
|
|
|
72992
72985
|
}
|
|
72993
72986
|
const candidates = candidatesOutArray || [];
|
|
72994
72987
|
reorderCandidates(signatures, candidates, callChainFlags);
|
|
72995
|
-
|
|
72996
|
-
if (reportErrors2) {
|
|
72997
|
-
diagnostics.add(getDiagnosticForCallNode(node, Diagnostics.Call_target_does_not_contain_any_signatures));
|
|
72998
|
-
}
|
|
72999
|
-
return resolveErrorCall(node);
|
|
73000
|
-
}
|
|
72988
|
+
Debug.assert(candidates.length, "Revert #54442 and add a testcase with whatever triggered this");
|
|
73001
72989
|
const args = getEffectiveCallArguments(node);
|
|
73002
72990
|
const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
|
|
73003
72991
|
let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
|
|
@@ -74449,7 +74437,10 @@ ${lanes.join("\n")}
|
|
|
74449
74437
|
}
|
|
74450
74438
|
return type;
|
|
74451
74439
|
}
|
|
74452
|
-
function getTupleElementLabel(d) {
|
|
74440
|
+
function getTupleElementLabel(d, index, restParameterName = "arg") {
|
|
74441
|
+
if (!d) {
|
|
74442
|
+
return `${restParameterName}_${index}`;
|
|
74443
|
+
}
|
|
74453
74444
|
Debug.assert(isIdentifier(d.name));
|
|
74454
74445
|
return d.name.escapedText;
|
|
74455
74446
|
}
|
|
@@ -74463,7 +74454,7 @@ ${lanes.join("\n")}
|
|
|
74463
74454
|
if (isTupleType(restType)) {
|
|
74464
74455
|
const associatedNames = restType.target.labeledElementDeclarations;
|
|
74465
74456
|
const index = pos - paramCount;
|
|
74466
|
-
return associatedNames
|
|
74457
|
+
return getTupleElementLabel(associatedNames == null ? void 0 : associatedNames[index], index, restParameter.escapedName);
|
|
74467
74458
|
}
|
|
74468
74459
|
return restParameter.escapedName;
|
|
74469
74460
|
}
|
|
@@ -77818,12 +77809,7 @@ ${lanes.join("\n")}
|
|
|
77818
77809
|
const elementTypes = node.elements;
|
|
77819
77810
|
let seenOptionalElement = false;
|
|
77820
77811
|
let seenRestElement = false;
|
|
77821
|
-
const hasNamedElement = some(elementTypes, isNamedTupleMember);
|
|
77822
77812
|
for (const e of elementTypes) {
|
|
77823
|
-
if (e.kind !== 202 /* NamedTupleMember */ && hasNamedElement) {
|
|
77824
|
-
grammarErrorOnNode(e, Diagnostics.Tuple_members_must_all_have_names_or_all_not_have_names);
|
|
77825
|
-
break;
|
|
77826
|
-
}
|
|
77827
77813
|
const flags = getTupleElementFlags(e);
|
|
77828
77814
|
if (flags & 8 /* Variadic */) {
|
|
77829
77815
|
const type = getTypeFromTypeNode(e.type);
|
|
@@ -118094,9 +118080,9 @@ ${lanes.join("\n")}
|
|
|
118094
118080
|
return typeof result === "object" ? result.impliedNodeFormat : result;
|
|
118095
118081
|
}
|
|
118096
118082
|
function getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host, options) {
|
|
118097
|
-
switch (
|
|
118098
|
-
case
|
|
118099
|
-
case
|
|
118083
|
+
switch (getEmitModuleKind(options)) {
|
|
118084
|
+
case 100 /* Node16 */:
|
|
118085
|
+
case 199 /* NodeNext */:
|
|
118100
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;
|
|
118101
118087
|
default:
|
|
118102
118088
|
return void 0;
|
|
@@ -157407,7 +157393,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157407
157393
|
}
|
|
157408
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) {
|
|
157409
157395
|
const start = timestamp();
|
|
157410
|
-
const variableOrParameterDeclaration = getVariableOrParameterDeclaration(contextToken);
|
|
157396
|
+
const variableOrParameterDeclaration = getVariableOrParameterDeclaration(contextToken, location);
|
|
157411
157397
|
const useSemicolons = probablyUsesSemicolons(sourceFile);
|
|
157412
157398
|
const typeChecker = program.getTypeChecker();
|
|
157413
157399
|
const uniques = /* @__PURE__ */ new Map();
|
|
@@ -159571,11 +159557,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159571
159557
|
return true;
|
|
159572
159558
|
return !((_a = tryCast(isExternalModuleReference(specifier) ? specifier.expression : specifier, isStringLiteralLike)) == null ? void 0 : _a.text);
|
|
159573
159559
|
}
|
|
159574
|
-
function getVariableOrParameterDeclaration(contextToken) {
|
|
159560
|
+
function getVariableOrParameterDeclaration(contextToken, location) {
|
|
159575
159561
|
if (!contextToken)
|
|
159576
159562
|
return;
|
|
159577
|
-
const
|
|
159578
|
-
|
|
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;
|
|
159579
159566
|
}
|
|
159580
159567
|
function isArrowFunctionBody(node) {
|
|
159581
159568
|
return node.parent && isArrowFunction(node.parent) && (node.parent.body === node || // const a = () => /**/;
|
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
|
package/lib/typescript.js
CHANGED
|
@@ -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."),
|
|
@@ -48612,6 +48610,7 @@ ${lanes.join("\n")}
|
|
|
48612
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);
|
|
48613
48611
|
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
|
|
48614
48612
|
const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
|
|
48613
|
+
const moduleKind2 = getEmitModuleKind(compilerOptions);
|
|
48615
48614
|
const resolvedModule = getResolvedModule(currentSourceFile, moduleReference, mode);
|
|
48616
48615
|
const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
|
|
48617
48616
|
const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
|
|
@@ -48644,7 +48643,7 @@ ${lanes.join("\n")}
|
|
|
48644
48643
|
moduleReference
|
|
48645
48644
|
);
|
|
48646
48645
|
}
|
|
48647
|
-
if (
|
|
48646
|
+
if (100 /* Node16 */ <= moduleKind2 && moduleKind2 <= 199 /* NodeNext */) {
|
|
48648
48647
|
const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
|
|
48649
48648
|
const overrideClauseHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
|
|
48650
48649
|
const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (_h = overrideClauseHost.assertions) == null ? void 0 : _h.assertClause : overrideClauseHost == null ? void 0 : overrideClauseHost.assertClause;
|
|
@@ -48768,7 +48767,7 @@ ${lanes.join("\n")}
|
|
|
48768
48767
|
return void 0;
|
|
48769
48768
|
function getSuggestedImportSource(tsExtension) {
|
|
48770
48769
|
const importSourceWithoutExtension = removeExtension(moduleReference, tsExtension);
|
|
48771
|
-
if (emitModuleKindIsNonNodeESM(
|
|
48770
|
+
if (emitModuleKindIsNonNodeESM(moduleKind2) || mode === 99 /* ESNext */) {
|
|
48772
48771
|
const preferTs = isDeclarationFileName(moduleReference) && shouldAllowImportingTsExtension(compilerOptions);
|
|
48773
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";
|
|
48774
48773
|
return importSourceWithoutExtension + ext;
|
|
@@ -50407,19 +50406,18 @@ ${lanes.join("\n")}
|
|
|
50407
50406
|
const arity = getTypeReferenceArity(type2);
|
|
50408
50407
|
const tupleConstituentNodes = mapToTypeNodes(typeArguments.slice(0, arity), context);
|
|
50409
50408
|
if (tupleConstituentNodes) {
|
|
50410
|
-
|
|
50411
|
-
|
|
50412
|
-
|
|
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) {
|
|
50413
50414
|
tupleConstituentNodes[i] = factory.createNamedTupleMember(
|
|
50414
50415
|
flags & 12 /* Variable */ ? factory.createToken(26 /* DotDotDotToken */) : void 0,
|
|
50415
|
-
factory.createIdentifier(unescapeLeadingUnderscores(getTupleElementLabel(
|
|
50416
|
+
factory.createIdentifier(unescapeLeadingUnderscores(getTupleElementLabel(labeledElementDeclaration))),
|
|
50416
50417
|
flags & 2 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0,
|
|
50417
50418
|
flags & 4 /* Rest */ ? factory.createArrayTypeNode(tupleConstituentNodes[i]) : tupleConstituentNodes[i]
|
|
50418
50419
|
);
|
|
50419
|
-
}
|
|
50420
|
-
} else {
|
|
50421
|
-
for (let i = 0; i < Math.min(arity, tupleConstituentNodes.length); i++) {
|
|
50422
|
-
const flags = type2.target.elementFlags[i];
|
|
50420
|
+
} else {
|
|
50423
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];
|
|
50424
50422
|
}
|
|
50425
50423
|
}
|
|
@@ -55531,17 +55529,18 @@ ${lanes.join("\n")}
|
|
|
55531
55529
|
function getExpandedParameters(sig, skipUnionExpanding) {
|
|
55532
55530
|
if (signatureHasRestParameter(sig)) {
|
|
55533
55531
|
const restIndex = sig.parameters.length - 1;
|
|
55532
|
+
const restName = sig.parameters[restIndex].escapedName;
|
|
55534
55533
|
const restType = getTypeOfSymbol(sig.parameters[restIndex]);
|
|
55535
55534
|
if (isTupleType(restType)) {
|
|
55536
|
-
return [expandSignatureParametersWithTupleMembers(restType, restIndex)];
|
|
55535
|
+
return [expandSignatureParametersWithTupleMembers(restType, restIndex, restName)];
|
|
55537
55536
|
} else if (!skipUnionExpanding && restType.flags & 1048576 /* Union */ && every(restType.types, isTupleType)) {
|
|
55538
|
-
return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex));
|
|
55537
|
+
return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex, restName));
|
|
55539
55538
|
}
|
|
55540
55539
|
}
|
|
55541
55540
|
return [sig.parameters];
|
|
55542
|
-
function expandSignatureParametersWithTupleMembers(restType, restIndex) {
|
|
55543
|
-
const elementTypes =
|
|
55544
|
-
const associatedNames = getUniqAssociatedNamesFromTupleType(restType);
|
|
55541
|
+
function expandSignatureParametersWithTupleMembers(restType, restIndex, restName) {
|
|
55542
|
+
const elementTypes = getTypeArguments(restType);
|
|
55543
|
+
const associatedNames = getUniqAssociatedNamesFromTupleType(restType, restName);
|
|
55545
55544
|
const restParams = map(elementTypes, (t, i) => {
|
|
55546
55545
|
const name = associatedNames && associatedNames[i] ? associatedNames[i] : getParameterNameAtPosition(sig, restIndex + i, restType);
|
|
55547
55546
|
const flags = restType.target.elementFlags[i];
|
|
@@ -55552,10 +55551,10 @@ ${lanes.join("\n")}
|
|
|
55552
55551
|
});
|
|
55553
55552
|
return concatenate(sig.parameters.slice(0, restIndex), restParams);
|
|
55554
55553
|
}
|
|
55555
|
-
function getUniqAssociatedNamesFromTupleType(type) {
|
|
55554
|
+
function getUniqAssociatedNamesFromTupleType(type, restName) {
|
|
55556
55555
|
const associatedNamesMap = /* @__PURE__ */ new Map();
|
|
55557
|
-
return map(type.target.labeledElementDeclarations, (labeledElement) => {
|
|
55558
|
-
const name = getTupleElementLabel(labeledElement);
|
|
55556
|
+
return map(type.target.labeledElementDeclarations, (labeledElement, i) => {
|
|
55557
|
+
const name = getTupleElementLabel(labeledElement, i, restName);
|
|
55559
55558
|
const prevCounter = associatedNamesMap.get(name);
|
|
55560
55559
|
if (prevCounter === void 0) {
|
|
55561
55560
|
associatedNamesMap.set(name, 1);
|
|
@@ -58489,13 +58488,10 @@ ${lanes.join("\n")}
|
|
|
58489
58488
|
return readonly ? globalReadonlyArrayType : globalArrayType;
|
|
58490
58489
|
}
|
|
58491
58490
|
const elementFlags = map(node.elements, getTupleElementFlags);
|
|
58492
|
-
|
|
58493
|
-
|
|
58494
|
-
|
|
58495
|
-
|
|
58496
|
-
/*associatedNames*/
|
|
58497
|
-
missingName ? void 0 : node.elements
|
|
58498
|
-
);
|
|
58491
|
+
return getTupleTargetType(elementFlags, readonly, map(node.elements, memberIfLabeledElementDeclaration));
|
|
58492
|
+
}
|
|
58493
|
+
function memberIfLabeledElementDeclaration(member) {
|
|
58494
|
+
return isNamedTupleMember(member) || isParameter(member) ? member : void 0;
|
|
58499
58495
|
}
|
|
58500
58496
|
function isDeferredTypeReferenceNode(node, hasDefaultTypeArguments) {
|
|
58501
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));
|
|
@@ -58570,7 +58566,7 @@ ${lanes.join("\n")}
|
|
|
58570
58566
|
function isReadonlyTypeOperator(node) {
|
|
58571
58567
|
return isTypeOperatorNode(node) && node.operator === 148 /* ReadonlyKeyword */;
|
|
58572
58568
|
}
|
|
58573
|
-
function createTupleType(elementTypes, elementFlags, readonly = false, namedMemberDeclarations) {
|
|
58569
|
+
function createTupleType(elementTypes, elementFlags, readonly = false, namedMemberDeclarations = []) {
|
|
58574
58570
|
const tupleTarget = getTupleTargetType(elementFlags || map(elementTypes, (_) => 1 /* Required */), readonly, namedMemberDeclarations);
|
|
58575
58571
|
return tupleTarget === emptyGenericType ? emptyObjectType : elementTypes.length ? createNormalizedTypeReference(tupleTarget, elementTypes) : tupleTarget;
|
|
58576
58572
|
}
|
|
@@ -58578,7 +58574,8 @@ ${lanes.join("\n")}
|
|
|
58578
58574
|
if (elementFlags.length === 1 && elementFlags[0] & 4 /* Rest */) {
|
|
58579
58575
|
return readonly ? globalReadonlyArrayType : globalArrayType;
|
|
58580
58576
|
}
|
|
58581
|
-
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(",") : "");
|
|
58582
58579
|
let type = tupleTypes.get(key);
|
|
58583
58580
|
if (!type) {
|
|
58584
58581
|
tupleTypes.set(key, type = createTupleTargetType(elementFlags, readonly, namedMemberDeclarations));
|
|
@@ -58660,7 +58657,7 @@ ${lanes.join("\n")}
|
|
|
58660
58657
|
}
|
|
58661
58658
|
const expandedTypes = [];
|
|
58662
58659
|
const expandedFlags = [];
|
|
58663
|
-
|
|
58660
|
+
const expandedDeclarations = [];
|
|
58664
58661
|
let lastRequiredIndex = -1;
|
|
58665
58662
|
let firstRestIndex = -1;
|
|
58666
58663
|
let lastOptionalOrRestIndex = -1;
|
|
@@ -58698,7 +58695,7 @@ ${lanes.join("\n")}
|
|
|
58698
58695
|
));
|
|
58699
58696
|
expandedTypes.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
|
|
58700
58697
|
expandedFlags.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
|
|
58701
|
-
expandedDeclarations
|
|
58698
|
+
expandedDeclarations.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
|
|
58702
58699
|
}
|
|
58703
58700
|
const tupleTarget = getTupleTargetType(expandedFlags, target.readonly, expandedDeclarations);
|
|
58704
58701
|
return tupleTarget === emptyGenericType ? emptyObjectType : expandedFlags.length ? createTypeReference(tupleTarget, expandedTypes) : tupleTarget;
|
|
@@ -58718,11 +58715,7 @@ ${lanes.join("\n")}
|
|
|
58718
58715
|
true
|
|
58719
58716
|
) : type);
|
|
58720
58717
|
expandedFlags.push(flags);
|
|
58721
|
-
|
|
58722
|
-
expandedDeclarations.push(declaration);
|
|
58723
|
-
} else {
|
|
58724
|
-
expandedDeclarations = void 0;
|
|
58725
|
-
}
|
|
58718
|
+
expandedDeclarations.push(declaration);
|
|
58726
58719
|
}
|
|
58727
58720
|
}
|
|
58728
58721
|
function sliceTupleType(type, index, endSkipCount = 0) {
|
|
@@ -72992,12 +72985,7 @@ ${lanes.join("\n")}
|
|
|
72992
72985
|
}
|
|
72993
72986
|
const candidates = candidatesOutArray || [];
|
|
72994
72987
|
reorderCandidates(signatures, candidates, callChainFlags);
|
|
72995
|
-
|
|
72996
|
-
if (reportErrors2) {
|
|
72997
|
-
diagnostics.add(getDiagnosticForCallNode(node, Diagnostics.Call_target_does_not_contain_any_signatures));
|
|
72998
|
-
}
|
|
72999
|
-
return resolveErrorCall(node);
|
|
73000
|
-
}
|
|
72988
|
+
Debug.assert(candidates.length, "Revert #54442 and add a testcase with whatever triggered this");
|
|
73001
72989
|
const args = getEffectiveCallArguments(node);
|
|
73002
72990
|
const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
|
|
73003
72991
|
let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
|
|
@@ -74449,7 +74437,10 @@ ${lanes.join("\n")}
|
|
|
74449
74437
|
}
|
|
74450
74438
|
return type;
|
|
74451
74439
|
}
|
|
74452
|
-
function getTupleElementLabel(d) {
|
|
74440
|
+
function getTupleElementLabel(d, index, restParameterName = "arg") {
|
|
74441
|
+
if (!d) {
|
|
74442
|
+
return `${restParameterName}_${index}`;
|
|
74443
|
+
}
|
|
74453
74444
|
Debug.assert(isIdentifier(d.name));
|
|
74454
74445
|
return d.name.escapedText;
|
|
74455
74446
|
}
|
|
@@ -74463,7 +74454,7 @@ ${lanes.join("\n")}
|
|
|
74463
74454
|
if (isTupleType(restType)) {
|
|
74464
74455
|
const associatedNames = restType.target.labeledElementDeclarations;
|
|
74465
74456
|
const index = pos - paramCount;
|
|
74466
|
-
return associatedNames
|
|
74457
|
+
return getTupleElementLabel(associatedNames == null ? void 0 : associatedNames[index], index, restParameter.escapedName);
|
|
74467
74458
|
}
|
|
74468
74459
|
return restParameter.escapedName;
|
|
74469
74460
|
}
|
|
@@ -77818,12 +77809,7 @@ ${lanes.join("\n")}
|
|
|
77818
77809
|
const elementTypes = node.elements;
|
|
77819
77810
|
let seenOptionalElement = false;
|
|
77820
77811
|
let seenRestElement = false;
|
|
77821
|
-
const hasNamedElement = some(elementTypes, isNamedTupleMember);
|
|
77822
77812
|
for (const e of elementTypes) {
|
|
77823
|
-
if (e.kind !== 202 /* NamedTupleMember */ && hasNamedElement) {
|
|
77824
|
-
grammarErrorOnNode(e, Diagnostics.Tuple_members_must_all_have_names_or_all_not_have_names);
|
|
77825
|
-
break;
|
|
77826
|
-
}
|
|
77827
77813
|
const flags = getTupleElementFlags(e);
|
|
77828
77814
|
if (flags & 8 /* Variadic */) {
|
|
77829
77815
|
const type = getTypeFromTypeNode(e.type);
|
|
@@ -118094,9 +118080,9 @@ ${lanes.join("\n")}
|
|
|
118094
118080
|
return typeof result === "object" ? result.impliedNodeFormat : result;
|
|
118095
118081
|
}
|
|
118096
118082
|
function getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host, options) {
|
|
118097
|
-
switch (
|
|
118098
|
-
case
|
|
118099
|
-
case
|
|
118083
|
+
switch (getEmitModuleKind(options)) {
|
|
118084
|
+
case 100 /* Node16 */:
|
|
118085
|
+
case 199 /* NodeNext */:
|
|
118100
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;
|
|
118101
118087
|
default:
|
|
118102
118088
|
return void 0;
|
|
@@ -157422,7 +157408,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157422
157408
|
}
|
|
157423
157409
|
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) {
|
|
157424
157410
|
const start = timestamp();
|
|
157425
|
-
const variableOrParameterDeclaration = getVariableOrParameterDeclaration(contextToken);
|
|
157411
|
+
const variableOrParameterDeclaration = getVariableOrParameterDeclaration(contextToken, location);
|
|
157426
157412
|
const useSemicolons = probablyUsesSemicolons(sourceFile);
|
|
157427
157413
|
const typeChecker = program.getTypeChecker();
|
|
157428
157414
|
const uniques = /* @__PURE__ */ new Map();
|
|
@@ -159586,11 +159572,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159586
159572
|
return true;
|
|
159587
159573
|
return !((_a = tryCast(isExternalModuleReference(specifier) ? specifier.expression : specifier, isStringLiteralLike)) == null ? void 0 : _a.text);
|
|
159588
159574
|
}
|
|
159589
|
-
function getVariableOrParameterDeclaration(contextToken) {
|
|
159575
|
+
function getVariableOrParameterDeclaration(contextToken, location) {
|
|
159590
159576
|
if (!contextToken)
|
|
159591
159577
|
return;
|
|
159592
|
-
const
|
|
159593
|
-
|
|
159578
|
+
const possiblyParameterDeclaration = findAncestor(contextToken, (node) => isFunctionBlock(node) || isArrowFunctionBody(node) || isBindingPattern(node) ? "quit" : (isParameter(node) || isTypeParameterDeclaration(node)) && !isIndexSignatureDeclaration(node.parent));
|
|
159579
|
+
const possiblyVariableDeclaration = findAncestor(location, (node) => isFunctionBlock(node) || isArrowFunctionBody(node) || isBindingPattern(node) ? "quit" : isVariableDeclaration(node));
|
|
159580
|
+
return possiblyParameterDeclaration || possiblyVariableDeclaration;
|
|
159594
159581
|
}
|
|
159595
159582
|
function isArrowFunctionBody(node) {
|
|
159596
159583
|
return node.parent && isArrowFunction(node.parent) && (node.parent.body === node || // const a = () => /**/;
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -5586,7 +5586,6 @@ var Diagnostics = {
|
|
|
5586
5586
|
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}'."),
|
|
5587
5587
|
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}'."),
|
|
5588
5588
|
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}'."),
|
|
5589
|
-
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."),
|
|
5590
5589
|
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."),
|
|
5591
5590
|
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'?"),
|
|
5592
5591
|
This_expression_is_not_callable: diag(2349, 1 /* Error */, "This_expression_is_not_callable_2349", "This expression is not callable."),
|
|
@@ -6196,7 +6195,6 @@ var Diagnostics = {
|
|
|
6196
6195
|
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}."),
|
|
6197
6196
|
_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}'."),
|
|
6198
6197
|
Cannot_read_file_0: diag(5083, 1 /* Error */, "Cannot_read_file_0_5083", "Cannot read file '{0}'."),
|
|
6199
|
-
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."),
|
|
6200
6198
|
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."),
|
|
6201
6199
|
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."),
|
|
6202
6200
|
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."),
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@typescript-deploys/pr-build",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.2.0-pr-
|
|
5
|
+
"version": "5.2.0-pr-54788-8",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -115,5 +115,5 @@
|
|
|
115
115
|
"node": "20.1.0",
|
|
116
116
|
"npm": "8.19.4"
|
|
117
117
|
},
|
|
118
|
-
"gitHead": "
|
|
118
|
+
"gitHead": "ecdd4e167d65aea78e61a236764d9cf6962f8852"
|
|
119
119
|
}
|