@typescript-deploys/pr-build 4.6.0-pr-47183-2 → 4.6.0-pr-47126-2

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.
@@ -297,6 +297,7 @@ declare namespace Intl {
297
297
  };
298
298
 
299
299
  interface DisplayNamesOptions {
300
+ locale: UnicodeBCP47LocaleIdentifier;
300
301
  localeMatcher: RelativeTimeFormatLocaleMatcher;
301
302
  style: RelativeTimeFormatStyle;
302
303
  type: "language" | "region" | "script" | "currency";
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-insiders.20211217";
72
+ ts.version = ts.versionMajorMinor + ".0-insiders.20220107";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  function tryGetNativeMap() {
@@ -17785,7 +17785,7 @@ var ts;
17785
17785
  result.push(createModifier(144));
17786
17786
  if (flags & 256)
17787
17787
  result.push(createModifier(131));
17788
- return result;
17788
+ return result.length ? result : undefined;
17789
17789
  }
17790
17790
  function createQualifiedName(left, right) {
17791
17791
  var node = createBaseNode(160);
@@ -21036,32 +21036,36 @@ var ts;
21036
21036
  }
21037
21037
  function updateModifiers(node, modifiers) {
21038
21038
  var _a;
21039
+ var modifierArray;
21039
21040
  if (typeof modifiers === "number") {
21040
- modifiers = createModifiersFromModifierFlags(modifiers);
21041
- }
21042
- return ts.isParameter(node) ? updateParameterDeclaration(node, node.decorators, modifiers, node.dotDotDotToken, node.name, node.questionToken, node.type, node.initializer) :
21043
- ts.isPropertySignature(node) ? updatePropertySignature(node, modifiers, node.name, node.questionToken, node.type) :
21044
- ts.isPropertyDeclaration(node) ? updatePropertyDeclaration(node, node.decorators, modifiers, node.name, (_a = node.questionToken) !== null && _a !== void 0 ? _a : node.exclamationToken, node.type, node.initializer) :
21045
- ts.isMethodSignature(node) ? updateMethodSignature(node, modifiers, node.name, node.questionToken, node.typeParameters, node.parameters, node.type) :
21046
- ts.isMethodDeclaration(node) ? updateMethodDeclaration(node, node.decorators, modifiers, node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, node.type, node.body) :
21047
- ts.isConstructorDeclaration(node) ? updateConstructorDeclaration(node, node.decorators, modifiers, node.parameters, node.body) :
21048
- ts.isGetAccessorDeclaration(node) ? updateGetAccessorDeclaration(node, node.decorators, modifiers, node.name, node.parameters, node.type, node.body) :
21049
- ts.isSetAccessorDeclaration(node) ? updateSetAccessorDeclaration(node, node.decorators, modifiers, node.name, node.parameters, node.body) :
21050
- ts.isIndexSignatureDeclaration(node) ? updateIndexSignature(node, node.decorators, modifiers, node.parameters, node.type) :
21051
- ts.isFunctionExpression(node) ? updateFunctionExpression(node, modifiers, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body) :
21052
- ts.isArrowFunction(node) ? updateArrowFunction(node, modifiers, node.typeParameters, node.parameters, node.type, node.equalsGreaterThanToken, node.body) :
21053
- ts.isClassExpression(node) ? updateClassExpression(node, node.decorators, modifiers, node.name, node.typeParameters, node.heritageClauses, node.members) :
21054
- ts.isVariableStatement(node) ? updateVariableStatement(node, modifiers, node.declarationList) :
21055
- ts.isFunctionDeclaration(node) ? updateFunctionDeclaration(node, node.decorators, modifiers, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body) :
21056
- ts.isClassDeclaration(node) ? updateClassDeclaration(node, node.decorators, modifiers, node.name, node.typeParameters, node.heritageClauses, node.members) :
21057
- ts.isInterfaceDeclaration(node) ? updateInterfaceDeclaration(node, node.decorators, modifiers, node.name, node.typeParameters, node.heritageClauses, node.members) :
21058
- ts.isTypeAliasDeclaration(node) ? updateTypeAliasDeclaration(node, node.decorators, modifiers, node.name, node.typeParameters, node.type) :
21059
- ts.isEnumDeclaration(node) ? updateEnumDeclaration(node, node.decorators, modifiers, node.name, node.members) :
21060
- ts.isModuleDeclaration(node) ? updateModuleDeclaration(node, node.decorators, modifiers, node.name, node.body) :
21061
- ts.isImportEqualsDeclaration(node) ? updateImportEqualsDeclaration(node, node.decorators, modifiers, node.isTypeOnly, node.name, node.moduleReference) :
21062
- ts.isImportDeclaration(node) ? updateImportDeclaration(node, node.decorators, modifiers, node.importClause, node.moduleSpecifier, node.assertClause) :
21063
- ts.isExportAssignment(node) ? updateExportAssignment(node, node.decorators, modifiers, node.expression) :
21064
- ts.isExportDeclaration(node) ? updateExportDeclaration(node, node.decorators, modifiers, node.isTypeOnly, node.exportClause, node.moduleSpecifier, node.assertClause) :
21041
+ modifierArray = createModifiersFromModifierFlags(modifiers);
21042
+ }
21043
+ else {
21044
+ modifierArray = modifiers;
21045
+ }
21046
+ return ts.isParameter(node) ? updateParameterDeclaration(node, node.decorators, modifierArray, node.dotDotDotToken, node.name, node.questionToken, node.type, node.initializer) :
21047
+ ts.isPropertySignature(node) ? updatePropertySignature(node, modifierArray, node.name, node.questionToken, node.type) :
21048
+ ts.isPropertyDeclaration(node) ? updatePropertyDeclaration(node, node.decorators, modifierArray, node.name, (_a = node.questionToken) !== null && _a !== void 0 ? _a : node.exclamationToken, node.type, node.initializer) :
21049
+ ts.isMethodSignature(node) ? updateMethodSignature(node, modifierArray, node.name, node.questionToken, node.typeParameters, node.parameters, node.type) :
21050
+ ts.isMethodDeclaration(node) ? updateMethodDeclaration(node, node.decorators, modifierArray, node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, node.type, node.body) :
21051
+ ts.isConstructorDeclaration(node) ? updateConstructorDeclaration(node, node.decorators, modifierArray, node.parameters, node.body) :
21052
+ ts.isGetAccessorDeclaration(node) ? updateGetAccessorDeclaration(node, node.decorators, modifierArray, node.name, node.parameters, node.type, node.body) :
21053
+ ts.isSetAccessorDeclaration(node) ? updateSetAccessorDeclaration(node, node.decorators, modifierArray, node.name, node.parameters, node.body) :
21054
+ ts.isIndexSignatureDeclaration(node) ? updateIndexSignature(node, node.decorators, modifierArray, node.parameters, node.type) :
21055
+ ts.isFunctionExpression(node) ? updateFunctionExpression(node, modifierArray, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body) :
21056
+ ts.isArrowFunction(node) ? updateArrowFunction(node, modifierArray, node.typeParameters, node.parameters, node.type, node.equalsGreaterThanToken, node.body) :
21057
+ ts.isClassExpression(node) ? updateClassExpression(node, node.decorators, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) :
21058
+ ts.isVariableStatement(node) ? updateVariableStatement(node, modifierArray, node.declarationList) :
21059
+ ts.isFunctionDeclaration(node) ? updateFunctionDeclaration(node, node.decorators, modifierArray, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body) :
21060
+ ts.isClassDeclaration(node) ? updateClassDeclaration(node, node.decorators, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) :
21061
+ ts.isInterfaceDeclaration(node) ? updateInterfaceDeclaration(node, node.decorators, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) :
21062
+ ts.isTypeAliasDeclaration(node) ? updateTypeAliasDeclaration(node, node.decorators, modifierArray, node.name, node.typeParameters, node.type) :
21063
+ ts.isEnumDeclaration(node) ? updateEnumDeclaration(node, node.decorators, modifierArray, node.name, node.members) :
21064
+ ts.isModuleDeclaration(node) ? updateModuleDeclaration(node, node.decorators, modifierArray, node.name, node.body) :
21065
+ ts.isImportEqualsDeclaration(node) ? updateImportEqualsDeclaration(node, node.decorators, modifierArray, node.isTypeOnly, node.name, node.moduleReference) :
21066
+ ts.isImportDeclaration(node) ? updateImportDeclaration(node, node.decorators, modifierArray, node.importClause, node.moduleSpecifier, node.assertClause) :
21067
+ ts.isExportAssignment(node) ? updateExportAssignment(node, node.decorators, modifierArray, node.expression) :
21068
+ ts.isExportDeclaration(node) ? updateExportDeclaration(node, node.decorators, modifierArray, node.isTypeOnly, node.exportClause, node.moduleSpecifier, node.assertClause) :
21065
21069
  ts.Debug.assertNever(node);
21066
21070
  }
