typescript 4.6.0-dev.20220126 → 4.6.0-dev.20220130

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.20220126";
72
+ ts.version = ts.versionMajorMinor + ".0-dev.20220130";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  var globals = typeof globalThis !== "undefined" ? globalThis :
@@ -6657,9 +6657,8 @@ var ts;
6657
6657
  Remove_variable_statement: diag(90010, ts.DiagnosticCategory.Message, "Remove_variable_statement_90010", "Remove variable statement"),
6658
6658
  Remove_template_tag: diag(90011, ts.DiagnosticCategory.Message, "Remove_template_tag_90011", "Remove template tag"),
6659
6659
  Remove_type_parameters: diag(90012, ts.DiagnosticCategory.Message, "Remove_type_parameters_90012", "Remove type parameters"),
6660
- Import_0_from_module_1: diag(90013, ts.DiagnosticCategory.Message, "Import_0_from_module_1_90013", "Import '{0}' from module \"{1}\""),
6660
+ Import_0_from_1: diag(90013, ts.DiagnosticCategory.Message, "Import_0_from_1_90013", "Import '{0}' from \"{1}\""),
6661
6661
  Change_0_to_1: diag(90014, ts.DiagnosticCategory.Message, "Change_0_to_1_90014", "Change '{0}' to '{1}'"),
6662
- Add_0_to_existing_import_declaration_from_1: diag(90015, ts.DiagnosticCategory.Message, "Add_0_to_existing_import_declaration_from_1_90015", "Add '{0}' to existing import declaration from \"{1}\""),
6663
6662
  Declare_property_0: diag(90016, ts.DiagnosticCategory.Message, "Declare_property_0_90016", "Declare property '{0}'"),
6664
6663
  Add_index_signature_for_property_0: diag(90017, ts.DiagnosticCategory.Message, "Add_index_signature_for_property_0_90017", "Add index signature for property '{0}'"),
6665
6664
  Disable_checking_for_this_file: diag(90018, ts.DiagnosticCategory.Message, "Disable_checking_for_this_file_90018", "Disable checking for this file"),
@@ -6676,8 +6675,6 @@ var ts;
6676
6675
  Add_async_modifier_to_containing_function: diag(90029, ts.DiagnosticCategory.Message, "Add_async_modifier_to_containing_function_90029", "Add async modifier to containing function"),
6677
6676
  Replace_infer_0_with_unknown: diag(90030, ts.DiagnosticCategory.Message, "Replace_infer_0_with_unknown_90030", "Replace 'infer {0}' with 'unknown'"),
6678
6677
  Replace_all_unused_infer_with_unknown: diag(90031, ts.DiagnosticCategory.Message, "Replace_all_unused_infer_with_unknown_90031", "Replace all unused 'infer' with 'unknown'"),
6679
- Import_default_0_from_module_1: diag(90032, ts.DiagnosticCategory.Message, "Import_default_0_from_module_1_90032", "Import default '{0}' from module \"{1}\""),
6680
- Add_default_import_0_to_existing_import_declaration_from_1: diag(90033, ts.DiagnosticCategory.Message, "Add_default_import_0_to_existing_import_declaration_from_1_90033", "Add default import '{0}' to existing import declaration from \"{1}\""),
6681
6678
  Add_parameter_name: diag(90034, ts.DiagnosticCategory.Message, "Add_parameter_name_90034", "Add parameter name"),
6682
6679
  Declare_private_property_0: diag(90035, ts.DiagnosticCategory.Message, "Declare_private_property_0_90035", "Declare private property '{0}'"),
6683
6680
  Replace_0_with_Promise_1: diag(90036, ts.DiagnosticCategory.Message, "Replace_0_with_Promise_1_90036", "Replace '{0}' with 'Promise<{1}>'"),
@@ -6687,6 +6684,10 @@ var ts;
6687
6684
  Remove_unused_declarations_for_Colon_0: diag(90041, ts.DiagnosticCategory.Message, "Remove_unused_declarations_for_Colon_0_90041", "Remove unused declarations for: '{0}'"),
6688
6685
  Declare_a_private_field_named_0: diag(90053, ts.DiagnosticCategory.Message, "Declare_a_private_field_named_0_90053", "Declare a private field named '{0}'."),
6689
6686
  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}'"),
