typescript 4.6.0-dev.20211205 → 4.6.0-dev.20211209

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.20211205";
92
+ ts.version = ts.versionMajorMinor + ".0-dev.20211209";
93
93
  /* @internal */
94
94
  var Comparison;
95
95
  (function (Comparison) {
@@ -7926,7 +7926,7 @@ var ts;
7926
7926
  Duplicate_label_0: diag(1114, ts.DiagnosticCategory.Error, "Duplicate_label_0_1114", "Duplicate label '{0}'."),
7927
7927
  A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: diag(1115, ts.DiagnosticCategory.Error, "A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement_1115", "A 'continue' statement can only jump to a label of an enclosing iteration statement."),
7928
7928
  A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: diag(1116, ts.DiagnosticCategory.Error, "A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement_1116", "A 'break' statement can only jump to a label of an enclosing statement."),
7929
- An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: diag(1117, ts.DiagnosticCategory.Error, "An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode_1117", "An object literal cannot have multiple properties with the same name in strict mode."),
7929
+ An_object_literal_cannot_have_multiple_properties_with_the_same_name: diag(1117, ts.DiagnosticCategory.Error, "An_object_literal_cannot_have_multiple_properties_with_the_same_name_1117", "An object literal cannot have multiple properties with the same name."),
7930
7930
  An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: diag(1118, ts.DiagnosticCategory.Error, "An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name_1118", "An object literal cannot have multiple get/set accessors with the same name."),
7931
7931
  An_object_literal_cannot_have_property_and_accessor_with_the_same_name: diag(1119, ts.DiagnosticCategory.Error, "An_object_literal_cannot_have_property_and_accessor_with_the_same_name_1119", "An object literal cannot have property and accessor with the same name."),
7932
7932
  An_export_assignment_cannot_have_modifiers: diag(1120, ts.DiagnosticCategory.Error, "An_export_assignment_cannot_have_modifiers_1120", "An export assignment cannot have modifiers."),
@@ -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;
@@ -33609,10 +33613,14 @@ var ts;
33609
33613
  // - "(x,y)" is a comma expression parsed as a signature with two parameters.
33610
33614
  // - "a ? (b): c" will have "(b):" parsed as a signature with a return type annotation.
33611
33615
  // - "a ? (b): function() {}" will too, since function() is a valid JSDoc function type.
33612
- // - "a ? (b): (function() {})" as well, but inside of a parenthesized type.
33616
+ // - "a ? (b): (function() {})" as well, but inside of a parenthesized type with an arbitrary amount of nesting.
33613
33617
  //
33614
33618
  // So we need just a bit of lookahead to ensure that it can only be a signature.
33615
- var hasJSDocFunctionType = type && (ts.isJSDocFunctionType(type) || ts.isParenthesizedTypeNode(type) && ts.isJSDocFunctionType(type.type));
33619
+ var unwrappedType = type;
33620
+ while ((unwrappedType === null || unwrappedType === void 0 ? void 0 : unwrappedType.kind) === 190 /* ParenthesizedType */) {
33621
+ unwrappedType = unwrappedType.type; // Skip parens if need be
33622
+ }
33623
+ var hasJSDocFunctionType = unwrappedType && ts.isJSDocFunctionType(unwrappedType);
33616
33624
  if (!allowAmbiguity && token() !== 38 /* EqualsGreaterThanToken */ && (hasJSDocFunctionType || token() !== 18 /* OpenBraceToken */)) {
33617
33625
  // Returning undefined here will cause our caller to rewind to where we started from.
33618
33626
  return undefined;
@@ -44943,10 +44951,6 @@ var ts;
44943
44951
  seen.set(identifier.escapedText, currentKind);
44944
44952
  continue;
44945
44953
  }
44946
- if (currentKind === 1 /* Property */ && existingKind === 1 /* Property */) {
44947
- var span = ts.getErrorSpanForNode(file, identifier);
44948
- file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, ts.Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode));
44949
- }
44950
44954
  }
44951
44955
  }
