typescript 4.6.0-dev.20220123 → 4.6.0-dev.20220127

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,15 +69,21 @@ 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.20220123";
72
+ ts.version = ts.versionMajorMinor + ".0-dev.20220127";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
+ var globals = typeof globalThis !== "undefined" ? globalThis :
76
+ typeof global !== "undefined" ? global :
77
+ typeof self !== "undefined" ? self :
78
+ undefined;
75
79
  function tryGetNativeMap() {
76
- return typeof Map !== "undefined" && "entries" in Map.prototype && new Map([[0, 0]]).size === 1 ? Map : undefined;
80
+ var gMap = globals === null || globals === void 0 ? void 0 : globals.Map;
81
+ return typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined;
77
82
  }
78
83
  NativeCollections.tryGetNativeMap = tryGetNativeMap;
79
84
  function tryGetNativeSet() {
80
- return typeof Set !== "undefined" && "entries" in Set.prototype && new Set([0]).size === 1 ? Set : undefined;
85
+ var gSet = globals === null || globals === void 0 ? void 0 : globals.Set;
86
+ return typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined;
81
87
  }
82
88
  NativeCollections.tryGetNativeSet = tryGetNativeSet;
83
89
  })(NativeCollections || (NativeCollections = {}));
@@ -6681,6 +6687,8 @@ var ts;
6681
6687
  Remove_unused_declarations_for_Colon_0: diag(90041, ts.DiagnosticCategory.Message, "Remove_unused_declarations_for_Colon_0_90041", "Remove unused declarations for: '{0}'"),
6682
6688
  Declare_a_private_field_named_0: diag(90053, ts.DiagnosticCategory.Message, "Declare_a_private_field_named_0_90053", "Declare a private field named '{0}'."),
6683
6689
  Includes_imports_of_types_referenced_by_0: diag(90054, ts.DiagnosticCategory.Message, "Includes_imports_of_types_referenced_by_0_90054", "Includes imports of types referenced by '{0}'"),
6690
+ Remove_type_from_import_declaration_from_0: diag(90055, ts.DiagnosticCategory.Message, "Remove_type_from_import_declaration_from_0_90055", "Remove 'type' from import declaration from \"{0}\""),
6691
+ Remove_type_from_import_of_0_from_1: diag(90056, ts.DiagnosticCategory.Message, "Remove_type_from_import_of_0_from_1_90056", "Remove 'type' from import of '{0}' from \"{1}\""),
6684
6692
  Convert_function_to_an_ES2015_class: diag(95001, ts.DiagnosticCategory.Message, "Convert_function_to_an_ES2015_class_95001", "Convert function to an ES2015 class"),
6685
6693
  Convert_0_to_1_in_0: diag(95003, ts.DiagnosticCategory.Message, "Convert_0_to_1_in_0_95003", "Convert '{0}' to '{1} in {0}'"),
6686
6694
  Extract_to_0_in_1: diag(95004, ts.DiagnosticCategory.Message, "Extract_to_0_in_1_95004", "Extract to {0} in {1}"),
@@ -10667,10 +10675,13 @@ var ts;
10667
10675
  function packageIdIsEqual(a, b) {
10668
10676
  return a === b || !!a && !!b && a.name === b.name && a.subModuleName === b.subModuleName && a.version === b.version;
10669
10677
  }
10670
- function packageIdToString(_a) {
10671
- var name = _a.name, subModuleName = _a.subModuleName, version = _a.version;
10672
- var fullName = subModuleName ? name + "/" + subModuleName : name;
10673
- return fullName + "@" + version;
10678
+ function packageIdToPackageName(_a) {
10679
+ var name = _a.name, subModuleName = _a.subModuleName;
10680
+ return subModuleName ? name + "/" + subModuleName : name;
10681
+ }
10682
+ ts.packageIdToPackageName = packageIdToPackageName;
10683
+ function packageIdToString(packageId) {
10684
+ return packageIdToPackageName(packageId) + "@" + packageId.version;
10674
10685
  }
10675
10686
  ts.packageIdToString = packageIdToString;
10676
10687
  function typeDirectiveIsEqualTo(oldResolution, newResolution) {
@@ -11396,6 +11407,15 @@ var ts;
11396
11407
  };
11397
11408
  }
11398
11409
  ts.createDiagnosticForFileFromMessageChain = createDiagnosticForFileFromMessageChain;
