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.
@@ -89,7 +89,7 @@ var ts;
89
89
  // The following is baselined as a literal template type without intervention
90
90
  /** The version of the TypeScript compiler release */
91
91
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
92
- ts.version = ts.versionMajorMinor + ".0-dev.20220123";
92
+ ts.version = ts.versionMajorMinor + ".0-dev.20220127";
93
93
  /* @internal */
94
94
  var Comparison;
95
95
  (function (Comparison) {
@@ -100,13 +100,18 @@ var ts;
100
100
  /* @internal */
101
101
  var NativeCollections;
102
102
  (function (NativeCollections) {
103
+ var globals = typeof globalThis !== "undefined" ? globalThis :
104
+ typeof global !== "undefined" ? global :
105
+ typeof self !== "undefined" ? self :
106
+ undefined;
103
107
  /**
104
108
  * Returns the native Map implementation if it is available and compatible (i.e. supports iteration).
105
109
  */
106
110
  function tryGetNativeMap() {
107
111
  // Internet Explorer's Map doesn't support iteration, so don't use it.
112
+ var gMap = globals === null || globals === void 0 ? void 0 : globals.Map;
108
113
  // eslint-disable-next-line no-in-operator
109
- return typeof Map !== "undefined" && "entries" in Map.prototype && new Map([[0, 0]]).size === 1 ? Map : undefined;
114
+ return typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined;
110
115
  }
111
116
  NativeCollections.tryGetNativeMap = tryGetNativeMap;
112
117
  /**
@@ -114,8 +119,9 @@ var ts;
114
119
  */
115
120
  function tryGetNativeSet() {
116
121
  // Internet Explorer's Set doesn't support iteration, so don't use it.
122
+ var gSet = globals === null || globals === void 0 ? void 0 : globals.Set;
117
123
  // eslint-disable-next-line no-in-operator
118
- return typeof Set !== "undefined" && "entries" in Set.prototype && new Set([0]).size === 1 ? Set : undefined;
124
+ return typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined;
119
125
  }
120
126
  NativeCollections.tryGetNativeSet = tryGetNativeSet;
121
127
  })(NativeCollections || (NativeCollections = {}));
@@ -9456,6 +9462,8 @@ var ts;
9456
9462
  Remove_unused_declarations_for_Colon_0: diag(90041, ts.DiagnosticCategory.Message, "Remove_unused_declarations_for_Colon_0_90041", "Remove unused declarations for: '{0}'"),
9457
9463
  Declare_a_private_field_named_0: diag(90053, ts.DiagnosticCategory.Message, "Declare_a_private_field_named_0_90053", "Declare a private field named '{0}'."),
9458
9464
  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}'"),
9465
+ 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}\""),
9466
+ 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}\""),
9459
9467
  Convert_function_to_an_ES2015_class: diag(95001, ts.DiagnosticCategory.Message, "Convert_function_to_an_ES2015_class_95001", "Convert function to an ES2015 class"),
9460
9468
  Convert_0_to_1_in_0: diag(95003, ts.DiagnosticCategory.Message, "Convert_0_to_1_in_0_95003", "Convert '{0}' to '{1} in {0}'"),
9461
9469
  Extract_to_0_in_1: diag(95004, ts.DiagnosticCategory.Message, "Extract_to_0_in_1_95004", "Extract to {0} in {1}"),
@@ -14046,10 +14054,13 @@ var ts;
14046
14054
  function packageIdIsEqual(a, b) {
14047
14055
  return a === b || !!a && !!b && a.name === b.name && a.subModuleName === b.subModuleName && a.version === b.version;
14048
14056
  }