6687
+ 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}\""),
6688
+ 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}\""),
6689
+ Add_import_from_0: diag(90057, ts.DiagnosticCategory.Message, "Add_import_from_0_90057", "Add import from \"{0}\""),
6690
+ Update_import_from_0: diag(90058, ts.DiagnosticCategory.Message, "Update_import_from_0_90058", "Update import from \"{0}\""),
6690
6691
  Convert_function_to_an_ES2015_class: diag(95001, ts.DiagnosticCategory.Message, "Convert_function_to_an_ES2015_class_95001", "Convert function to an ES2015 class"),
6691
6692
  Convert_0_to_1_in_0: diag(95003, ts.DiagnosticCategory.Message, "Convert_0_to_1_in_0_95003", "Convert '{0}' to '{1} in {0}'"),
6692
6693
  Extract_to_0_in_1: diag(95004, ts.DiagnosticCategory.Message, "Extract_to_0_in_1_95004", "Extract to {0} in {1}"),
@@ -11405,6 +11406,15 @@ var ts;
11405
11406
  };
11406
11407
  }
11407
11408
  ts.createDiagnosticForFileFromMessageChain = createDiagnosticForFileFromMessageChain;
11409
+ function createDiagnosticMessageChainFromDiagnostic(diagnostic) {
11410
+ return typeof diagnostic.messageText === "string" ? {
11411
+ code: diagnostic.code,
11412
+ category: diagnostic.category,
11413
+ messageText: diagnostic.messageText,
11414
+ next: diagnostic.next,
11415
+ } : diagnostic.messageText;
11416
+ }
11417
+ ts.createDiagnosticMessageChainFromDiagnostic = createDiagnosticMessageChainFromDiagnostic;
11408
11418
  function createDiagnosticForRange(sourceFile, range, message) {
11409
11419
  return {
11410
11420
  file: sourceFile,
@@ -16588,6 +16598,49 @@ var ts;
16588
16598
  return !!(type.flags & 262144 && type.isThisType);
16589
16599
  }
16590
16600
  ts.isThisTypeParameter = isThisTypeParameter;
16601
+ function getNodeModulePathParts(fullPath) {
16602
+ var topLevelNodeModulesIndex = 0;
16603
+ var topLevelPackageNameIndex = 0;
16604
+ var packageRootIndex = 0;
16605
+ var fileNameIndex = 0;
16606
+ var partStart = 0;
16607
+ var partEnd = 0;
16608
+ var state = 0;
16609
+ while (partEnd >= 0) {
16610
+ partStart = partEnd;
16611
+ partEnd = fullPath.indexOf("/", partStart + 1);
16612
+ switch (state) {
16613
+ case 0:
16614
+ if (fullPath.indexOf(ts.nodeModulesPathPart, partStart) === partStart) {
16615
+ topLevelNodeModulesIndex = partStart;
16616
+ topLevelPackageNameIndex = partEnd;
16617
+ state = 1;
16618
+ }
16619
+ break;
16620
+ case 1:
16621
+ case 2:
16622
+ if (state === 1 && fullPath.charAt(partStart + 1) === "@") {
16623
+ state = 2;
16624
+ }
16625
+ else {
16626
+ packageRootIndex = partEnd;
16627
+ state = 3;
16628
+ }
16629
+ break;
16630
+ case 3:
16631
+ if (fullPath.indexOf(ts.nodeModulesPathPart, partStart) === partStart) {
16632
+ state = 1;
16633
+ }
16634
+ else {
16635
+ state = 3;
16636
+ }
16637
+ break;
16638
+ }
16639
+ }
16640
+ fileNameIndex = partStart;
16641
+ return state > 1 ? { topLevelNodeModulesIndex: topLevelNodeModulesIndex, topLevelPackageNameIndex: topLevelPackageNameIndex, packageRootIndex: packageRootIndex, fileNameIndex: fileNameIndex } : undefined;
16642
+ }
16643
+ ts.getNodeModulePathParts = getNodeModulePathParts;
16591
16644
  })(ts || (ts = {}));
16592
16645
  var ts;
16593
16646
  (function (ts) {
@@ -39959,24 +40012,19 @@ var ts;
39959
40012
  error(errorLocation, ts.Diagnostics.Parameter_0_cannot_reference_identifier_1_declared_after_it, ts.declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name), ts.declarationNameToString(errorLocation));
39960
40013
  }
39961
40014
  }