11410
+ function createDiagnosticMessageChainFromDiagnostic(diagnostic) {
11411
+ return typeof diagnostic.messageText === "string" ? {
11412
+ code: diagnostic.code,
11413
+ category: diagnostic.category,
11414
+ messageText: diagnostic.messageText,
11415
+ next: diagnostic.next,
11416
+ } : diagnostic.messageText;
11417
+ }
11418
+ ts.createDiagnosticMessageChainFromDiagnostic = createDiagnosticMessageChainFromDiagnostic;
11399
11419
  function createDiagnosticForRange(sourceFile, range, message) {
11400
11420
  return {
11401
11421
  file: sourceFile,
@@ -11556,7 +11576,8 @@ var ts;
11556
11576
  node.kind === 212 ||
11557
11577
  node.kind === 213 ||
11558
11578
  node.kind === 211 ||
11559
- node.kind === 253) ?
11579
+ node.kind === 253 ||
11580
+ node.kind === 274) ?
11560
11581
  ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) :
11561
11582
  ts.getLeadingCommentRanges(text, node.pos);
11562
11583
  return ts.filter(commentRanges, function (comment) {
@@ -29193,7 +29214,8 @@ var ts;
29193
29214
  return finishNode(node, pos);
29194
29215
  }
29195
29216
  function parseExportSpecifier() {
29196
- return parseImportOrExportSpecifier(274);
29217
+ var hasJSDoc = hasPrecedingJSDocComment();
29218
+ return withJSDoc(parseImportOrExportSpecifier(274), hasJSDoc);
29197
29219
  }
29198
29220
  function parseImportSpecifier() {
29199
29221
  return parseImportOrExportSpecifier(269);
@@ -35492,14 +35514,12 @@ var ts;
35492
35514
  }
35493
35515
  var binder = createBinder();
35494
35516
  function bindSourceFile(file, options) {
35495
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("bind", "bindSourceFile", { path: file.path }, true);
35496
35517
  ts.performance.mark("beforeBind");
35497
35518
  ts.perfLogger.logStartBindFile("" + file.fileName);
35498
35519
  binder(file, options);
35499
35520
  ts.perfLogger.logStopBindFile();
35500
35521
  ts.performance.mark("afterBind");
35501
35522
  ts.performance.measure("Bind", "beforeBind", "afterBind");
35502
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
35503
35523
  }
35504
35524
  ts.bindSourceFile = bindSourceFile;
35505
35525
  function createBinder() {
@@ -35546,7 +35566,9 @@ var ts;
35546
35566
  ts.Debug.attachFlowNodeDebugInfo(unreachableFlow);
35547
35567
  ts.Debug.attachFlowNodeDebugInfo(reportedUnreachableFlow);
35548
35568
  if (!file.locals) {
35569
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("bind", "bindSourceFile", { path: file.path }, true);
35549
35570
  bind(file);
35571
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
35550
35572
  file.symbolCount = symbolCount;
35551
35573
  file.classifiableNames = classifiableNames;
35552
35574
  delayedBindJSDocTypedefTag();
@@ -39135,6 +39157,9 @@ var ts;
39135
39157
  suggestionDiagnostics.add(diagnostic);
39136
39158
  return diagnostic;
39137
39159
  }
39160
+ function isDeprecatedSymbol(symbol) {
39161
+ return !!(getDeclarationNodeFlagsFromSymbol(symbol) & 134217728);
39162
+ }
39138
39163
  function addDeprecatedSuggestion(location, declarations, deprecatedEntity) {
39139
39164
  var diagnostic = ts.createDiagnosticForNode(location, ts.Diagnostics._0_is_deprecated, deprecatedEntity);
39140
39165
  return addDeprecatedSuggestionWorker(declarations, diagnostic);
@@ -43355,7 +43380,8 @@ var ts;
43355
43380
  includePrivateSymbol === null || includePrivateSymbol === void 0 ? void 0 : includePrivateSymbol(sym);
43356
43381
  }
43357
43382
  if (ts.isIdentifier(node)) {
43358
- var name = sym.flags & 262144 ? typeParameterToName(getDeclaredTypeOfSymbol(sym), context) : ts.factory.cloneNode(node);
43383
+ var type = getDeclaredTypeOfSymbol(sym);
43384
+ var name = sym.flags & 262144 && !isTypeSymbolAccessible(type.symbol, context.enclosingDeclaration) ? typeParameterToName(type, context) : ts.factory.cloneNode(node);
43359
43385
  name.symbol = sym;
43360
43386
  return { introducesError: introducesError, node: ts.setEmitFlags(ts.setOriginalNode(name, node), 16777216) };
43361
43387
  }
@@ -50260,7 +50286,7 @@ var ts;
50260
50286
  }
50261
50287
  var prop = getPropertyOfType(objectType, propName);
50262
50288
  if (prop) {
50263
- if (accessFlags & 64 && accessNode && prop.declarations && getDeclarationNodeFlagsFromSymbol(prop) & 134217728 && isUncalledFunctionReference(accessNode, prop)) {
50289
+ if (accessFlags & 64 && accessNode && prop.declarations && isDeprecatedSymbol(prop) && isUncalledFunctionReference(accessNode, prop)) {
50264
50290
  var deprecatedNode = (_a = accessExpression === null || accessExpression === void 0 ? void 0 : accessExpression.argumentExpression) !== null && _a !== void 0 ? _a : (ts.isIndexedAccessTypeNode(accessNode) ? accessNode.indexType : accessNode);
50265
50291
  addDeprecatedSuggestion(deprecatedNode, prop.declarations, propName);
50266
50292
  }
@@ -58410,9 +58436,9 @@ var ts;
58410
58436
  markAliasReferenced(symbol, node);
58411
58437
  }
58412
58438
  var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
58413
- var sourceSymbol = localOrExportSymbol.flags & 2097152 ? resolveAlias(localOrExportSymbol) : localOrExportSymbol;
58414
- if (sourceSymbol.declarations && getDeclarationNodeFlagsFromSymbol(sourceSymbol) & 134217728 && isUncalledFunctionReference(node, sourceSymbol)) {
58415
- addDeprecatedSuggestion(node, sourceSymbol.declarations, node.escapedText);
58439
+ var targetSymbol = checkDeprecatedAliasedSymbol(localOrExportSymbol, node);
58440
+ if (isDeprecatedSymbol(targetSymbol) && isUncalledFunctionReference(node, targetSymbol) && targetSymbol.declarations) {
58441
+ addDeprecatedSuggestion(node, targetSymbol.declarations, node.escapedText);
58416
58442
  }
58417
58443
  var declaration = localOrExportSymbol.valueDeclaration;
58418
58444
  if (declaration && localOrExportSymbol.flags & 32) {
@@ -60944,7 +60970,7 @@ var ts;
60944
60970
  }
60945
60971
  }
60946
60972
  else {
60947
- if (prop.declarations && getDeclarationNodeFlagsFromSymbol(prop) & 134217728 && isUncalledFunctionReference(node, prop)) {
60973
+ if (isDeprecatedSymbol(prop) && isUncalledFunctionReference(node, prop) && prop.declarations) {
60948
60974
  addDeprecatedSuggestion(right, prop.declarations, right.escapedText);
60949
60975
  }
60950
60976
  checkPropertyNotUsedBeforeDeclaration(prop, node, right);
@@ -62171,7 +62197,7 @@ var ts;
62171
62197
  }
62172
62198
  var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
62173
62199
  ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
62174
- var chain = ts.chainDiagnosticMessages(ts.map(diags_3, function (d) { return typeof d.messageText === "string" ? d : d.messageText; }), ts.Diagnostics.No_overload_matches_this_call);
62200
+ var chain = ts.chainDiagnosticMessages(ts.map(diags_3, ts.createDiagnosticMessageChainFromDiagnostic), ts.Diagnostics.No_overload_matches_this_call);
62175
62201
  var related = __spreadArray([], ts.flatMap(diags_3, function (d) { return d.relatedInformation; }), true);
62176
62202
  var diag = void 0;
62177
62203
  if (ts.every(diags_3, function (d) { return d.start === diags_3[0].start && d.length === diags_3[0].length && d.file === diags_3[0].file; })) {
@@ -69334,16 +69360,15 @@ var ts;
69334
69360
  return ts.nodeIsMissing(expr) ? 0 : evaluateEnumMember(expr, getSymbolOfNode(member.parent), identifier.escapedText);
69335
69361
  case 206:
69336
69362
  case 205:
69337
- var ex = expr;
69338
- if (isConstantMemberAccess(ex)) {
69339
- var type = getTypeOfExpression(ex.expression);
69363
+ if (isConstantMemberAccess(expr)) {
69364
+ var type = getTypeOfExpression(expr.expression);
69340
69365
  if (type.symbol && type.symbol.flags & 384) {
69341
69366
  var name = void 0;
69342
- if (ex.kind === 205) {
69343
- name = ex.name.escapedText;
69367
+ if (expr.kind === 205) {
69368
+ name = expr.name.escapedText;
69344
69369
  }
69345
69370
  else {
69346
- name = ts.escapeLeadingUnderscores(ts.cast(ex.argumentExpression, ts.isLiteralExpression).text);
69371
+ name = ts.escapeLeadingUnderscores(ts.cast(expr.argumentExpression, ts.isLiteralExpression).text);
69347
69372
  }
69348
69373
  return evaluateEnumMember(expr, type.symbol, name);
69349
69374
  }
@@ -69371,6 +69396,10 @@ var ts;
69371
69396
  }
69372
69397
  }
69373
69398
  function isConstantMemberAccess(node) {
69399
+ var type = getTypeOfExpression(node);
69400
+ if (type === errorType) {
69401
+ return false;
69402
+ }
69374
69403
  return node.kind === 79 ||
69375
69404
  node.kind === 205 && isConstantMemberAccess(node.expression) ||
69376
69405
  node.kind === 206 && isConstantMemberAccess(node.expression) &&
@@ -69629,7 +69658,6 @@ var ts;
69629
69658
  return true;
69630
69659
  }
69631
69660
  function checkAliasSymbol(node) {
69632
- var _a;
69633
69661
  var symbol = getSymbolOfNode(node);
69634
69662
  var target = resolveAlias(symbol);
69635
69663
  if (target !== unknownSymbol) {
@@ -69676,10 +69704,45 @@ var ts;
69676
69704
  }
69677
69705
  }
69678
69706
  }
69679
- if (ts.isImportSpecifier(node) && ((_a = target.declarations) === null || _a === void 0 ? void 0 : _a.every(function (d) { return !!(ts.getCombinedNodeFlags(d) & 134217728); }))) {
69680
- addDeprecatedSuggestion(node.name, target.declarations, symbol.escapedName);
69707
+ if (ts.isImportSpecifier(node)) {
69708
+ var targetSymbol = checkDeprecatedAliasedSymbol(symbol, node);
69709
+ if (isDeprecatedAliasedSymbol(targetSymbol) && targetSymbol.declarations) {
69710
+ addDeprecatedSuggestion(node, targetSymbol.declarations, targetSymbol.escapedName);
69711
+ }
69712
+ }
69713
+ }
69714
+ }
69715
+ function isDeprecatedAliasedSymbol(symbol) {
69716
+ return !!symbol.declarations && ts.every(symbol.declarations, function (d) { return !!(ts.getCombinedNodeFlags(d) & 134217728); });
69717
+ }
69718
+ function checkDeprecatedAliasedSymbol(symbol, location) {
69719
+ if (!(symbol.flags & 2097152))
69720
+ return symbol;
69721
+ var targetSymbol = resolveAlias(symbol);
69722
+ if (targetSymbol === unknownSymbol)
69723
+ return targetSymbol;
69724
+ while (symbol.flags & 2097152) {
69725
+ var target = getImmediateAliasedSymbol(symbol);
69726
+ if (target) {
69727
+ if (target === targetSymbol)
69728
+ break;
69729
+ if (target.declarations && ts.length(target.declarations)) {
69730
+ if (isDeprecatedAliasedSymbol(target)) {
69731
+ addDeprecatedSuggestion(location, target.declarations, target.escapedName);
69732
+ break;
69733
+ }
69734
+ else {
69735
+ if (symbol === targetSymbol)
69736
+ break;
69737
+ symbol = target;
69738
+ }
69739
+ }
69740
+ }
69741
+ else {
69742
+ break;
69681
69743
  }
69682
69744
  }
69745
+ return targetSymbol;
69683
69746
  }
69684
69747
  function checkImportBinding(node) {
69685
69748
  checkCollisionsForDeclarationName(node, node.name);
@@ -95574,13 +95637,13 @@ var ts;
95574
95637
  redirectTargetsMap.add(fileFromPackageId.path, fileName);
95575
95638
  addFileToFilesByName(dupFile, path, redirectedPath);
95576
95639
  addFileIncludeReason(dupFile, reason);
95577
- sourceFileToPackageName.set(path, packageId.name);
95640
+ sourceFileToPackageName.set(path, ts.packageIdToPackageName(packageId));
95578
95641
  processingOtherFiles.push(dupFile);
95579
95642
  return dupFile;
95580
95643
  }
95581
95644
  else if (file) {
95582
95645
  packageIdToSourceFile.set(packageIdKey, file);
95583
- sourceFileToPackageName.set(path, packageId.name);
95646
+ sourceFileToPackageName.set(path, ts.packageIdToPackageName(packageId));
95584
95647
  }
95585
95648
  }
95586
95649
  addFileToFilesByName(file, path, redirectedPath);