14049
- function packageIdToString(_a) {
14050
- var name = _a.name, subModuleName = _a.subModuleName, version = _a.version;
14051
- var fullName = subModuleName ? name + "/" + subModuleName : name;
14052
- return fullName + "@" + version;
14057
+ function packageIdToPackageName(_a) {
14058
+ var name = _a.name, subModuleName = _a.subModuleName;
14059
+ return subModuleName ? name + "/" + subModuleName : name;
14060
+ }
14061
+ ts.packageIdToPackageName = packageIdToPackageName;
14062
+ function packageIdToString(packageId) {
14063
+ return packageIdToPackageName(packageId) + "@" + packageId.version;
14053
14064
  }
14054
14065
  ts.packageIdToString = packageIdToString;
14055
14066
  function typeDirectiveIsEqualTo(oldResolution, newResolution) {
@@ -14882,6 +14893,15 @@ var ts;
14882
14893
  };
14883
14894
  }
14884
14895
  ts.createDiagnosticForFileFromMessageChain = createDiagnosticForFileFromMessageChain;
14896
+ function createDiagnosticMessageChainFromDiagnostic(diagnostic) {
14897
+ return typeof diagnostic.messageText === "string" ? {
14898
+ code: diagnostic.code,
14899
+ category: diagnostic.category,
14900
+ messageText: diagnostic.messageText,
14901
+ next: diagnostic.next,
14902
+ } : diagnostic.messageText;
14903
+ }
14904
+ ts.createDiagnosticMessageChainFromDiagnostic = createDiagnosticMessageChainFromDiagnostic;
14885
14905
  function createDiagnosticForRange(sourceFile, range, message) {
14886
14906
  return {
14887
14907
  file: sourceFile,
@@ -15050,7 +15070,8 @@ var ts;
15050
15070
  node.kind === 212 /* FunctionExpression */ ||
15051
15071
  node.kind === 213 /* ArrowFunction */ ||
15052
15072
  node.kind === 211 /* ParenthesizedExpression */ ||
15053
- node.kind === 253 /* VariableDeclaration */) ?
15073
+ node.kind === 253 /* VariableDeclaration */ ||
15074
+ node.kind === 274 /* ExportSpecifier */) ?
15054
15075
  ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) :
15055
15076
  ts.getLeadingCommentRanges(text, node.pos);
15056
15077
  // True if the comment starts with '/**' but not if it is '/**/'
@@ -36201,7 +36222,8 @@ var ts;
36201
36222
  return finishNode(node, pos);
36202
36223
  }
36203
36224
  function parseExportSpecifier() {
36204
- return parseImportOrExportSpecifier(274 /* ExportSpecifier */);
36225
+ var hasJSDoc = hasPrecedingJSDocComment();
36226
+ return withJSDoc(parseImportOrExportSpecifier(274 /* ExportSpecifier */), hasJSDoc);
36205
36227
  }
36206
36228
  function parseImportSpecifier() {
36207
36229
  return parseImportOrExportSpecifier(269 /* ImportSpecifier */);
@@ -43406,14 +43428,12 @@ var ts;
43406
43428
  }
43407
43429
  var binder = createBinder();
43408
43430
  function bindSourceFile(file, options) {
43409
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("bind" /* Bind */, "bindSourceFile", { path: file.path }, /*separateBeginAndEnd*/ true);
43410
43431
  ts.performance.mark("beforeBind");
43411
43432
  ts.perfLogger.logStartBindFile("" + file.fileName);
43412
43433
  binder(file, options);
43413
43434
  ts.perfLogger.logStopBindFile();
43414
43435
  ts.performance.mark("afterBind");
43415
43436
  ts.performance.measure("Bind", "beforeBind", "afterBind");
43416
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
43417
43437
  }
43418
43438
  ts.bindSourceFile = bindSourceFile;