39962
- if (result && errorLocation && meaning & 111551 && result.flags & 2097152) {
39963
- checkSymbolUsageInExpressionContext(result, name, errorLocation);
40015
+ if (result && errorLocation && meaning & 111551 && result.flags & 2097152 && !(result.flags & 111551) && !ts.isValidTypeOnlyAliasUseSite(errorLocation)) {
40016
+ var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result);
40017
+ if (typeOnlyDeclaration) {
40018
+ var message = typeOnlyDeclaration.kind === 274
40019
+ ? ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type
40020
+ : ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type;
40021
+ var unescapedName = ts.unescapeLeadingUnderscores(name);
40022
+ addTypeOnlyDeclarationRelatedInfo(error(errorLocation, message, unescapedName), typeOnlyDeclaration, unescapedName);
40023
+ }
39964
40024
  }
39965
40025
  }
39966
40026
  return result;
39967
40027
  }
39968
- function checkSymbolUsageInExpressionContext(symbol, name, useSite) {
39969
- if (!ts.isValidTypeOnlyAliasUseSite(useSite)) {
39970
- var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(symbol);
39971
- if (typeOnlyDeclaration) {
39972
- var message = typeOnlyDeclaration.kind === 274
39973
- ? ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type
39974
- : ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type;
39975
- var unescapedName = ts.unescapeLeadingUnderscores(name);
39976
- addTypeOnlyDeclarationRelatedInfo(error(useSite, message, unescapedName), typeOnlyDeclaration, unescapedName);
39977
- }
39978
- }
39979
- }
39980
40028
  function addTypeOnlyDeclarationRelatedInfo(diagnostic, typeOnlyDeclaration, unescapedName) {
39981
40029
  if (!typeOnlyDeclaration)
39982
40030
  return diagnostic;
@@ -43369,7 +43417,8 @@ var ts;
43369
43417
  includePrivateSymbol === null || includePrivateSymbol === void 0 ? void 0 : includePrivateSymbol(sym);
43370
43418
  }
43371
43419
  if (ts.isIdentifier(node)) {
43372
- var name = sym.flags & 262144 ? typeParameterToName(getDeclaredTypeOfSymbol(sym), context) : ts.factory.cloneNode(node);
43420
+ var type = getDeclaredTypeOfSymbol(sym);
43421
+ var name = sym.flags & 262144 && !isTypeSymbolAccessible(type.symbol, context.enclosingDeclaration) ? typeParameterToName(type, context) : ts.factory.cloneNode(node);
43373
43422
  name.symbol = sym;
43374
43423
  return { introducesError: introducesError, node: ts.setEmitFlags(ts.setOriginalNode(name, node), 16777216) };
43375
43424
  }
@@ -62185,7 +62234,7 @@ var ts;
62185
62234
  }
62186
62235
  var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
62187
62236
  ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
62188
- 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);
62237
+ var chain = ts.chainDiagnosticMessages(ts.map(diags_3, ts.createDiagnosticMessageChainFromDiagnostic), ts.Diagnostics.No_overload_matches_this_call);
62189
62238
  var related = __spreadArray([], ts.flatMap(diags_3, function (d) { return d.relatedInformation; }), true);
62190
62239
  var diag = void 0;