44952
44956
  return bindAnonymousDeclaration(node, 4096 /* ObjectLiteral */, "__object" /* Object */);
@@ -45180,7 +45184,7 @@ var ts;
45180
45184
  }
45181
45185
  }
45182
45186
  function checkStrictModeNumericLiteral(node) {
45183
- if (inStrictMode && node.numericLiteralFlags & 32 /* Octal */) {
45187
+ if (languageVersion < 1 /* ES5 */ && inStrictMode && node.numericLiteralFlags & 32 /* Octal */) {
45184
45188
  file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode));
45185
45189
  }
45186
45190
  }
@@ -48785,10 +48789,12 @@ var ts;
48785
48789
  }
48786
48790
  /* Starting from 'initial' node walk up the parent chain until 'stopAt' node is reached.
48787
48791
  * If at any point current node is equal to 'parent' node - return true.
48792
+ * If current node is an IIFE, continue walking up.
48788
48793
  * Return false if 'stopAt' node is reached or isFunctionLike(current) === true.
48789
48794
  */
48790
48795
  function isSameScopeDescendentOf(initial, parent, stopAt) {
48791
- return !!parent && !!ts.findAncestor(initial, function (n) { return n === stopAt || ts.isFunctionLike(n) ? "quit" : n === parent; });
48796
+ return !!parent && !!ts.findAncestor(initial, function (n) { return n === parent
48797
+ || (n === stopAt || ts.isFunctionLike(n) && !ts.getImmediatelyInvokedFunctionExpression(n) ? "quit" : false); });
48792
48798
  }
48793
48799
  function getAnyImportSyntax(node) {
48794
48800
  switch (node.kind) {
@@ -65570,7 +65576,7 @@ var ts;
65570
65576
  }
65571
65577
  function getBaseTypeOfLiteralType(type) {
65572
65578
  return type.flags & 1024 /* EnumLiteral */ ? getBaseTypeOfEnumLiteralType(type) :
65573
- type.flags & 128 /* StringLiteral */ ? stringType :
65579
+ type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ? stringType :
65574
65580
  type.flags & 256 /* NumberLiteral */ ? numberType :
65575
65581
  type.flags & 2048 /* BigIntLiteral */ ? bigintType :
65576
65582
  type.flags & 512 /* BooleanLiteral */ ? booleanType :
@@ -74326,7 +74332,7 @@ var ts;
74326
74332
  typeArguments.pop();
74327
74333
  }
74328
74334
  while (typeArguments.length < typeParameters.length) {
74329
- typeArguments.push(getConstraintOfTypeParameter(typeParameters[typeArguments.length]) || getDefaultTypeArgumentType(isJs));
74335
+ typeArguments.push(getDefaultFromTypeParameter(typeParameters[typeArguments.length]) || getConstraintOfTypeParameter(typeParameters[typeArguments.length]) || getDefaultTypeArgumentType(isJs));
74330
74336
  }
74331
74337
  return typeArguments;
74332
74338
  }
@@ -74982,8 +74988,7 @@ var ts;
74982
74988
  */
74983
74989
  function checkCallExpression(node, checkMode) {
74984
74990
  var _a;
74985
- if (!checkGrammarTypeArguments(node, node.typeArguments))
74986
- checkGrammarArguments(node.arguments);
74991
+ checkGrammarTypeArguments(node, node.typeArguments);
74987
74992
  var signature = getResolvedSignature(node, /*candidatesOutArray*/ undefined, checkMode);
74988
74993
  if (signature === resolvingSignature) {
74989
74994
  // CheckMode.SkipGenericFunctions is enabled and this is a call to a generic function that
@@ -75088,8 +75093,7 @@ var ts;
75088
75093
  }
75089
75094
  function checkImportCallExpression(node) {
75090
75095
  // Check grammar of dynamic import
75091
- if (!checkGrammarArguments(node.arguments))
75092
- checkGrammarImportCallExpression(node);
75096
+ checkGrammarImportCallExpression(node);
75093
75097
  if (node.arguments.length === 0) {
75094
75098
  return createPromiseReturnType(node, anyType);
75095
75099
  }
@@ -85750,20 +85754,6 @@ var ts;
85750
85754
  }
85751
85755
  return false;
85752
85756
  }