43419
43439
  function createBinder() {
@@ -43473,7 +43493,9 @@ var ts;
43473
43493
  ts.Debug.attachFlowNodeDebugInfo(unreachableFlow);
43474
43494
  ts.Debug.attachFlowNodeDebugInfo(reportedUnreachableFlow);
43475
43495
  if (!file.locals) {
43496
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("bind" /* Bind */, "bindSourceFile", { path: file.path }, /*separateBeginAndEnd*/ true);
43476
43497
  bind(file);
43498
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
43477
43499
  file.symbolCount = symbolCount;
43478
43500
  file.classifiableNames = classifiableNames;
43479
43501
  delayedBindJSDocTypedefTag();
@@ -47740,6 +47762,9 @@ var ts;
47740
47762
  suggestionDiagnostics.add(diagnostic);
47741
47763
  return diagnostic;
47742
47764
  }
47765
+ function isDeprecatedSymbol(symbol) {
47766
+ return !!(getDeclarationNodeFlagsFromSymbol(symbol) & 134217728 /* Deprecated */);
47767
+ }
47743
47768
  function addDeprecatedSuggestion(location, declarations, deprecatedEntity) {
47744
47769
  var diagnostic = ts.createDiagnosticForNode(location, ts.Diagnostics._0_is_deprecated, deprecatedEntity);
47745
47770
  return addDeprecatedSuggestionWorker(declarations, diagnostic);
@@ -52510,7 +52535,8 @@ var ts;
52510
52535
  includePrivateSymbol === null || includePrivateSymbol === void 0 ? void 0 : includePrivateSymbol(sym);
52511
52536
  }
52512
52537
  if (ts.isIdentifier(node)) {
52513
- var name = sym.flags & 262144 /* TypeParameter */ ? typeParameterToName(getDeclaredTypeOfSymbol(sym), context) : ts.factory.cloneNode(node);
52538
+ var type = getDeclaredTypeOfSymbol(sym);
52539
+ var name = sym.flags & 262144 /* TypeParameter */ && !isTypeSymbolAccessible(type.symbol, context.enclosingDeclaration) ? typeParameterToName(type, context) : ts.factory.cloneNode(node);
52514
52540
  name.symbol = sym; // for quickinfo, which uses identifier symbol information
52515
52541
  return { introducesError: introducesError, node: ts.setEmitFlags(ts.setOriginalNode(name, node), 16777216 /* NoAsciiEscaping */) };
52516
52542
  }
@@ -60526,7 +60552,7 @@ var ts;
60526
60552
  }
60527
60553
  var prop = getPropertyOfType(objectType, propName);