62191
62240
  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; })) {
@@ -69348,16 +69397,15 @@ var ts;
69348
69397
  return ts.nodeIsMissing(expr) ? 0 : evaluateEnumMember(expr, getSymbolOfNode(member.parent), identifier.escapedText);
69349
69398
  case 206:
69350
69399
  case 205:
69351
- var ex = expr;
69352
- if (isConstantMemberAccess(ex)) {
69353
- var type = getTypeOfExpression(ex.expression);
69400
+ if (isConstantMemberAccess(expr)) {
69401
+ var type = getTypeOfExpression(expr.expression);
69354
69402
  if (type.symbol && type.symbol.flags & 384) {
69355
69403
  var name = void 0;
69356
- if (ex.kind === 205) {
69357
- name = ex.name.escapedText;
69404
+ if (expr.kind === 205) {
69405
+ name = expr.name.escapedText;
69358
69406
  }
69359
69407
  else {
69360
- name = ts.escapeLeadingUnderscores(ts.cast(ex.argumentExpression, ts.isLiteralExpression).text);
69408
+ name = ts.escapeLeadingUnderscores(ts.cast(expr.argumentExpression, ts.isLiteralExpression).text);
69361
69409
  }
69362
69410
  return evaluateEnumMember(expr, type.symbol, name);
69363
69411
  }
@@ -69385,6 +69433,10 @@ var ts;
69385
69433
  }
69386
69434
  }
69387
69435
  function isConstantMemberAccess(node) {
69436
+ var type = getTypeOfExpression(node);
69437
+ if (type === errorType) {
69438
+ return false;
69439
+ }
69388
69440
  return node.kind === 79 ||
69389
69441
  node.kind === 205 && isConstantMemberAccess(node.expression) ||
69390
69442
  node.kind === 206 && isConstantMemberAccess(node.expression) &&
@@ -71908,7 +71960,7 @@ var ts;
71908
71960
  if (quickResult !== undefined) {
71909
71961
  return quickResult;
71910
71962
  }
71911
- var lastStatic, lastDeclare, lastAsync, lastReadonly, lastOverride;
71963
+ var lastStatic, lastDeclare, lastAsync, lastOverride;
71912
71964
  var flags = 0;
71913
71965
  for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) {
71914
71966
  var modifier = _a[_i];
@@ -72010,7 +72062,6 @@ var ts;
72010
72062
  return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature);
72011
72063
  }
72012
72064
  flags |= 64;
72013
- lastReadonly = modifier;
72014
72065
  break;
72015
72066
  case 93:
72016
72067
  if (flags & 1) {
@@ -72123,18 +72174,12 @@ var ts;
72123
72174
  if (flags & 32) {
72124
72175
  return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static");
72125
72176
  }
72126
- if (flags & 128) {
72127
- return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "abstract");
72128
- }
72129
72177
  if (flags & 16384) {
72130
72178
  return grammarErrorOnNode(lastOverride, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "override");
72131
72179
  }
72132
- else if (flags & 256) {
72180
+ if (flags & 256) {
72133
72181
  return grammarErrorOnNode(lastAsync, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "async");
72134
72182
  }
72135
- else if (flags & 64) {
72136
- return grammarErrorOnNode(lastReadonly, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "readonly");
72137
- }
72138
72183
  return false;
72139
72184
  }
72140
72185
  else if ((node.kind === 265 || node.kind === 264) && flags & 2) {
@@ -99178,7 +99223,7 @@ var ts;
99178
99223
  if (!host.fileExists || !host.readFile) {
99179
99224
  return undefined;
99180
99225
  }
99181
- var parts = getNodeModulePathParts(path);
99226
+ var parts = ts.getNodeModulePathParts(path);
99182
99227
  if (!parts) {
99183
99228
  return undefined;
99184
99229
  }
@@ -99285,48 +99330,6 @@ var ts;
99285
99330
  }
99286
99331
  }
99287
99332
  }
99288
- function getNodeModulePathParts(fullPath) {
99289
- var topLevelNodeModulesIndex = 0;
99290
- var topLevelPackageNameIndex = 0;
99291
- var packageRootIndex = 0;
99292
- var fileNameIndex = 0;
99293
- var partStart = 0;
99294
- var partEnd = 0;
99295
- var state = 0;
99296
- while (partEnd >= 0) {
99297
- partStart = partEnd;
99298
- partEnd = fullPath.indexOf("/", partStart + 1);
99299
- switch (state) {
99300
- case 0:
99301
- if (fullPath.indexOf(ts.nodeModulesPathPart, partStart) === partStart) {
99302
- topLevelNodeModulesIndex = partStart;
99303
- topLevelPackageNameIndex = partEnd;
99304
- state = 1;
99305
- }
99306
- break;
99307
- case 1:
99308
- case 2:
99309
- if (state === 1 && fullPath.charAt(partStart + 1) === "@") {
99310
- state = 2;
99311
- }
99312
- else {
99313
- packageRootIndex = partEnd;
99314
- state = 3;
99315
- }
99316
- break;
99317
- case 3:
99318
- if (fullPath.indexOf(ts.nodeModulesPathPart, partStart) === partStart) {
99319
- state = 1;
99320
- }
99321
- else {
99322
- state = 3;
99323
- }
99324
- break;
99325
- }
99326
- }
99327
- fileNameIndex = partStart;
99328
- return state > 1 ? { topLevelNodeModulesIndex: topLevelNodeModulesIndex, topLevelPackageNameIndex: topLevelPackageNameIndex, packageRootIndex: packageRootIndex, fileNameIndex: fileNameIndex } : undefined;
99329
- }
99330
99333
  function getPathRelativeToRootDirs(path, rootDirs, getCanonicalFileName) {
99331
99334
  return ts.firstDefined(rootDirs, function (rootDir) {
99332
99335
  var relativePath = getRelativePathIfInDirectory(path, rootDir, getCanonicalFileName);