typescript 4.6.0-dev.20211124 → 4.6.0-dev.20211201

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/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.20211124";
297
+ ts.version = ts.versionMajorMinor + ".0-dev.20211201";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -33802,9 +33802,10 @@ var ts;
33802
33802
  // - "(x,y)" is a comma expression parsed as a signature with two parameters.
33803
33803
  // - "a ? (b): c" will have "(b):" parsed as a signature with a return type annotation.
33804
33804
  // - "a ? (b): function() {}" will too, since function() is a valid JSDoc function type.
33805
+ // - "a ? (b): (function() {})" as well, but inside of a parenthesized type.
33805
33806
  //
33806
33807
  // So we need just a bit of lookahead to ensure that it can only be a signature.
33807
- var hasJSDocFunctionType = type && ts.isJSDocFunctionType(type);
33808
+ var hasJSDocFunctionType = type && (ts.isJSDocFunctionType(type) || ts.isParenthesizedTypeNode(type) && ts.isJSDocFunctionType(type.type));
33808
33809
  if (!allowAmbiguity && token() !== 38 /* EqualsGreaterThanToken */ && (hasJSDocFunctionType || token() !== 18 /* OpenBraceToken */)) {
33809
33810
  // Returning undefined here will cause our caller to rewind to where we started from.
33810
33811
  return undefined;
@@ -91104,11 +91105,10 @@ var ts;
91104
91105
  // we can safely elide the parentheses here, as a new synthetic
91105
91106
  // ParenthesizedExpression will be inserted if we remove parentheses too
91106
91107
  // aggressively.
91107
- // HOWEVER - if there are leading comments on the expression itself, to handle ASI
91108
- // correctly for return and throw, we must keep the parenthesis
91109
- if (ts.length(ts.getLeadingCommentRangesOfNode(expression, currentSourceFile))) {
91110
- return factory.updateParenthesizedExpression(node, expression);
91111
- }
91108
+ //
91109
+ // If there are leading comments on the expression itself, the emitter will handle ASI
91110
+ // for return, throw, and yield by re-introducing parenthesis during emit on an as-need
91111
+ // basis.
91112
91112
  return factory.createPartiallyEmittedExpression(expression, node);
91113
91113
  }
91114
91114
  return ts.visitEachChild(node, visitor, context);
@@ -95056,11 +95056,11 @@ var ts;
95056
95056
  }
95057
95057
  function visitOptionalExpression(node, captureThisArg, isDelete) {
95058
95058
  var _a = flattenChain(node), expression = _a.expression, chain = _a.chain;
95059
- var left = visitNonOptionalExpression(expression, ts.isCallChain(chain[0]), /*isDelete*/ false);
95059
+ var left = visitNonOptionalExpression(ts.skipPartiallyEmittedExpressions(expression), ts.isCallChain(chain[0]), /*isDelete*/ false);
95060
95060
  var leftThisArg = ts.isSyntheticReference(left) ? left.thisArg : undefined;
95061
- var leftExpression = ts.isSyntheticReference(left) ? left.expression : left;
95062
- var capturedLeft = leftExpression;
95063
- if (!ts.isSimpleCopiableExpression(leftExpression)) {
95061
+ var capturedLeft = ts.isSyntheticReference(left) ? left.expression : left;
95062
+ var leftExpression = factory.restoreOuterExpressions(expression, capturedLeft, 8 /* PartiallyEmittedExpressions */);
95063
+ if (!ts.isSimpleCopiableExpression(capturedLeft)) {
95064
95064
  capturedLeft = factory.createTempVariable(hoistVariableDeclaration);
95065
95065
  leftExpression = factory.createAssignment(capturedLeft, leftExpression);
95066
95066
  }
@@ -95086,6 +95086,10 @@ var ts;
95086
95086
  break;
95087
95087
  case 207 /* CallExpression */:
95088
95088
  if (i === 0 && leftThisArg) {
95089
+ if (!ts.isGeneratedIdentifier(leftThisArg)) {
95090
+ leftThisArg = factory.cloneNode(leftThisArg);
95091
+ ts.addEmitFlags(leftThisArg, 1536 /* NoComments */);
95092
+ }
95089
95093
  rightExpression = factory.createFunctionCallCall(rightExpression, leftThisArg.kind === 106 /* SuperKeyword */ ? factory.createThis() : leftThisArg, ts.visitNodes(segment.arguments, visitor, ts.isExpression));
95090
95094
  }
95091
95095
  else {
@@ -109868,7 +109872,7 @@ var ts;
109868
109872
  function emitYieldExpression(node) {
109869
109873
  emitTokenWithComment(125 /* YieldKeyword */, node.pos, writeKeyword, node);
109870
109874
  emit(node.asteriskToken);
109871
- emitExpressionWithLeadingSpace(node.expression, parenthesizer.parenthesizeExpressionForDisallowedComma);
109875
+ emitExpressionWithLeadingSpace(node.expression && parenthesizeExpressionForNoAsi(node.expression), parenthesizeExpressionForNoAsiAndDisallowedComma);
109872
109876
  }
109873
109877
  function emitSpreadElement(node) {
109874
109878
  emitTokenWithComment(25 /* DotDotDotToken */, node.pos, writePunctuation, node);
@@ -110065,9 +110069,49 @@ var ts;
110065
110069
  }
110066
110070
  return pos;
110067
110071
  }
110072
+ function commentWillEmitNewLine(node) {
110073
+ return node.kind === 2 /* SingleLineCommentTrivia */ || !!node.hasTrailingNewLine;
110074
+ }
110075
+ function willEmitLeadingNewLine(node) {
110076
+ if (!currentSourceFile)
110077
+ return false;
110078
+ if (ts.some(ts.getLeadingCommentRanges(currentSourceFile.text, node.pos), commentWillEmitNewLine))
110079
+ return true;
110080
+ if (ts.some(ts.getSyntheticLeadingComments(node), commentWillEmitNewLine))
110081
+ return true;
110082
+ if (ts.isPartiallyEmittedExpression(node)) {
110083
+ if (node.pos !== node.expression.pos) {
110084
+ if (ts.some(ts.getTrailingCommentRanges(currentSourceFile.text, node.expression.pos), commentWillEmitNewLine))
110085
+ return true;
110086
+ }
110087
+ return willEmitLeadingNewLine(node.expression);
110088
+ }
110089
+ return false;
110090
+ }
110091
+ /**
110092
+ * Wraps an expression in parens if we would emit a leading comment that would introduce a line separator
110093
+ * between the node and its parent.
110094
+ */
110095
+ function parenthesizeExpressionForNoAsi(node) {
110096
+ if (!commentsDisabled && ts.isPartiallyEmittedExpression(node) && willEmitLeadingNewLine(node)) {
110097
+ var parseNode = ts.getParseTreeNode(node);
110098
+ if (parseNode && ts.isParenthesizedExpression(parseNode)) {
110099
+ // If the original node was a parenthesized expression, restore it to preserve comment and source map emit
110100
+ var parens = ts.factory.createParenthesizedExpression(node.expression);
110101
+ ts.setOriginalNode(parens, node);
110102
+ ts.setTextRange(parens, parseNode);
110103
+ return parens;
110104
+ }
110105
+ return ts.factory.createParenthesizedExpression(node);
110106
+ }
110107
+ return node;
110108
+ }
110109
+ function parenthesizeExpressionForNoAsiAndDisallowedComma(node) {
110110
+ return parenthesizeExpressionForNoAsi(parenthesizer.parenthesizeExpressionForDisallowedComma(node));
110111
+ }
110068
110112
  function emitReturnStatement(node) {
110069
110113
  emitTokenWithComment(105 /* ReturnKeyword */, node.pos, writeKeyword, /*contextNode*/ node);
110070
- emitExpressionWithLeadingSpace(node.expression);
110114
+ emitExpressionWithLeadingSpace(node.expression && parenthesizeExpressionForNoAsi(node.expression), parenthesizeExpressionForNoAsi);
110071
110115
  writeTrailingSemicolon();
110072
110116
  }
110073
110117
  function emitWithStatement(node) {
@@ -110095,7 +110139,7 @@ var ts;
110095
110139
  }
110096
110140
  function emitThrowStatement(node) {
110097
110141
  emitTokenWithComment(109 /* ThrowKeyword */, node.pos, writeKeyword, node);
110098
- emitExpressionWithLeadingSpace(node.expression);
110142
+ emitExpressionWithLeadingSpace(parenthesizeExpressionForNoAsi(node.expression), parenthesizeExpressionForNoAsi);
110099
110143
  writeTrailingSemicolon();
110100
110144
  }
110101
110145
  function emitTryStatement(node) {
@@ -110939,7 +110983,14 @@ var ts;
110939
110983
  }
110940
110984
  // Transformation nodes
110941
110985
  function emitPartiallyEmittedExpression(node) {
110986
+ var emitFlags = ts.getEmitFlags(node);
110987
+ if (!(emitFlags & 512 /* NoLeadingComments */) && node.pos !== node.expression.pos) {
110988
+ emitTrailingCommentsOfPosition(node.expression.pos);
110989
+ }
110942
110990
  emitExpression(node.expression);
110991
+ if (!(emitFlags & 1024 /* NoTrailingComments */) && node.end !== node.expression.end) {
110992
+ emitLeadingCommentsOfPosition(node.expression.end);
110993
+ }
110943
110994
  }
110944
110995
  function emitCommaList(node) {
110945
110996
  emitExpressionList(node, node.elements, 528 /* CommaListElements */, /*parenthesizerRule*/ undefined);
@@ -111303,10 +111354,8 @@ var ts;
111303
111354
  // Emit this child.
111304
111355
  previousSourceFileTextKind = recordBundleFileInternalSectionStart(child);
111305
111356
  if (shouldEmitInterveningComments) {
111306
- if (emitTrailingCommentsOfPosition) {
111307
- var commentRange = ts.getCommentRange(child);
111308
- emitTrailingCommentsOfPosition(commentRange.pos);
111309
- }
111357
+ var commentRange = ts.getCommentRange(child);
111358
+ emitTrailingCommentsOfPosition(commentRange.pos);
111310
111359
  }
111311
111360
  else {
111312
111361
  shouldEmitInterveningComments = mayEmitInterveningComments;
@@ -111627,7 +111676,7 @@ var ts;
111627
111676
  function writeLineSeparatorsAndIndentBefore(node, parent) {
111628
111677
  var leadingNewlines = preserveSourceNewlines && getLeadingLineTerminatorCount(parent, [node], 0 /* None */);
111629
111678
  if (leadingNewlines) {
111630
- writeLinesAndIndent(leadingNewlines, /*writeLinesIfNotIndenting*/ false);
111679
+ writeLinesAndIndent(leadingNewlines, /*writeSpaceIfNotIndenting*/ false);
111631
111680
  }
111632
111681
  return !!leadingNewlines;
111633
111682
  }
@@ -126005,7 +126054,6 @@ var ts;
126005
126054
  || kind === 165 /* PropertySignature */
126006
126055
  || kind === 167 /* MethodSignature */;
126007
126056
  }
126008
- ts.syntaxRequiresTrailingCommaOrSemicolonOrASI = syntaxRequiresTrailingCommaOrSemicolonOrASI;
126009
126057
  function syntaxRequiresTrailingFunctionBlockOrSemicolonOrASI(kind) {
126010
126058
  return kind === 255 /* FunctionDeclaration */
126011
126059
  || kind === 170 /* Constructor */
@@ -126013,11 +126061,9 @@ var ts;
126013
126061
  || kind === 171 /* GetAccessor */
126014
126062
  || kind === 172 /* SetAccessor */;
126015
126063
  }
126016
- ts.syntaxRequiresTrailingFunctionBlockOrSemicolonOrASI = syntaxRequiresTrailingFunctionBlockOrSemicolonOrASI;
126017
126064
  function syntaxRequiresTrailingModuleBlockOrSemicolonOrASI(kind) {
126018
126065
  return kind === 260 /* ModuleDeclaration */;
126019
126066
  }
126020
- ts.syntaxRequiresTrailingModuleBlockOrSemicolonOrASI = syntaxRequiresTrailingModuleBlockOrSemicolonOrASI;
126021
126067
  function syntaxRequiresTrailingSemicolonOrASI(kind) {
126022
126068
  return kind === 236 /* VariableStatement */
126023
126069
  || kind === 237 /* ExpressionStatement */
@@ -126092,19 +126138,34 @@ var ts;
126092
126138
  ts.forEachChild(sourceFile, function visit(node) {
126093
126139
  if (syntaxRequiresTrailingSemicolonOrASI(node.kind)) {
126094
126140
  var lastToken = node.getLastToken(sourceFile);
126095
- if (lastToken && lastToken.kind === 26 /* SemicolonToken */) {
126141
+ if ((lastToken === null || lastToken === void 0 ? void 0 : lastToken.kind) === 26 /* SemicolonToken */) {
126096
126142
  withSemicolon++;
126097
126143
  }
126098
126144
  else {
126099
126145
  withoutSemicolon++;
126100
126146
  }
126101
126147
  }
126148
+ else if (syntaxRequiresTrailingCommaOrSemicolonOrASI(node.kind)) {
126149
+ var lastToken = node.getLastToken(sourceFile);
126150
+ if ((lastToken === null || lastToken === void 0 ? void 0 : lastToken.kind) === 26 /* SemicolonToken */) {
126151
+ withSemicolon++;
126152
+ }
126153
+ else if (lastToken && lastToken.kind !== 27 /* CommaToken */) {
126154
+ var lastTokenLine = ts.getLineAndCharacterOfPosition(sourceFile, lastToken.getStart(sourceFile)).line;
126155
+ var nextTokenLine = ts.getLineAndCharacterOfPosition(sourceFile, ts.getSpanOfTokenAtPosition(sourceFile, lastToken.end).start).line;
126156
+ // Avoid counting missing semicolon in single-line objects:
126157
+ // `function f(p: { x: string /*no semicolon here is insignificant*/ }) {`
126158
+ if (lastTokenLine !== nextTokenLine) {
126159
+ withoutSemicolon++;
126160
+ }
126161
+ }
126162
+ }
126102
126163
  if (withSemicolon + withoutSemicolon >= nStatementsToObserve) {
126103
126164
  return true;
126104
126165
  }
126105
126166
  return ts.forEachChild(node, visit);
126106
126167
  });
126107
- // One statement missing a semicolon isn’t sufficient evidence to say the user
126168
+ // One statement missing a semicolon isn't sufficient evidence to say the user
126108
126169
  // doesn’t want semicolons, because they may not even be done writing that statement.
126109
126170
  if (withSemicolon === 0 && withoutSemicolon <= 1) {
126110
126171
  return true;
@@ -141970,6 +142031,7 @@ var ts;
141970
142031
  lastTrailingTriviaWasNewLine: function () { return wasNewLine; },
141971
142032
  skipToEndOf: skipToEndOf,
141972
142033
  skipToStartOf: skipToStartOf,
142034
+ getStartPos: function () { var _a; return (_a = lastTokenInfo === null || lastTokenInfo === void 0 ? void 0 : lastTokenInfo.token.pos) !== null && _a !== void 0 ? _a : scanner.getTokenPos(); },
141973
142035
  });
141974
142036
  lastTokenInfo = undefined;
141975
142037
  scanner.setText(undefined);
@@ -142143,8 +142205,7 @@ var ts;
142143
142205
  }
142144
142206
  function isOnToken() {
142145
142207
  var current = lastTokenInfo ? lastTokenInfo.token.kind : scanner.getToken();
142146
- var startPos = lastTokenInfo ? lastTokenInfo.token.pos : scanner.getStartPos();
142147
- return startPos < endPos && current !== 1 /* EndOfFileToken */ && !ts.isTrivia(current);
142208
+ return current !== 1 /* EndOfFileToken */ && !ts.isTrivia(current);
142148
142209
  }
142149
142210
  function isOnEOF() {
142150
142211
  var current = lastTokenInfo ? lastTokenInfo.token.kind : scanner.getToken();
@@ -143332,7 +143393,7 @@ var ts;
143332
143393
  return 0;
143333
143394
  }
143334
143395
  function formatNodeGivenIndentation(node, sourceFileLike, languageVariant, initialIndentation, delta, formatContext) {
143335
- var range = { pos: 0, end: sourceFileLike.text.length };
143396
+ var range = { pos: node.pos, end: node.end };
143336
143397
  return formatting.getFormattingScanner(sourceFileLike.text, languageVariant, range.pos, range.end, function (scanner) { return formatSpanWorker(range, node, initialIndentation, delta, scanner, formatContext, 1 /* FormatSelection */, function (_) { return false; }, // assume that node does not have any errors
143337
143398
  sourceFileLike); });
143338
143399
  }
@@ -143383,6 +143444,15 @@ var ts;
143383
143444
  }
143384
143445
  }
143385
143446
  }
143447
+ if (previousRange && formattingScanner.getStartPos() >= originalRange.end) {
143448
+ var token = formattingScanner.isOnEOF() ? formattingScanner.readEOFTokenRange() :
143449
+ formattingScanner.isOnToken() ? formattingScanner.readTokenInfo(enclosingNode).token :
143450
+ undefined;
143451
+ if (token) {
143452
+ processPair(token, sourceFile.getLineAndCharacterOfPosition(token.pos).line, enclosingNode, previousRange, previousRangeStartLine, previousParent, enclosingNode,
143453
+ /*dynamicIndentation*/ undefined);
143454
+ }
143455
+ }
143386
143456
  return edits;
143387
143457
  // local functions
143388
143458
  /** Tries to compute the indentation for a list element.
@@ -143565,19 +143635,13 @@ var ts;
143565
143635
  processChildNodes(nodes, node, nodeStartLine, nodeDynamicIndentation);
143566
143636
  });
143567
143637
  // proceed any tokens in the node that are located after child nodes
143568
- while (formattingScanner.isOnToken()) {
143638
+ while (formattingScanner.isOnToken() && formattingScanner.getStartPos() < originalRange.end) {
143569
143639
  var tokenInfo = formattingScanner.readTokenInfo(node);
143570
- if (tokenInfo.token.end > node.end) {
143640
+ if (tokenInfo.token.end > Math.min(node.end, originalRange.end)) {
143571
143641
  break;
143572
143642
  }
143573
143643
  consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation, node);
143574
143644
  }
143575
- if (!node.parent && formattingScanner.isOnEOF()) {
143576
- var token = formattingScanner.readEOFTokenRange();
143577
- if (token.end <= node.end && previousRange) {
143578
- processPair(token, sourceFile.getLineAndCharacterOfPosition(token.pos).line, node, previousRange, previousRangeStartLine, previousParent, contextNode, nodeDynamicIndentation);
143579
- }
143580
- }
143581
143645
  function processChildNode(child, inheritedIndentation, parent, parentDynamicIndentation, parentStartLine, undecoratedParentStartLine, isListItem, isFirstListItem) {
143582
143646
  var childStartPos = child.getStart(sourceFile);
143583
143647
  var childStartLine = sourceFile.getLineAndCharacterOfPosition(childStartPos).line;
@@ -143603,9 +143667,12 @@ var ts;
143603
143667
  if (child.getFullWidth() === 0) {
143604
143668
  return inheritedIndentation;
143605
143669
  }
143606
- while (formattingScanner.isOnToken()) {
143670
+ while (formattingScanner.isOnToken() && formattingScanner.getStartPos() < originalRange.end) {
143607
143671
  // proceed any parent tokens that are located prior to child.getStart()
143608
143672
  var tokenInfo = formattingScanner.readTokenInfo(node);
143673
+ if (tokenInfo.token.end > originalRange.end) {
143674
+ return inheritedIndentation;
143675
+ }
143609
143676
  if (tokenInfo.token.end > childStartPos) {
143610
143677
  if (tokenInfo.token.pos > childStartPos) {
143611
143678
  formattingScanner.skipToStartOf(child);
@@ -143615,7 +143682,7 @@ var ts;
143615
143682
  }
143616
143683
  consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, node);
143617
143684
  }
143618
- if (!formattingScanner.isOnToken()) {
143685
+ if (!formattingScanner.isOnToken() || formattingScanner.getStartPos() >= originalRange.end) {
143619
143686
  return inheritedIndentation;
143620
143687
  }
143621
143688
  if (ts.isToken(child)) {
@@ -143644,7 +143711,7 @@ var ts;
143644
143711
  var startLine = parentStartLine;
143645
143712
  if (listStartToken !== 0 /* Unknown */) {
143646
143713
  // introduce a new indentation scope for lists (including list start and end tokens)
143647
- while (formattingScanner.isOnToken()) {
143714
+ while (formattingScanner.isOnToken() && formattingScanner.getStartPos() < originalRange.end) {
143648
143715
  var tokenInfo = formattingScanner.readTokenInfo(parent);
143649
143716
  if (tokenInfo.token.end > nodes.pos) {
143650
143717
  // stop when formatting scanner moves past the beginning of node list
@@ -143680,7 +143747,7 @@ var ts;
143680
143747
  inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, startLine, startLine, /*isListItem*/ true, /*isFirstListItem*/ i === 0);
143681
143748
  }
143682
143749
  var listEndToken = getCloseTokenForOpenToken(listStartToken);
143683
- if (listEndToken !== 0 /* Unknown */ && formattingScanner.isOnToken()) {
143750
+ if (listEndToken !== 0 /* Unknown */ && formattingScanner.isOnToken() && formattingScanner.getStartPos() < originalRange.end) {
143684
143751
  var tokenInfo = formattingScanner.readTokenInfo(parent);
143685
143752
  if (tokenInfo.token.kind === 27 /* CommaToken */ && ts.isCallLikeExpression(parent)) {
143686
143753
  var commaTokenLine = sourceFile.getLineAndCharacterOfPosition(tokenInfo.token.pos).line;
@@ -143811,24 +143878,26 @@ var ts;
143811
143878
  // win in a conflict with lower priority rules.
143812
143879
  ts.forEachRight(rules, function (rule) {
143813
143880
  lineAction = applyRuleEdits(rule, previousItem, previousStartLine, currentItem, currentStartLine);
143814
- switch (lineAction) {
143815
- case 2 /* LineRemoved */:
143816
- // Handle the case where the next line is moved to be the end of this line.
143817
- // In this case we don't indent the next line in the next pass.
143818
- if (currentParent.getStart(sourceFile) === currentItem.pos) {
143819
- dynamicIndentation.recomputeIndentation(/*lineAddedByFormatting*/ false, contextNode);
143820
- }
143821
- break;
143822
- case 1 /* LineAdded */:
143823
- // Handle the case where token2 is moved to the new line.
143824
- // In this case we indent token2 in the next pass but we set
143825
- // sameLineIndent flag to notify the indenter that the indentation is within the line.
143826
- if (currentParent.getStart(sourceFile) === currentItem.pos) {
143827
- dynamicIndentation.recomputeIndentation(/*lineAddedByFormatting*/ true, contextNode);
143828
- }
143829
- break;
143830
- default:
143831
- ts.Debug.assert(lineAction === 0 /* None */);
143881
+ if (dynamicIndentation) {
143882
+ switch (lineAction) {
143883
+ case 2 /* LineRemoved */:
143884
+ // Handle the case where the next line is moved to be the end of this line.
143885
+ // In this case we don't indent the next line in the next pass.
143886
+ if (currentParent.getStart(sourceFile) === currentItem.pos) {
143887
+ dynamicIndentation.recomputeIndentation(/*lineAddedByFormatting*/ false, contextNode);
143888
+ }
143889
+ break;
143890
+ case 1 /* LineAdded */:
143891
+ // Handle the case where token2 is moved to the new line.
143892
+ // In this case we indent token2 in the next pass but we set
143893
+ // sameLineIndent flag to notify the indenter that the indentation is within the line.
143894
+ if (currentParent.getStart(sourceFile) === currentItem.pos) {
143895
+ dynamicIndentation.recomputeIndentation(/*lineAddedByFormatting*/ true, contextNode);
143896
+ }
143897
+ break;
143898
+ default:
143899
+ ts.Debug.assert(lineAction === 0 /* None */);
143900
+ }
143832
143901
  }
143833
143902
  // We need to trim trailing whitespace between the tokens if they were on different lines, and no rule was applied to put them on the same line
143834
143903
  trimTrailingWhitespaces = trimTrailingWhitespaces && !(rule.action & 16 /* DeleteSpace */) && rule.flags !== 1 /* CanDeleteNewLines */;
@@ -146306,7 +146375,7 @@ var ts;
146306
146375
  var errorCodes = [ts.Diagnostics.Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the_other_If_this_was_intentional_convert_the_expression_to_unknown_first.code];
146307
146376
  codefix.registerCodeFix({
146308
146377
  errorCodes: errorCodes,
146309
- getCodeActions: function (context) {
146378
+ getCodeActions: function getCodeActionsToAddConvertToUnknownForNonOverlappingTypes(context) {
146310
146379
  var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return makeChange(t, context.sourceFile, context.span.start); });
146311
146380
  return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_unknown_conversion_for_non_overlapping_types, fixId, ts.Diagnostics.Add_unknown_to_all_conversions_of_non_overlapping_types)];
146312
146381
  },
@@ -146333,7 +146402,7 @@ var ts;
146333
146402
  ts.Diagnostics.await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module.code,
146334
146403
  ts.Diagnostics.for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module.code,
146335
146404
  ],
146336
- getCodeActions: function (context) {
146405
+ getCodeActions: function getCodeActionsToAddEmptyExportDeclaration(context) {
146337
146406
  var sourceFile = context.sourceFile;
146338
146407
  var changes = ts.textChanges.ChangeTracker.with(context, function (changes) {
146339
146408
  var exportDeclaration = ts.factory.createExportDeclaration(
@@ -146362,7 +146431,7 @@ var ts;
146362
146431
  codefix.registerCodeFix({
146363
146432
  fixIds: [fixId],
146364
146433
  errorCodes: errorCodes,
146365
- getCodeActions: function (context) {
146434
+ getCodeActions: function getCodeActionsToAddMissingAsync(context) {
146366
146435
  var sourceFile = context.sourceFile, errorCode = context.errorCode, cancellationToken = context.cancellationToken, program = context.program, span = context.span;
146367
146436
  var diagnostic = ts.find(program.getDiagnosticsProducingTypeChecker().getDiagnostics(sourceFile, cancellationToken), getIsMatchingAsyncError(span, errorCode));
146368
146437
  var directSpan = diagnostic && diagnostic.relatedInformation && ts.find(diagnostic.relatedInformation, function (r) { return r.code === ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async.code; });
@@ -146459,7 +146528,7 @@ var ts;
146459
146528
  codefix.registerCodeFix({
146460
146529
  fixIds: [fixId],
146461
146530
  errorCodes: errorCodes,
146462
- getCodeActions: function (context) {
146531
+ getCodeActions: function getCodeActionsToAddMissingAwait(context) {
146463
146532
  var sourceFile = context.sourceFile, errorCode = context.errorCode, span = context.span, cancellationToken = context.cancellationToken, program = context.program;
146464
146533
  var expression = getAwaitErrorSpanExpression(sourceFile, errorCode, span, cancellationToken, program);
146465
146534
  if (!expression) {
@@ -146691,7 +146760,7 @@ var ts;
146691
146760
  ];
146692
146761
  codefix.registerCodeFix({
146693
146762
  errorCodes: errorCodes,
146694
- getCodeActions: function (context) {
146763
+ getCodeActions: function getCodeActionsToAddMissingConst(context) {
146695
146764
  var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return makeChange(t, context.sourceFile, context.span.start, context.program); });
146696
146765
  if (changes.length > 0) {
146697
146766
  return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_const_to_unresolved_variable, fixId, ts.Diagnostics.Add_const_to_all_unresolved_variables)];
@@ -146791,7 +146860,7 @@ var ts;
146791
146860
  ];
146792
146861
  codefix.registerCodeFix({
146793
146862
  errorCodes: errorCodes,
146794
- getCodeActions: function (context) {
146863
+ getCodeActions: function getCodeActionsToAddMissingDeclareOnProperty(context) {
146795
146864
  var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return makeChange(t, context.sourceFile, context.span.start); });
146796
146865
  if (changes.length > 0) {
146797
146866
  return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Prefix_with_declare, fixId, ts.Diagnostics.Prefix_all_incorrect_property_declarations_with_declare)];
@@ -146825,7 +146894,7 @@ var ts;
146825
146894
  var errorCodes = [ts.Diagnostics._0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write_0.code];
146826
146895
  codefix.registerCodeFix({
146827
146896
  errorCodes: errorCodes,
146828
- getCodeActions: function (context) {
146897
+ getCodeActions: function getCodeActionsToAddMissingInvocationForDecorator(context) {
146829
146898
  var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return makeChange(t, context.sourceFile, context.span.start); });
146830
146899
  return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Call_decorator_expression, fixId, ts.Diagnostics.Add_to_all_uncalled_decorators)];
146831
146900
  },
@@ -146850,7 +146919,7 @@ var ts;
146850
146919
  var errorCodes = [ts.Diagnostics.Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1.code];
146851
146920
  codefix.registerCodeFix({
146852
146921
  errorCodes: errorCodes,
146853
- getCodeActions: function (context) {
146922
+ getCodeActions: function getCodeActionsToAddNameToNamelessParameter(context) {
146854
146923
  var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return makeChange(t, context.sourceFile, context.span.start); });
146855
146924
  return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_parameter_name, fixId, ts.Diagnostics.Add_names_to_all_parameters_without_names)];
146856
146925
  },
@@ -148652,14 +148721,14 @@ var ts;
148652
148721
  var fixId = "convertToTypeOnlyExport";
148653
148722
  codefix.registerCodeFix({
148654
148723
  errorCodes: errorCodes,
148655
- getCodeActions: function (context) {
148724
+ getCodeActions: function getCodeActionsToConvertToTypeOnlyExport(context) {
148656
148725
  var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return fixSingleExportDeclaration(t, getExportSpecifierForDiagnosticSpan(context.span, context.sourceFile), context); });
148657
148726
  if (changes.length) {
148658
148727
  return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Convert_to_type_only_export, fixId, ts.Diagnostics.Convert_all_re_exported_types_to_type_only_exports)];
148659
148728
  }
148660
148729
  },
148661
148730
  fixIds: [fixId],
148662
- getAllCodeActions: function (context) {
148731
+ getAllCodeActions: function getAllCodeActionsToConvertToTypeOnlyExport(context) {
148663
148732
  var fixedExportDeclarations = new ts.Map();
148664
148733
  return codefix.codeFixAll(context, errorCodes, function (changes, diag) {
148665
148734
  var exportSpecifier = getExportSpecifierForDiagnosticSpan(diag, context.sourceFile);
@@ -148720,7 +148789,7 @@ var ts;
148720
148789
  var fixId = "convertToTypeOnlyImport";
148721
148790
  codefix.registerCodeFix({
148722
148791
  errorCodes: errorCodes,
148723
- getCodeActions: function (context) {
148792
+ getCodeActions: function getCodeActionsToConvertToTypeOnlyImport(context) {
148724
148793
  var changes = ts.textChanges.ChangeTracker.with(context, function (t) {
148725
148794
  var importDeclaration = getImportDeclarationForDiagnosticSpan(context.span, context.sourceFile);
148726
148795
  fixSingleImportDeclaration(t, importDeclaration, context);
@@ -148730,7 +148799,7 @@ var ts;
148730
148799
  }
148731
148800
  },
148732
148801
  fixIds: [fixId],
148733
- getAllCodeActions: function (context) {
148802
+ getAllCodeActions: function getAllCodeActionsToConvertToTypeOnlyImport(context) {
148734
148803
  return codefix.codeFixAll(context, errorCodes, function (changes, diag) {
148735
148804
  var importDeclaration = getImportDeclarationForDiagnosticSpan(diag, context.sourceFile);
148736
148805
  fixSingleImportDeclaration(changes, importDeclaration, context);
@@ -148769,7 +148838,7 @@ var ts;
148769
148838
  var errorCodes = [ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0.code];
148770
148839
  codefix.registerCodeFix({
148771
148840
  errorCodes: errorCodes,
148772
- getCodeActions: function (context) {
148841
+ getCodeActions: function getCodeActionsToConvertLiteralTypeToMappedType(context) {
148773
148842
  var sourceFile = context.sourceFile, span = context.span;
148774
148843
  var info = getInfo(sourceFile, span.start);
148775
148844
  if (!info) {
@@ -149913,7 +149982,7 @@ var ts;
149913
149982
  _a);
149914
149983
  codefix.registerCodeFix({
149915
149984
  errorCodes: errorCodes,
149916
- getCodeActions: function (context) {
149985
+ getCodeActions: function getCodeActionsToFixOverrideModifierIssues(context) {
149917
149986
  var errorCode = context.errorCode, span = context.span;
149918
149987
  var info = errorCodeFixIdMap[errorCode];
149919
149988
  if (!info)
@@ -150109,7 +150178,7 @@ var ts;
150109
150178
  ];
150110
150179
  codefix.registerCodeFix({
150111
150180
  errorCodes: errorCodes,
150112
- getCodeActions: function (context) {
150181
+ getCodeActions: function getCodeActionsToFixIncorrectNamedTupleSyntax(context) {
150113
150182
  var sourceFile = context.sourceFile, span = context.span;
150114
150183
  var namedTupleMember = getNamedTupleMember(sourceFile, span.start);
150115
150184
  var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, namedTupleMember); });
@@ -150308,7 +150377,7 @@ var ts;
150308
150377
  codefix.registerCodeFix({
150309
150378
  errorCodes: errorCodes,
150310
150379
  fixIds: [fixIdAddReturnStatement, fixRemoveBracesFromArrowFunctionBody, fixIdWrapTheBlockWithParen],
150311
- getCodeActions: function (context) {
150380
+ getCodeActions: function getCodeActionsToCorrectReturnValue(context) {
150312
150381
  var program = context.program, sourceFile = context.sourceFile, start = context.span.start, errorCode = context.errorCode;
150313
150382
  var info = getInfo(program.getTypeChecker(), sourceFile, start, errorCode);
150314
150383
  if (!info)
@@ -151058,7 +151127,7 @@ var ts;
151058
151127
  ];
151059
151128
  codefix.registerCodeFix({
151060
151129
  errorCodes: errorCodes,
151061
- getCodeActions: function (context) {
151130
+ getCodeActions: function getCodeActionsToFixNotFoundModule(context) {
151062
151131
  var host = context.host, sourceFile = context.sourceFile, start = context.span.start;
151063
151132
  var packageName = tryGetImportedPackageName(sourceFile, start);
151064
151133
  if (packageName === undefined)
@@ -151119,7 +151188,7 @@ var ts;
151119
151188
  var fixId = "fixClassDoesntImplementInheritedAbstractMember";
151120
151189
  codefix.registerCodeFix({
151121
151190
  errorCodes: errorCodes,
151122
- getCodeActions: function (context) {
151191
+ getCodeActions: function getCodeActionsToFixClassNotImplementingInheritedMembers(context) {
151123
151192
  var sourceFile = context.sourceFile, span = context.span;
151124
151193
  var changes = ts.textChanges.ChangeTracker.with(context, function (t) {
151125
151194
  return addMissingMembers(getClass(sourceFile, span.start), sourceFile, context, t, context.preferences);
@@ -151127,7 +151196,7 @@ var ts;
151127
151196
  return changes.length === 0 ? undefined : [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Implement_inherited_abstract_class, fixId, ts.Diagnostics.Implement_all_inherited_abstract_classes)];
151128
151197
  },
151129
151198
  fixIds: [fixId],
151130
- getAllCodeActions: function (context) {
151199
+ getAllCodeActions: function getAllCodeActionsToFixClassDoesntImplementInheritedAbstractMember(context) {
151131
151200
  var seenClassDeclarations = new ts.Map();
151132
151201
  return codefix.codeFixAll(context, errorCodes, function (changes, diag) {
151133
151202
  var classDeclaration = getClass(diag.file, diag.start);
@@ -151260,7 +151329,7 @@ var ts;
151260
151329
  ];
151261
151330
  codefix.registerCodeFix({
151262
151331
  errorCodes: errorCodes,
151263
- getCodeActions: function (context) {
151332
+ getCodeActions: function getCodeActionsToEnableExperimentalDecorators(context) {
151264
151333
  var configFile = context.program.getCompilerOptions().configFile;
151265
151334
  if (configFile === undefined) {
151266
151335
  return undefined;
@@ -151291,7 +151360,7 @@ var ts;
151291
151360
  var errorCodes = [ts.Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided.code];
151292
151361
  codefix.registerCodeFix({
151293
151362
  errorCodes: errorCodes,
151294
- getCodeActions: function (context) {
151363
+ getCodeActions: function getCodeActionsToFixEnableJsxFlag(context) {
151295
151364
  var configFile = context.program.getCompilerOptions().configFile;
151296
151365
  if (configFile === undefined) {
151297
151366
  return undefined;
@@ -151329,7 +151398,7 @@ var ts;
151329
151398
  ts.Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher.code,
151330
151399
  ts.Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher.code,
151331
151400
  ],
151332
- getCodeActions: function (context) {
151401
+ getCodeActions: function getCodeActionsToFixModuleAndTarget(context) {
151333
151402
  var compilerOptions = context.program.getCompilerOptions();
151334
151403
  var configFile = compilerOptions.configFile;
151335
151404
  if (configFile === undefined) {
@@ -152101,7 +152170,7 @@ var ts;
152101
152170
  return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_async_modifier_to_containing_function, fixId, ts.Diagnostics.Add_all_missing_async_modifiers)];
152102
152171
  },
152103
152172
  fixIds: [fixId],
152104
- getAllCodeActions: function (context) {
152173
+ getAllCodeActions: function getAllCodeActionsToFixAwaitInSyncFunction(context) {
152105
152174
  var seen = new ts.Map();
152106
152175
  return codefix.codeFixAll(context, errorCodes, function (changes, diag) {
152107
152176
  var nodes = getNodes(diag.file, diag.start);
@@ -153223,7 +153292,7 @@ var ts;
153223
153292
  codefix.registerCodeFix({
153224
153293
  errorCodes: errorCodes,
153225
153294
  fixIds: [fixId],
153226
- getCodeActions: function (context) {
153295
+ getCodeActions: function getCodeActionsToFixReturnTypeInAsyncFunction(context) {
153227
153296
  var sourceFile = context.sourceFile, program = context.program, span = context.span;
153228
153297
  var checker = program.getTypeChecker();
153229
153298
  var info = getInfo(sourceFile, program.getTypeChecker(), span.start);
@@ -153277,7 +153346,7 @@ var ts;
153277
153346
  });
153278
153347
  codefix.registerCodeFix({
153279
153348
  errorCodes: errorCodes,
153280
- getCodeActions: function (context) {
153349
+ getCodeActions: function getCodeActionsToDisableJsDiagnostics(context) {
153281
153350
  var sourceFile = context.sourceFile, program = context.program, span = context.span, host = context.host, formatContext = context.formatContext;
153282
153351
  if (!ts.isInJSFile(sourceFile) || !ts.isCheckJsEnabledForFile(sourceFile, program.getCompilerOptions())) {
153283
153352
  return undefined;
@@ -154046,7 +154115,7 @@ var ts;
154046
154115
  var errorCodes = [ts.Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor.code];
154047
154116
  codefix.registerCodeFix({
154048
154117
  errorCodes: errorCodes,
154049
- getCodeActions: function (context) {
154118
+ getCodeActions: function getCodeActionsForStrictClassInitializationErrors(context) {
154050
154119
  var propertyDeclaration = getPropertyDeclaration(context.sourceFile, context.span.start);
154051
154120
  if (!propertyDeclaration)
154052
154121
  return;
@@ -154269,7 +154338,7 @@ var ts;
154269
154338
  ];
154270
154339
  codefix.registerCodeFix({
154271
154340
  errorCodes: errorCodes,
154272
- getCodeActions: function (context) {
154341
+ getCodeActions: function getCodeActionsToUseBigintLiteral(context) {
154273
154342
  var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return makeChange(t, context.sourceFile, context.span); });
154274
154343
  if (changes.length > 0) {
154275
154344
  return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Convert_to_a_bigint_numeric_literal, fixId, ts.Diagnostics.Convert_all_to_bigint_numeric_literals)];
@@ -154301,7 +154370,7 @@ var ts;
154301
154370
  var errorCodes = [ts.Diagnostics.Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0.code];
154302
154371
  codefix.registerCodeFix({
154303
154372
  errorCodes: errorCodes,
154304
- getCodeActions: function (context) {
154373
+ getCodeActions: function getCodeActionsToAddMissingTypeof(context) {
154305
154374
  var sourceFile = context.sourceFile, span = context.span;
154306
154375
  var importType = getImportTypeNode(sourceFile, span.start);
154307
154376
  var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, importType); });
@@ -154333,7 +154402,7 @@ var ts;
154333
154402
  var errorCodes = [ts.Diagnostics.JSX_expressions_must_have_one_parent_element.code];
154334
154403
  codefix.registerCodeFix({
154335
154404
  errorCodes: errorCodes,
154336
- getCodeActions: function (context) {
154405
+ getCodeActions: function getCodeActionsToWrapJsxInFragment(context) {
154337
154406
  var sourceFile = context.sourceFile, span = context.span;
154338
154407
  var node = findNodeToFix(sourceFile, span.start);
154339
154408
  if (!node)
@@ -154405,12 +154474,11 @@ var ts;
154405
154474
  (function (ts) {
154406
154475
  var codefix;
154407
154476
  (function (codefix) {
154408
- var fixIdAddMissingTypeof = "fixConvertToMappedObjectType";
154409
- var fixId = fixIdAddMissingTypeof;
154477
+ var fixId = "fixConvertToMappedObjectType";
154410
154478
  var errorCodes = [ts.Diagnostics.An_index_signature_parameter_type_cannot_be_a_literal_type_or_generic_type_Consider_using_a_mapped_object_type_instead.code];
154411
154479
  codefix.registerCodeFix({
154412
154480
  errorCodes: errorCodes,
154413
- getCodeActions: function (context) {
154481
+ getCodeActions: function getCodeActionsToConvertToMappedTypeObject(context) {
154414
154482
  var sourceFile = context.sourceFile, span = context.span;
154415
154483
  var info = getInfo(sourceFile, span.start);
154416
154484
  if (!info)
@@ -154489,7 +154557,7 @@ var ts;
154489
154557
  ];
154490
154558
  codefix.registerCodeFix({
154491
154559
  errorCodes: errorCodes,
154492
- getCodeActions: function (context) {
154560
+ getCodeActions: function getCodeActionsToRemoveUnnecessaryAwait(context) {
154493
154561
  var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return makeChange(t, context.sourceFile, context.span); });
154494
154562
  if (changes.length > 0) {
154495
154563
  return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Remove_unnecessary_await, fixId, ts.Diagnostics.Remove_all_unnecessary_uses_of_await)];
@@ -154531,7 +154599,7 @@ var ts;
154531
154599
  codefix.registerCodeFix({
154532
154600
  errorCodes: errorCodes,
154533
154601
  fixIds: [fixId],
154534
- getCodeActions: function (context) {
154602
+ getCodeActions: function getCodeActionsToSplitTypeOnlyImport(context) {
154535
154603
  var changes = ts.textChanges.ChangeTracker.with(context, function (t) {
154536
154604
  return splitTypeOnlyImport(t, getImportDeclaration(context.sourceFile, context.span), context);
154537
154605
  });
@@ -154567,7 +154635,7 @@ var ts;
154567
154635
  var errorCodes = [ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_constant.code];
154568
154636
  codefix.registerCodeFix({
154569
154637
  errorCodes: errorCodes,
154570
- getCodeActions: function (context) {
154638
+ getCodeActions: function getCodeActionsToConvertConstToLet(context) {
154571
154639
  var sourceFile = context.sourceFile, span = context.span, program = context.program;
154572
154640
  var range = getConstTokenRange(sourceFile, span.start, program);
154573
154641
  if (range === undefined)