typescript 4.7.0-dev.20220330 → 4.7.0-dev.20220402
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/es/diagnosticMessages.generated.json +1 -0
- package/lib/fr/diagnosticMessages.generated.json +1 -0
- package/lib/it/diagnosticMessages.generated.json +1 -0
- package/lib/ja/diagnosticMessages.generated.json +1 -0
- package/lib/ko/diagnosticMessages.generated.json +1 -0
- package/lib/pl/diagnosticMessages.generated.json +1 -0
- package/lib/protocol.d.ts +23 -0
- package/lib/pt-br/diagnosticMessages.generated.json +1 -0
- package/lib/ru/diagnosticMessages.generated.json +1 -0
- package/lib/tsc.js +38 -6
- package/lib/tsserver.js +183 -93
- package/lib/tsserverlibrary.d.ts +31 -1
- package/lib/tsserverlibrary.js +183 -93
- package/lib/typescript.d.ts +8 -1
- package/lib/typescript.js +165 -91
- package/lib/typescriptServices.d.ts +8 -1
- package/lib/typescriptServices.js +165 -91
- package/lib/typingsInstaller.js +43 -7
- package/lib/zh-cn/diagnosticMessages.generated.json +1 -0
- package/lib/zh-tw/diagnosticMessages.generated.json +1 -0
- package/package.json +1 -1
package/lib/typescript.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.20220402";
|
|
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
|
}
|
|
@@ -111317,6 +111352,7 @@ var ts;
|
|
|
111317
111352
|
writeLine();
|
|
111318
111353
|
decreaseIndent();
|
|
111319
111354
|
}
|
|
111355
|
+
emitList(node, node.members, 2 /* PreserveLines */);
|
|
111320
111356
|
writePunctuation("}");
|
|
111321
111357
|
}
|
|
111322
111358
|
function emitLiteralType(node) {
|
|
@@ -131530,6 +131566,7 @@ var ts;
|
|
|
131530
131566
|
var source = getSourceFromOrigin(origin);
|
|
131531
131567
|
var sourceDisplay;
|
|
131532
131568
|
var hasAction;
|
|
131569
|
+
var labelDetails;
|
|
131533
131570
|
var typeChecker = program.getTypeChecker();
|
|
131534
131571
|
var insertQuestionDot = origin && originIsNullableMember(origin);
|
|
131535
131572
|
var useBraces = origin && originIsSymbolMember(origin) || needsConvertPropertyAccess;
|
|
@@ -131598,7 +131635,11 @@ var ts;
|
|
|
131598
131635
|
}
|
|
131599
131636
|
if (origin && originIsObjectLiteralMethod(origin)) {
|
|
131600
131637
|
var importAdder = void 0;
|
|
131601
|
-
(insertText = origin.insertText, isSnippet = origin.isSnippet, importAdder = origin.importAdder,
|
|
131638
|
+
(insertText = origin.insertText, isSnippet = origin.isSnippet, importAdder = origin.importAdder, labelDetails = origin.labelDetails);
|
|
131639
|
+
if (!preferences.useLabelDetailsInCompletionEntries) {
|
|
131640
|
+
name = name + labelDetails.detail;
|
|
131641
|
+
labelDetails = undefined;
|
|
131642
|
+
}
|
|
131602
131643
|
source = CompletionSource.ObjectLiteralMethodSnippet;
|
|
131603
131644
|
sortText = Completions.SortText.SortBelow(sortText);
|
|
131604
131645
|
if (importAdder.hasFixes()) {
|
|
@@ -131652,6 +131693,7 @@ var ts;
|
|
|
131652
131693
|
insertText: insertText,
|
|
131653
131694
|
replacementSpan: replacementSpan,
|
|
131654
131695
|
sourceDisplay: sourceDisplay,
|
|
131696
|
+
labelDetails: labelDetails,
|
|
131655
131697
|
isSnippet: isSnippet,
|
|
131656
131698
|
isPackageJsonImport: originIsPackageJsonImport(origin) || undefined,
|
|
131657
131699
|
isImportStatementCompletion: !!importCompletionNode || undefined,
|
|
@@ -131843,9 +131885,19 @@ var ts;
|
|
|
131843
131885
|
else {
|
|
131844
131886
|
insertText = printer.printSnippetList(16 /* CommaDelimited */ | 64 /* AllowTrailingComma */, ts.factory.createNodeArray([method], /*hasTrailingComma*/ true), sourceFile);
|
|
131845
131887
|
}
|
|
131846
|
-
var
|
|
131847
|
-
|
|
131848
|
-
|
|
131888
|
+
var signaturePrinter = ts.createPrinter({
|
|
131889
|
+
removeComments: true,
|
|
131890
|
+
module: options.module,
|
|
131891
|
+
target: options.target,
|
|
131892
|
+
omitTrailingSemicolon: true,
|
|
131893
|
+
});
|
|
131894
|
+
// The `labelDetails.detail` will be displayed right beside the method name,
|
|
131895
|
+
// so we drop the name (and modifiers) from the signature.
|
|
131896
|
+
var methodSignature = ts.factory.createMethodSignature(
|
|
131897
|
+
/*modifiers*/ undefined,
|
|
131898
|
+
/*name*/ "", method.questionToken, method.typeParameters, method.parameters, method.type);
|
|
131899
|
+
var labelDetails = { detail: signaturePrinter.printNode(4 /* Unspecified */, methodSignature, sourceFile) };
|
|
131900
|
+
return { isSnippet: isSnippet, insertText: insertText, importAdder: importAdder, labelDetails: labelDetails };
|
|
131849
131901
|
}
|
|
131850
131902
|
;
|
|
131851
131903
|
function createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, program, host, preferences, importAdder) {
|
|
@@ -136015,9 +136067,10 @@ var ts;
|
|
|
136015
136067
|
})(FindReferencesUse = FindAllReferences.FindReferencesUse || (FindAllReferences.FindReferencesUse = {}));
|
|
136016
136068
|
function findReferencedSymbols(program, cancellationToken, sourceFiles, sourceFile, position) {
|
|
136017
136069
|
var node = ts.getTouchingPropertyName(sourceFile, position);
|
|
136018
|
-
var
|
|
136070
|
+
var options = { use: 1 /* References */ };
|
|
136071
|
+
var referencedSymbols = Core.getReferencedSymbolsForNode(position, node, program, sourceFiles, cancellationToken, options);
|
|
136019
136072
|
var checker = program.getTypeChecker();
|
|
136020
|
-
var symbol = checker.getSymbolAtLocation(node);
|
|
136073
|
+
var symbol = checker.getSymbolAtLocation(ts.getAdjustedReferenceLocation(Core.getAdjustedNode(node, options)));
|
|
136021
136074
|
return !referencedSymbols || !referencedSymbols.length ? undefined : ts.mapDefined(referencedSymbols, function (_a) {
|
|
136022
136075
|
var definition = _a.definition, references = _a.references;
|
|
136023
136076
|
// Only include referenced symbols that have a valid definition.
|
|
@@ -136362,12 +136415,7 @@ var ts;
|
|
|
136362
136415
|
var _a, _b;
|
|
136363
136416
|
if (options === void 0) { options = {}; }
|
|
136364
136417
|
if (sourceFilesSet === void 0) { sourceFilesSet = new ts.Set(sourceFiles.map(function (f) { return f.fileName; })); }
|
|
136365
|
-
|
|
136366
|
-
node = ts.getAdjustedReferenceLocation(node);
|
|
136367
|
-
}
|
|
136368
|
-
else if (options.use === 2 /* Rename */) {
|
|
136369
|
-
node = ts.getAdjustedRenameLocation(node);
|
|
136370
|
-
}
|
|
136418
|
+
node = getAdjustedNode(node, options);
|
|
136371
136419
|
if (ts.isSourceFile(node)) {
|
|
136372
136420
|
var resolvedRef = ts.GoToDefinition.getReferenceAtPosition(node, position, program);
|
|
136373
136421
|
if (!(resolvedRef === null || resolvedRef === void 0 ? void 0 : resolvedRef.file)) {
|
|
@@ -136428,6 +136476,16 @@ var ts;
|
|
|
136428
136476
|
return mergeReferences(program, moduleReferences, references, moduleReferencesOfExportTarget);
|
|
136429
136477
|
}
|
|
136430
136478
|
Core.getReferencedSymbolsForNode = getReferencedSymbolsForNode;
|
|
136479
|
+
function getAdjustedNode(node, options) {
|
|
136480
|
+
if (options.use === 1 /* References */) {
|
|
136481
|
+
node = ts.getAdjustedReferenceLocation(node);
|
|
136482
|
+
}
|
|
136483
|
+
else if (options.use === 2 /* Rename */) {
|
|
136484
|
+
node = ts.getAdjustedRenameLocation(node);
|
|
136485
|
+
}
|
|
136486
|
+
return node;
|
|
136487
|
+
}
|
|
136488
|
+
Core.getAdjustedNode = getAdjustedNode;
|
|
136431
136489
|
function getReferencesForFileName(fileName, program, sourceFiles, sourceFilesSet) {
|
|
136432
136490
|
var _a, _b;
|
|
136433
136491
|
if (sourceFilesSet === void 0) { sourceFilesSet = new ts.Set(sourceFiles.map(function (f) { return f.fileName; })); }
|
|
@@ -139394,7 +139452,8 @@ var ts;
|
|
|
139394
139452
|
return undefined;
|
|
139395
139453
|
}
|
|
139396
139454
|
var commentOwner = commentOwnerInfo.commentOwner, parameters = commentOwnerInfo.parameters, hasReturn = commentOwnerInfo.hasReturn;
|
|
139397
|
-
|
|
139455
|
+
var commentOwnerJSDoc = ts.hasJSDocNodes(commentOwner) && commentOwner.jsDoc ? ts.lastOrUndefined(commentOwner.jsDoc) : undefined;
|
|
139456
|
+
if (commentOwner.getStart(sourceFile) < position || commentOwnerJSDoc && commentOwnerJSDoc !== existingDocComment) {
|
|
139398
139457
|
return undefined;
|
|
139399
139458
|
}
|
|
139400
139459
|
var indentationStr = getIndentationStringAtPosition(sourceFile, position);
|
|
@@ -148088,25 +148147,25 @@ var ts;
|
|
|
148088
148147
|
suffix: this.newLineCharacter
|
|
148089
148148
|
});
|
|
148090
148149
|
};
|
|
148091
|
-
ChangeTracker.prototype.
|
|
148092
|
-
this.insertNodeAtStartWorker(sourceFile,
|
|
148150
|
+
ChangeTracker.prototype.insertMemberAtStart = function (sourceFile, node, newElement) {
|
|
148151
|
+
this.insertNodeAtStartWorker(sourceFile, node, newElement);
|
|
148093
148152
|
};
|
|
148094
148153
|
ChangeTracker.prototype.insertNodeAtObjectStart = function (sourceFile, obj, newElement) {
|
|
148095
148154
|
this.insertNodeAtStartWorker(sourceFile, obj, newElement);
|
|
148096
148155
|
};
|
|
148097
|
-
ChangeTracker.prototype.insertNodeAtStartWorker = function (sourceFile,
|
|
148156
|
+
ChangeTracker.prototype.insertNodeAtStartWorker = function (sourceFile, node, newElement) {
|
|
148098
148157
|
var _a;
|
|
148099
|
-
var indentation = (_a = this.guessIndentationFromExistingMembers(sourceFile,
|
|
148100
|
-
this.insertNodeAt(sourceFile, getMembersOrProperties(
|
|
148158
|
+
var indentation = (_a = this.guessIndentationFromExistingMembers(sourceFile, node)) !== null && _a !== void 0 ? _a : this.computeIndentationForNewMember(sourceFile, node);
|
|
148159
|
+
this.insertNodeAt(sourceFile, getMembersOrProperties(node).pos, newElement, this.getInsertNodeAtStartInsertOptions(sourceFile, node, indentation));
|
|
148101
148160
|
};
|
|
148102
148161
|
/**
|
|
148103
148162
|
* Tries to guess the indentation from the existing members of a class/interface/object. All members must be on
|
|
148104
148163
|
* new lines and must share the same indentation.
|
|
148105
148164
|
*/
|
|
148106
|
-
ChangeTracker.prototype.guessIndentationFromExistingMembers = function (sourceFile,
|
|
148165
|
+
ChangeTracker.prototype.guessIndentationFromExistingMembers = function (sourceFile, node) {
|
|
148107
148166
|
var indentation;
|
|
148108
|
-
var lastRange =
|
|
148109
|
-
for (var _i = 0, _a = getMembersOrProperties(
|
|
148167
|
+
var lastRange = node;
|
|
148168
|
+
for (var _i = 0, _a = getMembersOrProperties(node); _i < _a.length; _i++) {
|
|
148110
148169
|
var member = _a[_i];
|
|
148111
148170
|
if (ts.rangeStartPositionsAreOnSameLine(lastRange, member, sourceFile)) {
|
|
148112
148171
|
// each indented member must be on a new line
|
|
@@ -148125,13 +148184,13 @@ var ts;
|
|
|
148125
148184
|
}
|
|
148126
148185
|
return indentation;
|
|
148127
148186
|
};
|
|
148128
|
-
ChangeTracker.prototype.computeIndentationForNewMember = function (sourceFile,
|
|
148187
|
+
ChangeTracker.prototype.computeIndentationForNewMember = function (sourceFile, node) {
|
|
148129
148188
|
var _a;
|
|
148130
|
-
var
|
|
148131
|
-
return ts.formatting.SmartIndenter.findFirstNonWhitespaceColumn(ts.getLineStartPositionForPosition(
|
|
148189
|
+
var nodeStart = node.getStart(sourceFile);
|
|
148190
|
+
return ts.formatting.SmartIndenter.findFirstNonWhitespaceColumn(ts.getLineStartPositionForPosition(nodeStart, sourceFile), nodeStart, sourceFile, this.formatContext.options)
|
|
148132
148191
|
+ ((_a = this.formatContext.options.indentSize) !== null && _a !== void 0 ? _a : 4);
|
|
148133
148192
|
};
|
|
148134
|
-
ChangeTracker.prototype.getInsertNodeAtStartInsertOptions = function (sourceFile,
|
|
148193
|
+
ChangeTracker.prototype.getInsertNodeAtStartInsertOptions = function (sourceFile, node, indentation) {
|
|
148135
148194
|
// Rules:
|
|
148136
148195
|
// - Always insert leading newline.
|
|
148137
148196
|
// - For object literals:
|
|
@@ -148141,11 +148200,11 @@ var ts;
|
|
|
148141
148200
|
// and the node is empty (because we didn't add a trailing comma per the previous rule).
|
|
148142
148201
|
// - Only insert a trailing newline if body is single-line and there are no other insertions for the node.
|
|
148143
148202
|
// NOTE: This is handled in `finishClassesWithNodesInsertedAtStart`.
|
|
148144
|
-
var members = getMembersOrProperties(
|
|
148203
|
+
var members = getMembersOrProperties(node);
|
|
148145
148204
|
var isEmpty = members.length === 0;
|
|
148146
|
-
var isFirstInsertion = ts.addToSeen(this.classesWithNodesInsertedAtStart, ts.getNodeId(
|
|
148147
|
-
var insertTrailingComma = ts.isObjectLiteralExpression(
|
|
148148
|
-
var insertLeadingComma = ts.isObjectLiteralExpression(
|
|
148205
|
+
var isFirstInsertion = ts.addToSeen(this.classesWithNodesInsertedAtStart, ts.getNodeId(node), { node: node, sourceFile: sourceFile });
|
|
148206
|
+
var insertTrailingComma = ts.isObjectLiteralExpression(node) && (!ts.isJsonSourceFile(sourceFile) || !isEmpty);
|
|
148207
|
+
var insertLeadingComma = ts.isObjectLiteralExpression(node) && ts.isJsonSourceFile(sourceFile) && isEmpty && !isFirstInsertion;
|
|
148149
148208
|
return {
|
|
148150
148209
|
indentation: indentation,
|
|
148151
148210
|
prefix: (insertLeadingComma ? "," : "") + this.newLineCharacter,
|
|
@@ -148439,8 +148498,8 @@ var ts;
|
|
|
148439
148498
|
var close = ts.findChildOfKind(cls, 19 /* CloseBraceToken */, sourceFile);
|
|
148440
148499
|
return [open === null || open === void 0 ? void 0 : open.end, close === null || close === void 0 ? void 0 : close.end];
|
|
148441
148500
|
}
|
|
148442
|
-
function getMembersOrProperties(
|
|
148443
|
-
return ts.isObjectLiteralExpression(
|
|
148501
|
+
function getMembersOrProperties(node) {
|
|
148502
|
+
return ts.isObjectLiteralExpression(node) ? node.properties : node.members;
|
|
148444
148503
|
}
|
|
148445
148504
|
function getNewFileText(statements, scriptKind, newLineCharacter, formatContext) {
|
|
148446
148505
|
return changesToText.newFileChangesWorker(/*oldFile*/ undefined, scriptKind, statements, newLineCharacter, formatContext);
|
|
@@ -151723,7 +151782,7 @@ var ts;
|
|
|
151723
151782
|
changeTracker.insertNodeAfter(sourceFile, constructor, newElement);
|
|
151724
151783
|
}
|
|
151725
151784
|
else {
|
|
151726
|
-
changeTracker.
|
|
151785
|
+
changeTracker.insertMemberAtStart(sourceFile, cls, newElement);
|
|
151727
151786
|
}
|
|
151728
151787
|
}
|
|
151729
151788
|
}
|
|
@@ -153507,7 +153566,7 @@ var ts;
|
|
|
153507
153566
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addFunctionDeclaration(t, context, info); });
|
|
153508
153567
|
return [codefix.createCodeFixAction(fixMissingFunctionDeclaration, changes, [ts.Diagnostics.Add_missing_function_declaration_0, info.token.text], fixMissingFunctionDeclaration, ts.Diagnostics.Add_all_missing_function_declarations)];
|
|
153509
153568
|
}
|
|
153510
|
-
if (info.kind ===
|
|
153569
|
+
if (info.kind === 1 /* Enum */) {
|
|
153511
153570
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addEnumMemberDeclaration(t, context.program.getTypeChecker(), info); });
|
|
153512
153571
|
return [codefix.createCodeFixAction(fixMissingMember, changes, [ts.Diagnostics.Add_missing_enum_member_0, info.token.text], fixMissingMember, ts.Diagnostics.Add_all_missing_members)];
|
|
153513
153572
|
}
|
|
@@ -153535,10 +153594,10 @@ var ts;
|
|
|
153535
153594
|
addJsxAttributes(changes, context, info);
|
|
153536
153595
|
}
|
|
153537
153596
|
else {
|
|
153538
|
-
if (info.kind ===
|
|
153597
|
+
if (info.kind === 1 /* Enum */) {
|
|
153539
153598
|
addEnumMemberDeclaration(changes, checker, info);
|
|
153540
153599
|
}
|
|
153541
|
-
if (info.kind ===
|
|
153600
|
+
if (info.kind === 0 /* TypeLikeDeclaration */) {
|
|
153542
153601
|
var parentDeclaration = info.parentDeclaration, token_1 = info.token;
|
|
153543
153602
|
var infos = ts.getOrUpdate(typeDeclToMembers, parentDeclaration, function () { return []; });
|
|
153544
153603
|
if (!infos.some(function (i) { return i.token.text === token_1.text; })) {
|
|
@@ -153547,11 +153606,11 @@ var ts;
|
|
|
153547
153606
|
}
|
|
153548
153607
|
}
|
|
153549
153608
|
});
|
|
153550
|
-
typeDeclToMembers.forEach(function (infos,
|
|
153551
|
-
var supers = codefix.getAllSupers(
|
|
153609
|
+
typeDeclToMembers.forEach(function (infos, declaration) {
|
|
153610
|
+
var supers = ts.isTypeLiteralNode(declaration) ? undefined : codefix.getAllSupers(declaration, checker);
|
|
153552
153611
|
var _loop_15 = function (info) {
|
|
153553
153612
|
// If some superclass added this property, don't add it again.
|
|
153554
|
-
if (supers.some(function (superClassOrInterface) {
|
|
153613
|
+
if (supers === null || supers === void 0 ? void 0 : supers.some(function (superClassOrInterface) {
|
|
153555
153614
|
var superInfos = typeDeclToMembers.get(superClassOrInterface);
|
|
153556
153615
|
return !!superInfos && superInfos.some(function (_a) {
|
|
153557
153616
|
var token = _a.token;
|
|
@@ -153565,11 +153624,11 @@ var ts;
|
|
|
153565
153624
|
addMethodDeclaration(context, changes, call, token, modifierFlags & 32 /* Static */, parentDeclaration, declSourceFile);
|
|
153566
153625
|
}
|
|
153567
153626
|
else {
|
|
153568
|
-
if (isJSFile && !ts.isInterfaceDeclaration(parentDeclaration)) {
|
|
153627
|
+
if (isJSFile && !ts.isInterfaceDeclaration(parentDeclaration) && !ts.isTypeLiteralNode(parentDeclaration)) {
|
|
153569
153628
|
addMissingMemberInJs(changes, declSourceFile, parentDeclaration, token, !!(modifierFlags & 32 /* Static */));
|
|
153570
153629
|
}
|
|
153571
153630
|
else {
|
|
153572
|
-
var typeNode = getTypeNode(
|
|
153631
|
+
var typeNode = getTypeNode(checker, parentDeclaration, token);
|
|
153573
153632
|
addPropertyDeclaration(changes, declSourceFile, parentDeclaration, token.text, typeNode, modifierFlags & 32 /* Static */);
|
|
153574
153633
|
}
|
|
153575
153634
|
}
|
|
@@ -153584,8 +153643,8 @@ var ts;
|
|
|
153584
153643
|
});
|
|
153585
153644
|
var InfoKind;
|
|
153586
153645
|
(function (InfoKind) {
|
|
153587
|
-
InfoKind[InfoKind["
|
|
153588
|
-
InfoKind[InfoKind["
|
|
153646
|
+
InfoKind[InfoKind["TypeLikeDeclaration"] = 0] = "TypeLikeDeclaration";
|
|
153647
|
+
InfoKind[InfoKind["Enum"] = 1] = "Enum";
|
|
153589
153648
|
InfoKind[InfoKind["Function"] = 2] = "Function";
|
|
153590
153649
|
InfoKind[InfoKind["ObjectLiteral"] = 3] = "ObjectLiteral";
|
|
153591
153650
|
InfoKind[InfoKind["JsxAttributes"] = 4] = "JsxAttributes";
|
|
@@ -153655,20 +153714,21 @@ var ts;
|
|
|
153655
153714
|
if (!classDeclaration && ts.isPrivateIdentifier(token))
|
|
153656
153715
|
return undefined;
|
|
153657
153716
|
// 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(
|
|
153717
|
+
var declaration = classDeclaration || ts.find(symbol.declarations, function (d) { return ts.isInterfaceDeclaration(d) || ts.isTypeLiteralNode(d); });
|
|
153718
|
+
if (declaration && !isSourceFileFromLibrary(program, declaration.getSourceFile())) {
|
|
153719
|
+
var makeStatic = !ts.isTypeLiteralNode(declaration) && (leftExpressionType.target || leftExpressionType) !== checker.getDeclaredTypeOfSymbol(symbol);
|
|
153720
|
+
if (makeStatic && (ts.isPrivateIdentifier(token) || ts.isInterfaceDeclaration(declaration)))
|
|
153662
153721
|
return undefined;
|
|
153663
|
-
var declSourceFile =
|
|
153664
|
-
var modifierFlags =
|
|
153722
|
+
var declSourceFile = declaration.getSourceFile();
|
|
153723
|
+
var modifierFlags = ts.isTypeLiteralNode(declaration) ? 0 /* None */ :
|
|
153724
|
+
(makeStatic ? 32 /* Static */ : 0 /* None */) | (ts.startsWithUnderscore(token.text) ? 8 /* Private */ : 0 /* None */);
|
|
153665
153725
|
var isJSFile = ts.isSourceFileJS(declSourceFile);
|
|
153666
153726
|
var call = ts.tryCast(parent.parent, ts.isCallExpression);
|
|
153667
|
-
return { kind:
|
|
153727
|
+
return { kind: 0 /* TypeLikeDeclaration */, token: token, call: call, modifierFlags: modifierFlags, parentDeclaration: declaration, declSourceFile: declSourceFile, isJSFile: isJSFile };
|
|
153668
153728
|
}
|
|
153669
153729
|
var enumDeclaration = ts.find(symbol.declarations, ts.isEnumDeclaration);
|
|
153670
153730
|
if (enumDeclaration && !ts.isPrivateIdentifier(token) && !isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) {
|
|
153671
|
-
return { kind:
|
|
153731
|
+
return { kind: 1 /* Enum */, token: token, parentDeclaration: enumDeclaration };
|
|
153672
153732
|
}
|
|
153673
153733
|
return undefined;
|
|
153674
153734
|
}
|
|
@@ -153681,7 +153741,7 @@ var ts;
|
|
|
153681
153741
|
}
|
|
153682
153742
|
function createActionForAddMissingMemberInJavascriptFile(context, _a) {
|
|
153683
153743
|
var parentDeclaration = _a.parentDeclaration, declSourceFile = _a.declSourceFile, modifierFlags = _a.modifierFlags, token = _a.token;
|
|
153684
|
-
if (ts.isInterfaceDeclaration(parentDeclaration)) {
|
|
153744
|
+
if (ts.isInterfaceDeclaration(parentDeclaration) || ts.isTypeLiteralNode(parentDeclaration)) {
|
|
153685
153745
|
return undefined;
|
|
153686
153746
|
}
|
|
153687
153747
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addMissingMemberInJs(t, declSourceFile, parentDeclaration, token, !!(modifierFlags & 32 /* Static */)); });
|
|
@@ -153692,7 +153752,7 @@ var ts;
|
|
|
153692
153752
|
ts.isPrivateIdentifier(token) ? ts.Diagnostics.Declare_a_private_field_named_0 : ts.Diagnostics.Initialize_property_0_in_the_constructor;
|
|
153693
153753
|
return codefix.createCodeFixAction(fixMissingMember, changes, [diagnostic, token.text], fixMissingMember, ts.Diagnostics.Add_all_missing_members);
|
|
153694
153754
|
}
|
|
153695
|
-
function addMissingMemberInJs(changeTracker,
|
|
153755
|
+
function addMissingMemberInJs(changeTracker, sourceFile, classDeclaration, token, makeStatic) {
|
|
153696
153756
|
var tokenName = token.text;
|
|
153697
153757
|
if (makeStatic) {
|
|
153698
153758
|
if (classDeclaration.kind === 226 /* ClassExpression */) {
|
|
@@ -153700,7 +153760,7 @@ var ts;
|
|
|
153700
153760
|
}
|
|
153701
153761
|
var className = classDeclaration.name.getText();
|
|
153702
153762
|
var staticInitialization = initializePropertyToUndefined(ts.factory.createIdentifier(className), tokenName);
|
|
153703
|
-
changeTracker.insertNodeAfter(
|
|
153763
|
+
changeTracker.insertNodeAfter(sourceFile, classDeclaration, staticInitialization);
|
|
153704
153764
|
}
|
|
153705
153765
|
else if (ts.isPrivateIdentifier(token)) {
|
|
153706
153766
|
var property = ts.factory.createPropertyDeclaration(
|
|
@@ -153711,10 +153771,10 @@ var ts;
|
|
|
153711
153771
|
/*initializer*/ undefined);
|
|
153712
153772
|
var lastProp = getNodeToInsertPropertyAfter(classDeclaration);
|
|
153713
153773
|
if (lastProp) {
|
|
153714
|
-
changeTracker.insertNodeAfter(
|
|
153774
|
+
changeTracker.insertNodeAfter(sourceFile, lastProp, property);
|
|
153715
153775
|
}
|
|
153716
153776
|
else {
|
|
153717
|
-
changeTracker.
|
|
153777
|
+
changeTracker.insertMemberAtStart(sourceFile, classDeclaration, property);
|
|
153718
153778
|
}
|
|
153719
153779
|
}
|
|
153720
153780
|
else {
|
|
@@ -153723,7 +153783,7 @@ var ts;
|
|
|
153723
153783
|
return;
|
|
153724
153784
|
}
|
|
153725
153785
|
var propertyInitialization = initializePropertyToUndefined(ts.factory.createThis(), tokenName);
|
|
153726
|
-
changeTracker.insertNodeAtConstructorEnd(
|
|
153786
|
+
changeTracker.insertNodeAtConstructorEnd(sourceFile, classConstructor, propertyInitialization);
|
|
153727
153787
|
}
|
|
153728
153788
|
}
|
|
153729
153789
|
function initializePropertyToUndefined(obj, propertyName) {
|
|
@@ -153745,13 +153805,13 @@ var ts;
|
|
|
153745
153805
|
actions.push(createAddIndexSignatureAction(context, declSourceFile, parentDeclaration, token.text, typeNode));
|
|
153746
153806
|
return actions;
|
|
153747
153807
|
}
|
|
153748
|
-
function getTypeNode(checker,
|
|
153808
|
+
function getTypeNode(checker, node, token) {
|
|
153749
153809
|
var typeNode;
|
|
153750
153810
|
if (token.parent.parent.kind === 221 /* BinaryExpression */) {
|
|
153751
153811
|
var binaryExpression = token.parent.parent;
|
|
153752
153812
|
var otherExpression = token.parent === binaryExpression.left ? binaryExpression.right : binaryExpression.left;
|
|
153753
153813
|
var widenedType = checker.getWidenedType(checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(otherExpression)));
|
|
153754
|
-
typeNode = checker.typeToTypeNode(widenedType,
|
|
153814
|
+
typeNode = checker.typeToTypeNode(widenedType, node, 1 /* NoTruncation */);
|
|
153755
153815
|
}
|
|
153756
153816
|
else {
|
|
153757
153817
|
var contextualType = checker.getContextualType(token.parent);
|
|
@@ -153759,24 +153819,23 @@ var ts;
|
|
|
153759
153819
|
}
|
|
153760
153820
|
return typeNode || ts.factory.createKeywordTypeNode(130 /* AnyKeyword */);
|
|
153761
153821
|
}
|
|
153762
|
-
function addPropertyDeclaration(changeTracker,
|
|
153763
|
-
var
|
|
153764
|
-
|
|
153765
|
-
|
|
153766
|
-
|
|
153767
|
-
|
|
153768
|
-
var lastProp = getNodeToInsertPropertyAfter(classDeclaration);
|
|
153822
|
+
function addPropertyDeclaration(changeTracker, sourceFile, node, tokenName, typeNode, modifierFlags) {
|
|
153823
|
+
var modifiers = modifierFlags ? ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(modifierFlags)) : undefined;
|
|
153824
|
+
var property = ts.isClassLike(node)
|
|
153825
|
+
? ts.factory.createPropertyDeclaration(/*decorators*/ undefined, modifiers, tokenName, /*questionToken*/ undefined, typeNode, /*initializer*/ undefined)
|
|
153826
|
+
: ts.factory.createPropertySignature(/*modifiers*/ undefined, tokenName, /*questionToken*/ undefined, typeNode);
|
|
153827
|
+
var lastProp = getNodeToInsertPropertyAfter(node);
|
|
153769
153828
|
if (lastProp) {
|
|
153770
|
-
changeTracker.insertNodeAfter(
|
|
153829
|
+
changeTracker.insertNodeAfter(sourceFile, lastProp, property);
|
|
153771
153830
|
}
|
|
153772
153831
|
else {
|
|
153773
|
-
changeTracker.
|
|
153832
|
+
changeTracker.insertMemberAtStart(sourceFile, node, property);
|
|
153774
153833
|
}
|
|
153775
153834
|
}
|
|
153776
153835
|
// Gets the last of the first run of PropertyDeclarations, or undefined if the class does not start with a PropertyDeclaration.
|
|
153777
|
-
function getNodeToInsertPropertyAfter(
|
|
153836
|
+
function getNodeToInsertPropertyAfter(node) {
|
|
153778
153837
|
var res;
|
|
153779
|
-
for (var _i = 0, _a =
|
|
153838
|
+
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
153780
153839
|
var member = _a[_i];
|
|
153781
153840
|
if (!ts.isPropertyDeclaration(member))
|
|
153782
153841
|
break;
|
|
@@ -153784,7 +153843,7 @@ var ts;
|
|
|
153784
153843
|
}
|
|
153785
153844
|
return res;
|
|
153786
153845
|
}
|
|
153787
|
-
function createAddIndexSignatureAction(context,
|
|
153846
|
+
function createAddIndexSignatureAction(context, sourceFile, node, tokenName, typeNode) {
|
|
153788
153847
|
// Index signatures cannot have the static modifier.
|
|
153789
153848
|
var stringTypeNode = ts.factory.createKeywordTypeNode(150 /* StringKeyword */);
|
|
153790
153849
|
var indexingParameter = ts.factory.createParameterDeclaration(
|
|
@@ -153796,7 +153855,7 @@ var ts;
|
|
|
153796
153855
|
var indexSignature = ts.factory.createIndexSignature(
|
|
153797
153856
|
/*decorators*/ undefined,
|
|
153798
153857
|
/*modifiers*/ undefined, [indexingParameter], typeNode);
|
|
153799
|
-
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return t.
|
|
153858
|
+
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return t.insertMemberAtStart(sourceFile, node, indexSignature); });
|
|
153800
153859
|
// No fixId here because code-fix-all currently only works on adding individual named properties.
|
|
153801
153860
|
return codefix.createCodeFixActionWithoutFixAll(fixMissingMember, changes, [ts.Diagnostics.Add_index_signature_for_property_0, tokenName]);
|
|
153802
153861
|
}
|
|
@@ -153819,13 +153878,14 @@ var ts;
|
|
|
153819
153878
|
}
|
|
153820
153879
|
function addMethodDeclaration(context, changes, callExpression, name, modifierFlags, parentDeclaration, sourceFile) {
|
|
153821
153880
|
var importAdder = codefix.createImportAdder(sourceFile, context.program, context.preferences, context.host);
|
|
153822
|
-
var
|
|
153823
|
-
var
|
|
153824
|
-
|
|
153825
|
-
|
|
153881
|
+
var kind = ts.isClassLike(parentDeclaration) ? 169 /* MethodDeclaration */ : 168 /* MethodSignature */;
|
|
153882
|
+
var signatureDeclaration = codefix.createSignatureDeclarationFromCallExpression(kind, context, importAdder, callExpression, name, modifierFlags, parentDeclaration);
|
|
153883
|
+
var containingMethodDeclaration = tryGetContainingMethodDeclaration(parentDeclaration, callExpression);
|
|
153884
|
+
if (containingMethodDeclaration) {
|
|
153885
|
+
changes.insertNodeAfter(sourceFile, containingMethodDeclaration, signatureDeclaration);
|
|
153826
153886
|
}
|
|
153827
153887
|
else {
|
|
153828
|
-
changes.
|
|
153888
|
+
changes.insertMemberAtStart(sourceFile, parentDeclaration, signatureDeclaration);
|
|
153829
153889
|
}
|
|
153830
153890
|
importAdder.writeFixes(changes);
|
|
153831
153891
|
}
|
|
@@ -153988,6 +154048,13 @@ var ts;
|
|
|
153988
154048
|
return ts.isIdentifierText(targetProp.name, target, 1 /* JSX */) && !((targetProp.flags & 16777216 /* Optional */ || ts.getCheckFlags(targetProp) & 48 /* Partial */) || seenNames.has(targetProp.escapedName));
|
|
153989
154049
|
});
|
|
153990
154050
|
}
|
|
154051
|
+
function tryGetContainingMethodDeclaration(node, callExpression) {
|
|
154052
|
+
if (ts.isTypeLiteralNode(node)) {
|
|
154053
|
+
return undefined;
|
|
154054
|
+
}
|
|
154055
|
+
var declaration = ts.findAncestor(callExpression, function (n) { return ts.isMethodDeclaration(n) || ts.isConstructorDeclaration(n); });
|
|
154056
|
+
return declaration && declaration.parent === node ? declaration : undefined;
|
|
154057
|
+
}
|
|
153991
154058
|
})(codefix = ts.codefix || (ts.codefix = {}));
|
|
153992
154059
|
})(ts || (ts = {}));
|
|
153993
154060
|
/* @internal */
|
|
@@ -154131,7 +154198,7 @@ var ts;
|
|
|
154131
154198
|
// so duplicates cannot occur.
|
|
154132
154199
|
var abstractAndNonPrivateExtendsSymbols = checker.getPropertiesOfType(instantiatedExtendsType).filter(symbolPointsToNonPrivateAndAbstractMember);
|
|
154133
154200
|
var importAdder = codefix.createImportAdder(sourceFile, context.program, preferences, context.host);
|
|
154134
|
-
codefix.createMissingMemberNodes(classDeclaration, abstractAndNonPrivateExtendsSymbols, sourceFile, context, preferences, importAdder, function (member) { return changeTracker.
|
|
154201
|
+
codefix.createMissingMemberNodes(classDeclaration, abstractAndNonPrivateExtendsSymbols, sourceFile, context, preferences, importAdder, function (member) { return changeTracker.insertMemberAtStart(sourceFile, classDeclaration, member); });
|
|
154135
154202
|
importAdder.writeFixes(changeTracker);
|
|
154136
154203
|
}
|
|
154137
154204
|
function symbolPointsToNonPrivateAndAbstractMember(symbol) {
|
|
@@ -156704,13 +156771,20 @@ var ts;
|
|
|
156704
156771
|
var type = isJs || contextualType === undefined
|
|
156705
156772
|
? undefined
|
|
156706
156773
|
: checker.typeToTypeNode(contextualType, contextNode, /*flags*/ undefined, tracker);
|
|
156707
|
-
|
|
156708
|
-
|
|
156709
|
-
|
|
156710
|
-
|
|
156774
|
+
switch (kind) {
|
|
156775
|
+
case 169 /* MethodDeclaration */:
|
|
156776
|
+
return ts.factory.createMethodDeclaration(
|
|
156777
|
+
/*decorators*/ undefined, modifiers, asteriskToken, name,
|
|
156778
|
+
/*questionToken*/ undefined, typeParameters, parameters, type, createStubbedMethodBody(quotePreference));
|
|
156779
|
+
case 168 /* MethodSignature */:
|
|
156780
|
+
return ts.factory.createMethodSignature(modifiers, name,
|
|
156781
|
+
/*questionToken*/ undefined, typeParameters, parameters, type);
|
|
156782
|
+
case 256 /* FunctionDeclaration */:
|
|
156783
|
+
return ts.factory.createFunctionDeclaration(
|
|
156784
|
+
/*decorators*/ undefined, modifiers, asteriskToken, name, typeParameters, parameters, type, createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference));
|
|
156785
|
+
default:
|
|
156786
|
+
ts.Debug.fail("Unexpected kind");
|
|
156711
156787
|
}
|
|
156712
|
-
return ts.factory.createFunctionDeclaration(
|
|
156713
|
-
/*decorators*/ undefined, modifiers, asteriskToken, name, typeParameters, parameters, type, createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference));
|
|
156714
156788
|
}
|
|
156715
156789
|
codefix.createSignatureDeclarationFromCallExpression = createSignatureDeclarationFromCallExpression;
|
|
156716
156790
|
function typeToAutoImportableTypeNode(checker, importAdder, type, contextNode, scriptTarget, flags, tracker) {
|
|
@@ -157036,7 +157110,7 @@ var ts;
|
|
|
157036
157110
|
}
|
|
157037
157111
|
}
|
|
157038
157112
|
function insertAccessor(changeTracker, file, accessor, declaration, container) {
|
|
157039
|
-
ts.isParameterPropertyDeclaration(declaration, declaration.parent) ? changeTracker.
|
|
157113
|
+
ts.isParameterPropertyDeclaration(declaration, declaration.parent) ? changeTracker.insertMemberAtStart(file, container, accessor) :
|
|
157040
157114
|
ts.isPropertyAssignment(declaration) ? changeTracker.insertNodeAfterComma(file, declaration, accessor) :
|
|
157041
157115
|
changeTracker.insertNodeAfter(file, declaration, accessor);
|
|
157042
157116
|
}
|