60528
60554
  if (prop) {
60529
- if (accessFlags & 64 /* ReportDeprecated */ && accessNode && prop.declarations && getDeclarationNodeFlagsFromSymbol(prop) & 134217728 /* Deprecated */ && isUncalledFunctionReference(accessNode, prop)) {
60555
+ if (accessFlags & 64 /* ReportDeprecated */ && accessNode && prop.declarations && isDeprecatedSymbol(prop) && isUncalledFunctionReference(accessNode, prop)) {
60530
60556
  var deprecatedNode = (_a = accessExpression === null || accessExpression === void 0 ? void 0 : accessExpression.argumentExpression) !== null && _a !== void 0 ? _a : (ts.isIndexedAccessTypeNode(accessNode) ? accessNode.indexType : accessNode);
60531
60557
  addDeprecatedSuggestion(deprecatedNode, prop.declarations, propName);
60532
60558
  }
@@ -69929,9 +69955,9 @@ var ts;
69929
69955
  markAliasReferenced(symbol, node);
69930
69956
  }
69931
69957
  var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
69932
- var sourceSymbol = localOrExportSymbol.flags & 2097152 /* Alias */ ? resolveAlias(localOrExportSymbol) : localOrExportSymbol;
69933
- if (sourceSymbol.declarations && getDeclarationNodeFlagsFromSymbol(sourceSymbol) & 134217728 /* Deprecated */ && isUncalledFunctionReference(node, sourceSymbol)) {
69934
- addDeprecatedSuggestion(node, sourceSymbol.declarations, node.escapedText);
69958
+ var targetSymbol = checkDeprecatedAliasedSymbol(localOrExportSymbol, node);
69959
+ if (isDeprecatedSymbol(targetSymbol) && isUncalledFunctionReference(node, targetSymbol) && targetSymbol.declarations) {
69960
+ addDeprecatedSuggestion(node, targetSymbol.declarations, node.escapedText);
69935
69961
  }
69936
69962
  var declaration = localOrExportSymbol.valueDeclaration;
69937
69963
  if (declaration && localOrExportSymbol.flags & 32 /* Class */) {
@@ -72943,7 +72969,7 @@ var ts;
72943
72969
  }
72944
72970
  }
72945
72971
  else {
72946
- if (prop.declarations && getDeclarationNodeFlagsFromSymbol(prop) & 134217728 /* Deprecated */ && isUncalledFunctionReference(node, prop)) {
72972
+ if (isDeprecatedSymbol(prop) && isUncalledFunctionReference(node, prop) && prop.declarations) {
72947
72973
  addDeprecatedSuggestion(right, prop.declarations, right.escapedText);
72948
72974
  }
72949
72975
  checkPropertyNotUsedBeforeDeclaration(prop, node, right);
@@ -74402,7 +74428,7 @@ var ts;
74402
74428
  }
74403
74429
  var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
74404
74430
  ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
74405
- 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);
74431
+ var chain = ts.chainDiagnosticMessages(ts.map(diags_3, ts.createDiagnosticMessageChainFromDiagnostic), ts.Diagnostics.No_overload_matches_this_call);
74406
74432
  // The below is a spread to guarantee we get a new (mutable) array - our `flatMap` helper tries to do "smart" optimizations where it reuses input
74407
74433
  // arrays and the emptyArray singleton where possible, which is decidedly not what we want while we're still constructing this diagnostic
74408
74434
  var related = __spreadArray([], ts.flatMap(diags_3, function (d) { return d.relatedInformation; }), true);
@@ -82781,16 +82807,15 @@ var ts;
82781
82807
  return ts.nodeIsMissing(expr) ? 0 : evaluateEnumMember(expr, getSymbolOfNode(member.parent), identifier.escapedText);
82782
82808
  case 206 /* ElementAccessExpression */:
82783
82809
  case 205 /* PropertyAccessExpression */:
82784
- var ex = expr;
82785
- if (isConstantMemberAccess(ex)) {
82786
- var type = getTypeOfExpression(ex.expression);
82810
+ if (isConstantMemberAccess(expr)) {
82811
+ var type = getTypeOfExpression(expr.expression);
82787
82812
  if (type.symbol && type.symbol.flags & 384 /* Enum */) {
82788
82813
  var name = void 0;
82789
- if (ex.kind === 205 /* PropertyAccessExpression */) {
82790
- name = ex.name.escapedText;
82814
+ if (expr.kind === 205 /* PropertyAccessExpression */) {
82815
+ name = expr.name.escapedText;
82791
82816
  }
82792
82817
  else {
82793
- name = ts.escapeLeadingUnderscores(ts.cast(ex.argumentExpression, ts.isLiteralExpression).text);
82818
+ name = ts.escapeLeadingUnderscores(ts.cast(expr.argumentExpression, ts.isLiteralExpression).text);
82794
82819
  }
82795
82820
  return evaluateEnumMember(expr, type.symbol, name);
82796
82821
  }
@@ -82818,6 +82843,10 @@ var ts;
82818
82843
  }
82819
82844
  }
82820
82845
  function isConstantMemberAccess(node) {
82846
+ var type = getTypeOfExpression(node);
82847
+ if (type === errorType) {
82848
+ return false;
82849
+ }
82821
82850
  return node.kind === 79 /* Identifier */ ||
82822
82851
  node.kind === 205 /* PropertyAccessExpression */ && isConstantMemberAccess(node.expression) ||
82823
82852
  node.kind === 206 /* ElementAccessExpression */ && isConstantMemberAccess(node.expression) &&
@@ -83112,7 +83141,6 @@ var ts;
83112
83141
  return true;
83113
83142
  }
83114
83143
  function checkAliasSymbol(node) {
83115
- var _a;
83116
83144
  var symbol = getSymbolOfNode(node);
83117
83145
  var target = resolveAlias(symbol);
83118
83146
  if (target !== unknownSymbol) {
@@ -83168,10 +83196,45 @@ var ts;
83168
83196
  }
83169
83197
  }
83170
83198
  }
83171
- if (ts.isImportSpecifier(node) && ((_a = target.declarations) === null || _a === void 0 ? void 0 : _a.every(function (d) { return !!(ts.getCombinedNodeFlags(d) & 134217728 /* Deprecated */); }))) {
83172
- addDeprecatedSuggestion(node.name, target.declarations, symbol.escapedName);
83199
+ if (ts.isImportSpecifier(node)) {
83200
+ var targetSymbol = checkDeprecatedAliasedSymbol(symbol, node);
83201
+ if (isDeprecatedAliasedSymbol(targetSymbol) && targetSymbol.declarations) {
83202
+ addDeprecatedSuggestion(node, targetSymbol.declarations, targetSymbol.escapedName);
83203
+ }
83204
+ }
83205
+ }
83206
+ }
83207
+ function isDeprecatedAliasedSymbol(symbol) {
83208
+ return !!symbol.declarations && ts.every(symbol.declarations, function (d) { return !!(ts.getCombinedNodeFlags(d) & 134217728 /* Deprecated */); });
83209
+ }
83210
+ function checkDeprecatedAliasedSymbol(symbol, location) {
83211
+ if (!(symbol.flags & 2097152 /* Alias */))
83212
+ return symbol;
83213
+ var targetSymbol = resolveAlias(symbol);
83214
+ if (targetSymbol === unknownSymbol)
83215
+ return targetSymbol;
83216
+ while (symbol.flags & 2097152 /* Alias */) {
83217
+ var target = getImmediateAliasedSymbol(symbol);
83218
+ if (target) {
83219
+ if (target === targetSymbol)
83220
+ break;
83221
+ if (target.declarations && ts.length(target.declarations)) {
83222
+ if (isDeprecatedAliasedSymbol(target)) {
83223
+ addDeprecatedSuggestion(location, target.declarations, target.escapedName);
83224
+ break;
83225
+ }
83226
+ else {
83227
+ if (symbol === targetSymbol)
83228
+ break;
83229
+ symbol = target;
83230
+ }
83231
+ }
83232
+ }
83233
+ else {
83234
+ break;
83173
83235
  }
83174
83236
  }
83237
+ return targetSymbol;
83175
83238
  }
83176
83239
  function checkImportBinding(node) {
83177
83240
  checkCollisionsForDeclarationName(node, node.name);
@@ -115830,14 +115893,14 @@ var ts;
115830
115893
  redirectTargetsMap.add(fileFromPackageId.path, fileName);
115831
115894
  addFileToFilesByName(dupFile, path, redirectedPath);
115832
115895
  addFileIncludeReason(dupFile, reason);
115833
- sourceFileToPackageName.set(path, packageId.name);
115896
+ sourceFileToPackageName.set(path, ts.packageIdToPackageName(packageId));
115834
115897
  processingOtherFiles.push(dupFile);
115835
115898
  return dupFile;
115836
115899
  }
115837
115900
  else if (file) {
115838
115901
  // This is the first source file to have this packageId.
115839
115902
  packageIdToSourceFile.set(packageIdKey, file);
115840
- sourceFileToPackageName.set(path, packageId.name);
115903
+ sourceFileToPackageName.set(path, ts.packageIdToPackageName(packageId));
115841
115904
  }
115842
115905
  }
115843
115906
  addFileToFilesByName(file, path, redirectedPath);
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "typescript",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "4.6.0-dev.20220123",
5
+ "version": "4.6.0-dev.20220127",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [