@typescript-deploys/pr-build 5.2.0-pr-54788-8 → 5.2.0-pr-52493-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 +60 -30
- package/lib/tsserver.js +120 -35
- package/lib/tsserverlibrary.d.ts +2 -2
- package/lib/tsserverlibrary.js +118 -35
- package/lib/typescript.d.ts +2 -2
- package/lib/typescript.js +116 -35
- package/lib/typingsInstaller.js +2 -1
- package/package.json +2 -2
package/lib/tsserverlibrary.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.2";
|
|
38
|
-
version = `${versionMajorMinor}.0-insiders.
|
|
38
|
+
version = `${versionMajorMinor}.0-insiders.20230627`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -9050,6 +9050,7 @@ ${lanes.join("\n")}
|
|
|
9050
9050
|
Inline_variable: diag(95184, 3 /* Message */, "Inline_variable_95184", "Inline variable"),
|
|
9051
9051
|
Could_not_find_variable_to_inline: diag(95185, 3 /* Message */, "Could_not_find_variable_to_inline_95185", "Could not find variable to inline."),
|
|
9052
9052
|
Variables_with_multiple_declarations_cannot_be_inlined: diag(95186, 3 /* Message */, "Variables_with_multiple_declarations_cannot_be_inlined_95186", "Variables with multiple declarations cannot be inlined."),
|
|
9053
|
+
Add_missing_comma_for_object_member_completion_0: diag(95187, 3 /* Message */, "Add_missing_comma_for_object_member_completion_0_95187", "Add missing comma for object member completion '{0}'."),
|
|
9053
9054
|
No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, 1 /* Error */, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
|
|
9054
9055
|
Classes_may_not_have_a_field_named_constructor: diag(18006, 1 /* Error */, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
|
|
9055
9056
|
JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, 1 /* Error */, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
|
|
@@ -14904,8 +14905,8 @@ ${lanes.join("\n")}
|
|
|
14904
14905
|
return forStatement.initializer === node && forStatement.initializer.kind !== 261 /* VariableDeclarationList */ || forStatement.condition === node || forStatement.incrementor === node;
|
|
14905
14906
|
case 249 /* ForInStatement */:
|
|
14906
14907
|
case 250 /* ForOfStatement */:
|
|
14907
|
-
const
|
|
14908
|
-
return
|
|
14908
|
+
const forInOrOfStatement = parent2;
|
|
14909
|
+
return forInOrOfStatement.initializer === node && forInOrOfStatement.initializer.kind !== 261 /* VariableDeclarationList */ || forInOrOfStatement.expression === node;
|
|
14909
14910
|
case 216 /* TypeAssertionExpression */:
|
|
14910
14911
|
case 234 /* AsExpression */:
|
|
14911
14912
|
return node === parent2.expression;
|
|
@@ -15595,20 +15596,23 @@ ${lanes.join("\n")}
|
|
|
15595
15596
|
function hasTypeArguments(node) {
|
|
15596
15597
|
return !!node.typeArguments;
|
|
15597
15598
|
}
|
|
15598
|
-
function
|
|
15599
|
+
function getAssignmentTarget(node) {
|
|
15599
15600
|
let parent2 = node.parent;
|
|
15600
15601
|
while (true) {
|
|
15601
15602
|
switch (parent2.kind) {
|
|
15602
15603
|
case 226 /* BinaryExpression */:
|
|
15603
|
-
const
|
|
15604
|
-
|
|
15604
|
+
const binaryExpression = parent2;
|
|
15605
|
+
const binaryOperator = binaryExpression.operatorToken.kind;
|
|
15606
|
+
return isAssignmentOperator(binaryOperator) && binaryExpression.left === node ? binaryExpression : void 0;
|
|
15605
15607
|
case 224 /* PrefixUnaryExpression */:
|
|
15606
15608
|
case 225 /* PostfixUnaryExpression */:
|
|
15607
|
-
const
|
|
15608
|
-
|
|
15609
|
+
const unaryExpression = parent2;
|
|
15610
|
+
const unaryOperator = unaryExpression.operator;
|
|
15611
|
+
return unaryOperator === 46 /* PlusPlusToken */ || unaryOperator === 47 /* MinusMinusToken */ ? unaryExpression : void 0;
|
|
15609
15612
|
case 249 /* ForInStatement */:
|
|
15610
15613
|
case 250 /* ForOfStatement */:
|
|
15611
|
-
|
|
15614
|
+
const forInOrOfStatement = parent2;
|
|
15615
|
+
return forInOrOfStatement.initializer === node ? forInOrOfStatement : void 0;
|
|
15612
15616
|
case 217 /* ParenthesizedExpression */:
|
|
15613
15617
|
case 209 /* ArrayLiteralExpression */:
|
|
15614
15618
|
case 230 /* SpreadElement */:
|
|
@@ -15620,24 +15624,53 @@ ${lanes.join("\n")}
|
|
|
15620
15624
|
break;
|
|
15621
15625
|
case 304 /* ShorthandPropertyAssignment */:
|
|
15622
15626
|
if (parent2.name !== node) {
|
|
15623
|
-
return 0
|
|
15627
|
+
return void 0;
|
|
15624
15628
|
}
|
|
15625
15629
|
node = parent2.parent;
|
|
15626
15630
|
break;
|
|
15627
15631
|
case 303 /* PropertyAssignment */:
|
|
15628
15632
|
if (parent2.name === node) {
|
|
15629
|
-
return 0
|
|
15633
|
+
return void 0;
|
|
15630
15634
|
}
|
|
15631
15635
|
node = parent2.parent;
|
|
15632
15636
|
break;
|
|
15633
15637
|
default:
|
|
15634
|
-
return 0
|
|
15638
|
+
return void 0;
|
|
15635
15639
|
}
|
|
15636
15640
|
parent2 = node.parent;
|
|
15637
15641
|
}
|
|
15638
15642
|
}
|
|
15643
|
+
function getAssignmentTargetKind(node) {
|
|
15644
|
+
const target = getAssignmentTarget(node);
|
|
15645
|
+
if (!target) {
|
|
15646
|
+
return 0 /* None */;
|
|
15647
|
+
}
|
|
15648
|
+
switch (target.kind) {
|
|
15649
|
+
case 226 /* BinaryExpression */:
|
|
15650
|
+
const binaryOperator = target.operatorToken.kind;
|
|
15651
|
+
return binaryOperator === 64 /* EqualsToken */ || isLogicalOrCoalescingAssignmentOperator(binaryOperator) ? 1 /* Definite */ : 2 /* Compound */;
|
|
15652
|
+
case 224 /* PrefixUnaryExpression */:
|
|
15653
|
+
case 225 /* PostfixUnaryExpression */:
|
|
15654
|
+
return 2 /* Compound */;
|
|
15655
|
+
case 249 /* ForInStatement */:
|
|
15656
|
+
case 250 /* ForOfStatement */:
|
|
15657
|
+
return 1 /* Definite */;
|
|
15658
|
+
}
|
|
15659
|
+
}
|
|
15639
15660
|
function isAssignmentTarget(node) {
|
|
15640
|
-
return
|
|
15661
|
+
return !!getAssignmentTarget(node);
|
|
15662
|
+
}
|
|
15663
|
+
function isCompoundLikeAssignment(assignment) {
|
|
15664
|
+
const right = skipParentheses(assignment.right);
|
|
15665
|
+
return right.kind === 226 /* BinaryExpression */ && isShiftOperatorOrHigher(right.operatorToken.kind);
|
|
15666
|
+
}
|
|
15667
|
+
function isInCompoundLikeAssignment(node) {
|
|
15668
|
+
const target = getAssignmentTarget(node);
|
|
15669
|
+
return !!target && isAssignmentExpression(
|
|
15670
|
+
target,
|
|
15671
|
+
/*excludeCompoundAssignment*/
|
|
15672
|
+
true
|
|
15673
|
+
) && isCompoundLikeAssignment(target);
|
|
15641
15674
|
}
|
|
15642
15675
|
function isNodeWithPossibleHoistedDeclaration(node) {
|
|
15643
15676
|
switch (node.kind) {
|
|
@@ -48610,7 +48643,6 @@ ${lanes.join("\n")}
|
|
|
48610
48643
|
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);
|
|
48611
48644
|
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
|
|
48612
48645
|
const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
|
|
48613
|
-
const moduleKind2 = getEmitModuleKind(compilerOptions);
|
|
48614
48646
|
const resolvedModule = getResolvedModule(currentSourceFile, moduleReference, mode);
|
|
48615
48647
|
const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
|
|
48616
48648
|
const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
|
|
@@ -48643,7 +48675,7 @@ ${lanes.join("\n")}
|
|
|
48643
48675
|
moduleReference
|
|
48644
48676
|
);
|
|
48645
48677
|
}
|
|
48646
|
-
if (
|
|
48678
|
+
if (moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */) {
|
|
48647
48679
|
const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
|
|
48648
48680
|
const overrideClauseHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
|
|
48649
48681
|
const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (_h = overrideClauseHost.assertions) == null ? void 0 : _h.assertClause : overrideClauseHost == null ? void 0 : overrideClauseHost.assertClause;
|
|
@@ -48767,7 +48799,7 @@ ${lanes.join("\n")}
|
|
|
48767
48799
|
return void 0;
|
|
48768
48800
|
function getSuggestedImportSource(tsExtension) {
|
|
48769
48801
|
const importSourceWithoutExtension = removeExtension(moduleReference, tsExtension);
|
|
48770
|
-
if (emitModuleKindIsNonNodeESM(
|
|
48802
|
+
if (emitModuleKindIsNonNodeESM(moduleKind) || mode === 99 /* ESNext */) {
|
|
48771
48803
|
const preferTs = isDeclarationFileName(moduleReference) && shouldAllowImportingTsExtension(compilerOptions);
|
|
48772
48804
|
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";
|
|
48773
48805
|
return importSourceWithoutExtension + ext;
|
|
@@ -67614,10 +67646,11 @@ ${lanes.join("\n")}
|
|
|
67614
67646
|
const assignedType = getWidenedLiteralType(getInitialOrAssignedType(flow));
|
|
67615
67647
|
return isTypeAssignableTo(assignedType, declaredType) ? assignedType : anyArrayType;
|
|
67616
67648
|
}
|
|
67617
|
-
|
|
67618
|
-
|
|
67649
|
+
const t = isInCompoundLikeAssignment(node) ? getBaseTypeOfLiteralType(declaredType) : declaredType;
|
|
67650
|
+
if (t.flags & 1048576 /* Union */) {
|
|
67651
|
+
return getAssignmentReducedType(t, getInitialOrAssignedType(flow));
|
|
67619
67652
|
}
|
|
67620
|
-
return
|
|
67653
|
+
return t;
|
|
67621
67654
|
}
|
|
67622
67655
|
if (containsMatchingReference(reference, node)) {
|
|
67623
67656
|
if (!isReachableFlowNode(flow)) {
|
|
@@ -68746,7 +68779,7 @@ ${lanes.join("\n")}
|
|
|
68746
68779
|
const isAlias = localOrExportSymbol.flags & 2097152 /* Alias */;
|
|
68747
68780
|
if (localOrExportSymbol.flags & 3 /* Variable */) {
|
|
68748
68781
|
if (assignmentKind === 1 /* Definite */) {
|
|
68749
|
-
return type;
|
|
68782
|
+
return isInCompoundLikeAssignment(node) ? getBaseTypeOfLiteralType(type) : type;
|
|
68750
68783
|
}
|
|
68751
68784
|
} else if (isAlias) {
|
|
68752
68785
|
declaration = getDeclarationOfAliasSymbol(symbol);
|
|
@@ -69073,17 +69106,14 @@ ${lanes.join("\n")}
|
|
|
69073
69106
|
}
|
|
69074
69107
|
}
|
|
69075
69108
|
function getTypeForThisExpressionFromJSDoc(node) {
|
|
69076
|
-
const jsdocType = getJSDocType(node);
|
|
69077
|
-
if (jsdocType && jsdocType.kind === 324 /* JSDocFunctionType */) {
|
|
69078
|
-
const jsDocFunctionType = jsdocType;
|
|
69079
|
-
if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].name && jsDocFunctionType.parameters[0].name.escapedText === "this" /* This */) {
|
|
69080
|
-
return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type);
|
|
69081
|
-
}
|
|
69082
|
-
}
|
|
69083
69109
|
const thisTag = getJSDocThisTag(node);
|
|
69084
69110
|
if (thisTag && thisTag.typeExpression) {
|
|
69085
69111
|
return getTypeFromTypeNode(thisTag.typeExpression);
|
|
69086
69112
|
}
|
|
69113
|
+
const signature = getSignatureOfTypeTag(node);
|
|
69114
|
+
if (signature) {
|
|
69115
|
+
return getThisTypeOfSignature(signature);
|
|
69116
|
+
}
|
|
69087
69117
|
}
|
|
69088
69118
|
function isInConstructorArgumentInitializer(node, constructorDecl) {
|
|
69089
69119
|
return !!findAncestor(node, (n) => isFunctionLikeDeclaration(n) ? "quit" : n.kind === 169 /* Parameter */ && n.parent === constructorDecl);
|
|
@@ -118080,9 +118110,9 @@ ${lanes.join("\n")}
|
|
|
118080
118110
|
return typeof result === "object" ? result.impliedNodeFormat : result;
|
|
118081
118111
|
}
|
|
118082
118112
|
function getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host, options) {
|
|
118083
|
-
switch (
|
|
118084
|
-
case
|
|
118085
|
-
case
|
|
118113
|
+
switch (getEmitModuleResolutionKind(options)) {
|
|
118114
|
+
case 3 /* Node16 */:
|
|
118115
|
+
case 99 /* NodeNext */:
|
|
118086
118116
|
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;
|
|
118087
118117
|
default:
|
|
118088
118118
|
return void 0;
|
|
@@ -136381,7 +136411,10 @@ ${lanes.join("\n")}
|
|
|
136381
136411
|
if (isExpression(parent2) && (getExpressionPrecedence(replacement) < getExpressionPrecedence(parent2) || needsParentheses(parent2))) {
|
|
136382
136412
|
return factory.createParenthesizedExpression(replacement);
|
|
136383
136413
|
}
|
|
136384
|
-
if (isFunctionLike(replacement) && isCallLikeExpression(parent2)) {
|
|
136414
|
+
if (isFunctionLike(replacement) && (isCallLikeExpression(parent2) || isPropertyAccessExpression(parent2))) {
|
|
136415
|
+
return factory.createParenthesizedExpression(replacement);
|
|
136416
|
+
}
|
|
136417
|
+
if (isPropertyAccessExpression(parent2) && (isNumericLiteral(replacement) || isObjectLiteralExpression(replacement))) {
|
|
136385
136418
|
return factory.createParenthesizedExpression(replacement);
|
|
136386
136419
|
}
|
|
136387
136420
|
return replacement;
|
|
@@ -156772,6 +156805,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
156772
156805
|
return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* string */, kindModifiers: "" /* none */, sortText: SortText.LocationPriority };
|
|
156773
156806
|
}
|
|
156774
156807
|
function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, position, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag, includeSymbol) {
|
|
156808
|
+
var _a, _b;
|
|
156775
156809
|
let insertText;
|
|
156776
156810
|
let filterText;
|
|
156777
156811
|
let replacementSpan = getReplacementSpanForContextToken(replacementToken);
|
|
@@ -156830,6 +156864,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
156830
156864
|
if ((origin == null ? void 0 : origin.kind) === 64 /* TypeOnlyAlias */) {
|
|
156831
156865
|
hasAction = true;
|
|
156832
156866
|
}
|
|
156867
|
+
if (completionKind === 0 /* ObjectPropertyDeclaration */ && contextToken && ((_a = findPrecedingToken(contextToken.pos, sourceFile, contextToken)) == null ? void 0 : _a.kind) !== 28 /* CommaToken */) {
|
|
156868
|
+
if (isMethodDeclaration(contextToken.parent.parent) || isGetAccessorDeclaration(contextToken.parent.parent) || isSetAccessorDeclaration(contextToken.parent.parent) || isSpreadAssignment(contextToken.parent) || ((_b = findAncestor(contextToken.parent, isPropertyAssignment)) == null ? void 0 : _b.getLastToken(sourceFile)) === contextToken || isShorthandPropertyAssignment(contextToken.parent) && getLineAndCharacterOfPosition(sourceFile, contextToken.getEnd()).line !== getLineAndCharacterOfPosition(sourceFile, position).line) {
|
|
156869
|
+
source = "ObjectLiteralMemberWithComma/" /* ObjectLiteralMemberWithComma */;
|
|
156870
|
+
hasAction = true;
|
|
156871
|
+
}
|
|
156872
|
+
}
|
|
156833
156873
|
if (preferences.includeCompletionsWithClassMemberSnippets && preferences.includeCompletionsWithInsertText && completionKind === 3 /* MemberLike */ && isClassLikeMemberCompletion(symbol, location, sourceFile)) {
|
|
156834
156874
|
let importAdder;
|
|
156835
156875
|
const memberCompletionEntry = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, position, contextToken, formatContext);
|
|
@@ -157560,7 +157600,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157560
157600
|
return firstDefined(symbols, (symbol, index) => {
|
|
157561
157601
|
const origin = symbolToOriginInfoMap[index];
|
|
157562
157602
|
const info = getCompletionEntryDisplayNameForSymbol(symbol, getEmitScriptTarget(compilerOptions), origin, completionKind, completionData.isJsxIdentifierExpected);
|
|
157563
|
-
return info && info.name === entryId.name && (entryId.source === "ClassMemberSnippet/" /* ClassMemberSnippet */ && symbol.flags & 106500 /* ClassMember */ || entryId.source === "ObjectLiteralMethodSnippet/" /* ObjectLiteralMethodSnippet */ && symbol.flags & (4 /* Property */ | 8192 /* Method */) || getSourceFromOrigin(origin) === entryId.source) ? { type: "symbol", symbol, location, origin, contextToken, previousToken, isJsxInitializer, isTypeOnlyLocation } : void 0;
|
|
157603
|
+
return info && info.name === entryId.name && (entryId.source === "ClassMemberSnippet/" /* ClassMemberSnippet */ && symbol.flags & 106500 /* ClassMember */ || entryId.source === "ObjectLiteralMethodSnippet/" /* ObjectLiteralMethodSnippet */ && symbol.flags & (4 /* Property */ | 8192 /* Method */) || getSourceFromOrigin(origin) === entryId.source || entryId.source === "ObjectLiteralMemberWithComma/" /* ObjectLiteralMemberWithComma */) ? { type: "symbol", symbol, location, origin, contextToken, previousToken, isJsxInitializer, isTypeOnlyLocation } : void 0;
|
|
157564
157604
|
}) || { type: "none" };
|
|
157565
157605
|
}
|
|
157566
157606
|
function getCompletionEntryDetails(program, log, sourceFile, position, entryId, host, formatContext, preferences, cancellationToken) {
|
|
@@ -157705,6 +157745,21 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157705
157745
|
Debug.assertIsDefined(codeAction2, "Expected to have a code action for promoting type-only alias");
|
|
157706
157746
|
return { codeActions: [codeAction2], sourceDisplay: void 0 };
|
|
157707
157747
|
}
|
|
157748
|
+
if (source === "ObjectLiteralMemberWithComma/" /* ObjectLiteralMemberWithComma */ && contextToken) {
|
|
157749
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(
|
|
157750
|
+
{ host, formatContext, preferences },
|
|
157751
|
+
(tracker) => tracker.insertText(sourceFile, contextToken.end, ",")
|
|
157752
|
+
);
|
|
157753
|
+
if (changes) {
|
|
157754
|
+
return {
|
|
157755
|
+
sourceDisplay: void 0,
|
|
157756
|
+
codeActions: [{
|
|
157757
|
+
changes,
|
|
157758
|
+
description: diagnosticToString([Diagnostics.Add_missing_comma_for_object_member_completion_0, name])
|
|
157759
|
+
}]
|
|
157760
|
+
};
|
|
157761
|
+
}
|
|
157762
|
+
}
|
|
157708
157763
|
if (!origin || !(originIsExport(origin) || originIsResolvedExport(origin))) {
|
|
157709
157764
|
return { codeActions: void 0, sourceDisplay: void 0 };
|
|
157710
157765
|
}
|
|
@@ -158602,7 +158657,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
158602
158657
|
}
|
|
158603
158658
|
function tryGetObjectLikeCompletionSymbols() {
|
|
158604
158659
|
const symbolsStartIndex = symbols.length;
|
|
158605
|
-
const objectLikeContainer = tryGetObjectLikeCompletionContainer(contextToken);
|
|
158660
|
+
const objectLikeContainer = tryGetObjectLikeCompletionContainer(contextToken, position, sourceFile);
|
|
158606
158661
|
if (!objectLikeContainer)
|
|
158607
158662
|
return 0 /* Continue */;
|
|
158608
158663
|
completionKind = 0 /* ObjectPropertyDeclaration */;
|
|
@@ -159088,7 +159143,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159088
159143
|
return node2.getStart(sourceFile) <= position && position <= node2.getEnd();
|
|
159089
159144
|
}
|
|
159090
159145
|
}
|
|
159091
|
-
function tryGetObjectLikeCompletionContainer(contextToken) {
|
|
159146
|
+
function tryGetObjectLikeCompletionContainer(contextToken, position, sourceFile) {
|
|
159147
|
+
var _a;
|
|
159092
159148
|
if (contextToken) {
|
|
159093
159149
|
const { parent: parent2 } = contextToken;
|
|
159094
159150
|
switch (contextToken.kind) {
|
|
@@ -159103,7 +159159,29 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159103
159159
|
case 134 /* AsyncKeyword */:
|
|
159104
159160
|
return tryCast(parent2.parent, isObjectLiteralExpression);
|
|
159105
159161
|
case 80 /* Identifier */:
|
|
159106
|
-
|
|
159162
|
+
if (contextToken.text === "async" && isShorthandPropertyAssignment(contextToken.parent)) {
|
|
159163
|
+
return contextToken.parent.parent;
|
|
159164
|
+
} else {
|
|
159165
|
+
if (isObjectLiteralExpression(contextToken.parent.parent) && (isSpreadAssignment(contextToken.parent) || isShorthandPropertyAssignment(contextToken.parent) && getLineAndCharacterOfPosition(sourceFile, contextToken.getEnd()).line !== getLineAndCharacterOfPosition(sourceFile, position).line)) {
|
|
159166
|
+
return contextToken.parent.parent;
|
|
159167
|
+
}
|
|
159168
|
+
const ancestorNode2 = findAncestor(parent2, isPropertyAssignment);
|
|
159169
|
+
if ((ancestorNode2 == null ? void 0 : ancestorNode2.getLastToken(sourceFile)) === contextToken && isObjectLiteralExpression(ancestorNode2.parent)) {
|
|
159170
|
+
return ancestorNode2.parent;
|
|
159171
|
+
}
|
|
159172
|
+
}
|
|
159173
|
+
break;
|
|
159174
|
+
default:
|
|
159175
|
+
if (((_a = parent2.parent) == null ? void 0 : _a.parent) && (isMethodDeclaration(parent2.parent) || isGetAccessorDeclaration(parent2.parent) || isSetAccessorDeclaration(parent2.parent)) && isObjectLiteralExpression(parent2.parent.parent)) {
|
|
159176
|
+
return parent2.parent.parent;
|
|
159177
|
+
}
|
|
159178
|
+
if (isSpreadAssignment(parent2) && isObjectLiteralExpression(parent2.parent)) {
|
|
159179
|
+
return parent2.parent;
|
|
159180
|
+
}
|
|
159181
|
+
const ancestorNode = findAncestor(parent2, isPropertyAssignment);
|
|
159182
|
+
if (contextToken.kind !== 59 /* ColonToken */ && (ancestorNode == null ? void 0 : ancestorNode.getLastToken(sourceFile)) === contextToken && isObjectLiteralExpression(ancestorNode.parent)) {
|
|
159183
|
+
return ancestorNode.parent;
|
|
159184
|
+
}
|
|
159107
159185
|
}
|
|
159108
159186
|
}
|
|
159109
159187
|
return void 0;
|
|
@@ -159646,6 +159724,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159646
159724
|
CompletionSource2["TypeOnlyAlias"] = "TypeOnlyAlias/";
|
|
159647
159725
|
CompletionSource2["ObjectLiteralMethodSnippet"] = "ObjectLiteralMethodSnippet/";
|
|
159648
159726
|
CompletionSource2["SwitchCases"] = "SwitchCases/";
|
|
159727
|
+
CompletionSource2["ObjectLiteralMemberWithComma"] = "ObjectLiteralMemberWithComma/";
|
|
159649
159728
|
return CompletionSource2;
|
|
159650
159729
|
})(CompletionSource || {});
|
|
159651
159730
|
SymbolOriginInfoKind = /* @__PURE__ */ ((SymbolOriginInfoKind2) => {
|
|
@@ -184084,6 +184163,7 @@ ${e.message}`;
|
|
|
184084
184163
|
isImportTypeNode: () => isImportTypeNode,
|
|
184085
184164
|
isImportableFile: () => isImportableFile,
|
|
184086
184165
|
isInComment: () => isInComment,
|
|
184166
|
+
isInCompoundLikeAssignment: () => isInCompoundLikeAssignment,
|
|
184087
184167
|
isInExpressionContext: () => isInExpressionContext,
|
|
184088
184168
|
isInJSDoc: () => isInJSDoc,
|
|
184089
184169
|
isInJSFile: () => isInJSFile,
|
|
@@ -184376,6 +184456,7 @@ ${e.message}`;
|
|
|
184376
184456
|
isSetAccessor: () => isSetAccessor,
|
|
184377
184457
|
isSetAccessorDeclaration: () => isSetAccessorDeclaration,
|
|
184378
184458
|
isShebangTrivia: () => isShebangTrivia,
|
|
184459
|
+
isShiftOperatorOrHigher: () => isShiftOperatorOrHigher,
|
|
184379
184460
|
isShorthandAmbientModuleSymbol: () => isShorthandAmbientModuleSymbol,
|
|
184380
184461
|
isShorthandPropertyAssignment: () => isShorthandPropertyAssignment,
|
|
184381
184462
|
isSignedNumericLiteral: () => isSignedNumericLiteral,
|
|
@@ -186487,6 +186568,7 @@ ${e.message}`;
|
|
|
186487
186568
|
isImportTypeNode: () => isImportTypeNode,
|
|
186488
186569
|
isImportableFile: () => isImportableFile,
|
|
186489
186570
|
isInComment: () => isInComment,
|
|
186571
|
+
isInCompoundLikeAssignment: () => isInCompoundLikeAssignment,
|
|
186490
186572
|
isInExpressionContext: () => isInExpressionContext,
|
|
186491
186573
|
isInJSDoc: () => isInJSDoc,
|
|
186492
186574
|
isInJSFile: () => isInJSFile,
|
|
@@ -186779,6 +186861,7 @@ ${e.message}`;
|
|
|
186779
186861
|
isSetAccessor: () => isSetAccessor,
|
|
186780
186862
|
isSetAccessorDeclaration: () => isSetAccessorDeclaration,
|
|
186781
186863
|
isShebangTrivia: () => isShebangTrivia,
|
|
186864
|
+
isShiftOperatorOrHigher: () => isShiftOperatorOrHigher,
|
|
186782
186865
|
isShorthandAmbientModuleSymbol: () => isShorthandAmbientModuleSymbol,
|
|
186783
186866
|
isShorthandPropertyAssignment: () => isShorthandPropertyAssignment,
|
|
186784
186867
|
isSignedNumericLiteral: () => isSignedNumericLiteral,
|
package/lib/typescript.d.ts
CHANGED
|
@@ -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 `moduleResolution` 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
|
+
* `moduleResolution` 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
|