typescript 4.6.0-dev.20211207 → 4.6.0-dev.20211211

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.20211207";
92
+ ts.version = ts.versionMajorMinor + ".0-dev.20211211";
93
93
  /* @internal */
94
94
  var Comparison;
95
95
  (function (Comparison) {
@@ -8878,6 +8878,7 @@ var ts;
8878
8878
  DIRECTORY: diag(6038, ts.DiagnosticCategory.Message, "DIRECTORY_6038", "DIRECTORY"),
8879
8879
  STRATEGY: diag(6039, ts.DiagnosticCategory.Message, "STRATEGY_6039", "STRATEGY"),
8880
8880
  FILE_OR_DIRECTORY: diag(6040, ts.DiagnosticCategory.Message, "FILE_OR_DIRECTORY_6040", "FILE OR DIRECTORY"),
8881
+ Errors_Files: diag(6041, ts.DiagnosticCategory.Message, "Errors_Files_6041", "Errors Files"),
8881
8882
  Generates_corresponding_map_file: diag(6043, ts.DiagnosticCategory.Message, "Generates_corresponding_map_file_6043", "Generates corresponding '.map' file."),
8882
8883
  Compiler_option_0_expects_an_argument: diag(6044, ts.DiagnosticCategory.Error, "Compiler_option_0_expects_an_argument_6044", "Compiler option '{0}' expects an argument."),
8883
8884
  Unterminated_quoted_string_in_response_file_0: diag(6045, ts.DiagnosticCategory.Error, "Unterminated_quoted_string_in_response_file_0_6045", "Unterminated quoted string in response file '{0}'."),
@@ -9071,6 +9072,9 @@ var ts;
9071
9072
  Output_Formatting: diag(6256, ts.DiagnosticCategory.Message, "Output_Formatting_6256", "Output Formatting"),
9072
9073
  Completeness: diag(6257, ts.DiagnosticCategory.Message, "Completeness_6257", "Completeness"),
9073
9074
  _0_should_be_set_inside_the_compilerOptions_object_of_the_config_json_file: diag(6258, ts.DiagnosticCategory.Error, "_0_should_be_set_inside_the_compilerOptions_object_of_the_config_json_file_6258", "'{0}' should be set inside the 'compilerOptions' object of the config json file"),
9075
+ Found_1_error_in_1: diag(6259, ts.DiagnosticCategory.Message, "Found_1_error_in_1_6259", "Found 1 error in {1}"),
9076
+ Found_0_errors_in_1_file: diag(6260, ts.DiagnosticCategory.Message, "Found_0_errors_in_1_file_6260", "Found {0} errors in 1 file."),
9077
+ Found_0_errors_in_1_files: diag(6261, ts.DiagnosticCategory.Message, "Found_0_errors_in_1_files_6261", "Found {0} errors in {1} files."),
9074
9078
  Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve: diag(6270, ts.DiagnosticCategory.Message, "Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve_6270", "Directory '{0}' has no containing package.json scope. Imports will not resolve."),
9075
9079
  Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1: diag(6271, ts.DiagnosticCategory.Message, "Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1_6271", "Import specifier '{0}' does not exist in package.json scope at path '{1}'."),
9076
9080
  Invalid_import_specifier_0_has_no_possible_resolutions: diag(6272, ts.DiagnosticCategory.Message, "Invalid_import_specifier_0_has_no_possible_resolutions_6272", "Invalid import specifier '{0}' has no possible resolutions."),
@@ -24423,7 +24427,7 @@ var ts;
24423
24427
  // @api
24424
24428
  function createAssertClause(elements, multiLine) {
24425
24429
  var node = createBaseNode(292 /* AssertClause */);
24426
- node.elements = elements;
24430
+ node.elements = createNodeArray(elements);
24427
24431
  node.multiLine = multiLine;
24428
24432
  node.transformFlags |= 4 /* ContainsESNext */;
24429
24433
  return node;
@@ -54044,7 +54048,27 @@ var ts;
54044
54048
  return mapType(source, function (t) { return getRestType(t, properties, symbol); });
54045
54049
  }
54046
54050
  var omitKeyType = getUnionType(ts.map(properties, getLiteralTypeFromPropertyName));
54051
+ var spreadableProperties = [];
54052
+ var unspreadableToRestKeys = [];
54053
+ for (var _i = 0, _a = getPropertiesOfType(source); _i < _a.length; _i++) {
54054
+ var prop = _a[_i];
54055
+ var literalTypeFromProperty = getLiteralTypeFromProperty(prop, 8576 /* StringOrNumberLiteralOrUnique */);
54056
+ if (!isTypeAssignableTo(literalTypeFromProperty, omitKeyType)
54057
+ && !(ts.getDeclarationModifierFlagsFromSymbol(prop) & (8 /* Private */ | 16 /* Protected */))
54058
+ && isSpreadableProperty(prop)) {
54059
+ spreadableProperties.push(prop);
54060
+ }
54061
+ else {
54062
+ unspreadableToRestKeys.push(literalTypeFromProperty);
54063
+ }
54064
+ }
54047
54065
  if (isGenericObjectType(source) || isGenericIndexType(omitKeyType)) {
54066
+ if (unspreadableToRestKeys.length) {
54067
+ // If the type we're spreading from has properties that cannot
54068
+ // be spread into the rest type (e.g. getters, methods), ensure
54069
+ // they are explicitly omitted, as they would in the non-generic case.
54070
+ omitKeyType = getUnionType(__spreadArray([omitKeyType], unspreadableToRestKeys, true));
54071
+ }
54048
54072
  if (omitKeyType.flags & 131072 /* Never */) {
54049
54073
  return source;
54050
54074
  }
@@ -54055,13 +54079,9 @@ var ts;
54055
54079
  return getTypeAliasInstantiation(omitTypeAlias, [source, omitKeyType]);
54056
54080
  }
54057
54081
  var members = ts.createSymbolTable();
54058
- for (var _i = 0, _a = getPropertiesOfType(source); _i < _a.length; _i++) {
54059
- var prop = _a[_i];
54060
- if (!isTypeAssignableTo(getLiteralTypeFromProperty(prop, 8576 /* StringOrNumberLiteralOrUnique */), omitKeyType)
54061
- && !(ts.getDeclarationModifierFlagsFromSymbol(prop) & (8 /* Private */ | 16 /* Protected */))
54062
- && isSpreadableProperty(prop)) {
54063
- members.set(prop.escapedName, getSpreadSymbol(prop, /*readonly*/ false));
54064
- }
54082
+ for (var _b = 0, spreadableProperties_1 = spreadableProperties; _b < spreadableProperties_1.length; _b++) {
54083
+ var prop = spreadableProperties_1[_b];
54084
+ members.set(prop.escapedName, getSpreadSymbol(prop, /*readonly*/ false));
54065
54085
  }
54066
54086
  var result = createAnonymousType(symbol, members, ts.emptyArray, ts.emptyArray, getIndexInfosOfType(source));
54067
54087
  result.objectFlags |= 8388608 /* ObjectRestType */;
@@ -74328,7 +74348,7 @@ var ts;
74328
74348
  typeArguments.pop();
74329
74349
  }
74330
74350
  while (typeArguments.length < typeParameters.length) {
74331
- typeArguments.push(getConstraintOfTypeParameter(typeParameters[typeArguments.length]) || getDefaultTypeArgumentType(isJs));
74351
+ typeArguments.push(getDefaultFromTypeParameter(typeParameters[typeArguments.length]) || getConstraintOfTypeParameter(typeParameters[typeArguments.length]) || getDefaultTypeArgumentType(isJs));
74332
74352
  }
74333
74353
  return typeArguments;
74334
74354
  }
@@ -74984,8 +75004,7 @@ var ts;
74984
75004
  */
74985
75005
  function checkCallExpression(node, checkMode) {
74986
75006
  var _a;
74987
- if (!checkGrammarTypeArguments(node, node.typeArguments))
74988
- checkGrammarArguments(node.arguments);
75007
+ checkGrammarTypeArguments(node, node.typeArguments);
74989
75008
  var signature = getResolvedSignature(node, /*candidatesOutArray*/ undefined, checkMode);
74990
75009
  if (signature === resolvingSignature) {
74991
75010
  // CheckMode.SkipGenericFunctions is enabled and this is a call to a generic function that
@@ -75090,8 +75109,7 @@ var ts;
75090
75109
  }
75091
75110
  function checkImportCallExpression(node) {
75092
75111
  // Check grammar of dynamic import
75093
- if (!checkGrammarArguments(node.arguments))
75094
- checkGrammarImportCallExpression(node);
75112
+ checkGrammarImportCallExpression(node);
75095
75113
  if (node.arguments.length === 0) {
75096
75114
  return createPromiseReturnType(node, anyType);
75097
75115
  }
@@ -82199,7 +82217,7 @@ var ts;
82199
82217
  for (var _a = 0, properties_4 = properties_5; _a < properties_4.length; _a++) {
82200
82218
  var prop = properties_4[_a];
82201
82219
  var existing = seen.get(prop.escapedName);
82202
- if (existing && !isPropertyIdenticalTo(existing, prop)) {
82220
+ if (existing && prop.parent === existing.parent) {
82203
82221
  seen.delete(prop.escapedName);
82204
82222
  }
82205
82223
  }
@@ -85752,20 +85770,6 @@ var ts;
85752
85770
  }
85753
85771
  return false;
85754
85772
  }
85755
- function checkGrammarForOmittedArgument(args) {
85756
- if (args) {
85757
- for (var _i = 0, args_4 = args; _i < args_4.length; _i++) {
85758
- var arg = args_4[_i];
85759
- if (arg.kind === 226 /* OmittedExpression */) {
85760
- return grammarErrorAtPos(arg, arg.pos, 0, ts.Diagnostics.Argument_expression_expected);
85761
- }
85762
- }
85763
- }
85764
- return false;
85765
- }
85766
- function checkGrammarArguments(args) {
85767
- return checkGrammarForOmittedArgument(args);
85768
- }
85769
85773
  function checkGrammarHeritageClause(node) {
85770
85774
  var types = node.types;
85771
85775
  if (checkGrammarForDisallowedTrailingComma(types)) {
@@ -103013,7 +103017,7 @@ var ts;
103013
103017
  if (ts.isIdentifier(node.expression)) {
103014
103018
  var expression = substituteExpressionIdentifier(node.expression);
103015
103019
  noSubstitution[ts.getNodeId(expression)] = true;
103016
- if (!ts.isIdentifier(expression)) {
103020
+ if (!ts.isIdentifier(expression) && !(ts.getEmitFlags(node.expression) & 4096 /* HelperName */)) {
103017
103021
  return ts.addEmitFlags(factory.updateCallExpression(node, expression,
103018
103022
  /*typeArguments*/ undefined, node.arguments), 536870912 /* IndirectCall */);
103019
103023
  }
@@ -103024,7 +103028,7 @@ var ts;
103024
103028
  if (ts.isIdentifier(node.tag)) {
103025
103029
  var tag = substituteExpressionIdentifier(node.tag);
103026
103030
  noSubstitution[ts.getNodeId(tag)] = true;
103027
- if (!ts.isIdentifier(tag)) {
103031
+ if (!ts.isIdentifier(tag) && !(ts.getEmitFlags(node.tag) & 4096 /* HelperName */)) {
103028
103032
  return ts.addEmitFlags(factory.updateTaggedTemplateExpression(node, tag,
103029
103033
  /*typeArguments*/ undefined, node.template), 536870912 /* IndirectCall */);
103030
103034
  }
@@ -113650,6 +113654,7 @@ var ts;
113650
113654
  ts.getImpliedNodeFormatForFile = getImpliedNodeFormatForFile;
113651
113655
  /** @internal */
113652
113656
  ts.plainJSErrors = new ts.Set([
113657
+ // binder errors
113653
113658
  ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0.code,
113654
113659
  ts.Diagnostics.A_module_cannot_have_multiple_default_exports.code,
113655
113660
  ts.Diagnostics.Another_export_default_is_here.code,
@@ -113665,6 +113670,81 @@ var ts;
113665
113670
  ts.Diagnostics.A_label_is_not_allowed_here.code,
113666
113671
  ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode.code,
113667
113672
  ts.Diagnostics.with_statements_are_not_allowed_in_strict_mode.code,
113673
+ // grammar errors
113674
+ ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement.code,
113675
+ ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement.code,
113676
+ ts.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name.code,
113677
+ ts.Diagnostics.A_class_member_cannot_have_the_0_keyword.code,
113678
+ ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name.code,
113679
+ ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement.code,
113680
+ ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement.code,
113681
+ ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement.code,
113682
+ ts.Diagnostics.A_default_clause_cannot_appear_more_than_once_in_a_switch_statement.code,
113683
+ ts.Diagnostics.A_default_export_must_be_at_the_top_level_of_a_file_or_module_declaration.code,
113684
+ ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context.code,
113685
+ ts.Diagnostics.A_destructuring_declaration_must_have_an_initializer.code,
113686
+ ts.Diagnostics.A_get_accessor_cannot_have_parameters.code,
113687
+ ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern.code,
113688
+ ts.Diagnostics.A_rest_element_cannot_have_a_property_name.code,
113689
+ ts.Diagnostics.A_rest_element_cannot_have_an_initializer.code,
113690
+ ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern.code,
113691
+ ts.Diagnostics.A_rest_parameter_cannot_have_an_initializer.code,
113692
+ ts.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list.code,
113693
+ ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma.code,
113694
+ ts.Diagnostics.A_return_statement_can_only_be_used_within_a_function_body.code,
113695
+ ts.Diagnostics.A_return_statement_cannot_be_used_inside_a_class_static_block.code,
113696
+ ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter.code,
113697
+ ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter.code,
113698
+ ts.Diagnostics.An_export_declaration_can_only_be_used_in_a_module.code,
113699
+ ts.Diagnostics.An_export_declaration_cannot_have_modifiers.code,
113700
+ ts.Diagnostics.An_import_declaration_can_only_be_used_in_a_namespace_or_module.code,
113701
+ ts.Diagnostics.An_import_declaration_cannot_have_modifiers.code,
113702
+ ts.Diagnostics.An_object_member_cannot_be_declared_optional.code,
113703
+ ts.Diagnostics.Argument_of_dynamic_import_cannot_be_spread_element.code,
113704
+ ts.Diagnostics.Cannot_assign_to_private_method_0_Private_methods_are_not_writable.code,
113705
+ ts.Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause.code,
113706
+ ts.Diagnostics.Catch_clause_variable_cannot_have_an_initializer.code,
113707
+ ts.Diagnostics.Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator.code,
113708
+ ts.Diagnostics.Classes_can_only_extend_a_single_class.code,
113709
+ ts.Diagnostics.Classes_may_not_have_a_field_named_constructor.code,
113710
+ ts.Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern.code,
113711
+ ts.Diagnostics.Duplicate_label_0.code,
113712
+ ts.Diagnostics.Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments.code,
113713
+ ts.Diagnostics.For_await_loops_cannot_be_used_inside_a_class_static_block.code,
113714
+ ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression.code,
113715
+ ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name.code,
113716
+ ts.Diagnostics.JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array.code,
113717
+ ts.Diagnostics.JSX_property_access_expressions_cannot_include_JSX_namespace_names.code,
113718
+ ts.Diagnostics.Jump_target_cannot_cross_function_boundary.code,
113719
+ ts.Diagnostics.Line_terminator_not_permitted_before_arrow.code,
113720
+ ts.Diagnostics.Modifiers_cannot_appear_here.code,
113721
+ ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement.code,
113722
+ ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement.code,
113723
+ ts.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies.code,
113724
+ ts.Diagnostics.Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression.code,
113725
+ ts.Diagnostics.Property_0_is_not_accessible_outside_class_1_because_it_has_a_private_identifier.code,
113726
+ ts.Diagnostics.Tagged_template_expressions_are_not_permitted_in_an_optional_chain.code,
113727
+ ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_may_not_be_async.code,
113728
+ ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer.code,
113729
+ ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer.code,
113730
+ ts.Diagnostics.Trailing_comma_not_allowed.code,
113731
+ ts.Diagnostics.Variable_declaration_list_cannot_be_empty.code,
113732
+ ts.Diagnostics._0_and_1_operations_cannot_be_mixed_without_parentheses.code,
113733
+ ts.Diagnostics._0_expected.code,
113734
+ ts.Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2.code,
113735
+ ts.Diagnostics._0_list_cannot_be_empty.code,
113736
+ ts.Diagnostics._0_modifier_already_seen.code,
113737
+ ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration.code,
113738
+ ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element.code,
113739
+ ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter.code,
113740
+ ts.Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind.code,
113741
+ ts.Diagnostics._0_modifier_cannot_be_used_here.code,
113742
+ ts.Diagnostics._0_modifier_must_precede_1_modifier.code,
113743
+ ts.Diagnostics.const_declarations_can_only_be_declared_inside_a_block.code,
113744
+ ts.Diagnostics.const_declarations_must_be_initialized.code,
113745
+ ts.Diagnostics.extends_clause_already_seen.code,
113746
+ ts.Diagnostics.let_declarations_can_only_be_declared_inside_a_block.code,
113747
+ ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations.code,
113668
113748
  ]);
113669
113749
  /**
113670
113750
  * Determine if source file needs to be re-created even if its text hasn't changed
@@ -114694,9 +114774,10 @@ var ts;
114694
114774
  var includeBindAndCheckDiagnostics = !isTsNoCheck && (sourceFile.scriptKind === 3 /* TS */ || sourceFile.scriptKind === 4 /* TSX */
114695
114775
  || sourceFile.scriptKind === 5 /* External */ || isPlainJs || isCheckJs || sourceFile.scriptKind === 7 /* Deferred */);
114696
114776
  var bindDiagnostics = includeBindAndCheckDiagnostics ? sourceFile.bindDiagnostics : ts.emptyArray;
114697
- var checkDiagnostics = includeBindAndCheckDiagnostics && !isPlainJs ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : ts.emptyArray;
114777
+ var checkDiagnostics = includeBindAndCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : ts.emptyArray;
114698
114778
  if (isPlainJs) {
114699
114779
  bindDiagnostics = ts.filter(bindDiagnostics, function (d) { return ts.plainJSErrors.has(d.code); });
114780
+ checkDiagnostics = ts.filter(checkDiagnostics, function (d) { return ts.plainJSErrors.has(d.code); });
114700
114781
  }
114701
114782
  // skip ts-expect-error errors in plain JS files, and skip JSDoc errors except in checked JS
114702
114783
  return getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics && !isPlainJs, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : undefined);
@@ -119714,7 +119795,7 @@ var ts;
119714
119795
  getCanonicalFileName: ts.createGetCanonicalFileName(ts.sys.useCaseSensitiveFileNames)
119715
119796
  } : undefined;
119716
119797
  /**
119717
- * Create a function that reports error by writing to the system and handles the formating of the diagnostic
119798
+ * Create a function that reports error by writing to the system and handles the formatting of the diagnostic
119718
119799
  */
119719
119800
  function createDiagnosticReporter(system, pretty) {
119720
119801
  var host = system === ts.sys && sysFormatDiagnosticsHost ? sysFormatDiagnosticsHost : {
@@ -119800,19 +119881,74 @@ var ts;
119800
119881
  return ts.countWhere(diagnostics, function (diagnostic) { return diagnostic.category === ts.DiagnosticCategory.Error; });
119801
119882
  }
119802
119883
  ts.getErrorCountForSummary = getErrorCountForSummary;
119884
+ function getFilesInErrorForSummary(diagnostics) {
119885
+ var filesInError = ts.filter(diagnostics, function (diagnostic) { return diagnostic.category === ts.DiagnosticCategory.Error; })
119886
+ .map(function (errorDiagnostic) {
119887
+ if (errorDiagnostic.file === undefined)
119888
+ return;
119889
+ return "" + errorDiagnostic.file.fileName;
119890
+ });
119891
+ return filesInError.map(function (fileName) {
119892
+ var diagnosticForFileName = ts.find(diagnostics, function (diagnostic) {
119893
+ return diagnostic.file !== undefined && diagnostic.file.fileName === fileName;
119894
+ });
119895
+ if (diagnosticForFileName !== undefined) {
119896
+ var line = ts.getLineAndCharacterOfPosition(diagnosticForFileName.file, diagnosticForFileName.start).line;
119897
+ return {
119898
+ fileName: fileName,
119899
+ line: line + 1,
119900
+ };
119901
+ }
119902
+ });
119903
+ }
119904
+ ts.getFilesInErrorForSummary = getFilesInErrorForSummary;
119803
119905
  function getWatchErrorSummaryDiagnosticMessage(errorCount) {
119804
119906
  return errorCount === 1 ?
119805
119907
  ts.Diagnostics.Found_1_error_Watching_for_file_changes :
119806
119908
  ts.Diagnostics.Found_0_errors_Watching_for_file_changes;
119807
119909
  }
119808
119910
  ts.getWatchErrorSummaryDiagnosticMessage = getWatchErrorSummaryDiagnosticMessage;
119809
- function getErrorSummaryText(errorCount, newLine) {
119911
+ function getErrorSummaryText(errorCount, filesInError, newLine) {
119810
119912
  if (errorCount === 0)
119811
119913
  return "";
119812
- var d = ts.createCompilerDiagnostic(errorCount === 1 ? ts.Diagnostics.Found_1_error : ts.Diagnostics.Found_0_errors, errorCount);
119813
- return "" + newLine + ts.flattenDiagnosticMessageText(d.messageText, newLine) + newLine + newLine;
119914
+ var nonNilFiles = filesInError.filter(function (fileInError) { return fileInError !== undefined; });
119915
+ var distinctFileNamesWithLines = nonNilFiles.map(function (fileInError) { return fileInError.fileName + ":" + fileInError.line; })
119916
+ .filter(function (value, index, self) { return self.indexOf(value) === index; });
119917
+ var d = errorCount === 1 ?
119918
+ ts.createCompilerDiagnostic(filesInError[0] !== undefined ?
119919
+ ts.Diagnostics.Found_1_error_in_1 :
119920
+ ts.Diagnostics.Found_1_error, errorCount, distinctFileNamesWithLines[0]) :
119921
+ ts.createCompilerDiagnostic(distinctFileNamesWithLines.length === 0 ?
119922
+ ts.Diagnostics.Found_0_errors :
119923
+ distinctFileNamesWithLines.length === 1 ?
119924
+ ts.Diagnostics.Found_0_errors_in_1_file :
119925
+ ts.Diagnostics.Found_0_errors_in_1_files, errorCount, distinctFileNamesWithLines.length);
119926
+ return "" + newLine + ts.flattenDiagnosticMessageText(d.messageText, newLine) + newLine + newLine + (errorCount > 1 ? createTabularErrorsDisplay(nonNilFiles) : "");
119814
119927
  }
119815
119928
  ts.getErrorSummaryText = getErrorSummaryText;
119929
+ function createTabularErrorsDisplay(filesInError) {
119930
+ var distinctFiles = filesInError.filter(function (value, index, self) { return index === self.findIndex(function (file) { return (file === null || file === void 0 ? void 0 : file.fileName) === (value === null || value === void 0 ? void 0 : value.fileName); }); });
119931
+ if (distinctFiles.length === 0)
119932
+ return "";
119933
+ var numberLength = function (num) { return Math.log(num) * Math.LOG10E + 1; };
119934
+ var fileToErrorCount = distinctFiles.map(function (file) { return [file, ts.countWhere(filesInError, function (fileInError) { return fileInError.fileName === file.fileName; })]; });
119935
+ var maxErrors = fileToErrorCount.reduce(function (acc, value) { return Math.max(acc, value[1] || 0); }, 0);
119936
+ var headerRow = ts.Diagnostics.Errors_Files.message;
119937
+ var leftColumnHeadingLength = headerRow.split(" ")[0].length;
119938
+ var leftPaddingGoal = Math.max(leftColumnHeadingLength, numberLength(maxErrors));
119939
+ var headerPadding = Math.max(numberLength(maxErrors) - leftColumnHeadingLength, 0);
119940
+ var tabularData = "";
119941
+ tabularData += " ".repeat(headerPadding) + headerRow + "\n";
119942
+ fileToErrorCount.forEach(function (row) {
119943
+ var file = row[0], errorCount = row[1];
119944
+ var errorCountDigitsLength = Math.log(errorCount) * Math.LOG10E + 1 | 0;
119945
+ var leftPadding = errorCountDigitsLength < leftPaddingGoal ?
119946
+ " ".repeat(leftPaddingGoal - errorCountDigitsLength)
119947
+ : "";
119948
+ tabularData += "" + leftPadding + errorCount + " " + file.fileName + ":" + file.line + "\n";
119949
+ });
119950
+ return tabularData;
119951
+ }
119816
119952
  function isBuilderProgram(program) {
119817
119953
  return !!program.getState;
119818
119954
  }
@@ -120016,7 +120152,7 @@ var ts;
120016
120152
  listFiles(program, write);
120017
120153
  }
120018
120154
  if (reportSummary) {
120019
- reportSummary(getErrorCountForSummary(diagnostics));
120155
+ reportSummary(getErrorCountForSummary(diagnostics), getFilesInErrorForSummary(diagnostics));
120020
120156
  }
120021
120157
  return {
120022
120158
  emitResult: emitResult,
@@ -120227,7 +120363,7 @@ var ts;
120227
120363
  var system = input.system || ts.sys;
120228
120364
  var host = input.host || (input.host = ts.createIncrementalCompilerHost(input.options, system));
120229
120365
  var builderProgram = ts.createIncrementalProgram(input);
120230
- var exitStatus = emitFilesAndReportErrorsAndGetExitStatus(builderProgram, input.reportDiagnostic || createDiagnosticReporter(system), function (s) { return host.trace && host.trace(s); }, input.reportErrorSummary || input.options.pretty ? function (errorCount) { return system.write(getErrorSummaryText(errorCount, system.newLine)); } : undefined);
120366
+ var exitStatus = emitFilesAndReportErrorsAndGetExitStatus(builderProgram, input.reportDiagnostic || createDiagnosticReporter(system), function (s) { return host.trace && host.trace(s); }, input.reportErrorSummary || input.options.pretty ? function (errorCount, filesInError) { return system.write(getErrorSummaryText(errorCount, filesInError, system.newLine)); } : undefined);
120231
120367
  if (input.afterProgramEmitAndDiagnostics)
120232
120368
  input.afterProgramEmitAndDiagnostics(builderProgram);
120233
120369
  return exitStatus;
@@ -122446,11 +122582,14 @@ var ts;
122446
122582
  var canReportSummary = state.watch || !!state.host.reportErrorSummary;
122447
122583
  var diagnostics = state.diagnostics;
122448
122584
  var totalErrors = 0;
122585
+ var filesInError = [];
122449
122586
  if (isCircularBuildOrder(buildOrder)) {
122450
122587
  reportBuildQueue(state, buildOrder.buildOrder);
122451
122588
  reportErrors(state, buildOrder.circularDiagnostics);
122452
122589
  if (canReportSummary)
122453
122590
  totalErrors += ts.getErrorCountForSummary(buildOrder.circularDiagnostics);
122591
+ if (canReportSummary)
122592
+ filesInError = __spreadArray(__spreadArray([], filesInError, true), ts.getFilesInErrorForSummary(buildOrder.circularDiagnostics), true);
122454
122593
  }
122455
122594
  else {
122456
122595
  // Report errors from the other projects
@@ -122462,12 +122601,14 @@ var ts;
122462
122601
  });
122463
122602
  if (canReportSummary)
122464
122603
  diagnostics.forEach(function (singleProjectErrors) { return totalErrors += ts.getErrorCountForSummary(singleProjectErrors); });
122604
+ if (canReportSummary)
122605
+ diagnostics.forEach(function (singleProjectErrors) { return __spreadArray(__spreadArray([], filesInError, true), ts.getFilesInErrorForSummary(singleProjectErrors), true); });
122465
122606
  }
122466
122607
  if (state.watch) {
122467
122608
  reportWatchStatus(state, ts.getWatchErrorSummaryDiagnosticMessage(totalErrors), totalErrors);
122468
122609
  }
122469
122610
  else if (state.host.reportErrorSummary) {
122470
- state.host.reportErrorSummary(totalErrors);
122611
+ state.host.reportErrorSummary(totalErrors, filesInError);
122471
122612
  }
122472
122613
  }
122473
122614
  /**
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.20211207",
5
+ "version": "4.6.0-dev.20211211",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -28,6 +28,7 @@
28
28
  "engines": {
29
29
  "node": ">=4.2.0"
30
30
  },
31
+ "packageManager": "npm@6.14.15",
31
32
  "devDependencies": {
32
33
  "@octokit/rest": "latest",
33
34
  "@types/browserify": "latest",