85753
- function checkGrammarForOmittedArgument(args) {
85754
- if (args) {
85755
- for (var _i = 0, args_4 = args; _i < args_4.length; _i++) {
85756
- var arg = args_4[_i];
85757
- if (arg.kind === 226 /* OmittedExpression */) {
85758
- return grammarErrorAtPos(arg, arg.pos, 0, ts.Diagnostics.Argument_expression_expected);
85759
- }
85760
- }
85761
- }
85762
- return false;
85763
- }
85764
- function checkGrammarArguments(args) {
85765
- return checkGrammarForOmittedArgument(args);
85766
- }
85767
85757
  function checkGrammarHeritageClause(node) {
85768
85758
  var types = node.types;
85769
85759
  if (checkGrammarForDisallowedTrailingComma(types)) {
@@ -85938,9 +85928,12 @@ var ts;
85938
85928
  seen.set(effectiveName, currentKind);
85939
85929
  }
85940
85930
  else {
85941
- if ((currentKind & 12 /* PropertyAssignmentOrMethod */) && (existingKind & 12 /* PropertyAssignmentOrMethod */)) {
85931
+ if ((currentKind & 8 /* Method */) && (existingKind & 8 /* Method */)) {
85942
85932
  grammarErrorOnNode(name, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name));
85943
85933
  }
85934
+ else if ((currentKind & 4 /* PropertyAssignment */) && (existingKind & 4 /* PropertyAssignment */)) {
85935
+ grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name, ts.getTextOfNode(name));
85936
+ }
85944
85937
  else if ((currentKind & 3 /* GetOrSetAccessor */) && (existingKind & 3 /* GetOrSetAccessor */)) {
85945
85938
  if (existingKind !== 3 /* GetOrSetAccessor */ && currentKind !== existingKind) {
85946
85939
  seen.set(effectiveName, currentKind | existingKind);
@@ -103008,7 +103001,7 @@ var ts;
103008
103001
  if (ts.isIdentifier(node.expression)) {
103009
103002
  var expression = substituteExpressionIdentifier(node.expression);
103010
103003
  noSubstitution[ts.getNodeId(expression)] = true;
103011
- if (!ts.isIdentifier(expression)) {
103004
+ if (!ts.isIdentifier(expression) && !(ts.getEmitFlags(node.expression) & 4096 /* HelperName */)) {
103012
103005
  return ts.addEmitFlags(factory.updateCallExpression(node, expression,
103013
103006
  /*typeArguments*/ undefined, node.arguments), 536870912 /* IndirectCall */);
103014
103007
  }
@@ -103019,7 +103012,7 @@ var ts;
103019
103012
  if (ts.isIdentifier(node.tag)) {
103020
103013
  var tag = substituteExpressionIdentifier(node.tag);
103021
103014
  noSubstitution[ts.getNodeId(tag)] = true;
103022
- if (!ts.isIdentifier(tag)) {
103015
+ if (!ts.isIdentifier(tag) && !(ts.getEmitFlags(node.tag) & 4096 /* HelperName */)) {
103023
103016
  return ts.addEmitFlags(factory.updateTaggedTemplateExpression(node, tag,
103024
103017
  /*typeArguments*/ undefined, node.template), 536870912 /* IndirectCall */);
103025
103018
  }
@@ -113645,6 +113638,7 @@ var ts;
113645
113638
  ts.getImpliedNodeFormatForFile = getImpliedNodeFormatForFile;
113646
113639
  /** @internal */
113647
113640
  ts.plainJSErrors = new ts.Set([
113641
+ // binder errors
113648
113642
  ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0.code,
113649
113643
  ts.Diagnostics.A_module_cannot_have_multiple_default_exports.code,
113650
113644
  ts.Diagnostics.Another_export_default_is_here.code,
@@ -113660,6 +113654,81 @@ var ts;
113660
113654
  ts.Diagnostics.A_label_is_not_allowed_here.code,
113661
113655
  ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode.code,
113662
113656
  ts.Diagnostics.with_statements_are_not_allowed_in_strict_mode.code,
113657
+ // grammar errors
113658
+ ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement.code,
113659
+ ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement.code,
113660
+ ts.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name.code,
113661
+ ts.Diagnostics.A_class_member_cannot_have_the_0_keyword.code,
113662
+ ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name.code,
113663
+ ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement.code,
113664
+ ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement.code,
113665
+ ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement.code,
113666
+ ts.Diagnostics.A_default_clause_cannot_appear_more_than_once_in_a_switch_statement.code,
113667
+ ts.Diagnostics.A_default_export_must_be_at_the_top_level_of_a_file_or_module_declaration.code,
113668
+ ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context.code,
113669
+ ts.Diagnostics.A_destructuring_declaration_must_have_an_initializer.code,
113670
+ ts.Diagnostics.A_get_accessor_cannot_have_parameters.code,
113671
+ ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern.code,
113672
+ ts.Diagnostics.A_rest_element_cannot_have_a_property_name.code,
113673
+ ts.Diagnostics.A_rest_element_cannot_have_an_initializer.code,
113674
+ ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern.code,
113675
+ ts.Diagnostics.A_rest_parameter_cannot_have_an_initializer.code,
113676
+ ts.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list.code,
113677
+ ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma.code,
113678
+ ts.Diagnostics.A_return_statement_can_only_be_used_within_a_function_body.code,
113679
+ ts.Diagnostics.A_return_statement_cannot_be_used_inside_a_class_static_block.code,
113680
+ ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter.code,
113681
+ ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter.code,
113682
+ ts.Diagnostics.An_export_declaration_can_only_be_used_in_a_module.code,
113683
+ ts.Diagnostics.An_export_declaration_cannot_have_modifiers.code,
113684
+ ts.Diagnostics.An_import_declaration_can_only_be_used_in_a_namespace_or_module.code,
113685
+ ts.Diagnostics.An_import_declaration_cannot_have_modifiers.code,
113686
+ ts.Diagnostics.An_object_member_cannot_be_declared_optional.code,
113687
+ ts.Diagnostics.Argument_of_dynamic_import_cannot_be_spread_element.code,
113688
+ ts.Diagnostics.Cannot_assign_to_private_method_0_Private_methods_are_not_writable.code,
113689
+ ts.Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause.code,
113690
+ ts.Diagnostics.Catch_clause_variable_cannot_have_an_initializer.code,
113691
+ ts.Diagnostics.Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator.code,
113692
+ ts.Diagnostics.Classes_can_only_extend_a_single_class.code,
113693
+ ts.Diagnostics.Classes_may_not_have_a_field_named_constructor.code,
113694
+ 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,
113695
+ ts.Diagnostics.Duplicate_label_0.code,
113696
+ ts.Diagnostics.Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments.code,
113697
+ ts.Diagnostics.For_await_loops_cannot_be_used_inside_a_class_static_block.code,
113698
+ ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression.code,
113699
+ ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name.code,
113700
+ ts.Diagnostics.JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array.code,
113701
+ ts.Diagnostics.JSX_property_access_expressions_cannot_include_JSX_namespace_names.code,
113702
+ ts.Diagnostics.Jump_target_cannot_cross_function_boundary.code,
113703
+ ts.Diagnostics.Line_terminator_not_permitted_before_arrow.code,
113704
+ ts.Diagnostics.Modifiers_cannot_appear_here.code,
113705
+ ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement.code,
113706
+ ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement.code,
113707
+ ts.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies.code,
113708
+ 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,
113709
+ ts.Diagnostics.Property_0_is_not_accessible_outside_class_1_because_it_has_a_private_identifier.code,
113710
+ ts.Diagnostics.Tagged_template_expressions_are_not_permitted_in_an_optional_chain.code,
113711
+ ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_may_not_be_async.code,
113712
+ ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer.code,
113713
+ ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer.code,
113714
+ ts.Diagnostics.Trailing_comma_not_allowed.code,
113715
+ ts.Diagnostics.Variable_declaration_list_cannot_be_empty.code,
113716
+ ts.Diagnostics._0_and_1_operations_cannot_be_mixed_without_parentheses.code,
113717
+ ts.Diagnostics._0_expected.code,
113718
+ ts.Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2.code,
113719
+ ts.Diagnostics._0_list_cannot_be_empty.code,
113720
+ ts.Diagnostics._0_modifier_already_seen.code,
113721
+ ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration.code,
113722
+ ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element.code,
113723
+ ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter.code,
113724
+ ts.Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind.code,
113725
+ ts.Diagnostics._0_modifier_cannot_be_used_here.code,
113726
+ ts.Diagnostics._0_modifier_must_precede_1_modifier.code,
113727
+ ts.Diagnostics.const_declarations_can_only_be_declared_inside_a_block.code,
113728
+ ts.Diagnostics.const_declarations_must_be_initialized.code,
113729
+ ts.Diagnostics.extends_clause_already_seen.code,
113730
+ ts.Diagnostics.let_declarations_can_only_be_declared_inside_a_block.code,
113731
+ ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations.code,
113663
113732
  ]);
113664
113733
  /**
113665
113734
  * Determine if source file needs to be re-created even if its text hasn't changed
@@ -114689,9 +114758,10 @@ var ts;
114689
114758
  var includeBindAndCheckDiagnostics = !isTsNoCheck && (sourceFile.scriptKind === 3 /* TS */ || sourceFile.scriptKind === 4 /* TSX */
114690
114759
  || sourceFile.scriptKind === 5 /* External */ || isPlainJs || isCheckJs || sourceFile.scriptKind === 7 /* Deferred */);
114691
114760
  var bindDiagnostics = includeBindAndCheckDiagnostics ? sourceFile.bindDiagnostics : ts.emptyArray;
114692
- var checkDiagnostics = includeBindAndCheckDiagnostics && !isPlainJs ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : ts.emptyArray;
114761
+ var checkDiagnostics = includeBindAndCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : ts.emptyArray;
114693
114762
  if (isPlainJs) {
114694
114763
  bindDiagnostics = ts.filter(bindDiagnostics, function (d) { return ts.plainJSErrors.has(d.code); });
114764
+ checkDiagnostics = ts.filter(checkDiagnostics, function (d) { return ts.plainJSErrors.has(d.code); });
114695
114765
  }
114696
114766
  // skip ts-expect-error errors in plain JS files, and skip JSDoc errors except in checked JS
114697
114767
  return getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics && !isPlainJs, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : undefined);
@@ -119709,7 +119779,7 @@ var ts;
119709
119779
  getCanonicalFileName: ts.createGetCanonicalFileName(ts.sys.useCaseSensitiveFileNames)
119710
119780
  } : undefined;
119711
119781
  /**
119712
- * Create a function that reports error by writing to the system and handles the formating of the diagnostic
119782
+ * Create a function that reports error by writing to the system and handles the formatting of the diagnostic
119713
119783
  */
119714
119784
  function createDiagnosticReporter(system, pretty) {
119715
119785
  var host = system === ts.sys && sysFormatDiagnosticsHost ? sysFormatDiagnosticsHost : {
@@ -119795,19 +119865,74 @@ var ts;
119795
119865
  return ts.countWhere(diagnostics, function (diagnostic) { return diagnostic.category === ts.DiagnosticCategory.Error; });
119796
119866
  }
119797
119867
  ts.getErrorCountForSummary = getErrorCountForSummary;
119868
+ function getFilesInErrorForSummary(diagnostics) {
119869
+ var filesInError = ts.filter(diagnostics, function (diagnostic) { return diagnostic.category === ts.DiagnosticCategory.Error; })
119870
+ .map(function (errorDiagnostic) {
119871
+ if (errorDiagnostic.file === undefined)
119872
+ return;
119873
+ return "" + errorDiagnostic.file.fileName;
119874
+ });
119875
+ return filesInError.map(function (fileName) {
119876
+ var diagnosticForFileName = ts.find(diagnostics, function (diagnostic) {
119877
+ return diagnostic.file !== undefined && diagnostic.file.fileName === fileName;
119878
+ });
119879
+ if (diagnosticForFileName !== undefined) {
119880
+ var line = ts.getLineAndCharacterOfPosition(diagnosticForFileName.file, diagnosticForFileName.start).line;
119881
+ return {
119882
+ fileName: fileName,
119883
+ line: line + 1,
119884
+ };
119885
+ }
119886
+ });
119887
+ }
119888
+ ts.getFilesInErrorForSummary = getFilesInErrorForSummary;
119798
119889
  function getWatchErrorSummaryDiagnosticMessage(errorCount) {
119799
119890
  return errorCount === 1 ?
119800
119891
  ts.Diagnostics.Found_1_error_Watching_for_file_changes :
119801
119892
  ts.Diagnostics.Found_0_errors_Watching_for_file_changes;
119802
119893
  }
119803
119894
  ts.getWatchErrorSummaryDiagnosticMessage = getWatchErrorSummaryDiagnosticMessage;
119804
- function getErrorSummaryText(errorCount, newLine) {
119895
+ function getErrorSummaryText(errorCount, filesInError, newLine) {
119805
119896
  if (errorCount === 0)
119806
119897
  return "";
119807
- var d = ts.createCompilerDiagnostic(errorCount === 1 ? ts.Diagnostics.Found_1_error : ts.Diagnostics.Found_0_errors, errorCount);
119808
- return "" + newLine + ts.flattenDiagnosticMessageText(d.messageText, newLine) + newLine + newLine;
119898
+ var nonNilFiles = filesInError.filter(function (fileInError) { return fileInError !== undefined; });
119899
+ var distinctFileNamesWithLines = nonNilFiles.map(function (fileInError) { return fileInError.fileName + ":" + fileInError.line; })
119900
+ .filter(function (value, index, self) { return self.indexOf(value) === index; });
119901
+ var d = errorCount === 1 ?
119902
+ ts.createCompilerDiagnostic(filesInError[0] !== undefined ?
119903
+ ts.Diagnostics.Found_1_error_in_1 :
119904
+ ts.Diagnostics.Found_1_error, errorCount, distinctFileNamesWithLines[0]) :
119905
+ ts.createCompilerDiagnostic(distinctFileNamesWithLines.length === 0 ?
119906
+ ts.Diagnostics.Found_0_errors :
119907
+ distinctFileNamesWithLines.length === 1 ?
119908
+ ts.Diagnostics.Found_0_errors_in_1_file :
119909
+ ts.Diagnostics.Found_0_errors_in_1_files, errorCount, distinctFileNamesWithLines.length);
119910
+ return "" + newLine + ts.flattenDiagnosticMessageText(d.messageText, newLine) + newLine + newLine + (errorCount > 1 ? createTabularErrorsDisplay(nonNilFiles) : "");
119809
119911
  }
119810
119912
  ts.getErrorSummaryText = getErrorSummaryText;
119913
+ function createTabularErrorsDisplay(filesInError) {
119914
+ 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); }); });
119915
+ if (distinctFiles.length === 0)
119916
+ return "";
119917
+ var numberLength = function (num) { return Math.log(num) * Math.LOG10E + 1; };
119918
+ var fileToErrorCount = distinctFiles.map(function (file) { return [file, ts.countWhere(filesInError, function (fileInError) { return fileInError.fileName === file.fileName; })]; });
119919
+ var maxErrors = fileToErrorCount.reduce(function (acc, value) { return Math.max(acc, value[1] || 0); }, 0);
119920
+ var headerRow = ts.Diagnostics.Errors_Files.message;
119921
+ var leftColumnHeadingLength = headerRow.split(" ")[0].length;
119922
+ var leftPaddingGoal = Math.max(leftColumnHeadingLength, numberLength(maxErrors));
119923
+ var headerPadding = Math.max(numberLength(maxErrors) - leftColumnHeadingLength, 0);
119924
+ var tabularData = "";
119925
+ tabularData += " ".repeat(headerPadding) + headerRow + "\n";
119926
+ fileToErrorCount.forEach(function (row) {
119927
+ var file = row[0], errorCount = row[1];
119928
+ var errorCountDigitsLength = Math.log(errorCount) * Math.LOG10E + 1 | 0;
119929
+ var leftPadding = errorCountDigitsLength < leftPaddingGoal ?
119930
+ " ".repeat(leftPaddingGoal - errorCountDigitsLength)
119931
+ : "";
119932
+ tabularData += "" + leftPadding + errorCount + " " + file.fileName + ":" + file.line + "\n";
119933
+ });
119934
+ return tabularData;
119935
+ }
119811
119936
  function isBuilderProgram(program) {
119812
119937
  return !!program.getState;
119813
119938
  }
@@ -120011,7 +120136,7 @@ var ts;
120011
120136
  listFiles(program, write);
120012
120137
  }
