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/tsc.js CHANGED
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
69
69
  var ts;
70
70
  (function (ts) {
71
71
  ts.versionMajorMinor = "4.6";
72
- ts.version = ts.versionMajorMinor + ".0-dev.20211124";
72
+ ts.version = ts.versionMajorMinor + ".0-dev.20211201";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  function tryGetNativeMap() {
@@ -27071,7 +27071,7 @@ var ts;
27071
27071
  if (type && !allowAmbiguity && typeHasArrowFunctionBlockingParseError(type)) {
27072
27072
  return undefined;
27073
27073
  }
27074
- var hasJSDocFunctionType = type && ts.isJSDocFunctionType(type);
27074
+ var hasJSDocFunctionType = type && (ts.isJSDocFunctionType(type) || ts.isParenthesizedTypeNode(type) && ts.isJSDocFunctionType(type.type));
27075
27075
  if (!allowAmbiguity && token() !== 38 && (hasJSDocFunctionType || token() !== 18)) {
27076
27076
  return undefined;
27077
27077
  }
@@ -76099,9 +76099,6 @@ var ts;
76099
76099
  var innerExpression = ts.skipOuterExpressions(node.expression, ~6);
76100
76100
  if (ts.isAssertionExpression(innerExpression)) {
76101
76101
  var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
76102
- if (ts.length(ts.getLeadingCommentRangesOfNode(expression, currentSourceFile))) {
76103
- return factory.updateParenthesizedExpression(node, expression);
76104
- }
76105
76102
  return factory.createPartiallyEmittedExpression(expression, node);
76106
76103
  }
76107
76104
  return ts.visitEachChild(node, visitor, context);
@@ -79201,11 +79198,11 @@ var ts;
79201
79198
  }
79202
79199
  function visitOptionalExpression(node, captureThisArg, isDelete) {
79203
79200
  var _a = flattenChain(node), expression = _a.expression, chain = _a.chain;
79204
- var left = visitNonOptionalExpression(expression, ts.isCallChain(chain[0]), false);
79201
+ var left = visitNonOptionalExpression(ts.skipPartiallyEmittedExpressions(expression), ts.isCallChain(chain[0]), false);
79205
79202
  var leftThisArg = ts.isSyntheticReference(left) ? left.thisArg : undefined;
79206
- var leftExpression = ts.isSyntheticReference(left) ? left.expression : left;
79207
- var capturedLeft = leftExpression;
79208
- if (!ts.isSimpleCopiableExpression(leftExpression)) {
79203
+ var capturedLeft = ts.isSyntheticReference(left) ? left.expression : left;
79204
+ var leftExpression = factory.restoreOuterExpressions(expression, capturedLeft, 8);
79205
+ if (!ts.isSimpleCopiableExpression(capturedLeft)) {
79209
79206
  capturedLeft = factory.createTempVariable(hoistVariableDeclaration);
79210
79207
  leftExpression = factory.createAssignment(capturedLeft, leftExpression);
79211
79208
  }
@@ -79231,6 +79228,10 @@ var ts;
79231
79228
  break;
79232
79229
  case 207:
79233
79230
  if (i === 0 && leftThisArg) {
79231
+ if (!ts.isGeneratedIdentifier(leftThisArg)) {
79232
+ leftThisArg = factory.cloneNode(leftThisArg);
79233
+ ts.addEmitFlags(leftThisArg, 1536);
79234
+ }
79234
79235
  rightExpression = factory.createFunctionCallCall(rightExpression, leftThisArg.kind === 106 ? factory.createThis() : leftThisArg, ts.visitNodes(segment.arguments, visitor, ts.isExpression));
79235
79236
  }
79236
79237
  else {
@@ -90156,7 +90157,7 @@ var ts;
90156
90157
  function emitYieldExpression(node) {
90157
90158
  emitTokenWithComment(125, node.pos, writeKeyword, node);
90158
90159
  emit(node.asteriskToken);
90159
- emitExpressionWithLeadingSpace(node.expression, parenthesizer.parenthesizeExpressionForDisallowedComma);
90160
+ emitExpressionWithLeadingSpace(node.expression && parenthesizeExpressionForNoAsi(node.expression), parenthesizeExpressionForNoAsiAndDisallowedComma);
90160
90161
  }
90161
90162
  function emitSpreadElement(node) {
90162
90163
  emitTokenWithComment(25, node.pos, writePunctuation, node);
@@ -90343,9 +90344,44 @@ var ts;
90343
90344
  }
90344
90345
  return pos;
90345
90346
  }
90347
+ function commentWillEmitNewLine(node) {
90348
+ return node.kind === 2 || !!node.hasTrailingNewLine;
90349
+ }
90350
+ function willEmitLeadingNewLine(node) {
90351
+ if (!currentSourceFile)
90352
+ return false;
90353
+ if (ts.some(ts.getLeadingCommentRanges(currentSourceFile.text, node.pos), commentWillEmitNewLine))
90354
+ return true;
90355
+ if (ts.some(ts.getSyntheticLeadingComments(node), commentWillEmitNewLine))
90356
+ return true;
90357
+ if (ts.isPartiallyEmittedExpression(node)) {
90358
+ if (node.pos !== node.expression.pos) {
90359
+ if (ts.some(ts.getTrailingCommentRanges(currentSourceFile.text, node.expression.pos), commentWillEmitNewLine))
90360
+ return true;
90361
+ }
90362
+ return willEmitLeadingNewLine(node.expression);
90363
+ }
90364
+ return false;
90365
+ }
90366
+ function parenthesizeExpressionForNoAsi(node) {
90367
+ if (!commentsDisabled && ts.isPartiallyEmittedExpression(node) && willEmitLeadingNewLine(node)) {
90368
+ var parseNode = ts.getParseTreeNode(node);
90369
+ if (parseNode && ts.isParenthesizedExpression(parseNode)) {
90370
+ var parens = ts.factory.createParenthesizedExpression(node.expression);
90371
+ ts.setOriginalNode(parens, node);
90372
+ ts.setTextRange(parens, parseNode);
90373
+ return parens;
90374
+ }
90375
+ return ts.factory.createParenthesizedExpression(node);
90376
+ }
90377
+ return node;
90378
+ }
90379
+ function parenthesizeExpressionForNoAsiAndDisallowedComma(node) {
90380
+ return parenthesizeExpressionForNoAsi(parenthesizer.parenthesizeExpressionForDisallowedComma(node));
90381
+ }
90346
90382
  function emitReturnStatement(node) {
90347
90383
  emitTokenWithComment(105, node.pos, writeKeyword, node);
90348
- emitExpressionWithLeadingSpace(node.expression);
90384
+ emitExpressionWithLeadingSpace(node.expression && parenthesizeExpressionForNoAsi(node.expression), parenthesizeExpressionForNoAsi);
90349
90385
  writeTrailingSemicolon();
90350
90386
  }
90351
90387
  function emitWithStatement(node) {
@@ -90373,7 +90409,7 @@ var ts;
90373
90409
  }
90374
90410
  function emitThrowStatement(node) {
90375
90411
  emitTokenWithComment(109, node.pos, writeKeyword, node);
90376
- emitExpressionWithLeadingSpace(node.expression);
90412
+ emitExpressionWithLeadingSpace(parenthesizeExpressionForNoAsi(node.expression), parenthesizeExpressionForNoAsi);
90377
90413
  writeTrailingSemicolon();
90378
90414
  }
90379
90415
  function emitTryStatement(node) {
@@ -91173,7 +91209,14 @@ var ts;
91173
91209
  popNameGenerationScope(node);
91174
91210
  }
91175
91211
  function emitPartiallyEmittedExpression(node) {
91212
+ var emitFlags = ts.getEmitFlags(node);
91213
+ if (!(emitFlags & 512) && node.pos !== node.expression.pos) {
91214
+ emitTrailingCommentsOfPosition(node.expression.pos);
91215
+ }
91176
91216
  emitExpression(node.expression);
91217
+ if (!(emitFlags & 1024) && node.end !== node.expression.end) {
91218
+ emitLeadingCommentsOfPosition(node.expression.end);
91219
+ }
91177
91220
  }
91178
91221
  function emitCommaList(node) {
91179
91222
  emitExpressionList(node, node.elements, 528, undefined);
@@ -91512,10 +91555,8 @@ var ts;
91512
91555
  }
91513
91556
  previousSourceFileTextKind = recordBundleFileInternalSectionStart(child);
91514
91557
  if (shouldEmitInterveningComments) {
91515
- if (emitTrailingCommentsOfPosition) {
91516
- var commentRange = ts.getCommentRange(child);
91517
- emitTrailingCommentsOfPosition(commentRange.pos);
91518
- }
91558
+ var commentRange = ts.getCommentRange(child);
91559
+ emitTrailingCommentsOfPosition(commentRange.pos);
91519
91560
  }
91520
91561
  else {
91521
91562
  shouldEmitInterveningComments = mayEmitInterveningComments;