21067
21071
  function asNodeArray(array) {
@@ -47767,7 +47771,7 @@ var ts;
47767
47771
  return symbol_1;
47768
47772
  }
47769
47773
  }
47770
- return globalObjectType === undefined ? undefined : getPropertyOfObjectType(globalObjectType, name);
47774
+ return getPropertyOfObjectType(globalObjectType, name);
47771
47775
  }
47772
47776
  if (type.flags & 3145728) {
47773
47777
  return getPropertyOfUnionOrIntersectionType(type, name, skipObjectFunctionPropertyAugment);
@@ -56269,7 +56273,8 @@ var ts;
56269
56273
  return access.kind === 205 ? access.name.escapedText :
56270
56274
  access.kind === 206 && ts.isStringOrNumericLiteralLike(access.argumentExpression) ? ts.escapeLeadingUnderscores(access.argumentExpression.text) :
56271
56275
  access.kind === 202 && (propertyName = getDestructuringPropertyName(access)) ? ts.escapeLeadingUnderscores(propertyName) :
56272
- undefined;
56276
+ access.kind === 163 ? ("" + access.parent.parameters.indexOf(access)) :
56277
+ undefined;
56273
56278
  }
56274
56279
  function containsMatchingReference(source, target) {
56275
56280
  while (ts.isAccessExpression(source)) {
@@ -57470,11 +57475,11 @@ var ts;
57470
57475
  return result;
57471
57476
  }
57472
57477
  function getCandidateDiscriminantPropertyAccess(expr) {
57473
- if (ts.isBindingPattern(reference)) {
57478
+ if (ts.isBindingPattern(reference) || ts.isFunctionExpressionOrArrowFunction(reference)) {
57474
57479
  if (ts.isIdentifier(expr)) {
57475
57480
  var symbol = getResolvedSymbol(expr);
57476
57481
  var declaration = symbol.valueDeclaration;
57477
- if (declaration && ts.isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && reference === declaration.parent) {
57482
+ if (declaration && (ts.isBindingElement(declaration) || ts.isParameter(declaration)) && reference === declaration.parent && !declaration.initializer && !declaration.dotDotDotToken) {
57478
57483
  return declaration;
57479
57484
  }
57480
57485
  }
@@ -58159,18 +58164,34 @@ var ts;
58159
58164
  }
58160
58165
  function getNarrowedTypeOfSymbol(symbol, location) {
58161
58166
  var declaration = symbol.valueDeclaration;
58162
- if (declaration && ts.isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && declaration.parent.elements.length >= 2) {
58163
- var parent = declaration.parent.parent;
58164
- if (parent.kind === 253 && ts.getCombinedNodeFlags(declaration) & 2 || parent.kind === 163) {
58165
- var links = getNodeLinks(location);
58166
- if (!(links.flags & 268435456)) {
58167
- links.flags |= 268435456;
58168
- var parentType = getTypeForBindingElementParent(parent);
58169
- links.flags &= ~268435456;
58170
- if (parentType && parentType.flags & 1048576 && !(parent.kind === 163 && isSymbolAssigned(symbol))) {
58171
- var pattern = declaration.parent;
58172
- var narrowedType = getFlowTypeOfReference(pattern, parentType, parentType, undefined, location.flowNode);
58173
- return getBindingElementTypeFromParentType(declaration, narrowedType);
58167
+ if (declaration) {
58168
+ if (ts.isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && declaration.parent.elements.length >= 2) {
58169
+ var parent = declaration.parent.parent;
58170
+ if (parent.kind === 253 && ts.getCombinedNodeFlags(declaration) & 2 || parent.kind === 163) {
58171
+ var links = getNodeLinks(location);
58172
+ if (!(links.flags & 268435456)) {
58173
+ links.flags |= 268435456;
58174
+ var parentType = getTypeForBindingElementParent(parent);
58175
+ links.flags &= ~268435456;
58176
+ if (parentType && parentType.flags & 1048576 && !(parent.kind === 163 && isSymbolAssigned(symbol))) {
58177
+ var pattern = declaration.parent;
58178
+ var narrowedType = getFlowTypeOfReference(pattern, parentType, parentType, undefined, location.flowNode);
58179
+ return getBindingElementTypeFromParentType(declaration, narrowedType);
58180
+ }
58181
+ }
58182
+ }
58183
+ }
58184
+ if (ts.isParameter(declaration) && !declaration.type && !declaration.initializer && !declaration.dotDotDotToken) {
58185
+ var func = declaration.parent;
58186
+ if (func.parameters.length >= 2 && isContextSensitiveFunctionOrObjectLiteralMethod(func)) {
58187
+ var contextualSignature = getContextualSignature(func);
58188
+ if (contextualSignature && contextualSignature.parameters.length === 1 && signatureHasRestParameter(contextualSignature)) {
58189
+ var restType = getTypeOfSymbol(contextualSignature.parameters[0]);
58190
+ if (restType.flags & 1048576 && everyType(restType, isTupleType) && !isSymbolAssigned(symbol)) {
58191
+ var narrowedType = getFlowTypeOfReference(func, restType, restType, undefined, location.flowNode);
58192
+ var index = func.parameters.indexOf(declaration) - (ts.getThisParameter(func) ? 1 : 0);
58193
+ return getIndexedAccessType(narrowedType, getNumberLiteralType(index));
58194
+ }
58174
58195
  }
58175
58196
  }
58176
58197
  }
@@ -89528,7 +89549,7 @@ var ts;
89528
89549
  emitPlaceholder(hint, node, snippet);
89529
89550
  break;
89530
89551
  case 0:
89531
- emitTabStop(snippet);
89552
+ emitTabStop(hint, node, snippet);
89532
89553
  break;
89533
89554
  }
89534
89555
  }
@@ -89537,7 +89558,9 @@ var ts;
89537
89558
  pipelineEmitWithHintWorker(hint, node, false);
89538
89559
  nonEscapingWrite("}");
89539
89560
  }
89540
- function emitTabStop(snippet) {
89561
+ function emitTabStop(hint, node, snippet) {
89562
+ ts.Debug.assert(node.kind === 235, "A tab stop cannot be attached to a node of kind " + ts.Debug.formatSyntaxKind(node.kind) + ".");
89563
+ ts.Debug.assert(hint !== 5, "A tab stop cannot be attached to an embedded statement.");
89541
89564
  nonEscapingWrite("$" + snippet.order);
89542
89565
  }
89543
89566
  function emitIdentifier(node) {
@@ -93408,8 +93431,8 @@ var ts;
93408
93431
  var gutterSeparator = " ";
93409
93432
  var resetEscapeSequence = "\u001b[0m";
93410
93433
  var ellipsis = "...";
93434
+ var bullet = "● ";
93411
93435
  var halfIndent = " ";
93412
- var indent = " ";
93413
93436
  function getCategoryFormat(category) {
93414
93437
  switch (category) {
93415
93438
  case ts.DiagnosticCategory.Error: return ForegroundColorEscapeSequences.Red;
@@ -93422,7 +93445,7 @@ var ts;
93422
93445
  return formatStyle + text + resetEscapeSequence;
93423
93446
  }
93424
93447
  ts.formatColorAndReset = formatColorAndReset;
93425
- function formatCodeSpan(file, start, length, indent, squiggleColor, host) {
93448
+ function formatCodeSpan(file, start, length, indent, underlineColor, host) {
93426
93449
  var _a = ts.getLineAndCharacterOfPosition(file, start), firstLine = _a.line, firstLineChar = _a.character;
93427
93450
  var _b = ts.getLineAndCharacterOfPosition(file, start + length), lastLine = _b.line, lastLineChar = _b.character;
93428
93451
  var lastLineInFile = ts.getLineAndCharacterOfPosition(file, file.text.length).line;
@@ -93443,20 +93466,20 @@ var ts;
93443
93466
  var lineContent = file.text.slice(lineStart, lineEnd);
93444
93467
  lineContent = ts.trimStringEnd(lineContent);
93445
93468
  lineContent = lineContent.replace(/\t/g, " ");
93446
- context += indent + formatColorAndReset(ts.padLeft(i + 1 + "", gutterWidth), gutterStyleSequence) + gutterSeparator;
93469
+ context += indent + ts.padLeft("|", gutterWidth) + gutterSeparator;
93447
93470
  context += lineContent + host.getNewLine();
93448
- context += indent + formatColorAndReset(ts.padLeft("", gutterWidth), gutterStyleSequence) + gutterSeparator;
93449
- context += squiggleColor;
93471
+ context += indent + ts.padLeft("", gutterWidth) + gutterSeparator;
93472
+ context += underlineColor;
93450
93473
  if (i === firstLine) {
93451
93474
  var lastCharForLine = i === lastLine ? lastLineChar : undefined;
93452
93475
  context += lineContent.slice(0, firstLineChar).replace(/\S/g, " ");
93453
- context += lineContent.slice(firstLineChar, lastCharForLine).replace(/./g, "~");
93476
+ context += lineContent.slice(firstLineChar, lastCharForLine).replace(/./g, "");
93454
93477
  }
93455
93478
  else if (i === lastLine) {
93456
- context += lineContent.slice(0, lastLineChar).replace(/./g, "~");
93479
+ context += lineContent.slice(0, lastLineChar).replace(/./g, "");
93457
93480
  }
93458
93481
  else {
93459
- context += lineContent.replace(/./g, "~");
93482
+ context += lineContent.replace(/./g, "");
93460
93483
  }
93461
93484
  context += resetEscapeSequence;
93462
93485
  }
@@ -93476,41 +93499,51 @@ var ts;
93476
93499
  }
93477
93500
  ts.formatLocation = formatLocation;
93478
93501
  function formatDiagnosticsWithColorAndContext(diagnostics, host) {
93502
+ var _a, _b;
93503
+ var terminalWidth = (_b = (_a = ts.sys.getWidthOfTerminal) === null || _a === void 0 ? void 0 : _a.call(ts.sys)) !== null && _b !== void 0 ? _b : 0;
93504
+ var indent = terminalWidth < 60 ? "" : halfIndent;
93479
93505
  var output = "";
93480
93506
  for (var _i = 0, diagnostics_4 = diagnostics; _i < diagnostics_4.length; _i++) {
93481
93507
  var diagnostic = diagnostics_4[_i];
93508
+ var diagnosticCode = "TS" + diagnostic.code;
93482
93509
  if (diagnostic.file) {
93483
93510
  var file = diagnostic.file, start = diagnostic.start;
93484
- output += formatLocation(file, start, host);
93485
- output += " - ";
93486
- }
93487
- output += formatColorAndReset(ts.diagnosticCategoryName(diagnostic), getCategoryFormat(diagnostic.category));
93488
- output += formatColorAndReset(" TS" + diagnostic.code + ": ", ForegroundColorEscapeSequences.Grey);
93489
- output += flattenDiagnosticMessageText(diagnostic.messageText, host.getNewLine());
93490
- if (diagnostic.file) {
93511
+ var location = formatLocation(file, start, host);
93512
+ var locationLength = location.replace(/\u001b[[0-9]+m/g, "").length;
93513
+ var codeLength = diagnosticCode.length;
93514
+ output += bullet + location;
93515
+ var defaultPad = codeLength + 1;
93516
+ var padWidth = terminalWidth < 60 ? defaultPad : terminalWidth - (bullet.length + locationLength + codeLength);
93517
+ if (padWidth < diagnosticCode.length)
93518
+ padWidth = defaultPad;
93519
+ output += ts.padLeft(diagnosticCode, padWidth);
93520
+ output += formatCodeSpan(diagnostic.file, diagnostic.start, diagnostic.length, indent, getCategoryFormat(diagnostic.category), host);
93491
93521
  output += host.getNewLine();
93492
- output += formatCodeSpan(diagnostic.file, diagnostic.start, diagnostic.length, "", getCategoryFormat(diagnostic.category), host);
93493
93522
  }
93523
+ var diagnosticText = flattenDiagnosticMessageText(diagnostic.messageText, host.getNewLine(), 0, true);
93524
+ diagnosticText = ts.map(diagnosticText.split(host.getNewLine()), function (text) { return indent + text; }).join(host.getNewLine());
93525
+ output += diagnosticText;
93526
+ output += host.getNewLine();
93494
93527
  if (diagnostic.relatedInformation) {
93495
- output += host.getNewLine();
93496
- for (var _a = 0, _b = diagnostic.relatedInformation; _a < _b.length; _a++) {
93497
- var _c = _b[_a], file = _c.file, start = _c.start, length_9 = _c.length, messageText = _c.messageText;
93528
+ for (var _c = 0, _d = diagnostic.relatedInformation; _c < _d.length; _c++) {
93529
+ var _e = _d[_c], file = _e.file, start = _e.start, length_9 = _e.length, messageText = _e.messageText;
93530
+ output += host.getNewLine();
93531
+ output += indent + flattenDiagnosticMessageText(messageText, host.getNewLine(), 0, true);
93532
+ output += host.getNewLine();
93498
93533
  if (file) {
93534
+ output += indent + formatLocation(file, start, host);
93499
93535
  output += host.getNewLine();
93500
- output += halfIndent + formatLocation(file, start, host);
93501
93536
  output += formatCodeSpan(file, start, length_9, indent, ForegroundColorEscapeSequences.Cyan, host);
93502
93537
  }
93503
- output += host.getNewLine();
93504
- output += indent + flattenDiagnosticMessageText(messageText, host.getNewLine());
93505
93538
  }
93506
93539
  }
93507
- output += host.getNewLine();
93508
93540
  }
93509
93541
  return output;
93510
93542
  }
93511
93543
  ts.formatDiagnosticsWithColorAndContext = formatDiagnosticsWithColorAndContext;
93512
- function flattenDiagnosticMessageText(diag, newLine, indent) {
93544
+ function flattenDiagnosticMessageText(diag, newLine, indent, pretty) {
93513
93545
  if (indent === void 0) { indent = 0; }
93546
+ if (pretty === void 0) { pretty = false; }
93514
93547
  if (ts.isString(diag)) {
93515
93548
  return diag;
93516
93549
  }
@@ -93520,9 +93553,14 @@ var ts;
93520
93553
  var result = "";
93521
93554
  if (indent) {
93522
93555
  result += newLine;
93523
- for (var i = 0; i < indent; i++) {
93524
- result += " ";
93556
+ var indentsToReplaceWithNewLines = pretty ? 1 : 0;
93557
+ if (indent > indentsToReplaceWithNewLines) {
93558
+ for (var i = indentsToReplaceWithNewLines; i < indent; i++) {
93559
+ result += " ";
93560
+ }
93525
93561
  }
93562
+ else
93563
+ result += newLine;
93526
93564
  }
93527
93565
  result += diag.messageText;
93528
93566
  indent++;