120013
120138
  if (reportSummary) {
120014
- reportSummary(getErrorCountForSummary(diagnostics));
120139
+ reportSummary(getErrorCountForSummary(diagnostics), getFilesInErrorForSummary(diagnostics));
120015
120140
  }
120016
120141
  return {
120017
120142
  emitResult: emitResult,
@@ -120222,7 +120347,7 @@ var ts;
120222
120347
  var system = input.system || ts.sys;
120223
120348
  var host = input.host || (input.host = ts.createIncrementalCompilerHost(input.options, system));
120224
120349
  var builderProgram = ts.createIncrementalProgram(input);
120225
- 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);
120350
+ 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);
120226
120351
  if (input.afterProgramEmitAndDiagnostics)
120227
120352
  input.afterProgramEmitAndDiagnostics(builderProgram);
120228
120353
  return exitStatus;
@@ -122441,11 +122566,14 @@ var ts;
122441
122566
  var canReportSummary = state.watch || !!state.host.reportErrorSummary;
122442
122567
  var diagnostics = state.diagnostics;
122443
122568
  var totalErrors = 0;
122569
+ var filesInError = [];
122444
122570
  if (isCircularBuildOrder(buildOrder)) {
122445
122571
  reportBuildQueue(state, buildOrder.buildOrder);
122446
122572
  reportErrors(state, buildOrder.circularDiagnostics);
122447
122573
  if (canReportSummary)
122448
122574
  totalErrors += ts.getErrorCountForSummary(buildOrder.circularDiagnostics);
122575
+ if (canReportSummary)
122576
+ filesInError = __spreadArray(__spreadArray([], filesInError, true), ts.getFilesInErrorForSummary(buildOrder.circularDiagnostics), true);
122449
122577
  }
122450
122578
  else {
122451
122579
  // Report errors from the other projects
@@ -122457,12 +122585,14 @@ var ts;
122457
122585
  });
122458
122586
  if (canReportSummary)
122459
122587
  diagnostics.forEach(function (singleProjectErrors) { return totalErrors += ts.getErrorCountForSummary(singleProjectErrors); });
122588
+ if (canReportSummary)
122589
+ diagnostics.forEach(function (singleProjectErrors) { return __spreadArray(__spreadArray([], filesInError, true), ts.getFilesInErrorForSummary(singleProjectErrors), true); });
122460
122590
  }
122461
122591
  if (state.watch) {
122462
122592
  reportWatchStatus(state, ts.getWatchErrorSummaryDiagnosticMessage(totalErrors), totalErrors);
122463
122593
  }
122464
122594
  else if (state.host.reportErrorSummary) {
122465
- state.host.reportErrorSummary(totalErrors);
122595
+ state.host.reportErrorSummary(totalErrors, filesInError);
122466
122596
  }
122467
122597
  }
122468
122598
  /**
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.20211205",
5
+ "version": "4.6.0-dev.20211209",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [