typescript 4.7.0-dev.20220330 → 4.7.0-dev.20220331
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/protocol.d.ts +23 -0
- package/lib/tsc.js +37 -6
- package/lib/tsserver.js +168 -85
- package/lib/tsserverlibrary.d.ts +30 -0
- package/lib/tsserverlibrary.js +168 -85
- package/lib/typescript.d.ts +7 -0
- package/lib/typescript.js +150 -83
- package/lib/typescriptServices.d.ts +7 -0
- package/lib/typescriptServices.js +150 -83
- package/lib/typingsInstaller.js +42 -7
- package/package.json +1 -1
package/lib/tsserverlibrary.js
CHANGED
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220331";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -9689,6 +9689,7 @@ var ts;
|
|
|
9689
9689
|
An_expanded_version_of_this_information_showing_all_possible_compiler_options: diag(6928, ts.DiagnosticCategory.Message, "An_expanded_version_of_this_information_showing_all_possible_compiler_options_6928", "An expanded version of this information, showing all possible compiler options"),
|
|
9690
9690
|
Compiles_the_current_project_with_additional_settings: diag(6929, ts.DiagnosticCategory.Message, "Compiles_the_current_project_with_additional_settings_6929", "Compiles the current project, with additional settings."),
|
|
9691
9691
|
true_for_ES2022_and_above_including_ESNext: diag(6930, ts.DiagnosticCategory.Message, "true_for_ES2022_and_above_including_ESNext_6930", "`true` for ES2022 and above, including ESNext."),
|
|
9692
|
+
List_of_file_name_suffixes_to_search_when_resolving_a_module: diag(6931, ts.DiagnosticCategory.Error, "List_of_file_name_suffixes_to_search_when_resolving_a_module_6931", "List of file name suffixes to search when resolving a module."),
|
|
9692
9693
|
Variable_0_implicitly_has_an_1_type: diag(7005, ts.DiagnosticCategory.Error, "Variable_0_implicitly_has_an_1_type_7005", "Variable '{0}' implicitly has an '{1}' type."),
|
|
9693
9694
|
Parameter_0_implicitly_has_an_1_type: diag(7006, ts.DiagnosticCategory.Error, "Parameter_0_implicitly_has_an_1_type_7006", "Parameter '{0}' implicitly has an '{1}' type."),
|
|
9694
9695
|
Member_0_implicitly_has_an_1_type: diag(7008, ts.DiagnosticCategory.Error, "Member_0_implicitly_has_an_1_type_7008", "Member '{0}' implicitly has an '{1}' type."),
|
|
@@ -39683,6 +39684,18 @@ var ts;
|
|
|
39683
39684
|
description: ts.Diagnostics.Allow_accessing_UMD_globals_from_modules,
|
|
39684
39685
|
defaultValueDescription: false,
|
|
39685
39686
|
},
|
|
39687
|
+
{
|
|
39688
|
+
name: "moduleSuffixes",
|
|
39689
|
+
type: "list",
|
|
39690
|
+
element: {
|
|
39691
|
+
name: "suffix",
|
|
39692
|
+
type: "string",
|
|
39693
|
+
},
|
|
39694
|
+
listPreserveFalsyValues: true,
|
|
39695
|
+
affectsModuleResolution: true,
|
|
39696
|
+
category: ts.Diagnostics.Modules,
|
|
39697
|
+
description: ts.Diagnostics.List_of_file_name_suffixes_to_search_when_resolving_a_module,
|
|
39698
|
+
},
|
|
39686
39699
|
// Source Maps
|
|
39687
39700
|
{
|
|
39688
39701
|
name: "sourceRoot",
|
|
@@ -41609,7 +41622,7 @@ var ts;
|
|
|
41609
41622
|
if (option.type === "list") {
|
|
41610
41623
|
var listOption_1 = option;
|
|
41611
41624
|
if (listOption_1.element.isFilePath || !ts.isString(listOption_1.element.type)) {
|
|
41612
|
-
return ts.filter(ts.map(value, function (v) { return normalizeOptionValue(listOption_1.element, basePath, v); }), function (v) { return !!v; });
|
|
41625
|
+
return ts.filter(ts.map(value, function (v) { return normalizeOptionValue(listOption_1.element, basePath, v); }), function (v) { return listOption_1.listPreserveFalsyValues ? true : !!v; });
|
|
41613
41626
|
}
|
|
41614
41627
|
return value;
|
|
41615
41628
|
}
|
|
@@ -41650,7 +41663,7 @@ var ts;
|
|
|
41650
41663
|
}
|
|
41651
41664
|
}
|
|
41652
41665
|
function convertJsonOptionOfListType(option, values, basePath, errors) {
|
|
41653
|
-
return ts.filter(ts.map(values, function (v) { return convertJsonOption(option.element, v, basePath, errors); }), function (v) { return !!v; });
|
|
41666
|
+
return ts.filter(ts.map(values, function (v) { return convertJsonOption(option.element, v, basePath, errors); }), function (v) { return option.listPreserveFalsyValues ? true : !!v; });
|
|
41654
41667
|
}
|
|
41655
41668
|
/**
|
|
41656
41669
|
* Tests for a path that ends in a recursive directory wildcard.
|
|
@@ -43276,6 +43289,15 @@ var ts;
|
|
|
43276
43289
|
}
|
|
43277
43290
|
/** Return the file if it exists. */
|
|
43278
43291
|
function tryFile(fileName, onlyRecordFailures, state) {
|
|
43292
|
+
var _a, _b;
|
|
43293
|
+
if (!((_a = state.compilerOptions.moduleSuffixes) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
43294
|
+
return tryFileLookup(fileName, onlyRecordFailures, state);
|
|
43295
|
+
}
|
|
43296
|
+
var ext = (_b = ts.tryGetExtensionFromPath(fileName)) !== null && _b !== void 0 ? _b : "";
|
|
43297
|
+
var fileNameNoExtension = ext ? ts.removeExtension(fileName, ext) : fileName;
|
|
43298
|
+
return ts.forEach(state.compilerOptions.moduleSuffixes, function (suffix) { return tryFileLookup(fileNameNoExtension + suffix + ext, onlyRecordFailures, state); });
|
|
43299
|
+
}
|
|
43300
|
+
function tryFileLookup(fileName, onlyRecordFailures, state) {
|
|
43279
43301
|
if (!onlyRecordFailures) {
|
|
43280
43302
|
if (state.host.fileExists(fileName)) {
|
|
43281
43303
|
if (state.traceEnabled) {
|
|
@@ -52271,7 +52293,15 @@ var ts;
|
|
|
52271
52293
|
if (!ts.nodeIsSynthesized(node) && ts.getParseTreeNode(node) === node) {
|
|
52272
52294
|
return node;
|
|
52273
52295
|
}
|
|
52274
|
-
return ts.setTextRange(ts.factory.cloneNode(ts.visitEachChild(node, deepCloneOrReuseNode, ts.nullTransformationContext)), node);
|
|
52296
|
+
return ts.setTextRange(ts.factory.cloneNode(ts.visitEachChild(node, deepCloneOrReuseNode, ts.nullTransformationContext, deepCloneOrReuseNodes)), node);
|
|
52297
|
+
}
|
|
52298
|
+
function deepCloneOrReuseNodes(nodes, visitor, test, start, count) {
|
|
52299
|
+
if (nodes && nodes.length === 0) {
|
|
52300
|
+
// Ensure we explicitly make a copy of an empty array; visitNodes will not do this unless the array has elements,
|
|
52301
|
+
// which can lead to us reusing the same empty NodeArray more than once within the same AST during type noding.
|
|
52302
|
+
return ts.setTextRange(ts.factory.createNodeArray(/*nodes*/ undefined, nodes.hasTrailingComma), nodes);
|
|
52303
|
+
}
|
|
52304
|
+
return ts.visitNodes(nodes, visitor, test, start, count);
|
|
52275
52305
|
}
|
|
52276
52306
|
}
|
|
52277
52307
|
function createTypeNodeFromObjectType(type) {
|
|
@@ -71001,7 +71031,7 @@ var ts;
|
|
|
71001
71031
|
if (func.parameters.length >= 2 && isContextSensitiveFunctionOrObjectLiteralMethod(func)) {
|
|
71002
71032
|
var contextualSignature = getContextualSignature(func);
|
|
71003
71033
|
if (contextualSignature && contextualSignature.parameters.length === 1 && signatureHasRestParameter(contextualSignature)) {
|
|
71004
|
-
var restType = getTypeOfSymbol(contextualSignature.parameters[0]);
|
|
71034
|
+
var restType = getReducedApparentType(getTypeOfSymbol(contextualSignature.parameters[0]));
|
|
71005
71035
|
if (restType.flags & 1048576 /* Union */ && everyType(restType, isTupleType) && !isSymbolAssigned(symbol)) {
|
|
71006
71036
|
var narrowedType = getFlowTypeOfReference(func, restType, restType, /*flowContainer*/ undefined, location.flowNode);
|
|
71007
71037
|
var index = func.parameters.indexOf(declaration) - (ts.getThisParameter(func) ? 1 : 0);
|
|
@@ -72306,9 +72336,14 @@ var ts;
|
|
|
72306
72336
|
return instantiateInstantiableTypes(contextualType, inferenceContext.nonFixingMapper);
|
|
72307
72337
|
}
|
|
72308
72338
|
// For other purposes (e.g. determining whether to produce literal types) we only
|
|
72309
|
-
// incorporate inferences made from the return type in a function call.
|
|
72339
|
+
// incorporate inferences made from the return type in a function call. We remove
|
|
72340
|
+
// the 'boolean' type from the contextual type such that contextually typed boolean
|
|
72341
|
+
// literals actually end up widening to 'boolean' (see #48363).
|
|
72310
72342
|
if (inferenceContext.returnMapper) {
|
|
72311
|
-
|
|
72343
|
+
var type = instantiateInstantiableTypes(contextualType, inferenceContext.returnMapper);
|
|
72344
|
+
return type.flags & 1048576 /* Union */ && containsType(type.types, regularFalseType) && containsType(type.types, regularTrueType) ?
|
|
72345
|
+
filterType(type, function (t) { return t !== regularFalseType && t !== regularTrueType; }) :
|
|
72346
|
+
type;
|
|
72312
72347
|
}
|
|
72313
72348
|
}
|
|
72314
72349
|
}
|
|
@@ -131530,6 +131565,7 @@ var ts;
|
|
|
131530
131565
|
var source = getSourceFromOrigin(origin);
|
|
131531
131566
|
var sourceDisplay;
|
|
131532
131567
|
var hasAction;
|
|
131568
|
+
var labelDetails;
|
|
131533
131569
|
var typeChecker = program.getTypeChecker();
|
|
131534
131570
|
var insertQuestionDot = origin && originIsNullableMember(origin);
|
|
131535
131571
|
var useBraces = origin && originIsSymbolMember(origin) || needsConvertPropertyAccess;
|
|
@@ -131598,7 +131634,11 @@ var ts;
|
|
|
131598
131634
|
}
|
|
131599
131635
|
if (origin && originIsObjectLiteralMethod(origin)) {
|
|
131600
131636
|
var importAdder = void 0;
|
|
131601
|
-
(insertText = origin.insertText, isSnippet = origin.isSnippet, importAdder = origin.importAdder,
|
|
131637
|
+
(insertText = origin.insertText, isSnippet = origin.isSnippet, importAdder = origin.importAdder, labelDetails = origin.labelDetails);
|
|
131638
|
+
if (!preferences.useLabelDetailsInCompletionEntries) {
|
|
131639
|
+
name = name + labelDetails.detail;
|
|
131640
|
+
labelDetails = undefined;
|
|
131641
|
+
}
|
|
131602
131642
|
source = CompletionSource.ObjectLiteralMethodSnippet;
|
|
131603
131643
|
sortText = Completions.SortText.SortBelow(sortText);
|
|
131604
131644
|
if (importAdder.hasFixes()) {
|
|
@@ -131652,6 +131692,7 @@ var ts;
|
|
|
131652
131692
|
insertText: insertText,
|
|
131653
131693
|
replacementSpan: replacementSpan,
|
|
131654
131694
|
sourceDisplay: sourceDisplay,
|
|
131695
|
+
labelDetails: labelDetails,
|
|
131655
131696
|
isSnippet: isSnippet,
|
|
131656
131697
|
isPackageJsonImport: originIsPackageJsonImport(origin) || undefined,
|
|
131657
131698
|
isImportStatementCompletion: !!importCompletionNode || undefined,
|
|
@@ -131843,9 +131884,19 @@ var ts;
|
|
|
131843
131884
|
else {
|
|
131844
131885
|
insertText = printer.printSnippetList(16 /* CommaDelimited */ | 64 /* AllowTrailingComma */, ts.factory.createNodeArray([method], /*hasTrailingComma*/ true), sourceFile);
|
|
131845
131886
|
}
|
|
131846
|
-
var
|
|
131847
|
-
|
|
131848
|
-
|
|
131887
|
+
var signaturePrinter = ts.createPrinter({
|
|
131888
|
+
removeComments: true,
|
|
131889
|
+
module: options.module,
|
|
131890
|
+
target: options.target,
|
|
131891
|
+
omitTrailingSemicolon: true,
|
|
131892
|
+
});
|
|
131893
|
+
// The `labelDetails.detail` will be displayed right beside the method name,
|
|
131894
|
+
// so we drop the name (and modifiers) from the signature.
|
|
131895
|
+
var methodSignature = ts.factory.createMethodSignature(
|
|
131896
|
+
/*modifiers*/ undefined,
|
|
131897
|
+
/*name*/ "", method.questionToken, method.typeParameters, method.parameters, method.type);
|
|
131898
|
+
var labelDetails = { detail: signaturePrinter.printNode(4 /* Unspecified */, methodSignature, sourceFile) };
|
|
131899
|
+
return { isSnippet: isSnippet, insertText: insertText, importAdder: importAdder, labelDetails: labelDetails };
|
|
131849
131900
|
}
|
|
131850
131901
|
;
|
|
131851
131902
|
function createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, program, host, preferences, importAdder) {
|
|
@@ -139394,7 +139445,8 @@ var ts;
|
|
|
139394
139445
|
return undefined;
|
|
139395
139446
|
}
|
|
139396
139447
|
var commentOwner = commentOwnerInfo.commentOwner, parameters = commentOwnerInfo.parameters, hasReturn = commentOwnerInfo.hasReturn;
|
|
139397
|
-
|
|
139448
|
+
var commentOwnerJSDoc = ts.hasJSDocNodes(commentOwner) && commentOwner.jsDoc ? ts.lastOrUndefined(commentOwner.jsDoc) : undefined;
|
|
139449
|
+
if (commentOwner.getStart(sourceFile) < position || commentOwnerJSDoc && commentOwnerJSDoc !== existingDocComment) {
|
|
139398
139450
|
return undefined;
|
|
139399
139451
|
}
|
|
139400
139452
|
var indentationStr = getIndentationStringAtPosition(sourceFile, position);
|
|
@@ -148088,25 +148140,25 @@ var ts;
|
|
|
148088
148140
|
suffix: this.newLineCharacter
|
|
148089
148141
|
});
|
|
148090
148142
|
};
|
|
148091
|
-
ChangeTracker.prototype.
|
|
148092
|
-
this.insertNodeAtStartWorker(sourceFile,
|
|
148143
|
+
ChangeTracker.prototype.insertMemberAtStart = function (sourceFile, node, newElement) {
|
|
148144
|
+
this.insertNodeAtStartWorker(sourceFile, node, newElement);
|
|
148093
148145
|
};
|
|
148094
148146
|
ChangeTracker.prototype.insertNodeAtObjectStart = function (sourceFile, obj, newElement) {
|
|
148095
148147
|
this.insertNodeAtStartWorker(sourceFile, obj, newElement);
|
|
148096
148148
|
};
|
|
148097
|
-
ChangeTracker.prototype.insertNodeAtStartWorker = function (sourceFile,
|
|
148149
|
+
ChangeTracker.prototype.insertNodeAtStartWorker = function (sourceFile, node, newElement) {
|
|
148098
148150
|
var _a;
|
|
148099
|
-
var indentation = (_a = this.guessIndentationFromExistingMembers(sourceFile,
|
|
148100
|
-
this.insertNodeAt(sourceFile, getMembersOrProperties(
|
|
148151
|
+
var indentation = (_a = this.guessIndentationFromExistingMembers(sourceFile, node)) !== null && _a !== void 0 ? _a : this.computeIndentationForNewMember(sourceFile, node);
|
|
148152
|
+
this.insertNodeAt(sourceFile, getMembersOrProperties(node).pos, newElement, this.getInsertNodeAtStartInsertOptions(sourceFile, node, indentation));
|
|
148101
148153
|
};
|
|
148102
148154
|
/**
|
|
148103
148155
|
* Tries to guess the indentation from the existing members of a class/interface/object. All members must be on
|
|
148104
148156
|
* new lines and must share the same indentation.
|
|
148105
148157
|
*/
|
|
148106
|
-
ChangeTracker.prototype.guessIndentationFromExistingMembers = function (sourceFile,
|
|
148158
|
+
ChangeTracker.prototype.guessIndentationFromExistingMembers = function (sourceFile, node) {
|
|
148107
148159
|
var indentation;
|
|
148108
|
-
var lastRange =
|
|
148109
|
-
for (var _i = 0, _a = getMembersOrProperties(
|
|
148160
|
+
var lastRange = node;
|
|
148161
|
+
for (var _i = 0, _a = getMembersOrProperties(node); _i < _a.length; _i++) {
|
|
148110
148162
|
var member = _a[_i];
|
|
148111
148163
|
if (ts.rangeStartPositionsAreOnSameLine(lastRange, member, sourceFile)) {
|
|
148112
148164
|
// each indented member must be on a new line
|
|
@@ -148125,13 +148177,13 @@ var ts;
|
|
|
148125
148177
|
}
|
|
148126
148178
|
return indentation;
|
|
148127
148179
|
};
|
|
148128
|
-
ChangeTracker.prototype.computeIndentationForNewMember = function (sourceFile,
|
|
148180
|
+
ChangeTracker.prototype.computeIndentationForNewMember = function (sourceFile, node) {
|
|
148129
148181
|
var _a;
|
|
148130
|
-
var
|
|
148131
|
-
return ts.formatting.SmartIndenter.findFirstNonWhitespaceColumn(ts.getLineStartPositionForPosition(
|
|
148182
|
+
var nodeStart = node.getStart(sourceFile);
|
|
148183
|
+
return ts.formatting.SmartIndenter.findFirstNonWhitespaceColumn(ts.getLineStartPositionForPosition(nodeStart, sourceFile), nodeStart, sourceFile, this.formatContext.options)
|
|
148132
148184
|
+ ((_a = this.formatContext.options.indentSize) !== null && _a !== void 0 ? _a : 4);
|
|
148133
148185
|
};
|
|
148134
|
-
ChangeTracker.prototype.getInsertNodeAtStartInsertOptions = function (sourceFile,
|
|
148186
|
+
ChangeTracker.prototype.getInsertNodeAtStartInsertOptions = function (sourceFile, node, indentation) {
|
|
148135
148187
|
// Rules:
|
|
148136
148188
|
// - Always insert leading newline.
|
|
148137
148189
|
// - For object literals:
|
|
@@ -148141,11 +148193,11 @@ var ts;
|
|
|
148141
148193
|
// and the node is empty (because we didn't add a trailing comma per the previous rule).
|
|
148142
148194
|
// - Only insert a trailing newline if body is single-line and there are no other insertions for the node.
|
|
148143
148195
|
// NOTE: This is handled in `finishClassesWithNodesInsertedAtStart`.
|
|
148144
|
-
var members = getMembersOrProperties(
|
|
148196
|
+
var members = getMembersOrProperties(node);
|
|
148145
148197
|
var isEmpty = members.length === 0;
|
|
148146
|
-
var isFirstInsertion = ts.addToSeen(this.classesWithNodesInsertedAtStart, ts.getNodeId(
|
|
148147
|
-
var insertTrailingComma = ts.isObjectLiteralExpression(
|
|
148148
|
-
var insertLeadingComma = ts.isObjectLiteralExpression(
|
|
148198
|
+
var isFirstInsertion = ts.addToSeen(this.classesWithNodesInsertedAtStart, ts.getNodeId(node), { node: node, sourceFile: sourceFile });
|
|
148199
|
+
var insertTrailingComma = ts.isObjectLiteralExpression(node) && (!ts.isJsonSourceFile(sourceFile) || !isEmpty);
|
|
148200
|
+
var insertLeadingComma = ts.isObjectLiteralExpression(node) && ts.isJsonSourceFile(sourceFile) && isEmpty && !isFirstInsertion;
|
|
148149
148201
|
return {
|
|
148150
148202
|
indentation: indentation,
|
|
148151
148203
|
prefix: (insertLeadingComma ? "," : "") + this.newLineCharacter,
|
|
@@ -148439,8 +148491,8 @@ var ts;
|
|
|
148439
148491
|
var close = ts.findChildOfKind(cls, 19 /* CloseBraceToken */, sourceFile);
|
|
148440
148492
|
return [open === null || open === void 0 ? void 0 : open.end, close === null || close === void 0 ? void 0 : close.end];
|
|
148441
148493
|
}
|
|
148442
|
-
function getMembersOrProperties(
|
|
148443
|
-
return ts.isObjectLiteralExpression(
|
|
148494
|
+
function getMembersOrProperties(node) {
|
|
148495
|
+
return ts.isObjectLiteralExpression(node) ? node.properties : node.members;
|
|
148444
148496
|
}
|
|
148445
148497
|
function getNewFileText(statements, scriptKind, newLineCharacter, formatContext) {
|
|
148446
148498
|
return changesToText.newFileChangesWorker(/*oldFile*/ undefined, scriptKind, statements, newLineCharacter, formatContext);
|
|
@@ -151723,7 +151775,7 @@ var ts;
|
|
|
151723
151775
|
changeTracker.insertNodeAfter(sourceFile, constructor, newElement);
|
|
151724
151776
|
}
|
|
151725
151777
|
else {
|
|
151726
|
-
changeTracker.
|
|
151778
|
+
changeTracker.insertMemberAtStart(sourceFile, cls, newElement);
|
|
151727
151779
|
}
|
|
151728
151780
|
}
|
|
151729
151781
|
}
|
|
@@ -153507,7 +153559,7 @@ var ts;
|
|
|
153507
153559
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addFunctionDeclaration(t, context, info); });
|
|
153508
153560
|
return [codefix.createCodeFixAction(fixMissingFunctionDeclaration, changes, [ts.Diagnostics.Add_missing_function_declaration_0, info.token.text], fixMissingFunctionDeclaration, ts.Diagnostics.Add_all_missing_function_declarations)];
|
|
153509
153561
|
}
|
|
153510
|
-
if (info.kind ===
|
|
153562
|
+
if (info.kind === 1 /* Enum */) {
|
|
153511
153563
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addEnumMemberDeclaration(t, context.program.getTypeChecker(), info); });
|
|
153512
153564
|
return [codefix.createCodeFixAction(fixMissingMember, changes, [ts.Diagnostics.Add_missing_enum_member_0, info.token.text], fixMissingMember, ts.Diagnostics.Add_all_missing_members)];
|
|
153513
153565
|
}
|
|
@@ -153535,10 +153587,10 @@ var ts;
|
|
|
153535
153587
|
addJsxAttributes(changes, context, info);
|
|
153536
153588
|
}
|
|
153537
153589
|
else {
|
|
153538
|
-
if (info.kind ===
|
|
153590
|
+
if (info.kind === 1 /* Enum */) {
|
|
153539
153591
|
addEnumMemberDeclaration(changes, checker, info);
|
|
153540
153592
|
}
|
|
153541
|
-
if (info.kind ===
|
|
153593
|
+
if (info.kind === 0 /* TypeLikeDeclaration */) {
|
|
153542
153594
|
var parentDeclaration = info.parentDeclaration, token_1 = info.token;
|
|
153543
153595
|
var infos = ts.getOrUpdate(typeDeclToMembers, parentDeclaration, function () { return []; });
|
|
153544
153596
|
if (!infos.some(function (i) { return i.token.text === token_1.text; })) {
|
|
@@ -153547,11 +153599,11 @@ var ts;
|
|
|
153547
153599
|
}
|
|
153548
153600
|
}
|
|
153549
153601
|
});
|
|
153550
|
-
typeDeclToMembers.forEach(function (infos,
|
|
153551
|
-
var supers = codefix.getAllSupers(
|
|
153602
|
+
typeDeclToMembers.forEach(function (infos, declaration) {
|
|
153603
|
+
var supers = ts.isTypeLiteralNode(declaration) ? undefined : codefix.getAllSupers(declaration, checker);
|
|
153552
153604
|
var _loop_15 = function (info) {
|
|
153553
153605
|
// If some superclass added this property, don't add it again.
|
|
153554
|
-
if (supers.some(function (superClassOrInterface) {
|
|
153606
|
+
if (supers === null || supers === void 0 ? void 0 : supers.some(function (superClassOrInterface) {
|
|
153555
153607
|
var superInfos = typeDeclToMembers.get(superClassOrInterface);
|
|
153556
153608
|
return !!superInfos && superInfos.some(function (_a) {
|
|
153557
153609
|
var token = _a.token;
|
|
@@ -153565,11 +153617,11 @@ var ts;
|
|
|
153565
153617
|
addMethodDeclaration(context, changes, call, token, modifierFlags & 32 /* Static */, parentDeclaration, declSourceFile);
|
|
153566
153618
|
}
|
|
153567
153619
|
else {
|
|
153568
|
-
if (isJSFile && !ts.isInterfaceDeclaration(parentDeclaration)) {
|
|
153620
|
+
if (isJSFile && !ts.isInterfaceDeclaration(parentDeclaration) && !ts.isTypeLiteralNode(parentDeclaration)) {
|
|
153569
153621
|
addMissingMemberInJs(changes, declSourceFile, parentDeclaration, token, !!(modifierFlags & 32 /* Static */));
|
|
153570
153622
|
}
|
|
153571
153623
|
else {
|
|
153572
|
-
var typeNode = getTypeNode(
|
|
153624
|
+
var typeNode = getTypeNode(checker, parentDeclaration, token);
|
|
153573
153625
|
addPropertyDeclaration(changes, declSourceFile, parentDeclaration, token.text, typeNode, modifierFlags & 32 /* Static */);
|
|
153574
153626
|
}
|
|
153575
153627
|
}
|
|
@@ -153584,8 +153636,8 @@ var ts;
|
|
|
153584
153636
|
});
|
|
153585
153637
|
var InfoKind;
|
|
153586
153638
|
(function (InfoKind) {
|
|
153587
|
-
InfoKind[InfoKind["
|
|
153588
|
-
InfoKind[InfoKind["
|
|
153639
|
+
InfoKind[InfoKind["TypeLikeDeclaration"] = 0] = "TypeLikeDeclaration";
|
|
153640
|
+
InfoKind[InfoKind["Enum"] = 1] = "Enum";
|
|
153589
153641
|
InfoKind[InfoKind["Function"] = 2] = "Function";
|
|
153590
153642
|
InfoKind[InfoKind["ObjectLiteral"] = 3] = "ObjectLiteral";
|
|
153591
153643
|
InfoKind[InfoKind["JsxAttributes"] = 4] = "JsxAttributes";
|
|
@@ -153655,20 +153707,21 @@ var ts;
|
|
|
153655
153707
|
if (!classDeclaration && ts.isPrivateIdentifier(token))
|
|
153656
153708
|
return undefined;
|
|
153657
153709
|
// Prefer to change the class instead of the interface if they are merged
|
|
153658
|
-
var
|
|
153659
|
-
if (
|
|
153660
|
-
var makeStatic = (leftExpressionType.target || leftExpressionType) !== checker.getDeclaredTypeOfSymbol(symbol);
|
|
153661
|
-
if (makeStatic && (ts.isPrivateIdentifier(token) || ts.isInterfaceDeclaration(
|
|
153710
|
+
var declaration = classDeclaration || ts.find(symbol.declarations, function (d) { return ts.isInterfaceDeclaration(d) || ts.isTypeLiteralNode(d); });
|
|
153711
|
+
if (declaration && !isSourceFileFromLibrary(program, declaration.getSourceFile())) {
|
|
153712
|
+
var makeStatic = !ts.isTypeLiteralNode(declaration) && (leftExpressionType.target || leftExpressionType) !== checker.getDeclaredTypeOfSymbol(symbol);
|
|
153713
|
+
if (makeStatic && (ts.isPrivateIdentifier(token) || ts.isInterfaceDeclaration(declaration)))
|
|
153662
153714
|
return undefined;
|
|
153663
|
-
var declSourceFile =
|
|
153664
|
-
var modifierFlags =
|
|
153715
|
+
var declSourceFile = declaration.getSourceFile();
|
|
153716
|
+
var modifierFlags = ts.isTypeLiteralNode(declaration) ? 0 /* None */ :
|
|
153717
|
+
(makeStatic ? 32 /* Static */ : 0 /* None */) | (ts.startsWithUnderscore(token.text) ? 8 /* Private */ : 0 /* None */);
|
|
153665
153718
|
var isJSFile = ts.isSourceFileJS(declSourceFile);
|
|
153666
153719
|
var call = ts.tryCast(parent.parent, ts.isCallExpression);
|
|
153667
|
-
return { kind:
|
|
153720
|
+
return { kind: 0 /* TypeLikeDeclaration */, token: token, call: call, modifierFlags: modifierFlags, parentDeclaration: declaration, declSourceFile: declSourceFile, isJSFile: isJSFile };
|
|
153668
153721
|
}
|
|
153669
153722
|
var enumDeclaration = ts.find(symbol.declarations, ts.isEnumDeclaration);
|
|
153670
153723
|
if (enumDeclaration && !ts.isPrivateIdentifier(token) && !isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) {
|
|
153671
|
-
return { kind:
|
|
153724
|
+
return { kind: 1 /* Enum */, token: token, parentDeclaration: enumDeclaration };
|
|
153672
153725
|
}
|
|
153673
153726
|
return undefined;
|
|
153674
153727
|
}
|
|
@@ -153681,7 +153734,7 @@ var ts;
|
|
|
153681
153734
|
}
|
|
153682
153735
|
function createActionForAddMissingMemberInJavascriptFile(context, _a) {
|
|
153683
153736
|
var parentDeclaration = _a.parentDeclaration, declSourceFile = _a.declSourceFile, modifierFlags = _a.modifierFlags, token = _a.token;
|
|
153684
|
-
if (ts.isInterfaceDeclaration(parentDeclaration)) {
|
|
153737
|
+
if (ts.isInterfaceDeclaration(parentDeclaration) || ts.isTypeLiteralNode(parentDeclaration)) {
|
|
153685
153738
|
return undefined;
|
|
153686
153739
|
}
|
|
153687
153740
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addMissingMemberInJs(t, declSourceFile, parentDeclaration, token, !!(modifierFlags & 32 /* Static */)); });
|
|
@@ -153692,7 +153745,7 @@ var ts;
|
|
|
153692
153745
|
ts.isPrivateIdentifier(token) ? ts.Diagnostics.Declare_a_private_field_named_0 : ts.Diagnostics.Initialize_property_0_in_the_constructor;
|
|
153693
153746
|
return codefix.createCodeFixAction(fixMissingMember, changes, [diagnostic, token.text], fixMissingMember, ts.Diagnostics.Add_all_missing_members);
|
|
153694
153747
|
}
|
|
153695
|
-
function addMissingMemberInJs(changeTracker,
|
|
153748
|
+
function addMissingMemberInJs(changeTracker, sourceFile, classDeclaration, token, makeStatic) {
|
|
153696
153749
|
var tokenName = token.text;
|
|
153697
153750
|
if (makeStatic) {
|
|
153698
153751
|
if (classDeclaration.kind === 226 /* ClassExpression */) {
|
|
@@ -153700,7 +153753,7 @@ var ts;
|
|
|
153700
153753
|
}
|
|
153701
153754
|
var className = classDeclaration.name.getText();
|
|
153702
153755
|
var staticInitialization = initializePropertyToUndefined(ts.factory.createIdentifier(className), tokenName);
|
|
153703
|
-
changeTracker.insertNodeAfter(
|
|
153756
|
+
changeTracker.insertNodeAfter(sourceFile, classDeclaration, staticInitialization);
|
|
153704
153757
|
}
|
|
153705
153758
|
else if (ts.isPrivateIdentifier(token)) {
|
|
153706
153759
|
var property = ts.factory.createPropertyDeclaration(
|
|
@@ -153711,10 +153764,10 @@ var ts;
|
|
|
153711
153764
|
/*initializer*/ undefined);
|
|
153712
153765
|
var lastProp = getNodeToInsertPropertyAfter(classDeclaration);
|
|
153713
153766
|
if (lastProp) {
|
|
153714
|
-
changeTracker.insertNodeAfter(
|
|
153767
|
+
changeTracker.insertNodeAfter(sourceFile, lastProp, property);
|
|
153715
153768
|
}
|
|
153716
153769
|
else {
|
|
153717
|
-
changeTracker.
|
|
153770
|
+
changeTracker.insertMemberAtStart(sourceFile, classDeclaration, property);
|
|
153718
153771
|
}
|
|
153719
153772
|
}
|
|
153720
153773
|
else {
|
|
@@ -153723,7 +153776,7 @@ var ts;
|
|
|
153723
153776
|
return;
|
|
153724
153777
|
}
|
|
153725
153778
|
var propertyInitialization = initializePropertyToUndefined(ts.factory.createThis(), tokenName);
|
|
153726
|
-
changeTracker.insertNodeAtConstructorEnd(
|
|
153779
|
+
changeTracker.insertNodeAtConstructorEnd(sourceFile, classConstructor, propertyInitialization);
|
|
153727
153780
|
}
|
|
153728
153781
|
}
|
|
153729
153782
|
function initializePropertyToUndefined(obj, propertyName) {
|
|
@@ -153745,13 +153798,13 @@ var ts;
|
|
|
153745
153798
|
actions.push(createAddIndexSignatureAction(context, declSourceFile, parentDeclaration, token.text, typeNode));
|
|
153746
153799
|
return actions;
|
|
153747
153800
|
}
|
|
153748
|
-
function getTypeNode(checker,
|
|
153801
|
+
function getTypeNode(checker, node, token) {
|
|
153749
153802
|
var typeNode;
|
|
153750
153803
|
if (token.parent.parent.kind === 221 /* BinaryExpression */) {
|
|
153751
153804
|
var binaryExpression = token.parent.parent;
|
|
153752
153805
|
var otherExpression = token.parent === binaryExpression.left ? binaryExpression.right : binaryExpression.left;
|
|
153753
153806
|
var widenedType = checker.getWidenedType(checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(otherExpression)));
|
|
153754
|
-
typeNode = checker.typeToTypeNode(widenedType,
|
|
153807
|
+
typeNode = checker.typeToTypeNode(widenedType, node, 1 /* NoTruncation */);
|
|
153755
153808
|
}
|
|
153756
153809
|
else {
|
|
153757
153810
|
var contextualType = checker.getContextualType(token.parent);
|
|
@@ -153759,24 +153812,23 @@ var ts;
|
|
|
153759
153812
|
}
|
|
153760
153813
|
return typeNode || ts.factory.createKeywordTypeNode(130 /* AnyKeyword */);
|
|
153761
153814
|
}
|
|
153762
|
-
function addPropertyDeclaration(changeTracker,
|
|
153763
|
-
var
|
|
153764
|
-
|
|
153765
|
-
|
|
153766
|
-
|
|
153767
|
-
|
|
153768
|
-
var lastProp = getNodeToInsertPropertyAfter(classDeclaration);
|
|
153815
|
+
function addPropertyDeclaration(changeTracker, sourceFile, node, tokenName, typeNode, modifierFlags) {
|
|
153816
|
+
var modifiers = modifierFlags ? ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(modifierFlags)) : undefined;
|
|
153817
|
+
var property = ts.isClassLike(node)
|
|
153818
|
+
? ts.factory.createPropertyDeclaration(/*decorators*/ undefined, modifiers, tokenName, /*questionToken*/ undefined, typeNode, /*initializer*/ undefined)
|
|
153819
|
+
: ts.factory.createPropertySignature(/*modifiers*/ undefined, tokenName, /*questionToken*/ undefined, typeNode);
|
|
153820
|
+
var lastProp = getNodeToInsertPropertyAfter(node);
|
|
153769
153821
|
if (lastProp) {
|
|
153770
|
-
changeTracker.insertNodeAfter(
|
|
153822
|
+
changeTracker.insertNodeAfter(sourceFile, lastProp, property);
|
|
153771
153823
|
}
|
|
153772
153824
|
else {
|
|
153773
|
-
changeTracker.
|
|
153825
|
+
changeTracker.insertMemberAtStart(sourceFile, node, property);
|
|
153774
153826
|
}
|
|
153775
153827
|
}
|
|
153776
153828
|
// Gets the last of the first run of PropertyDeclarations, or undefined if the class does not start with a PropertyDeclaration.
|
|
153777
|
-
function getNodeToInsertPropertyAfter(
|
|
153829
|
+
function getNodeToInsertPropertyAfter(node) {
|
|
153778
153830
|
var res;
|
|
153779
|
-
for (var _i = 0, _a =
|
|
153831
|
+
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
153780
153832
|
var member = _a[_i];
|
|
153781
153833
|
if (!ts.isPropertyDeclaration(member))
|
|
153782
153834
|
break;
|
|
@@ -153784,7 +153836,7 @@ var ts;
|
|
|
153784
153836
|
}
|
|
153785
153837
|
return res;
|
|
153786
153838
|
}
|
|
153787
|
-
function createAddIndexSignatureAction(context,
|
|
153839
|
+
function createAddIndexSignatureAction(context, sourceFile, node, tokenName, typeNode) {
|
|
153788
153840
|
// Index signatures cannot have the static modifier.
|
|
153789
153841
|
var stringTypeNode = ts.factory.createKeywordTypeNode(150 /* StringKeyword */);
|
|
153790
153842
|
var indexingParameter = ts.factory.createParameterDeclaration(
|
|
@@ -153796,7 +153848,7 @@ var ts;
|
|
|
153796
153848
|
var indexSignature = ts.factory.createIndexSignature(
|
|
153797
153849
|
/*decorators*/ undefined,
|
|
153798
153850
|
/*modifiers*/ undefined, [indexingParameter], typeNode);
|
|
153799
|
-
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return t.
|
|
153851
|
+
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return t.insertMemberAtStart(sourceFile, node, indexSignature); });
|
|
153800
153852
|
// No fixId here because code-fix-all currently only works on adding individual named properties.
|
|
153801
153853
|
return codefix.createCodeFixActionWithoutFixAll(fixMissingMember, changes, [ts.Diagnostics.Add_index_signature_for_property_0, tokenName]);
|
|
153802
153854
|
}
|
|
@@ -153819,13 +153871,14 @@ var ts;
|
|
|
153819
153871
|
}
|
|
153820
153872
|
function addMethodDeclaration(context, changes, callExpression, name, modifierFlags, parentDeclaration, sourceFile) {
|
|
153821
153873
|
var importAdder = codefix.createImportAdder(sourceFile, context.program, context.preferences, context.host);
|
|
153822
|
-
var
|
|
153823
|
-
var
|
|
153824
|
-
|
|
153825
|
-
|
|
153874
|
+
var kind = ts.isClassLike(parentDeclaration) ? 169 /* MethodDeclaration */ : 168 /* MethodSignature */;
|
|
153875
|
+
var signatureDeclaration = codefix.createSignatureDeclarationFromCallExpression(kind, context, importAdder, callExpression, name, modifierFlags, parentDeclaration);
|
|
153876
|
+
var containingMethodDeclaration = tryGetContainingMethodDeclaration(parentDeclaration, callExpression);
|
|
153877
|
+
if (containingMethodDeclaration) {
|
|
153878
|
+
changes.insertNodeAfter(sourceFile, containingMethodDeclaration, signatureDeclaration);
|
|
153826
153879
|
}
|
|
153827
153880
|
else {
|
|
153828
|
-
changes.
|
|
153881
|
+
changes.insertMemberAtStart(sourceFile, parentDeclaration, signatureDeclaration);
|
|
153829
153882
|
}
|
|
153830
153883
|
importAdder.writeFixes(changes);
|
|
153831
153884
|
}
|
|
@@ -153988,6 +154041,13 @@ var ts;
|
|
|
153988
154041
|
return ts.isIdentifierText(targetProp.name, target, 1 /* JSX */) && !((targetProp.flags & 16777216 /* Optional */ || ts.getCheckFlags(targetProp) & 48 /* Partial */) || seenNames.has(targetProp.escapedName));
|
|
153989
154042
|
});
|
|
153990
154043
|
}
|
|
154044
|
+
function tryGetContainingMethodDeclaration(node, callExpression) {
|
|
154045
|
+
if (ts.isTypeLiteralNode(node)) {
|
|
154046
|
+
return undefined;
|
|
154047
|
+
}
|
|
154048
|
+
var declaration = ts.findAncestor(callExpression, function (n) { return ts.isMethodDeclaration(n) || ts.isConstructorDeclaration(n); });
|
|
154049
|
+
return declaration && declaration.parent === node ? declaration : undefined;
|
|
154050
|
+
}
|
|
153991
154051
|
})(codefix = ts.codefix || (ts.codefix = {}));
|
|
153992
154052
|
})(ts || (ts = {}));
|
|
153993
154053
|
/* @internal */
|
|
@@ -154131,7 +154191,7 @@ var ts;
|
|
|
154131
154191
|
// so duplicates cannot occur.
|
|
154132
154192
|
var abstractAndNonPrivateExtendsSymbols = checker.getPropertiesOfType(instantiatedExtendsType).filter(symbolPointsToNonPrivateAndAbstractMember);
|
|
154133
154193
|
var importAdder = codefix.createImportAdder(sourceFile, context.program, preferences, context.host);
|
|
154134
|
-
codefix.createMissingMemberNodes(classDeclaration, abstractAndNonPrivateExtendsSymbols, sourceFile, context, preferences, importAdder, function (member) { return changeTracker.
|
|
154194
|
+
codefix.createMissingMemberNodes(classDeclaration, abstractAndNonPrivateExtendsSymbols, sourceFile, context, preferences, importAdder, function (member) { return changeTracker.insertMemberAtStart(sourceFile, classDeclaration, member); });
|
|
154135
154195
|
importAdder.writeFixes(changeTracker);
|
|
154136
154196
|
}
|
|
154137
154197
|
function symbolPointsToNonPrivateAndAbstractMember(symbol) {
|
|
@@ -156704,13 +156764,20 @@ var ts;
|
|
|
156704
156764
|
var type = isJs || contextualType === undefined
|
|
156705
156765
|
? undefined
|
|
156706
156766
|
: checker.typeToTypeNode(contextualType, contextNode, /*flags*/ undefined, tracker);
|
|
156707
|
-
|
|
156708
|
-
|
|
156709
|
-
|
|
156710
|
-
|
|
156767
|
+
switch (kind) {
|
|
156768
|
+
case 169 /* MethodDeclaration */:
|
|
156769
|
+
return ts.factory.createMethodDeclaration(
|
|
156770
|
+
/*decorators*/ undefined, modifiers, asteriskToken, name,
|
|
156771
|
+
/*questionToken*/ undefined, typeParameters, parameters, type, createStubbedMethodBody(quotePreference));
|
|
156772
|
+
case 168 /* MethodSignature */:
|
|
156773
|
+
return ts.factory.createMethodSignature(modifiers, name,
|
|
156774
|
+
/*questionToken*/ undefined, typeParameters, parameters, type);
|
|
156775
|
+
case 256 /* FunctionDeclaration */:
|
|
156776
|
+
return ts.factory.createFunctionDeclaration(
|
|
156777
|
+
/*decorators*/ undefined, modifiers, asteriskToken, name, typeParameters, parameters, type, createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference));
|
|
156778
|
+
default:
|
|
156779
|
+
ts.Debug.fail("Unexpected kind");
|
|
156711
156780
|
}
|
|
156712
|
-
return ts.factory.createFunctionDeclaration(
|
|
156713
|
-
/*decorators*/ undefined, modifiers, asteriskToken, name, typeParameters, parameters, type, createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference));
|
|
156714
156781
|
}
|
|
156715
156782
|
codefix.createSignatureDeclarationFromCallExpression = createSignatureDeclarationFromCallExpression;
|
|
156716
156783
|
function typeToAutoImportableTypeNode(checker, importAdder, type, contextNode, scriptTarget, flags, tracker) {
|
|
@@ -157036,7 +157103,7 @@ var ts;
|
|
|
157036
157103
|
}
|
|
157037
157104
|
}
|
|
157038
157105
|
function insertAccessor(changeTracker, file, accessor, declaration, container) {
|
|
157039
|
-
ts.isParameterPropertyDeclaration(declaration, declaration.parent) ? changeTracker.
|
|
157106
|
+
ts.isParameterPropertyDeclaration(declaration, declaration.parent) ? changeTracker.insertMemberAtStart(file, container, accessor) :
|
|
157040
157107
|
ts.isPropertyAssignment(declaration) ? changeTracker.insertNodeAfterComma(file, declaration, accessor) :
|
|
157041
157108
|
changeTracker.insertNodeAfter(file, declaration, accessor);
|
|
157042
157109
|
}
|
|
@@ -175229,10 +175296,26 @@ var ts;
|
|
|
175229
175296
|
var prefix = args.prefix || "";
|
|
175230
175297
|
var entries = ts.mapDefined(completions.entries, function (entry) {
|
|
175231
175298
|
if (completions.isMemberCompletion || ts.startsWith(entry.name.toLowerCase(), prefix.toLowerCase())) {
|
|
175232
|
-
var name = entry.name, kind_1 = entry.kind, kindModifiers = entry.kindModifiers, sortText = entry.sortText, insertText = entry.insertText, replacementSpan = entry.replacementSpan, hasAction = entry.hasAction, source = entry.source, sourceDisplay = entry.sourceDisplay, isSnippet = entry.isSnippet, isRecommended = entry.isRecommended, isPackageJsonImport = entry.isPackageJsonImport, isImportStatementCompletion = entry.isImportStatementCompletion, data = entry.data;
|
|
175299
|
+
var name = entry.name, kind_1 = entry.kind, kindModifiers = entry.kindModifiers, sortText = entry.sortText, insertText = entry.insertText, replacementSpan = entry.replacementSpan, hasAction = entry.hasAction, source = entry.source, sourceDisplay = entry.sourceDisplay, labelDetails = entry.labelDetails, isSnippet = entry.isSnippet, isRecommended = entry.isRecommended, isPackageJsonImport = entry.isPackageJsonImport, isImportStatementCompletion = entry.isImportStatementCompletion, data = entry.data;
|
|
175233
175300
|
var convertedSpan = replacementSpan ? toProtocolTextSpan(replacementSpan, scriptInfo) : undefined;
|
|
175234
175301
|
// Use `hasAction || undefined` to avoid serializing `false`.
|
|
175235
|
-
return {
|
|
175302
|
+
return {
|
|
175303
|
+
name: name,
|
|
175304
|
+
kind: kind_1,
|
|
175305
|
+
kindModifiers: kindModifiers,
|
|
175306
|
+
sortText: sortText,
|
|
175307
|
+
insertText: insertText,
|
|
175308
|
+
replacementSpan: convertedSpan,
|
|
175309
|
+
isSnippet: isSnippet,
|
|
175310
|
+
hasAction: hasAction || undefined,
|
|
175311
|
+
source: source,
|
|
175312
|
+
sourceDisplay: sourceDisplay,
|
|
175313
|
+
labelDetails: labelDetails,
|
|
175314
|
+
isRecommended: isRecommended,
|
|
175315
|
+
isPackageJsonImport: isPackageJsonImport,
|
|
175316
|
+
isImportStatementCompletion: isImportStatementCompletion,
|
|
175317
|
+
data: data
|
|
175318
|
+
};
|
|
175236
175319
|
}
|
|
175237
175320
|
});
|
|
175238
175321
|
if (kind === "completions" /* Completions */) {
|
package/lib/typescript.d.ts
CHANGED
|
@@ -2977,6 +2977,7 @@ declare namespace ts {
|
|
|
2977
2977
|
maxNodeModuleJsDepth?: number;
|
|
2978
2978
|
module?: ModuleKind;
|
|
2979
2979
|
moduleResolution?: ModuleResolutionKind;
|
|
2980
|
+
moduleSuffixes?: string[];
|
|
2980
2981
|
moduleDetection?: ModuleDetectionKind;
|
|
2981
2982
|
newLine?: NewLineKind;
|
|
2982
2983
|
noEmit?: boolean;
|
|
@@ -4100,6 +4101,7 @@ declare namespace ts {
|
|
|
4100
4101
|
readonly includeCompletionsWithInsertText?: boolean;
|
|
4101
4102
|
readonly includeCompletionsWithClassMemberSnippets?: boolean;
|
|
4102
4103
|
readonly includeCompletionsWithObjectLiteralMethodSnippets?: boolean;
|
|
4104
|
+
readonly useLabelDetailsInCompletionEntries?: boolean;
|
|
4103
4105
|
readonly allowIncompleteCompletions?: boolean;
|
|
4104
4106
|
readonly importModuleSpecifierPreference?: "shortest" | "project-relative" | "relative" | "non-relative";
|
|
4105
4107
|
/** Determines whether we import `foo/index.ts` as "foo", "foo/index", or "foo/index.js" */
|
|
@@ -6485,6 +6487,7 @@ declare namespace ts {
|
|
|
6485
6487
|
hasAction?: true;
|
|
6486
6488
|
source?: string;
|
|
6487
6489
|
sourceDisplay?: SymbolDisplayPart[];
|
|
6490
|
+
labelDetails?: CompletionEntryLabelDetails;
|
|
6488
6491
|
isRecommended?: true;
|
|
6489
6492
|
isFromUncheckedFile?: true;
|
|
6490
6493
|
isPackageJsonImport?: true;
|
|
@@ -6499,6 +6502,10 @@ declare namespace ts {
|
|
|
6499
6502
|
*/
|
|
6500
6503
|
data?: CompletionEntryData;
|
|
6501
6504
|
}
|
|
6505
|
+
interface CompletionEntryLabelDetails {
|
|
6506
|
+
detail?: string;
|
|
6507
|
+
description?: string;
|
|
6508
|
+
}
|
|
6502
6509
|
interface CompletionEntryDetails {
|
|
6503
6510
|
name: string;
|
|
6504
6511
|
kind: ScriptElementKind;
|