typescript 5.1.0-dev.20230320 → 5.1.0-dev.20230322

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
@@ -15,15 +15,10 @@ and limitations under the License.
15
15
 
16
16
 
17
17
  "use strict";
18
- var __defProp = Object.defineProperty;
19
- var __export = (target, all) => {
20
- for (var name in all)
21
- __defProp(target, name, { get: all[name], enumerable: true });
22
- };
23
18
 
24
19
  // src/compiler/corePublic.ts
25
20
  var versionMajorMinor = "5.1";
26
- var version = `${versionMajorMinor}.0-dev.20230320`;
21
+ var version = `${versionMajorMinor}.0-dev.20230322`;
27
22
 
28
23
  // src/compiler/core.ts
29
24
  var emptyArray = [];
@@ -2655,25 +2650,6 @@ try {
2655
2650
  }
2656
2651
  var perfLogger = (etwModule == null ? void 0 : etwModule.logEvent) ? etwModule : void 0;
2657
2652
 
2658
- // src/compiler/_namespaces/ts.performance.ts
2659
- var ts_performance_exports = {};
2660
- __export(ts_performance_exports, {
2661
- clearMarks: () => clearMarks,
2662
- clearMeasures: () => clearMeasures,
2663
- createTimer: () => createTimer,
2664
- createTimerIf: () => createTimerIf,
2665
- disable: () => disable,
2666
- enable: () => enable,
2667
- forEachMark: () => forEachMark,
2668
- forEachMeasure: () => forEachMeasure,
2669
- getCount: () => getCount,
2670
- getDuration: () => getDuration,
2671
- isEnabled: () => isEnabled,
2672
- mark: () => mark,
2673
- measure: () => measure,
2674
- nullTimer: () => nullTimer
2675
- });
2676
-
2677
2653
  // src/compiler/performance.ts
2678
2654
  var perfHooks;
2679
2655
  var performanceImpl;
@@ -4869,7 +4845,7 @@ var sys = (() => {
4869
4845
  }
4870
4846
  let activeSession;
4871
4847
  let profilePath = "./profile.cpuprofile";
4872
- const Buffer2 = require("buffer").Buffer;
4848
+ const Buffer = require("buffer").Buffer;
4873
4849
  const isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
4874
4850
  const platform = _os.platform();
4875
4851
  const useCaseSensitiveFileNames = isFileSystemCaseSensitive();
@@ -5076,7 +5052,7 @@ var sys = (() => {
5076
5052
  }
5077
5053
  }
5078
5054
  function bufferFrom(input, encoding) {
5079
- return Buffer2.from && Buffer2.from !== Int8Array.from ? Buffer2.from(input, encoding) : new Buffer2(input, encoding);
5055
+ return Buffer.from && Buffer.from !== Int8Array.from ? Buffer.from(input, encoding) : new Buffer(input, encoding);
5080
5056
  }
5081
5057
  function isFileSystemCaseSensitive() {
5082
5058
  if (platform === "win32" || platform === "win64") {
@@ -6658,6 +6634,7 @@ var Diagnostics = {
6658
6634
  A_declaration_file_cannot_be_imported_without_import_type_Did_you_mean_to_import_an_implementation_file_0_instead: diag(2846, 1 /* Error */, "A_declaration_file_cannot_be_imported_without_import_type_Did_you_mean_to_import_an_implementation_f_2846", "A declaration file cannot be imported without 'import type'. Did you mean to import an implementation file '{0}' instead?"),
6659
6635
  A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value: diag(2847, 1 /* Error */, "A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value_2847", "A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value."),
6660
6636
  The_right_hand_side_of_an_instanceof_expression_must_not_be_an_instantiation_expression: diag(2848, 1 /* Error */, "The_right_hand_side_of_an_instanceof_expression_must_not_be_an_instantiation_expression_2848", "The right-hand side of an 'instanceof' expression must not be an instantiation expression."),
6637
+ Target_signature_provides_too_few_arguments_Expected_0_or_more_but_got_1: diag(2849, 1 /* Error */, "Target_signature_provides_too_few_arguments_Expected_0_or_more_but_got_1_2849", "Target signature provides too few arguments. Expected {0} or more, but got {1}."),
6661
6638
  Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
6662
6639
  Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* Error */, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
6663
6640
  Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* Error */, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
@@ -7103,13 +7080,14 @@ var Diagnostics = {
7103
7080
  Output_Formatting: diag(6256, 3 /* Message */, "Output_Formatting_6256", "Output Formatting"),
7104
7081
  Completeness: diag(6257, 3 /* Message */, "Completeness_6257", "Completeness"),
7105
7082
  _0_should_be_set_inside_the_compilerOptions_object_of_the_config_json_file: diag(6258, 1 /* 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"),
7106
- Found_1_error_in_1: diag(6259, 3 /* Message */, "Found_1_error_in_1_6259", "Found 1 error in {1}"),
7083
+ Found_1_error_in_0: diag(6259, 3 /* Message */, "Found_1_error_in_0_6259", "Found 1 error in {0}"),
7107
7084
  Found_0_errors_in_the_same_file_starting_at_Colon_1: diag(6260, 3 /* Message */, "Found_0_errors_in_the_same_file_starting_at_Colon_1_6260", "Found {0} errors in the same file, starting at: {1}"),
7108
7085
  Found_0_errors_in_1_files: diag(6261, 3 /* Message */, "Found_0_errors_in_1_files_6261", "Found {0} errors in {1} files."),
7109
7086
  File_name_0_has_a_1_extension_looking_up_2_instead: diag(6262, 3 /* Message */, "File_name_0_has_a_1_extension_looking_up_2_instead_6262", "File name '{0}' has a '{1}' extension - looking up '{2}' instead."),
7110
7087
  Module_0_was_resolved_to_1_but_allowArbitraryExtensions_is_not_set: diag(6263, 1 /* Error */, "Module_0_was_resolved_to_1_but_allowArbitraryExtensions_is_not_set_6263", "Module '{0}' was resolved to '{1}', but '--allowArbitraryExtensions' is not set."),
7111
7088
  Enable_importing_files_with_any_extension_provided_a_declaration_file_is_present: diag(6264, 3 /* Message */, "Enable_importing_files_with_any_extension_provided_a_declaration_file_is_present_6264", "Enable importing files with any extension, provided a declaration file is present."),
7112
7089
  Resolving_type_reference_directive_for_program_that_specifies_custom_typeRoots_skipping_lookup_in_node_modules_folder: diag(6265, 3 /* Message */, "Resolving_type_reference_directive_for_program_that_specifies_custom_typeRoots_skipping_lookup_in_no_6265", "Resolving type reference directive for program that specifies custom typeRoots, skipping lookup in 'node_modules' folder."),
7090
+ Option_0_can_only_be_specified_on_command_line: diag(6266, 1 /* Error */, "Option_0_can_only_be_specified_on_command_line_6266", "Option '{0}' can only be specified on command line."),
7113
7091
  Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve: diag(6270, 3 /* 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."),
7114
7092
  Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1: diag(6271, 3 /* 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}'."),
7115
7093
  Invalid_import_specifier_0_has_no_possible_resolutions: diag(6272, 3 /* Message */, "Invalid_import_specifier_0_has_no_possible_resolutions_6272", "Invalid import specifier '{0}' has no possible resolutions."),
@@ -12270,17 +12248,17 @@ function entityNameToString(name) {
12270
12248
  return Debug.assertNever(name);
12271
12249
  }
12272
12250
  }
12273
- function createDiagnosticForNode(node, message, arg0, arg1, arg2, arg3) {
12251
+ function createDiagnosticForNode(node, message, ...args) {
12274
12252
  const sourceFile = getSourceFileOfNode(node);
12275
- return createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2, arg3);
12253
+ return createDiagnosticForNodeInSourceFile(sourceFile, node, message, ...args);
12276
12254
  }
12277
- function createDiagnosticForNodeArray(sourceFile, nodes, message, arg0, arg1, arg2, arg3) {
12255
+ function createDiagnosticForNodeArray(sourceFile, nodes, message, ...args) {
12278
12256
  const start = skipTrivia(sourceFile.text, nodes.pos);
12279
- return createFileDiagnostic(sourceFile, start, nodes.end - start, message, arg0, arg1, arg2, arg3);
12257
+ return createFileDiagnostic(sourceFile, start, nodes.end - start, message, ...args);
12280
12258
  }
12281
- function createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2, arg3) {
12259
+ function createDiagnosticForNodeInSourceFile(sourceFile, node, message, ...args) {
12282
12260
  const span = getErrorSpanForNode(sourceFile, node);
12283
- return createFileDiagnostic(sourceFile, span.start, span.length, message, arg0, arg1, arg2, arg3);
12261
+ return createFileDiagnostic(sourceFile, span.start, span.length, message, ...args);
12284
12262
  }
12285
12263
  function createDiagnosticForNodeFromMessageChain(sourceFile, node, messageChain, relatedInformation) {
12286
12264
  const span = getErrorSpanForNode(sourceFile, node);
@@ -12734,17 +12712,20 @@ function isObjectLiteralOrClassExpressionMethodOrAccessor(node) {
12734
12712
  function isIdentifierTypePredicate(predicate) {
12735
12713
  return predicate && predicate.kind === 1 /* Identifier */;
12736
12714
  }
12737
- function getPropertyAssignment(objectLiteral, key, key2) {
12738
- return objectLiteral.properties.filter((property) => {
12739
- if (property.kind === 300 /* PropertyAssignment */) {
12740
- const propName = tryGetTextOfPropertyName(property.name);
12741
- return key === propName || !!key2 && key2 === propName;
12742
- }
12743
- return false;
12715
+ function forEachPropertyAssignment(objectLiteral, key, callback, key2) {
12716
+ return forEach(objectLiteral == null ? void 0 : objectLiteral.properties, (property) => {
12717
+ if (!isPropertyAssignment(property))
12718
+ return void 0;
12719
+ const propName = tryGetTextOfPropertyName(property.name);
12720
+ return key === propName || key2 && key2 === propName ? callback(property) : void 0;
12744
12721
  });
12745
12722
  }
12746
12723
  function getPropertyArrayElementValue(objectLiteral, propKey, elementValue) {
12747
- return firstDefined(getPropertyAssignment(objectLiteral, propKey), (property) => isArrayLiteralExpression(property.initializer) ? find(property.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : void 0);
12724
+ return forEachPropertyAssignment(
12725
+ objectLiteral,
12726
+ propKey,
12727
+ (property) => isArrayLiteralExpression(property.initializer) ? find(property.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : void 0
12728
+ );
12748
12729
  }
12749
12730
  function getTsConfigObjectLiteralExpression(tsConfigSourceFile) {
12750
12731
  if (tsConfigSourceFile && tsConfigSourceFile.statements.length) {
@@ -12753,11 +12734,10 @@ function getTsConfigObjectLiteralExpression(tsConfigSourceFile) {
12753
12734
  }
12754
12735
  }
12755
12736
  function getTsConfigPropArrayElementValue(tsConfigSourceFile, propKey, elementValue) {
12756
- return firstDefined(getTsConfigPropArray(tsConfigSourceFile, propKey), (property) => isArrayLiteralExpression(property.initializer) ? find(property.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : void 0);
12737
+ return forEachTsConfigPropArray(tsConfigSourceFile, propKey, (property) => isArrayLiteralExpression(property.initializer) ? find(property.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : void 0);
12757
12738
  }
12758
- function getTsConfigPropArray(tsConfigSourceFile, propKey) {
12759
- const jsonObjectLiteral = getTsConfigObjectLiteralExpression(tsConfigSourceFile);
12760
- return jsonObjectLiteral ? getPropertyAssignment(jsonObjectLiteral, propKey) : emptyArray;
12739
+ function forEachTsConfigPropArray(tsConfigSourceFile, propKey, callback) {
12740
+ return forEachPropertyAssignment(getTsConfigObjectLiteralExpression(tsConfigSourceFile), propKey, callback);
12761
12741
  }
12762
12742
  function getContainingFunction(node) {
12763
12743
  return findAncestor(node.parent, isFunctionLike);
@@ -14029,6 +14009,12 @@ function getAncestor(node, kind) {
14029
14009
  function isKeyword(token) {
14030
14010
  return 82 /* FirstKeyword */ <= token && token <= 163 /* LastKeyword */;
14031
14011
  }
14012
+ function isPunctuation(token) {
14013
+ return 18 /* FirstPunctuation */ <= token && token <= 78 /* LastPunctuation */;
14014
+ }
14015
+ function isKeywordOrPunctuation(token) {
14016
+ return isKeyword(token) || isPunctuation(token);
14017
+ }
14032
14018
  function isContextualKeyword(token) {
14033
14019
  return 127 /* FirstContextualKeyword */ <= token && token <= 163 /* LastContextualKeyword */;
14034
14020
  }
@@ -26085,14 +26071,12 @@ var Parser;
26085
26071
  scriptKind2 = ensureScriptKind(fileName2, scriptKind2);
26086
26072
  if (scriptKind2 === 6 /* JSON */) {
26087
26073
  const result2 = parseJsonText2(fileName2, sourceText2, languageVersion2, syntaxCursor2, setParentNodes);
26088
- convertToObjectWorker(
26074
+ convertToJson(
26089
26075
  result2,
26090
26076
  (_a2 = result2.statements[0]) == null ? void 0 : _a2.expression,
26091
26077
  result2.parseDiagnostics,
26092
26078
  /*returnValue*/
26093
26079
  false,
26094
- /*knownRootOptions*/
26095
- void 0,
26096
26080
  /*jsonConversionNotifier*/
26097
26081
  void 0
26098
26082
  );
@@ -26524,24 +26508,24 @@ var Parser;
26524
26508
  function inAwaitContext() {
26525
26509
  return inContext(32768 /* AwaitContext */);
26526
26510
  }
26527
- function parseErrorAtCurrentToken(message, arg0) {
26528
- return parseErrorAt(scanner.getTokenStart(), scanner.getTokenEnd(), message, arg0);
26511
+ function parseErrorAtCurrentToken(message, ...args) {
26512
+ return parseErrorAt(scanner.getTokenStart(), scanner.getTokenEnd(), message, ...args);
26529
26513
  }
26530
- function parseErrorAtPosition(start, length2, message, arg0) {
26514
+ function parseErrorAtPosition(start, length2, message, ...args) {
26531
26515
  const lastError = lastOrUndefined(parseDiagnostics);
26532
26516
  let result;
26533
26517
  if (!lastError || start !== lastError.start) {
26534
- result = createDetachedDiagnostic(fileName, start, length2, message, arg0);
26518
+ result = createDetachedDiagnostic(fileName, start, length2, message, ...args);
26535
26519
  parseDiagnostics.push(result);
26536
26520
  }
26537
26521
  parseErrorBeforeNextFinishedNode = true;
26538
26522
  return result;
26539
26523
  }
26540
- function parseErrorAt(start, end, message, arg0) {
26541
- return parseErrorAtPosition(start, end - start, message, arg0);
26524
+ function parseErrorAt(start, end, message, ...args) {
26525
+ return parseErrorAtPosition(start, end - start, message, ...args);
26542
26526
  }
26543
- function parseErrorAtRange(range, message, arg0) {
26544
- parseErrorAt(range.pos, range.end, message, arg0);
26527
+ function parseErrorAtRange(range, message, ...args) {
26528
+ parseErrorAt(range.pos, range.end, message, ...args);
26545
26529
  }
26546
26530
  function scanError(message, length2) {
26547
26531
  parseErrorAtPosition(scanner.getTokenEnd(), length2, message);
@@ -26747,6 +26731,7 @@ var Parser;
26747
26731
  nextTokenJSDoc();
26748
26732
  return true;
26749
26733
  }
26734
+ Debug.assert(isKeywordOrPunctuation(kind));
26750
26735
  parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(kind));
26751
26736
  return false;
26752
26737
  }
@@ -26795,7 +26780,11 @@ var Parser;
26795
26780
  );
26796
26781
  }
26797
26782
  function parseExpectedTokenJSDoc(t) {
26798
- return parseOptionalTokenJSDoc(t) || createMissingNode(
26783
+ const optional = parseOptionalTokenJSDoc(t);
26784
+ if (optional)
26785
+ return optional;
26786
+ Debug.assert(isKeywordOrPunctuation(t));
26787
+ return createMissingNode(
26799
26788
  t,
26800
26789
  /*reportAtCurrentPosition*/
26801
26790
  false,
@@ -26849,11 +26838,11 @@ var Parser;
26849
26838
  }
26850
26839
  return node;
26851
26840
  }
26852
- function createMissingNode(kind, reportAtCurrentPosition, diagnosticMessage, arg0) {
26841
+ function createMissingNode(kind, reportAtCurrentPosition, diagnosticMessage, ...args) {
26853
26842
  if (reportAtCurrentPosition) {
26854
- parseErrorAtPosition(scanner.getTokenFullStart(), 0, diagnosticMessage, arg0);
26843
+ parseErrorAtPosition(scanner.getTokenFullStart(), 0, diagnosticMessage, ...args);
26855
26844
  } else if (diagnosticMessage) {
26856
- parseErrorAtCurrentToken(diagnosticMessage, arg0);
26845
+ parseErrorAtCurrentToken(diagnosticMessage, ...args);
26857
26846
  }
26858
26847
  const pos = getNodePos();
26859
26848
  const result = kind === 79 /* Identifier */ ? factoryCreateIdentifier(
@@ -29212,6 +29201,7 @@ var Parser;
29212
29201
  if (simpleUnaryExpression.kind === 214 /* TypeAssertionExpression */) {
29213
29202
  parseErrorAt(pos, end, Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses);
29214
29203
  } else {
29204
+ Debug.assert(isKeywordOrPunctuation(unaryOperator));
29215
29205
  parseErrorAt(pos, end, Diagnostics.An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses, tokenToString(unaryOperator));
29216
29206
  }
29217
29207
  }
@@ -32159,14 +32149,14 @@ var Parser;
32159
32149
  }
32160
32150
  function parseReturnTag(start2, tagName, indent2, indentText) {
32161
32151
  if (some(tags, isJSDocReturnTag)) {
32162
- parseErrorAt(tagName.pos, scanner.getTokenStart(), Diagnostics._0_tag_already_specified, tagName.escapedText);
32152
+ parseErrorAt(tagName.pos, scanner.getTokenStart(), Diagnostics._0_tag_already_specified, unescapeLeadingUnderscores(tagName.escapedText));
32163
32153
  }
32164
32154
  const typeExpression = tryParseTypeExpression();
32165
32155
  return finishNode(factory2.createJSDocReturnTag(tagName, typeExpression, parseTrailingTagComments(start2, getNodePos(), indent2, indentText)), start2);
32166
32156
  }
32167
32157
  function parseTypeTag(start2, tagName, indent2, indentText) {
32168
32158
  if (some(tags, isJSDocTypeTag)) {
32169
- parseErrorAt(tagName.pos, scanner.getTokenStart(), Diagnostics._0_tag_already_specified, tagName.escapedText);
32159
+ parseErrorAt(tagName.pos, scanner.getTokenStart(), Diagnostics._0_tag_already_specified, unescapeLeadingUnderscores(tagName.escapedText));
32170
32160
  }
32171
32161
  const typeExpression = parseJSDocTypeExpression(
32172
32162
  /*mayOmitBraces*/
@@ -34613,9 +34603,6 @@ var defaultInitCompilerOptions = {
34613
34603
  forceConsistentCasingInFileNames: true,
34614
34604
  skipLibCheck: true
34615
34605
  };
34616
- function createCompilerDiagnosticForInvalidCustomType(opt) {
34617
- return createDiagnosticForInvalidCustomType(opt, createCompilerDiagnostic);
34618
- }
34619
34606
  function createDiagnosticForInvalidCustomType(opt, createDiagnostic) {
34620
34607
  const namesOfType = arrayFrom(opt.type.keys());
34621
34608
  const stringNames = (opt.deprecatedKeys ? namesOfType.filter((k) => !opt.deprecatedKeys.has(k)) : namesOfType).map((key) => `'${key}'`).join(", ");
@@ -34651,13 +34638,13 @@ function parseListTypeOption(opt, value = "", errors) {
34651
34638
  function getOptionName(option) {
34652
34639
  return option.name;
34653
34640
  }
34654
- function createUnknownOptionError(unknownOption, diagnostics, createDiagnostics, unknownOptionErrorText) {
34641
+ function createUnknownOptionError(unknownOption, diagnostics, unknownOptionErrorText, node, sourceFile) {
34655
34642
  var _a2;
34656
34643
  if ((_a2 = diagnostics.alternateMode) == null ? void 0 : _a2.getOptionsNameMap().optionsNameMap.has(unknownOption.toLowerCase())) {
34657
- return createDiagnostics(diagnostics.alternateMode.diagnostic, unknownOption);
34644
+ return createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.alternateMode.diagnostic, unknownOption);
34658
34645
  }
34659
34646
  const possibleOption = getSpellingSuggestion(unknownOption, diagnostics.optionDeclarations, getOptionName);
34660
- return possibleOption ? createDiagnostics(diagnostics.unknownDidYouMeanDiagnostic, unknownOptionErrorText || unknownOption, possibleOption.name) : createDiagnostics(diagnostics.unknownOptionDiagnostic, unknownOptionErrorText || unknownOption);
34647
+ return possibleOption ? createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.unknownDidYouMeanDiagnostic, unknownOptionErrorText || unknownOption, possibleOption.name) : createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.unknownOptionDiagnostic, unknownOptionErrorText || unknownOption);
34661
34648
  }
34662
34649
  function parseCommandLineWorker(diagnostics, commandLine, readFile) {
34663
34650
  const options = {};
@@ -34698,7 +34685,7 @@ function parseCommandLineWorker(diagnostics, commandLine, readFile) {
34698
34685
  if (watchOpt) {
34699
34686
  i = parseOptionValue(args, i, watchOptionsDidYouMeanDiagnostics, watchOpt, watchOptions || (watchOptions = {}), errors);
34700
34687
  } else {
34701
- errors.push(createUnknownOptionError(inputOptionName, diagnostics, createCompilerDiagnostic, s));
34688
+ errors.push(createUnknownOptionError(inputOptionName, diagnostics, s));
34702
34689
  }
34703
34690
  }
34704
34691
  } else {
@@ -34902,9 +34889,7 @@ function parseConfigFileTextToJson(fileName, jsonText) {
34902
34889
  config: convertConfigFileToObject(
34903
34890
  jsonSourceFile,
34904
34891
  jsonSourceFile.parseDiagnostics,
34905
- /*reportOptionsErrors*/
34906
- false,
34907
- /*optionsIterator*/
34892
+ /*jsonConversionNotifier*/
34908
34893
  void 0
34909
34894
  ),
34910
34895
  error: jsonSourceFile.parseDiagnostics.length ? jsonSourceFile.parseDiagnostics[0] : void 0
@@ -34961,7 +34946,26 @@ var extendsOptionDeclaration = {
34961
34946
  name: "extends",
34962
34947
  type: "string"
34963
34948
  },
34964
- category: Diagnostics.File_Management
34949
+ category: Diagnostics.File_Management,
34950
+ disallowNullOrUndefined: true
34951
+ };
34952
+ var compilerOptionsDeclaration = {
34953
+ name: "compilerOptions",
34954
+ type: "object",
34955
+ elementOptions: getCommandLineCompilerOptionsMap(),
34956
+ extraKeyDiagnostics: compilerOptionsDidYouMeanDiagnostics
34957
+ };
34958
+ var watchOptionsDeclaration = {
34959
+ name: "watchOptions",
34960
+ type: "object",
34961
+ elementOptions: getCommandLineWatchOptionsMap(),
34962
+ extraKeyDiagnostics: watchOptionsDidYouMeanDiagnostics
34963
+ };
34964
+ var typeAcquisitionDeclaration = {
34965
+ name: "typeAcquisition",
34966
+ type: "object",
34967
+ elementOptions: getCommandLineTypeAcquisitionMap(),
34968
+ extraKeyDiagnostics: typeAcquisitionDidYouMeanDiagnostics
34965
34969
  };
34966
34970
  var _tsconfigRootOptions;
34967
34971
  function getTsconfigRootOptionsMap() {
@@ -34971,24 +34975,9 @@ function getTsconfigRootOptionsMap() {
34971
34975
  // should never be needed since this is root
34972
34976
  type: "object",
34973
34977
  elementOptions: commandLineOptionsToMap([
34974
- {
34975
- name: "compilerOptions",
34976
- type: "object",
34977
- elementOptions: getCommandLineCompilerOptionsMap(),
34978
- extraKeyDiagnostics: compilerOptionsDidYouMeanDiagnostics
34979
- },
34980
- {
34981
- name: "watchOptions",
34982
- type: "object",
34983
- elementOptions: getCommandLineWatchOptionsMap(),
34984
- extraKeyDiagnostics: watchOptionsDidYouMeanDiagnostics
34985
- },
34986
- {
34987
- name: "typeAcquisition",
34988
- type: "object",
34989
- elementOptions: getCommandLineTypeAcquisitionMap(),
34990
- extraKeyDiagnostics: typeAcquisitionDidYouMeanDiagnostics
34991
- },
34978
+ compilerOptionsDeclaration,
34979
+ watchOptionsDeclaration,
34980
+ typeAcquisitionDeclaration,
34992
34981
  extendsOptionDeclaration,
34993
34982
  {
34994
34983
  name: "references",
@@ -35034,10 +35023,9 @@ function getTsconfigRootOptionsMap() {
35034
35023
  }
35035
35024
  return _tsconfigRootOptions;
35036
35025
  }
35037
- function convertConfigFileToObject(sourceFile, errors, reportOptionsErrors, optionsIterator) {
35026
+ function convertConfigFileToObject(sourceFile, errors, jsonConversionNotifier) {
35038
35027
  var _a2;
35039
35028
  const rootExpression = (_a2 = sourceFile.statements[0]) == null ? void 0 : _a2.expression;
35040
- const knownRootOptions = reportOptionsErrors ? getTsconfigRootOptionsMap() : void 0;
35041
35029
  if (rootExpression && rootExpression.kind !== 208 /* ObjectLiteralExpression */) {
35042
35030
  errors.push(createDiagnosticForNodeInSourceFile(
35043
35031
  sourceFile,
@@ -35048,52 +35036,46 @@ function convertConfigFileToObject(sourceFile, errors, reportOptionsErrors, opti
35048
35036
  if (isArrayLiteralExpression(rootExpression)) {
35049
35037
  const firstObject = find(rootExpression.elements, isObjectLiteralExpression);
35050
35038
  if (firstObject) {
35051
- return convertToObjectWorker(
35039
+ return convertToJson(
35052
35040
  sourceFile,
35053
35041
  firstObject,
35054
35042
  errors,
35055
35043
  /*returnValue*/
35056
35044
  true,
35057
- knownRootOptions,
35058
- optionsIterator
35045
+ jsonConversionNotifier
35059
35046
  );
35060
35047
  }
35061
35048
  }
35062
35049
  return {};
35063
35050
  }
35064
- return convertToObjectWorker(
35051
+ return convertToJson(
35065
35052
  sourceFile,
35066
35053
  rootExpression,
35067
35054
  errors,
35068
35055
  /*returnValue*/
35069
35056
  true,
35070
- knownRootOptions,
35071
- optionsIterator
35057
+ jsonConversionNotifier
35072
35058
  );
35073
35059
  }
35074
35060
  function convertToObject(sourceFile, errors) {
35075
35061
  var _a2;
35076
- return convertToObjectWorker(
35062
+ return convertToJson(
35077
35063
  sourceFile,
35078
35064
  (_a2 = sourceFile.statements[0]) == null ? void 0 : _a2.expression,
35079
35065
  errors,
35080
35066
  /*returnValue*/
35081
35067
  true,
35082
- /*knownRootOptions*/
35083
- void 0,
35084
35068
  /*jsonConversionNotifier*/
35085
35069
  void 0
35086
35070
  );
35087
35071
  }
35088
- function convertToObjectWorker(sourceFile, rootExpression, errors, returnValue, knownRootOptions, jsonConversionNotifier) {
35072
+ function convertToJson(sourceFile, rootExpression, errors, returnValue, jsonConversionNotifier) {
35089
35073
  if (!rootExpression) {
35090
35074
  return returnValue ? {} : void 0;
35091
35075
  }
35092
- return convertPropertyValueToJson(rootExpression, knownRootOptions);
35093
- function isRootOptionMap(knownOptions) {
35094
- return knownRootOptions && knownRootOptions.elementOptions === knownOptions;
35095
- }
35096
- function convertObjectLiteralExpressionToJson(node, knownOptions, extraKeyDiagnostics, parentOption) {
35076
+ return convertPropertyValueToJson(rootExpression, jsonConversionNotifier == null ? void 0 : jsonConversionNotifier.rootOptions);
35077
+ function convertObjectLiteralExpressionToJson(node, objectOption) {
35078
+ var _a2;
35097
35079
  const result = returnValue ? {} : void 0;
35098
35080
  for (const element of node.properties) {
35099
35081
  if (element.kind !== 300 /* PropertyAssignment */) {
@@ -35108,38 +35090,13 @@ function convertToObjectWorker(sourceFile, rootExpression, errors, returnValue,
35108
35090
  }
35109
35091
  const textOfKey = isComputedNonLiteralName(element.name) ? void 0 : getTextOfPropertyName(element.name);
35110
35092
  const keyText = textOfKey && unescapeLeadingUnderscores(textOfKey);
35111
- const option = keyText && knownOptions ? knownOptions.get(keyText) : void 0;
35112
- if (keyText && extraKeyDiagnostics && !option) {
35113
- if (knownOptions) {
35114
- errors.push(createUnknownOptionError(
35115
- keyText,
35116
- extraKeyDiagnostics,
35117
- (message, arg0, arg1) => createDiagnosticForNodeInSourceFile(sourceFile, element.name, message, arg0, arg1)
35118
- ));
35119
- } else {
35120
- errors.push(createDiagnosticForNodeInSourceFile(sourceFile, element.name, extraKeyDiagnostics.unknownOptionDiagnostic, keyText));
35121
- }
35122
- }
35093
+ const option = keyText ? (_a2 = objectOption == null ? void 0 : objectOption.elementOptions) == null ? void 0 : _a2.get(keyText) : void 0;
35123
35094
  const value = convertPropertyValueToJson(element.initializer, option);
35124
35095
  if (typeof keyText !== "undefined") {
35125
35096
  if (returnValue) {
35126
35097
  result[keyText] = value;
35127
35098
  }
35128
- if (jsonConversionNotifier && // Current callbacks are only on known parent option or if we are setting values in the root
35129
- (parentOption || isRootOptionMap(knownOptions))) {
35130
- const isValidOptionValue = isCompilerOptionsValue(option, value);
35131
- if (parentOption) {
35132
- if (isValidOptionValue) {
35133
- jsonConversionNotifier.onSetValidOptionKeyValueInParent(parentOption, option, value);
35134
- }
35135
- } else if (isRootOptionMap(knownOptions)) {
35136
- if (isValidOptionValue) {
35137
- jsonConversionNotifier.onSetValidOptionKeyValueInRoot(keyText, element.name, value, element.initializer);
35138
- } else if (!option) {
35139
- jsonConversionNotifier.onSetUnknownOptionKeyValueInRoot(keyText, element.name, value, element.initializer);
35140
- }
35141
- }
35142
- }
35099
+ jsonConversionNotifier == null ? void 0 : jsonConversionNotifier.onPropertySet(keyText, value, element, objectOption, option);
35143
35100
  }
35144
35101
  }
35145
35102
  return result;
@@ -35152,112 +35109,40 @@ function convertToObjectWorker(sourceFile, rootExpression, errors, returnValue,
35152
35109
  return filter(elements.map((element) => convertPropertyValueToJson(element, elementOption)), (v) => v !== void 0);
35153
35110
  }
35154
35111
  function convertPropertyValueToJson(valueExpression, option) {
35155
- let invalidReported;
35156
35112
  switch (valueExpression.kind) {
35157
35113
  case 111 /* TrueKeyword */:
35158
- reportInvalidOptionValue(option && option.type !== "boolean" && (option.type !== "listOrElement" || option.element.type !== "boolean"));
35159
- return validateValue(
35160
- /*value*/
35161
- true
35162
- );
35114
+ return true;
35163
35115
  case 96 /* FalseKeyword */:
35164
- reportInvalidOptionValue(option && option.type !== "boolean" && (option.type !== "listOrElement" || option.element.type !== "boolean"));
35165
- return validateValue(
35166
- /*value*/
35167
- false
35168
- );
35116
+ return false;
35169
35117
  case 105 /* NullKeyword */:
35170
- reportInvalidOptionValue(option && option.name === "extends");
35171
- return validateValue(
35172
- /*value*/
35173
- null
35174
- );
35118
+ return null;
35175
35119
  case 10 /* StringLiteral */:
35176
35120
  if (!isDoubleQuotedString(valueExpression)) {
35177
35121
  errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, Diagnostics.String_literal_with_double_quotes_expected));
35178
35122
  }
35179
- reportInvalidOptionValue(option && isString(option.type) && option.type !== "string" && (option.type !== "listOrElement" || isString(option.element.type) && option.element.type !== "string"));
35180
- const text = valueExpression.text;
35181
- if (option) {
35182
- Debug.assert(option.type !== "listOrElement" || option.element.type === "string", "Only string or array of string is handled for now");
35183
- }
35184
- if (option && !isString(option.type)) {
35185
- const customOption = option;
35186
- if (!customOption.type.has(text.toLowerCase())) {
35187
- errors.push(
35188
- createDiagnosticForInvalidCustomType(
35189
- customOption,
35190
- (message, arg0, arg1) => createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, message, arg0, arg1)
35191
- )
35192
- );
35193
- invalidReported = true;
35194
- }
35195
- }
35196
- return validateValue(text);
35123
+ return valueExpression.text;
35197
35124
  case 8 /* NumericLiteral */:
35198
- reportInvalidOptionValue(option && option.type !== "number" && (option.type !== "listOrElement" || option.element.type !== "number"));
35199
- return validateValue(Number(valueExpression.text));
35125
+ return Number(valueExpression.text);
35200
35126
  case 222 /* PrefixUnaryExpression */:
35201
35127
  if (valueExpression.operator !== 40 /* MinusToken */ || valueExpression.operand.kind !== 8 /* NumericLiteral */) {
35202
35128
  break;
35203
35129
  }
35204
- reportInvalidOptionValue(option && option.type !== "number" && (option.type !== "listOrElement" || option.element.type !== "number"));
35205
- return validateValue(-Number(valueExpression.operand.text));
35130
+ return -Number(valueExpression.operand.text);
35206
35131
  case 208 /* ObjectLiteralExpression */:
35207
- reportInvalidOptionValue(option && option.type !== "object" && (option.type !== "listOrElement" || option.element.type !== "object"));
35208
35132
  const objectLiteralExpression = valueExpression;
35209
- if (option) {
35210
- const { elementOptions, extraKeyDiagnostics, name: optionName } = option;
35211
- return validateValue(convertObjectLiteralExpressionToJson(
35212
- objectLiteralExpression,
35213
- elementOptions,
35214
- extraKeyDiagnostics,
35215
- optionName
35216
- ));
35217
- } else {
35218
- return validateValue(convertObjectLiteralExpressionToJson(
35219
- objectLiteralExpression,
35220
- /* knownOptions*/
35221
- void 0,
35222
- /*extraKeyDiagnosticMessage */
35223
- void 0,
35224
- /*parentOption*/
35225
- void 0
35226
- ));
35227
- }
35133
+ return convertObjectLiteralExpressionToJson(objectLiteralExpression, option);
35228
35134
  case 207 /* ArrayLiteralExpression */:
35229
- reportInvalidOptionValue(option && option.type !== "list" && option.type !== "listOrElement");
35230
- return validateValue(convertArrayLiteralExpressionToJson(
35135
+ return convertArrayLiteralExpressionToJson(
35231
35136
  valueExpression.elements,
35232
35137
  option && option.element
35233
- ));
35138
+ );
35234
35139
  }
35235
35140
  if (option) {
35236
- reportInvalidOptionValue(
35237
- /*isError*/
35238
- true
35239
- );
35141
+ errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, Diagnostics.Compiler_option_0_requires_a_value_of_type_1, option.name, getCompilerOptionValueTypeString(option)));
35240
35142
  } else {
35241
35143
  errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, Diagnostics.Property_value_can_only_be_string_literal_numeric_literal_true_false_null_object_literal_or_array_literal));
35242
35144
  }
35243
35145
  return void 0;
35244
- function validateValue(value) {
35245
- var _a2;
35246
- if (!invalidReported) {
35247
- const diagnostic = (_a2 = option == null ? void 0 : option.extraValidation) == null ? void 0 : _a2.call(option, value);
35248
- if (diagnostic) {
35249
- errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, ...diagnostic));
35250
- return void 0;
35251
- }
35252
- }
35253
- return value;
35254
- }
35255
- function reportInvalidOptionValue(isError) {
35256
- if (isError) {
35257
- errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, Diagnostics.Compiler_option_0_requires_a_value_of_type_1, option.name, getCompilerOptionValueTypeString(option)));
35258
- invalidReported = true;
35259
- }
35260
- }
35261
35146
  }
35262
35147
  function isDoubleQuotedString(node) {
35263
35148
  return isStringLiteral(node) && isStringDoubleQuoted(node, sourceFile);
@@ -35269,7 +35154,7 @@ function getCompilerOptionValueTypeString(option) {
35269
35154
  function isCompilerOptionsValue(option, value) {
35270
35155
  if (option) {
35271
35156
  if (isNullOrUndefined(value))
35272
- return true;
35157
+ return !option.disallowNullOrUndefined;
35273
35158
  if (option.type === "list") {
35274
35159
  return isArray(value);
35275
35160
  }
@@ -35614,8 +35499,8 @@ function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, exis
35614
35499
  if (sourceFile) {
35615
35500
  const fileName = configFileName || "tsconfig.json";
35616
35501
  const diagnosticMessage = Diagnostics.The_files_list_in_config_file_0_is_empty;
35617
- const nodeValue = firstDefined(getTsConfigPropArray(sourceFile, "files"), (property) => property.initializer);
35618
- const error = nodeValue ? createDiagnosticForNodeInSourceFile(sourceFile, nodeValue, diagnosticMessage, fileName) : createCompilerDiagnostic(diagnosticMessage, fileName);
35502
+ const nodeValue = forEachTsConfigPropArray(sourceFile, "files", (property) => property.initializer);
35503
+ const error = createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, nodeValue, diagnosticMessage, fileName);
35619
35504
  errors.push(error);
35620
35505
  } else {
35621
35506
  createCompilerDiagnosticOnlyIfJson(Diagnostics.The_files_list_in_config_file_0_is_empty, configFileName || "tsconfig.json");
@@ -35717,9 +35602,9 @@ function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, exis
35717
35602
  }
35718
35603
  return "no-prop";
35719
35604
  }
35720
- function createCompilerDiagnosticOnlyIfJson(message, arg0, arg1) {
35605
+ function createCompilerDiagnosticOnlyIfJson(message, ...args) {
35721
35606
  if (!sourceFile) {
35722
- errors.push(createCompilerDiagnostic(message, arg0, arg1));
35607
+ errors.push(createCompilerDiagnostic(message, ...args));
35723
35608
  }
35724
35609
  }
35725
35610
  }
@@ -35818,27 +35703,42 @@ function parseOwnConfigOfJson(json, host, basePath, configFileName, errors) {
35818
35703
  const typeAcquisition = convertTypeAcquisitionFromJsonWorker(json.typeAcquisition, basePath, errors, configFileName);
35819
35704
  const watchOptions = convertWatchOptionsFromJsonWorker(json.watchOptions, basePath, errors);
35820
35705
  json.compileOnSave = convertCompileOnSaveOptionFromJson(json, basePath, errors);
35706
+ const extendedConfigPath = json.extends || json.extends === "" ? getExtendsConfigPathOrArray(json.extends, host, basePath, configFileName, errors) : void 0;
35707
+ return { raw: json, options, watchOptions, typeAcquisition, extendedConfigPath };
35708
+ }
35709
+ function getExtendsConfigPathOrArray(value, host, basePath, configFileName, errors, propertyAssignment, valueExpression, sourceFile) {
35821
35710
  let extendedConfigPath;
35822
- if (json.extends || json.extends === "") {
35823
- if (!isCompilerOptionsValue(extendsOptionDeclaration, json.extends)) {
35824
- errors.push(createCompilerDiagnostic(Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "extends", getCompilerOptionValueTypeString(extendsOptionDeclaration)));
35825
- } else {
35826
- const newBase = configFileName ? directoryOfCombinedPath(configFileName, basePath) : basePath;
35827
- if (isString(json.extends)) {
35828
- extendedConfigPath = getExtendsConfigPath(json.extends, host, newBase, errors, createCompilerDiagnostic);
35711
+ const newBase = configFileName ? directoryOfCombinedPath(configFileName, basePath) : basePath;
35712
+ if (isString(value)) {
35713
+ extendedConfigPath = getExtendsConfigPath(
35714
+ value,
35715
+ host,
35716
+ newBase,
35717
+ errors,
35718
+ valueExpression,
35719
+ sourceFile
35720
+ );
35721
+ } else if (isArray(value)) {
35722
+ extendedConfigPath = [];
35723
+ for (let index = 0; index < value.length; index++) {
35724
+ const fileName = value[index];
35725
+ if (isString(fileName)) {
35726
+ extendedConfigPath = append(extendedConfigPath, getExtendsConfigPath(
35727
+ fileName,
35728
+ host,
35729
+ newBase,
35730
+ errors,
35731
+ valueExpression == null ? void 0 : valueExpression.elements[index],
35732
+ sourceFile
35733
+ ));
35829
35734
  } else {
35830
- extendedConfigPath = [];
35831
- for (const fileName of json.extends) {
35832
- if (isString(fileName)) {
35833
- extendedConfigPath = append(extendedConfigPath, getExtendsConfigPath(fileName, host, newBase, errors, createCompilerDiagnostic));
35834
- } else {
35835
- errors.push(createCompilerDiagnostic(Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "extends", getCompilerOptionValueTypeString(extendsOptionDeclaration.element)));
35836
- }
35837
- }
35735
+ convertJsonOption(extendsOptionDeclaration.element, value, basePath, errors, propertyAssignment, valueExpression == null ? void 0 : valueExpression.elements[index], sourceFile);
35838
35736
  }
35839
35737
  }
35738
+ } else {
35739
+ convertJsonOption(extendsOptionDeclaration, value, basePath, errors, propertyAssignment, valueExpression, sourceFile);
35840
35740
  }
35841
- return { raw: json, options, watchOptions, typeAcquisition, extendedConfigPath };
35741
+ return extendedConfigPath;
35842
35742
  }
35843
35743
  function parseOwnConfigOfJsonSourceFile(sourceFile, host, basePath, configFileName, errors) {
35844
35744
  const options = getDefaultCompilerOptions(configFileName);
@@ -35846,69 +35746,11 @@ function parseOwnConfigOfJsonSourceFile(sourceFile, host, basePath, configFileNa
35846
35746
  let watchOptions;
35847
35747
  let extendedConfigPath;
35848
35748
  let rootCompilerOptions;
35849
- const optionsIterator = {
35850
- onSetValidOptionKeyValueInParent(parentOption, option, value) {
35851
- let currentOption;
35852
- switch (parentOption) {
35853
- case "compilerOptions":
35854
- currentOption = options;
35855
- break;
35856
- case "watchOptions":
35857
- currentOption = watchOptions || (watchOptions = {});
35858
- break;
35859
- case "typeAcquisition":
35860
- currentOption = typeAcquisition || (typeAcquisition = getDefaultTypeAcquisition(configFileName));
35861
- break;
35862
- default:
35863
- Debug.fail("Unknown option");
35864
- }
35865
- currentOption[option.name] = normalizeOptionValue(option, basePath, value);
35866
- },
35867
- onSetValidOptionKeyValueInRoot(key, _keyNode, value, valueNode) {
35868
- switch (key) {
35869
- case "extends":
35870
- const newBase = configFileName ? directoryOfCombinedPath(configFileName, basePath) : basePath;
35871
- if (isString(value)) {
35872
- extendedConfigPath = getExtendsConfigPath(
35873
- value,
35874
- host,
35875
- newBase,
35876
- errors,
35877
- (message, arg0) => createDiagnosticForNodeInSourceFile(sourceFile, valueNode, message, arg0)
35878
- );
35879
- } else {
35880
- extendedConfigPath = [];
35881
- for (let index = 0; index < value.length; index++) {
35882
- const fileName = value[index];
35883
- if (isString(fileName)) {
35884
- extendedConfigPath = append(extendedConfigPath, getExtendsConfigPath(
35885
- fileName,
35886
- host,
35887
- newBase,
35888
- errors,
35889
- (message, arg0) => createDiagnosticForNodeInSourceFile(sourceFile, valueNode.elements[index], message, arg0)
35890
- ));
35891
- }
35892
- }
35893
- }
35894
- return;
35895
- }
35896
- },
35897
- onSetUnknownOptionKeyValueInRoot(key, keyNode, _value, _valueNode) {
35898
- if (key === "excludes") {
35899
- errors.push(createDiagnosticForNodeInSourceFile(sourceFile, keyNode, Diagnostics.Unknown_option_excludes_Did_you_mean_exclude));
35900
- }
35901
- if (find(commandOptionsWithoutBuild, (opt) => opt.name === key)) {
35902
- rootCompilerOptions = append(rootCompilerOptions, keyNode);
35903
- }
35904
- }
35905
- };
35749
+ const rootOptions = getTsconfigRootOptionsMap();
35906
35750
  const json = convertConfigFileToObject(
35907
35751
  sourceFile,
35908
35752
  errors,
35909
- /*reportOptionsErrors*/
35910
- true,
35911
- optionsIterator
35753
+ { rootOptions, onPropertySet }
35912
35754
  );
35913
35755
  if (!typeAcquisition) {
35914
35756
  typeAcquisition = getDefaultTypeAcquisition(configFileName);
@@ -35917,15 +35759,57 @@ function parseOwnConfigOfJsonSourceFile(sourceFile, host, basePath, configFileNa
35917
35759
  errors.push(createDiagnosticForNodeInSourceFile(sourceFile, rootCompilerOptions[0], Diagnostics._0_should_be_set_inside_the_compilerOptions_object_of_the_config_json_file, getTextOfPropertyName(rootCompilerOptions[0])));
35918
35760
  }
35919
35761
  return { raw: json, options, watchOptions, typeAcquisition, extendedConfigPath };
35762
+ function onPropertySet(keyText, value, propertyAssignment, parentOption, option) {
35763
+ if (option && option !== extendsOptionDeclaration)
35764
+ value = convertJsonOption(option, value, basePath, errors, propertyAssignment, propertyAssignment.initializer, sourceFile);
35765
+ if (parentOption == null ? void 0 : parentOption.name) {
35766
+ if (option) {
35767
+ let currentOption;
35768
+ if (parentOption === compilerOptionsDeclaration)
35769
+ currentOption = options;
35770
+ else if (parentOption === watchOptionsDeclaration)
35771
+ currentOption = watchOptions != null ? watchOptions : watchOptions = {};
35772
+ else if (parentOption === typeAcquisitionDeclaration)
35773
+ currentOption = typeAcquisition != null ? typeAcquisition : typeAcquisition = getDefaultTypeAcquisition(configFileName);
35774
+ else
35775
+ Debug.fail("Unknown option");
35776
+ currentOption[option.name] = value;
35777
+ } else if (keyText && (parentOption == null ? void 0 : parentOption.extraKeyDiagnostics)) {
35778
+ if (parentOption.elementOptions) {
35779
+ errors.push(createUnknownOptionError(
35780
+ keyText,
35781
+ parentOption.extraKeyDiagnostics,
35782
+ /*unknownOptionErrorText*/
35783
+ void 0,
35784
+ propertyAssignment.name,
35785
+ sourceFile
35786
+ ));
35787
+ } else {
35788
+ errors.push(createDiagnosticForNodeInSourceFile(sourceFile, propertyAssignment.name, parentOption.extraKeyDiagnostics.unknownOptionDiagnostic, keyText));
35789
+ }
35790
+ }
35791
+ } else if (parentOption === rootOptions) {
35792
+ if (option === extendsOptionDeclaration) {
35793
+ extendedConfigPath = getExtendsConfigPathOrArray(value, host, basePath, configFileName, errors, propertyAssignment, propertyAssignment.initializer, sourceFile);
35794
+ } else if (!option) {
35795
+ if (keyText === "excludes") {
35796
+ errors.push(createDiagnosticForNodeInSourceFile(sourceFile, propertyAssignment.name, Diagnostics.Unknown_option_excludes_Did_you_mean_exclude));
35797
+ }
35798
+ if (find(commandOptionsWithoutBuild, (opt) => opt.name === keyText)) {
35799
+ rootCompilerOptions = append(rootCompilerOptions, propertyAssignment.name);
35800
+ }
35801
+ }
35802
+ }
35803
+ }
35920
35804
  }
35921
- function getExtendsConfigPath(extendedConfig, host, basePath, errors, createDiagnostic) {
35805
+ function getExtendsConfigPath(extendedConfig, host, basePath, errors, valueExpression, sourceFile) {
35922
35806
  extendedConfig = normalizeSlashes(extendedConfig);
35923
35807
  if (isRootedDiskPath(extendedConfig) || startsWith(extendedConfig, "./") || startsWith(extendedConfig, "../")) {
35924
35808
  let extendedConfigPath = getNormalizedAbsolutePath(extendedConfig, basePath);
35925
35809
  if (!host.fileExists(extendedConfigPath) && !endsWith(extendedConfigPath, ".json" /* Json */)) {
35926
35810
  extendedConfigPath = `${extendedConfigPath}.json`;
35927
35811
  if (!host.fileExists(extendedConfigPath)) {
35928
- errors.push(createDiagnostic(Diagnostics.File_0_not_found, extendedConfig));
35812
+ errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, valueExpression, Diagnostics.File_0_not_found, extendedConfig));
35929
35813
  return void 0;
35930
35814
  }
35931
35815
  }
@@ -35936,9 +35820,9 @@ function getExtendsConfigPath(extendedConfig, host, basePath, errors, createDiag
35936
35820
  return resolved.resolvedModule.resolvedFileName;
35937
35821
  }
35938
35822
  if (extendedConfig === "") {
35939
- errors.push(createDiagnostic(Diagnostics.Compiler_option_0_cannot_be_given_an_empty_string, "extends"));
35823
+ errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, valueExpression, Diagnostics.Compiler_option_0_cannot_be_given_an_empty_string, "extends"));
35940
35824
  } else {
35941
- errors.push(createDiagnostic(Diagnostics.File_0_not_found, extendedConfig));
35825
+ errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, valueExpression, Diagnostics.File_0_not_found, extendedConfig));
35942
35826
  }
35943
35827
  return void 0;
35944
35828
  }
@@ -36030,42 +35914,33 @@ function convertOptionsFromJson(optionsNameMap, jsonOptions, basePath, defaultOp
36030
35914
  if (opt) {
36031
35915
  (defaultOptions || (defaultOptions = {}))[opt.name] = convertJsonOption(opt, jsonOptions[id], basePath, errors);
36032
35916
  } else {
36033
- errors.push(createUnknownOptionError(id, diagnostics, createCompilerDiagnostic));
35917
+ errors.push(createUnknownOptionError(id, diagnostics));
36034
35918
  }
36035
35919
  }
36036
35920
  return defaultOptions;
36037
35921
  }
36038
- function convertJsonOption(opt, value, basePath, errors) {
35922
+ function createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, message, ...args) {
35923
+ return sourceFile && node ? createDiagnosticForNodeInSourceFile(sourceFile, node, message, ...args) : createCompilerDiagnostic(message, ...args);
35924
+ }
35925
+ function convertJsonOption(opt, value, basePath, errors, propertyAssignment, valueExpression, sourceFile) {
35926
+ if (opt.isCommandLineOnly) {
35927
+ errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, propertyAssignment == null ? void 0 : propertyAssignment.name, Diagnostics.Option_0_can_only_be_specified_on_command_line, opt.name));
35928
+ return void 0;
35929
+ }
36039
35930
  if (isCompilerOptionsValue(opt, value)) {
36040
35931
  const optType = opt.type;
36041
35932
  if (optType === "list" && isArray(value)) {
36042
- return convertJsonOptionOfListType(opt, value, basePath, errors);
35933
+ return convertJsonOptionOfListType(opt, value, basePath, errors, propertyAssignment, valueExpression, sourceFile);
36043
35934
  } else if (optType === "listOrElement") {
36044
- return isArray(value) ? convertJsonOptionOfListType(opt, value, basePath, errors) : convertJsonOption(opt.element, value, basePath, errors);
35935
+ return isArray(value) ? convertJsonOptionOfListType(opt, value, basePath, errors, propertyAssignment, valueExpression, sourceFile) : convertJsonOption(opt.element, value, basePath, errors, propertyAssignment, valueExpression, sourceFile);
36045
35936
  } else if (!isString(opt.type)) {
36046
- return convertJsonOptionOfCustomType(opt, value, errors);
35937
+ return convertJsonOptionOfCustomType(opt, value, errors, valueExpression, sourceFile);
36047
35938
  }
36048
- const validatedValue = validateJsonOptionValue(opt, value, errors);
35939
+ const validatedValue = validateJsonOptionValue(opt, value, errors, valueExpression, sourceFile);
36049
35940
  return isNullOrUndefined(validatedValue) ? validatedValue : normalizeNonListOptionValue(opt, basePath, validatedValue);
36050
35941
  } else {
36051
- errors.push(createCompilerDiagnostic(Diagnostics.Compiler_option_0_requires_a_value_of_type_1, opt.name, getCompilerOptionValueTypeString(opt)));
36052
- }
36053
- }
36054
- function normalizeOptionValue(option, basePath, value) {
36055
- if (isNullOrUndefined(value))
36056
- return void 0;
36057
- if (option.type === "listOrElement" && !isArray(value))
36058
- return normalizeOptionValue(option.element, basePath, value);
36059
- else if (option.type === "list" || option.type === "listOrElement") {
36060
- const listOption = option;
36061
- if (listOption.element.isFilePath || !isString(listOption.element.type)) {
36062
- return filter(map(value, (v) => normalizeOptionValue(listOption.element, basePath, v)), (v) => listOption.listPreserveFalsyValues ? true : !!v);
36063
- }
36064
- return value;
36065
- } else if (!isString(option.type)) {
36066
- return option.type.get(isString(value) ? value.toLowerCase() : value);
35942
+ errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, valueExpression, Diagnostics.Compiler_option_0_requires_a_value_of_type_1, opt.name, getCompilerOptionValueTypeString(opt)));
36067
35943
  }
36068
- return normalizeNonListOptionValue(option, basePath, value);
36069
35944
  }
36070
35945
  function normalizeNonListOptionValue(option, basePath, value) {
36071
35946
  if (option.isFilePath) {
@@ -36076,29 +35951,29 @@ function normalizeNonListOptionValue(option, basePath, value) {
36076
35951
  }
36077
35952
  return value;
36078
35953
  }
36079
- function validateJsonOptionValue(opt, value, errors) {
35954
+ function validateJsonOptionValue(opt, value, errors, valueExpression, sourceFile) {
36080
35955
  var _a2;
36081
35956
  if (isNullOrUndefined(value))
36082
35957
  return void 0;
36083
35958
  const d = (_a2 = opt.extraValidation) == null ? void 0 : _a2.call(opt, value);
36084
35959
  if (!d)
36085
35960
  return value;
36086
- errors.push(createCompilerDiagnostic(...d));
35961
+ errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, valueExpression, ...d));
36087
35962
  return void 0;
36088
35963
  }
36089
- function convertJsonOptionOfCustomType(opt, value, errors) {
35964
+ function convertJsonOptionOfCustomType(opt, value, errors, valueExpression, sourceFile) {
36090
35965
  if (isNullOrUndefined(value))
36091
35966
  return void 0;
36092
35967
  const key = value.toLowerCase();
36093
35968
  const val = opt.type.get(key);
36094
35969
  if (val !== void 0) {
36095
- return validateJsonOptionValue(opt, val, errors);
35970
+ return validateJsonOptionValue(opt, val, errors, valueExpression, sourceFile);
36096
35971
  } else {
36097
- errors.push(createCompilerDiagnosticForInvalidCustomType(opt));
35972
+ errors.push(createDiagnosticForInvalidCustomType(opt, (message, ...args) => createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, valueExpression, message, ...args)));
36098
35973
  }
36099
35974
  }
36100
- function convertJsonOptionOfListType(option, values, basePath, errors) {
36101
- return filter(map(values, (v) => convertJsonOption(option.element, v, basePath, errors)), (v) => option.listPreserveFalsyValues ? true : !!v);
35975
+ function convertJsonOptionOfListType(option, values, basePath, errors, propertyAssignment, valueExpression, sourceFile) {
35976
+ return filter(map(values, (v, index) => convertJsonOption(option.element, v, basePath, errors, propertyAssignment, valueExpression == null ? void 0 : valueExpression.elements[index], sourceFile)), (v) => option.listPreserveFalsyValues ? true : !!v);
36102
35977
  }
36103
35978
  var invalidTrailingRecursionPattern = /(^|\/)\*\*\/?$/;
36104
35979
  var wildcardDirectoryPattern = /^[^*?]*(?=\/[^/]*[*?])/;
@@ -36207,7 +36082,7 @@ function validateSpecs(specs, errors, disallowTrailingRecursion, jsonSourceFile,
36207
36082
  });
36208
36083
  function createDiagnostic(message, spec) {
36209
36084
  const element = getTsConfigPropArrayElementValue(jsonSourceFile, specKey, spec);
36210
- return element ? createDiagnosticForNodeInSourceFile(jsonSourceFile, element, message, spec) : createCompilerDiagnostic(message, spec);
36085
+ return createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(jsonSourceFile, element, message, spec);
36211
36086
  }
36212
36087
  }
36213
36088
  function specToDiagnostic(spec, disallowTrailingRecursion) {
@@ -38904,8 +38779,8 @@ function createBinder() {
38904
38779
  var reportedUnreachableFlow = { flags: 1 /* Unreachable */ };
38905
38780
  var bindBinaryExpressionFlow = createBindBinaryExpressionFlow();
38906
38781
  return bindSourceFile2;
38907
- function createDiagnosticForNode2(node, message, arg0, arg1, arg2) {
38908
- return createDiagnosticForNodeInSourceFile(getSourceFileOfNode(node) || file, node, message, arg0, arg1, arg2);
38782
+ function createDiagnosticForNode2(node, message, ...args) {
38783
+ return createDiagnosticForNodeInSourceFile(getSourceFileOfNode(node) || file, node, message, ...args);
38909
38784
  }
38910
38785
  function bindSourceFile2(f, opts) {
38911
38786
  var _a2, _b;
@@ -39099,7 +38974,7 @@ function createBinder() {
39099
38974
  const declarationName = getNameOfDeclaration(node) || node;
39100
38975
  forEach(symbol.declarations, (declaration, index) => {
39101
38976
  const decl = getNameOfDeclaration(declaration) || declaration;
39102
- const diag3 = createDiagnosticForNode2(decl, message, messageNeedsName ? getDisplayName(declaration) : void 0);
38977
+ const diag3 = messageNeedsName ? createDiagnosticForNode2(decl, message, getDisplayName(declaration)) : createDiagnosticForNode2(decl, message);
39103
38978
  file.bindDiagnostics.push(
39104
38979
  multipleDefaultExports ? addRelatedInfo(diag3, createDiagnosticForNode2(declarationName, index === 0 ? Diagnostics.Another_export_default_is_here : Diagnostics.and_here)) : diag3
39105
38980
  );
@@ -39107,7 +38982,7 @@ function createBinder() {
39107
38982
  relatedInformation.push(createDiagnosticForNode2(decl, Diagnostics.The_first_export_default_is_here));
39108
38983
  }
39109
38984
  });
39110
- const diag2 = createDiagnosticForNode2(declarationName, message, messageNeedsName ? getDisplayName(node) : void 0);
38985
+ const diag2 = messageNeedsName ? createDiagnosticForNode2(declarationName, message, getDisplayName(node)) : createDiagnosticForNode2(declarationName, message);
39111
38986
  file.bindDiagnostics.push(addRelatedInfo(diag2, ...relatedInformation));
39112
38987
  symbol = createSymbol(0 /* None */, name);
39113
38988
  }
@@ -40568,9 +40443,9 @@ function createBinder() {
40568
40443
  }
40569
40444
  }
40570
40445
  }
40571
- function errorOnFirstToken(node, message, arg0, arg1, arg2) {
40446
+ function errorOnFirstToken(node, message, ...args) {
40572
40447
  const span = getSpanOfTokenAtPosition(file, node.pos);
40573
- file.bindDiagnostics.push(createFileDiagnostic(file, span.start, span.length, message, arg0, arg1, arg2));
40448
+ file.bindDiagnostics.push(createFileDiagnostic(file, span.start, span.length, message, ...args));
40574
40449
  }
40575
40450
  function errorOrSuggestionOnNode(isError, node, message) {
40576
40451
  errorOrSuggestionOnRange(isError, node, node, message);
@@ -42680,6 +42555,7 @@ function createTypeChecker(host) {
42680
42555
  var argumentsSymbol = createSymbol(4 /* Property */, "arguments");
42681
42556
  var requireSymbol = createSymbol(4 /* Property */, "require");
42682
42557
  var isolatedModulesLikeFlagName = compilerOptions.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules";
42558
+ var canCollectSymbolAliasAccessabilityData = !compilerOptions.verbatimModuleSyntax || !!compilerOptions.importsNotUsedAsValues;
42683
42559
  var apparentArgumentCount;
42684
42560
  const checker = {
42685
42561
  getNodeCount: () => reduceLeft(host.getSourceFiles(), (n, s) => n + s.nodeCount, 0),
@@ -43507,8 +43383,8 @@ function createTypeChecker(host) {
43507
43383
  getDiagnostics(sourceFile, cancellationToken2);
43508
43384
  return emitResolver;
43509
43385
  }
43510
- function lookupOrIssueError(location, message, arg0, arg1, arg2, arg3) {
43511
- const diagnostic = location ? createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : createCompilerDiagnostic(message, arg0, arg1, arg2, arg3);
43386
+ function lookupOrIssueError(location, message, ...args) {
43387
+ const diagnostic = location ? createDiagnosticForNode(location, message, ...args) : createCompilerDiagnostic(message, ...args);
43512
43388
  const existing = diagnostics.lookup(diagnostic);
43513
43389
  if (existing) {
43514
43390
  return existing;
@@ -43517,16 +43393,16 @@ function createTypeChecker(host) {
43517
43393
  return diagnostic;
43518
43394
  }
43519
43395
  }
43520
- function errorSkippedOn(key, location, message, arg0, arg1, arg2, arg3) {
43521
- const diagnostic = error(location, message, arg0, arg1, arg2, arg3);
43396
+ function errorSkippedOn(key, location, message, ...args) {
43397
+ const diagnostic = error(location, message, ...args);
43522
43398
  diagnostic.skippedOn = key;
43523
43399
  return diagnostic;
43524
43400
  }
43525
- function createError(location, message, arg0, arg1, arg2, arg3) {
43526
- return location ? createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : createCompilerDiagnostic(message, arg0, arg1, arg2, arg3);
43401
+ function createError(location, message, ...args) {
43402
+ return location ? createDiagnosticForNode(location, message, ...args) : createCompilerDiagnostic(message, ...args);
43527
43403
  }
43528
- function error(location, message, arg0, arg1, arg2, arg3) {
43529
- const diagnostic = createError(location, message, arg0, arg1, arg2, arg3);
43404
+ function error(location, message, ...args) {
43405
+ const diagnostic = createError(location, message, ...args);
43530
43406
  diagnostics.add(diagnostic);
43531
43407
  return diagnostic;
43532
43408
  }
@@ -43537,19 +43413,19 @@ function createTypeChecker(host) {
43537
43413
  suggestionDiagnostics.add({ ...diagnostic, category: 2 /* Suggestion */ });
43538
43414
  }
43539
43415
  }
43540
- function errorOrSuggestion(isError, location, message, arg0, arg1, arg2, arg3) {
43416
+ function errorOrSuggestion(isError, location, message, ...args) {
43541
43417
  if (location.pos < 0 || location.end < 0) {
43542
43418
  if (!isError) {
43543
43419
  return;
43544
43420
  }
43545
43421
  const file = getSourceFileOfNode(location);
43546
- addErrorOrSuggestion(isError, "message" in message ? createFileDiagnostic(file, 0, 0, message, arg0, arg1, arg2, arg3) : createDiagnosticForFileFromMessageChain(file, message));
43422
+ addErrorOrSuggestion(isError, "message" in message ? createFileDiagnostic(file, 0, 0, message, ...args) : createDiagnosticForFileFromMessageChain(file, message));
43547
43423
  return;
43548
43424
  }
43549
- addErrorOrSuggestion(isError, "message" in message ? createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(location), location, message));
43425
+ addErrorOrSuggestion(isError, "message" in message ? createDiagnosticForNode(location, message, ...args) : createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(location), location, message));
43550
43426
  }
43551
- function errorAndMaybeSuggestAwait(location, maybeMissingAwait, message, arg0, arg1, arg2, arg3) {
43552
- const diagnostic = error(location, message, arg0, arg1, arg2, arg3);
43427
+ function errorAndMaybeSuggestAwait(location, maybeMissingAwait, message, ...args) {
43428
+ const diagnostic = error(location, message, ...args);
43553
43429
  if (maybeMissingAwait) {
43554
43430
  const related = createDiagnosticForNode(location, Diagnostics.Did_you_forget_to_use_await);
43555
43431
  addRelatedInfo(diagnostic, related);
@@ -45423,7 +45299,7 @@ function createTypeChecker(host) {
45423
45299
  return void 0;
45424
45300
  }
45425
45301
  function markExportAsReferenced(node) {
45426
- if (compilerOptions.verbatimModuleSyntax) {
45302
+ if (!canCollectSymbolAliasAccessabilityData) {
45427
45303
  return;
45428
45304
  }
45429
45305
  const symbol = getSymbolOfDeclaration(node);
@@ -45436,7 +45312,7 @@ function createTypeChecker(host) {
45436
45312
  }
45437
45313
  }
45438
45314
  function markAliasSymbolAsReferenced(symbol) {
45439
- Debug.assert(!compilerOptions.verbatimModuleSyntax);
45315
+ Debug.assert(canCollectSymbolAliasAccessabilityData);
45440
45316
  const links = getSymbolLinks(symbol);
45441
45317
  if (!links.referenced) {
45442
45318
  links.referenced = true;
@@ -45567,6 +45443,9 @@ function createTypeChecker(host) {
45567
45443
  }
45568
45444
  }
45569
45445
  symbol = getMergedSymbol(getSymbol(getExportsOfSymbol(namespace), right.escapedText, meaning));
45446
+ if (!symbol && namespace.flags & 2097152 /* Alias */) {
45447
+ symbol = getMergedSymbol(getSymbol(getExportsOfSymbol(resolveAlias(namespace)), right.escapedText, meaning));
45448
+ }
45570
45449
  if (!symbol) {
45571
45450
  if (!ignoreErrors) {
45572
45451
  const namespaceName = getFullyQualifiedName(namespace);
@@ -45603,7 +45482,7 @@ function createTypeChecker(host) {
45603
45482
  return void 0;
45604
45483
  }
45605
45484
  } else {
45606
- throw Debug.assertNever(name, "Unknown entity name kind.");
45485
+ Debug.assertNever(name, "Unknown entity name kind.");
45607
45486
  }
45608
45487
  Debug.assert((getCheckFlags(symbol) & 1 /* Instantiated */) === 0, "Should never get an instantiated symbol here.");
45609
45488
  if (!nodeIsSynthesized(name) && isEntityName(name) && (symbol.flags & 2097152 /* Alias */ || name.parent.kind === 275 /* ExportAssignment */)) {
@@ -47316,8 +47195,11 @@ function createTypeChecker(host) {
47316
47195
  }
47317
47196
  return typeToTypeNodeHelper(type2, context);
47318
47197
  }
47198
+ function isMappedTypeHomomorphic(type2) {
47199
+ return !!getHomomorphicTypeVariable(type2);
47200
+ }
47319
47201
  function isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type2) {
47320
- return isMappedTypeWithKeyofConstraintDeclaration(type2) && !(getModifiersTypeFromMappedType(type2).flags & 262144 /* TypeParameter */);
47202
+ return !!type2.target && isMappedTypeHomomorphic(type2.target) && !isMappedTypeHomomorphic(type2);
47321
47203
  }
47322
47204
  function createMappedTypeNodeFromType(type2) {
47323
47205
  Debug.assert(!!(type2.flags & 524288 /* Object */));
@@ -53485,7 +53367,7 @@ function createTypeChecker(host) {
53485
53367
  return simplified !== type ? simplified : getConstraintOfType(type);
53486
53368
  }
53487
53369
  function getConstraintFromIndexedAccess(type) {
53488
- if (isMappedTypeGenericIndexedAccess(type)) {
53370
+ if (isMappedTypeGenericIndexedAccess(type) || isGenericMappedType(type.objectType)) {
53489
53371
  return substituteIndexedMappedType(type.objectType, type.indexType);
53490
53372
  }
53491
53373
  const indexConstraint = getSimplifiedTypeOrConstraint(type.indexType);
@@ -53721,7 +53603,7 @@ function createTypeChecker(host) {
53721
53603
  const typeVariable = getHomomorphicTypeVariable(type);
53722
53604
  if (typeVariable && !type.declaration.nameType) {
53723
53605
  const constraint = getConstraintOfTypeParameter(typeVariable);
53724
- if (constraint && isArrayType(constraint)) {
53606
+ if (constraint && everyType(constraint, isArrayOrTupleType)) {
53725
53607
  return instantiateType(type, prependTypeMapping(typeVariable, constraint, type.mapper));
53726
53608
  }
53727
53609
  }
@@ -55873,6 +55755,12 @@ function createTypeChecker(host) {
55873
55755
  i--;
55874
55756
  const source = types[i];
55875
55757
  if (hasEmptyObject || source.flags & 469499904 /* StructuredOrInstantiable */) {
55758
+ if (source.flags & 262144 /* TypeParameter */ && getBaseConstraintOrType(source).flags & 1048576 /* Union */) {
55759
+ if (isTypeRelatedTo(source, getUnionType(map(types, (t) => t === source ? neverType : t)), strictSubtypeRelation)) {
55760
+ orderedRemoveItemAt(types, i);
55761
+ }
55762
+ continue;
55763
+ }
55876
55764
  const keyProperty = source.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 58982400 /* InstantiableNonPrimitive */) ? find(getPropertiesOfType(source), (p) => isUnitType(getTypeOfSymbol(p))) : void 0;
55877
55765
  const keyPropertyType = keyProperty && getRegularTypeOfLiteralType(getTypeOfSymbol(keyProperty));
55878
55766
  for (const target of types) {
@@ -56440,7 +56328,7 @@ function createTypeChecker(host) {
56440
56328
  links.resolvedType = getTypeFromTypeNode(node.type);
56441
56329
  break;
56442
56330
  default:
56443
- throw Debug.assertNever(node.operator);
56331
+ Debug.assertNever(node.operator);
56444
56332
  }
56445
56333
  }
56446
56334
  return links.resolvedType;
@@ -56524,7 +56412,7 @@ function createTypeChecker(host) {
56524
56412
  return type;
56525
56413
  }
56526
56414
  function getStringMappingType(symbol, type) {
56527
- return type.flags & (1048576 /* Union */ | 131072 /* Never */) ? mapType(type, (t) => getStringMappingType(symbol, t)) : type.flags & 2097152 /* Intersection */ ? getIntersectionType(map(type.types, (t) => getStringMappingType(symbol, t))) : type.flags & 128 /* StringLiteral */ ? getStringLiteralType(applyStringMapping(symbol, type.value)) : type.flags & 134217728 /* TemplateLiteral */ ? getTemplateLiteralType(...applyTemplateStringMapping(symbol, type.texts, type.types)) : (
56415
+ return type.flags & (1048576 /* Union */ | 131072 /* Never */) ? mapType(type, (t) => getStringMappingType(symbol, t)) : type.flags & 128 /* StringLiteral */ ? getStringLiteralType(applyStringMapping(symbol, type.value)) : type.flags & 134217728 /* TemplateLiteral */ ? getTemplateLiteralType(...applyTemplateStringMapping(symbol, type.texts, type.types)) : (
56528
56416
  // Mapping<Mapping<T>> === Mapping<T>
56529
56417
  type.flags & 268435456 /* StringMapping */ && symbol === type.symbol ? type : type.flags & (1 /* Any */ | 4 /* String */ | 268435456 /* StringMapping */) || isGenericIndexType(type) ? getStringMappingTypeForGenericType(symbol, type) : (
56530
56418
  // This handles Mapping<`${number}`> and Mapping<`${bigint}`>
@@ -57407,7 +57295,10 @@ function createTypeChecker(host) {
57407
57295
  const declarations = concatenate(leftProp.declarations, rightProp.declarations);
57408
57296
  const flags = 4 /* Property */ | leftProp.flags & 16777216 /* Optional */;
57409
57297
  const result = createSymbol(flags, leftProp.escapedName);
57410
- result.links.type = getUnionType([getTypeOfSymbol(leftProp), removeMissingOrUndefinedType(rightType)], 2 /* Subtype */);
57298
+ const leftType = getTypeOfSymbol(leftProp);
57299
+ const leftTypeWithoutUndefined = removeMissingOrUndefinedType(leftType);
57300
+ const rightTypeWithoutUndefined = removeMissingOrUndefinedType(rightType);
57301
+ result.links.type = leftTypeWithoutUndefined === rightTypeWithoutUndefined ? leftType : getUnionType([leftType, rightTypeWithoutUndefined], 2 /* Subtype */);
57411
57302
  result.links.leftSpread = leftProp;
57412
57303
  result.links.rightSpread = rightProp;
57413
57304
  result.declarations = declarations;
@@ -58198,7 +58089,13 @@ function createTypeChecker(host) {
58198
58089
  return hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node);
58199
58090
  }
58200
58091
  function hasContextSensitiveReturnExpression(node) {
58201
- return !node.typeParameters && !getEffectiveReturnTypeNode(node) && !!node.body && node.body.kind !== 239 /* Block */ && isContextSensitive(node.body);
58092
+ if (node.typeParameters || getEffectiveReturnTypeNode(node) || !node.body) {
58093
+ return false;
58094
+ }
58095
+ if (node.body.kind !== 239 /* Block */) {
58096
+ return isContextSensitive(node.body);
58097
+ }
58098
+ return !!forEachReturnStatement(node.body, (statement) => !!statement.expression && isContextSensitive(statement.expression));
58202
58099
  }
58203
58100
  function isContextSensitiveFunctionOrObjectLiteralMethod(func) {
58204
58101
  return (isFunctionExpressionOrArrowFunction(func) || isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func);
@@ -58824,6 +58721,9 @@ function createTypeChecker(host) {
58824
58721
  const targetCount = getParameterCount(target);
58825
58722
  const sourceHasMoreParameters = !hasEffectiveRestParameter(target) && (checkMode & 8 /* StrictArity */ ? hasEffectiveRestParameter(source) || getParameterCount(source) > targetCount : getMinArgumentCount(source) > targetCount);
58826
58723
  if (sourceHasMoreParameters) {
58724
+ if (reportErrors2 && !(checkMode & 8 /* StrictArity */)) {
58725
+ errorReporter(Diagnostics.Target_signature_provides_too_few_arguments_Expected_0_or_more_but_got_1, getMinArgumentCount(source), targetCount);
58726
+ }
58827
58727
  return 0 /* False */;
58828
58728
  }
58829
58729
  if (source.typeParameters && source.typeParameters !== target.typeParameters) {
@@ -58867,7 +58767,12 @@ function createTypeChecker(host) {
58867
58767
  const paramCount = sourceRestType || targetRestType ? Math.min(sourceCount, targetCount) : Math.max(sourceCount, targetCount);
58868
58768
  const restIndex = sourceRestType || targetRestType ? paramCount - 1 : -1;
58869
58769
  for (let i = 0; i < paramCount; i++) {
58870
- const sourceType = i === restIndex ? getRestTypeAtPosition(source, i) : tryGetTypeAtPosition(source, i);
58770
+ const sourceType = i === restIndex ? getRestTypeAtPosition(
58771
+ source,
58772
+ i,
58773
+ /*readonly*/
58774
+ true
58775
+ ) : tryGetTypeAtPosition(source, i);
58871
58776
  const targetType = i === restIndex ? getRestTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
58872
58777
  if (sourceType && targetType) {
58873
58778
  const sourceSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
@@ -59133,7 +59038,7 @@ function createTypeChecker(host) {
59133
59038
  }
59134
59039
  function getNormalizedType(type, writing) {
59135
59040
  while (true) {
59136
- const t = isFreshLiteralType(type) ? type.regularType : getObjectFlags(type) & 4 /* Reference */ ? type.node ? createTypeReference(type.target, getTypeArguments(type)) : getSingleBaseForNonAugmentingSubtype(type) || type : type.flags & 3145728 /* UnionOrIntersection */ ? getNormalizedUnionOrIntersectionType(type, writing) : type.flags & 33554432 /* Substitution */ ? writing ? type.baseType : getSubstitutionIntersection(type) : type.flags & 25165824 /* Simplifiable */ ? getSimplifiedType(type, writing) : type;
59041
+ const t = isFreshLiteralType(type) ? type.regularType : isGenericTupleType(type) ? getNormalizedTupleType(type, writing) : getObjectFlags(type) & 4 /* Reference */ ? type.node ? createTypeReference(type.target, getTypeArguments(type)) : getSingleBaseForNonAugmentingSubtype(type) || type : type.flags & 3145728 /* UnionOrIntersection */ ? getNormalizedUnionOrIntersectionType(type, writing) : type.flags & 33554432 /* Substitution */ ? writing ? type.baseType : getSubstitutionIntersection(type) : type.flags & 25165824 /* Simplifiable */ ? getSimplifiedType(type, writing) : type;
59137
59042
  if (t === type)
59138
59043
  return t;
59139
59044
  type = t;
@@ -59152,6 +59057,11 @@ function createTypeChecker(host) {
59152
59057
  }
59153
59058
  return type;
59154
59059
  }
59060
+ function getNormalizedTupleType(type, writing) {
59061
+ const elements = getTypeArguments(type);
59062
+ const normalizedElements = sameMap(elements, (t) => t.flags & 25165824 /* Simplifiable */ ? getSimplifiedType(t, writing) : t);
59063
+ return elements !== normalizedElements ? createNormalizedTupleType(type.target, normalizedElements) : type;
59064
+ }
59155
59065
  function checkTypeRelatedTo(source, target, relation, errorNode, headMessage, containingMessageChain, errorOutputContainer) {
59156
59066
  var _a2;
59157
59067
  let errorInfo;
@@ -59241,10 +59151,10 @@ function createTypeChecker(host) {
59241
59151
  relatedInfo: relatedInfo == null ? void 0 : relatedInfo.slice()
59242
59152
  };
59243
59153
  }
59244
- function reportIncompatibleError(message, arg0, arg1, arg2, arg3) {
59154
+ function reportIncompatibleError(message, ...args) {
59245
59155
  overrideNextErrorInfo++;
59246
59156
  lastSkippedInfo = void 0;
59247
- (incompatibleStack || (incompatibleStack = [])).push([message, arg0, arg1, arg2, arg3]);
59157
+ (incompatibleStack || (incompatibleStack = [])).push([message, ...args]);
59248
59158
  }
59249
59159
  function reportIncompatibleStack() {
59250
59160
  const stack = incompatibleStack || [];
@@ -59336,13 +59246,13 @@ function createTypeChecker(host) {
59336
59246
  );
59337
59247
  }
59338
59248
  }
59339
- function reportError(message, arg0, arg1, arg2, arg3) {
59249
+ function reportError(message, ...args) {
59340
59250
  Debug.assert(!!errorNode);
59341
59251
  if (incompatibleStack)
59342
59252
  reportIncompatibleStack();
59343
59253
  if (message.elidedInCompatabilityPyramid)
59344
59254
  return;
59345
- errorInfo = chainDiagnosticMessages(errorInfo, message, arg0, arg1, arg2, arg3);
59255
+ errorInfo = chainDiagnosticMessages(errorInfo, message, ...args);
59346
59256
  }
59347
59257
  function associateRelatedInfo(info) {
59348
59258
  Debug.assert(!!errorInfo);
@@ -60522,6 +60432,26 @@ function createTypeChecker(host) {
60522
60432
  )) {
60523
60433
  return result2;
60524
60434
  }
60435
+ if (sourceFlags & 8388608 /* IndexedAccess */) {
60436
+ const indexType = source2.indexType;
60437
+ if (indexType.flags & 4194304 /* Index */) {
60438
+ const unresolvedIndexConstraint = getBaseConstraintOfType(indexType.type);
60439
+ const indexConstraint = unresolvedIndexConstraint && unresolvedIndexConstraint !== noConstraintType ? getIndexType(unresolvedIndexConstraint) : keyofConstraintType;
60440
+ const constraint2 = getIndexedAccessType(source2.objectType, indexConstraint);
60441
+ if (result2 = isRelatedTo(
60442
+ constraint2,
60443
+ target2,
60444
+ 1 /* Source */,
60445
+ /*reportErrors*/
60446
+ false,
60447
+ /*headMessage*/
60448
+ void 0,
60449
+ intersectionState
60450
+ )) {
60451
+ return result2;
60452
+ }
60453
+ }
60454
+ }
60525
60455
  if (isMappedTypeGenericIndexedAccess(source2)) {
60526
60456
  const indexConstraint = getConstraintOfType(source2.indexType);
60527
60457
  if (indexConstraint) {
@@ -60629,7 +60559,7 @@ function createTypeChecker(host) {
60629
60559
  if (varianceResult !== void 0) {
60630
60560
  return varianceResult;
60631
60561
  }
60632
- } else if (isReadonlyArrayType(target2) ? isArrayOrTupleType(source2) : isArrayType(target2) && isTupleType(source2) && !source2.target.readonly) {
60562
+ } else if (isReadonlyArrayType(target2) ? everyType(source2, isArrayOrTupleType) : isArrayType(target2) && everyType(source2, (t) => isTupleType(t) && !t.target.readonly)) {
60633
60563
  if (relation !== identityRelation) {
60634
60564
  return isRelatedTo(getIndexTypeOfType(source2, numberType) || anyType, getIndexTypeOfType(target2, numberType) || anyType, 3 /* Both */, reportErrors2);
60635
60565
  } else {
@@ -61512,22 +61442,7 @@ function createTypeChecker(host) {
61512
61442
  if (match === -1) {
61513
61443
  return defaultValue;
61514
61444
  }
61515
- let nextMatch = discriminable.indexOf(
61516
- /*searchElement*/
61517
- true,
61518
- match + 1
61519
- );
61520
- while (nextMatch !== -1) {
61521
- if (!isTypeIdenticalTo(target.types[match], target.types[nextMatch])) {
61522
- return defaultValue;
61523
- }
61524
- nextMatch = discriminable.indexOf(
61525
- /*searchElement*/
61526
- true,
61527
- nextMatch + 1
61528
- );
61529
- }
61530
- return target.types[match];
61445
+ return getUnionType(target.types.filter((_, index) => discriminable[index]));
61531
61446
  }
61532
61447
  function isWeakType(type) {
61533
61448
  if (type.flags & 524288 /* Object */) {
@@ -62971,21 +62886,19 @@ function createTypeChecker(host) {
62971
62886
  const saveInferencePriority = inferencePriority;
62972
62887
  inferencePriority = 2048 /* MaxValue */;
62973
62888
  const saveExpandingFlags = expandingFlags;
62974
- const sourceIdentity = getRecursionIdentity(source);
62975
- const targetIdentity = getRecursionIdentity(target);
62976
- if (contains(sourceStack, sourceIdentity))
62889
+ (sourceStack != null ? sourceStack : sourceStack = []).push(source);
62890
+ (targetStack != null ? targetStack : targetStack = []).push(target);
62891
+ if (isDeeplyNestedType(source, sourceStack, sourceStack.length, 2))
62977
62892
  expandingFlags |= 1 /* Source */;
62978
- if (contains(targetStack, targetIdentity))
62893
+ if (isDeeplyNestedType(target, targetStack, targetStack.length, 2))
62979
62894
  expandingFlags |= 2 /* Target */;
62980
62895
  if (expandingFlags !== 3 /* Both */) {
62981
- (sourceStack || (sourceStack = [])).push(sourceIdentity);
62982
- (targetStack || (targetStack = [])).push(targetIdentity);
62983
62896
  action(source, target);
62984
- targetStack.pop();
62985
- sourceStack.pop();
62986
62897
  } else {
62987
62898
  inferencePriority = -1 /* Circularity */;
62988
62899
  }
62900
+ targetStack.pop();
62901
+ sourceStack.pop();
62989
62902
  expandingFlags = saveExpandingFlags;
62990
62903
  visited.set(key, inferencePriority);
62991
62904
  inferencePriority = Math.min(inferencePriority, saveInferencePriority);
@@ -63127,7 +63040,11 @@ function createTypeChecker(host) {
63127
63040
  return true;
63128
63041
  }
63129
63042
  if (constraintType.flags & 262144 /* TypeParameter */) {
63130
- inferWithPriority(getIndexType(source), constraintType, 32 /* MappedTypeConstraint */);
63043
+ inferWithPriority(getIndexType(
63044
+ source,
63045
+ /*indexFlags*/
63046
+ !!source.pattern ? 2 /* NoIndexSignatures */ : 0 /* None */
63047
+ ), constraintType, 32 /* MappedTypeConstraint */);
63131
63048
  const extendedConstraint = getConstraintOfType(constraintType);
63132
63049
  if (extendedConstraint && inferToMappedType(source, target, extendedConstraint)) {
63133
63050
  return true;
@@ -63600,36 +63517,34 @@ function createTypeChecker(host) {
63600
63517
  return type.flags & 8192 /* UniqueESSymbol */ ? type.escapedName : type.flags & 384 /* StringOrNumberLiteral */ ? escapeLeadingUnderscores("" + type.value) : void 0;
63601
63518
  }
63602
63519
  function tryGetElementAccessExpressionName(node) {
63603
- if (isStringOrNumericLiteralLike(node.argumentExpression)) {
63604
- return escapeLeadingUnderscores(node.argumentExpression.text);
63520
+ return isStringOrNumericLiteralLike(node.argumentExpression) ? escapeLeadingUnderscores(node.argumentExpression.text) : isEntityNameExpression(node.argumentExpression) ? tryGetNameFromEntityNameExpression(node.argumentExpression) : void 0;
63521
+ }
63522
+ function tryGetNameFromEntityNameExpression(node) {
63523
+ const symbol = resolveEntityName(
63524
+ node,
63525
+ 111551 /* Value */,
63526
+ /*ignoreErrors*/
63527
+ true
63528
+ );
63529
+ if (!symbol || !(isConstVariable(symbol) || symbol.flags & 8 /* EnumMember */))
63530
+ return void 0;
63531
+ const declaration = symbol.valueDeclaration;
63532
+ if (declaration === void 0)
63533
+ return void 0;
63534
+ const type = tryGetTypeFromEffectiveTypeNode(declaration);
63535
+ if (type) {
63536
+ const name = tryGetNameFromType(type);
63537
+ if (name !== void 0) {
63538
+ return name;
63539
+ }
63605
63540
  }
63606
- if (isEntityNameExpression(node.argumentExpression)) {
63607
- const symbol = resolveEntityName(
63608
- node.argumentExpression,
63609
- 111551 /* Value */,
63610
- /*ignoreErrors*/
63611
- true
63612
- );
63613
- if (!symbol || !(isConstVariable(symbol) || symbol.flags & 8 /* EnumMember */))
63614
- return void 0;
63615
- const declaration = symbol.valueDeclaration;
63616
- if (declaration === void 0)
63617
- return void 0;
63618
- const type = tryGetTypeFromEffectiveTypeNode(declaration);
63619
- if (type) {
63620
- const name = tryGetNameFromType(type);
63621
- if (name !== void 0) {
63622
- return name;
63623
- }
63541
+ if (hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node)) {
63542
+ const initializer = getEffectiveInitializer(declaration);
63543
+ if (initializer) {
63544
+ return tryGetNameFromType(getTypeOfExpression(initializer));
63624
63545
  }
63625
- if (hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node.argumentExpression)) {
63626
- const initializer = getEffectiveInitializer(declaration);
63627
- if (initializer) {
63628
- return tryGetNameFromType(getTypeOfExpression(initializer));
63629
- }
63630
- if (isEnumMember(declaration)) {
63631
- return getTextOfPropertyName(declaration.name);
63632
- }
63546
+ if (isEnumMember(declaration)) {
63547
+ return getTextOfPropertyName(declaration.name);
63633
63548
  }
63634
63549
  }
63635
63550
  return void 0;
@@ -65547,7 +65462,7 @@ function createTypeChecker(host) {
65547
65462
  });
65548
65463
  }
65549
65464
  function markAliasReferenced(symbol, location) {
65550
- if (compilerOptions.verbatimModuleSyntax) {
65465
+ if (!canCollectSymbolAliasAccessabilityData) {
65551
65466
  return;
65552
65467
  }
65553
65468
  if (isNonLocalAlias(
@@ -66839,7 +66754,11 @@ function createTypeChecker(host) {
66839
66754
  if (instantiatedType && !(contextFlags && contextFlags & 2 /* NoConstraints */ && instantiatedType.flags & 8650752 /* TypeVariable */)) {
66840
66755
  const apparentType = mapType(
66841
66756
  instantiatedType,
66842
- getApparentType,
66757
+ // When obtaining apparent type of *contextual* type we don't want to get apparent type of mapped types.
66758
+ // That would evaluate mapped types with array or tuple type constraints too eagerly
66759
+ // and thus it would prevent `getTypeOfPropertyOfContextualType` from obtaining per-position contextual type for elements of array literal expressions.
66760
+ // Apparent type of other mapped types is already the mapped type itself so we can just avoid calling `getApparentType` here for all mapped types.
66761
+ (t) => getObjectFlags(t) & 32 /* Mapped */ ? t : getApparentType(t),
66843
66762
  /*noReductions*/
66844
66763
  true
66845
66764
  );
@@ -68104,7 +68023,7 @@ function createTypeChecker(host) {
68104
68023
  }
68105
68024
  if (jsxFactorySym) {
68106
68025
  jsxFactorySym.isReferenced = 67108863 /* All */;
68107
- if (!compilerOptions.verbatimModuleSyntax && jsxFactorySym.flags & 2097152 /* Alias */ && !getTypeOnlyAliasDeclaration(jsxFactorySym)) {
68026
+ if (canCollectSymbolAliasAccessabilityData && jsxFactorySym.flags & 2097152 /* Alias */ && !getTypeOnlyAliasDeclaration(jsxFactorySym)) {
68108
68027
  markAliasSymbolAsReferenced(jsxFactorySym);
68109
68028
  }
68110
68029
  }
@@ -69678,16 +69597,16 @@ function createTypeChecker(host) {
69678
69597
  }
69679
69598
  return { start, length: length2, sourceFile };
69680
69599
  }
69681
- function getDiagnosticForCallNode(node, message, arg0, arg1, arg2, arg3) {
69600
+ function getDiagnosticForCallNode(node, message, ...args) {
69682
69601
  if (isCallExpression(node)) {
69683
69602
  const { sourceFile, start, length: length2 } = getDiagnosticSpanForCallNode(node);
69684
69603
  if ("message" in message) {
69685
- return createFileDiagnostic(sourceFile, start, length2, message, arg0, arg1, arg2, arg3);
69604
+ return createFileDiagnostic(sourceFile, start, length2, message, ...args);
69686
69605
  }
69687
69606
  return createDiagnosticForFileFromMessageChain(sourceFile, message);
69688
69607
  } else {
69689
69608
  if ("message" in message) {
69690
- return createDiagnosticForNode(node, message, arg0, arg1, arg2, arg3);
69609
+ return createDiagnosticForNode(node, message, ...args);
69691
69610
  }
69692
69611
  return createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(node), node, message);
69693
69612
  }
@@ -69775,11 +69694,8 @@ function createTypeChecker(host) {
69775
69694
  }
69776
69695
  const parameter = (_a2 = closestSignature == null ? void 0 : closestSignature.declaration) == null ? void 0 : _a2.parameters[closestSignature.thisParameter ? args.length + 1 : args.length];
69777
69696
  if (parameter) {
69778
- const parameterError = createDiagnosticForNode(
69779
- parameter,
69780
- isBindingPattern(parameter.name) ? Diagnostics.An_argument_matching_this_binding_pattern_was_not_provided : isRestParameter(parameter) ? Diagnostics.Arguments_for_the_rest_parameter_0_were_not_provided : Diagnostics.An_argument_for_0_was_not_provided,
69781
- !parameter.name ? args.length : !isBindingPattern(parameter.name) ? idText(getFirstIdentifier(parameter.name)) : void 0
69782
- );
69697
+ const messageAndArgs = isBindingPattern(parameter.name) ? [Diagnostics.An_argument_matching_this_binding_pattern_was_not_provided] : isRestParameter(parameter) ? [Diagnostics.Arguments_for_the_rest_parameter_0_were_not_provided, idText(getFirstIdentifier(parameter.name))] : [Diagnostics.An_argument_for_0_was_not_provided, !parameter.name ? args.length : idText(getFirstIdentifier(parameter.name))];
69698
+ const parameterError = createDiagnosticForNode(parameter, ...messageAndArgs);
69783
69699
  return addRelatedInfo(diagnostic, parameterError);
69784
69700
  }
69785
69701
  return diagnostic;
@@ -70710,7 +70626,7 @@ function createTypeChecker(host) {
70710
70626
  case 283 /* JsxSelfClosingElement */:
70711
70627
  return resolveJsxOpeningLikeElement(node, candidatesOutArray, checkMode);
70712
70628
  }
70713
- throw Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable.");
70629
+ Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable.");
70714
70630
  }
70715
70631
  function getResolvedSignature(node, candidatesOutArray, checkMode) {
70716
70632
  const links = getNodeLinks(node);
@@ -71384,12 +71300,12 @@ function createTypeChecker(host) {
71384
71300
  }
71385
71301
  return void 0;
71386
71302
  }
71387
- function getRestTypeAtPosition(source, pos) {
71303
+ function getRestTypeAtPosition(source, pos, readonly = false) {
71388
71304
  const parameterCount = getParameterCount(source);
71389
71305
  const minArgumentCount = getMinArgumentCount(source);
71390
71306
  const restType = getEffectiveRestType(source);
71391
71307
  if (restType && pos >= parameterCount - 1) {
71392
- return pos === parameterCount - 1 ? restType : createArrayType(getIndexedAccessType(restType, numberType));
71308
+ return pos === parameterCount - 1 ? restType : createArrayType(getIndexedAccessType(restType, numberType), readonly);
71393
71309
  }
71394
71310
  const types = [];
71395
71311
  const flags = [];
@@ -71407,13 +71323,7 @@ function createTypeChecker(host) {
71407
71323
  names.push(name);
71408
71324
  }
71409
71325
  }
71410
- return createTupleType(
71411
- types,
71412
- flags,
71413
- /*readonly*/
71414
- false,
71415
- length(names) === length(types) ? names : void 0
71416
- );
71326
+ return createTupleType(types, flags, readonly, length(names) === length(types) ? names : void 0);
71417
71327
  }
71418
71328
  function getParameterCount(signature) {
71419
71329
  const length2 = signature.parameters.length;
@@ -75119,9 +75029,9 @@ function createTypeChecker(host) {
75119
75029
  }
75120
75030
  }
75121
75031
  }
75122
- function getAwaitedTypeOfPromise(type, errorNode, diagnosticMessage, arg0) {
75032
+ function getAwaitedTypeOfPromise(type, errorNode, diagnosticMessage, ...args) {
75123
75033
  const promisedType = getPromisedTypeOfPromise(type, errorNode);
75124
- return promisedType && getAwaitedType(promisedType, errorNode, diagnosticMessage, arg0);
75034
+ return promisedType && getAwaitedType(promisedType, errorNode, diagnosticMessage, ...args);
75125
75035
  }
75126
75036
  function getPromisedTypeOfPromise(type, errorNode, thisTypeForErrorOut) {
75127
75037
  if (isTypeAny(type)) {
@@ -75184,8 +75094,8 @@ function createTypeChecker(host) {
75184
75094
  }
75185
75095
  return typeAsPromise.promisedTypeOfPromise = getUnionType(map(onfulfilledParameterSignatures, getTypeOfFirstParameterOfSignature), 2 /* Subtype */);
75186
75096
  }
75187
- function checkAwaitedType(type, withAlias, errorNode, diagnosticMessage, arg0) {
75188
- const awaitedType = withAlias ? getAwaitedType(type, errorNode, diagnosticMessage, arg0) : getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage, arg0);
75097
+ function checkAwaitedType(type, withAlias, errorNode, diagnosticMessage, ...args) {
75098
+ const awaitedType = withAlias ? getAwaitedType(type, errorNode, diagnosticMessage, ...args) : getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage, ...args);
75189
75099
  return awaitedType || errorType;
75190
75100
  }
75191
75101
  function isThenableType(type) {
@@ -75241,11 +75151,11 @@ function createTypeChecker(host) {
75241
75151
  Debug.assert(isAwaitedTypeInstantiation(type) || getPromisedTypeOfPromise(type) === void 0, "type provided should not be a non-generic 'promise'-like.");
75242
75152
  return type;
75243
75153
  }
75244
- function getAwaitedType(type, errorNode, diagnosticMessage, arg0) {
75245
- const awaitedType = getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage, arg0);
75154
+ function getAwaitedType(type, errorNode, diagnosticMessage, ...args) {
75155
+ const awaitedType = getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage, ...args);
75246
75156
  return awaitedType && createAwaitedTypeIfNeeded(awaitedType);
75247
75157
  }
75248
- function getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage, arg0) {
75158
+ function getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage, ...args) {
75249
75159
  if (isTypeAny(type)) {
75250
75160
  return type;
75251
75161
  }
@@ -75263,7 +75173,7 @@ function createTypeChecker(host) {
75263
75173
  }
75264
75174
  return void 0;
75265
75175
  }
75266
- const mapper = errorNode ? (constituentType) => getAwaitedTypeNoAlias(constituentType, errorNode, diagnosticMessage, arg0) : getAwaitedTypeNoAlias;
75176
+ const mapper = errorNode ? (constituentType) => getAwaitedTypeNoAlias(constituentType, errorNode, diagnosticMessage, ...args) : getAwaitedTypeNoAlias;
75267
75177
  awaitedTypeStack.push(type.id);
75268
75178
  const mapped = mapType(type, mapper);
75269
75179
  awaitedTypeStack.pop();
@@ -75287,7 +75197,7 @@ function createTypeChecker(host) {
75287
75197
  return void 0;
75288
75198
  }
75289
75199
  awaitedTypeStack.push(type.id);
75290
- const awaitedType = getAwaitedTypeNoAlias(promisedType, errorNode, diagnosticMessage, arg0);
75200
+ const awaitedType = getAwaitedTypeNoAlias(promisedType, errorNode, diagnosticMessage, ...args);
75291
75201
  awaitedTypeStack.pop();
75292
75202
  if (!awaitedType) {
75293
75203
  return void 0;
@@ -75301,7 +75211,7 @@ function createTypeChecker(host) {
75301
75211
  if (thisTypeForErrorOut.value) {
75302
75212
  chain = chainDiagnosticMessages(chain, Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1, typeToString(type), typeToString(thisTypeForErrorOut.value));
75303
75213
  }
75304
- chain = chainDiagnosticMessages(chain, diagnosticMessage, arg0);
75214
+ chain = chainDiagnosticMessages(chain, diagnosticMessage, ...args);
75305
75215
  diagnostics.add(createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(errorNode), errorNode, chain));
75306
75216
  }
75307
75217
  return void 0;
@@ -75479,7 +75389,7 @@ function createTypeChecker(host) {
75479
75389
  true
75480
75390
  );
75481
75391
  if (rootSymbol && rootSymbol.flags & 2097152 /* Alias */) {
75482
- if (!compilerOptions.verbatimModuleSyntax && symbolIsValue(rootSymbol) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol)) && !getTypeOnlyAliasDeclaration(rootSymbol)) {
75392
+ if (canCollectSymbolAliasAccessabilityData && symbolIsValue(rootSymbol) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol)) && !getTypeOnlyAliasDeclaration(rootSymbol)) {
75483
75393
  markAliasSymbolAsReferenced(rootSymbol);
75484
75394
  } else if (forDecoratorMetadata && getIsolatedModules(compilerOptions) && getEmitModuleKind(compilerOptions) >= 5 /* ES2015 */ && !symbolIsValue(rootSymbol) && !some(rootSymbol.declarations, isTypeOnlyImportOrExportDeclaration)) {
75485
75395
  const diag2 = error(typeName, Diagnostics.A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled);
@@ -75888,9 +75798,8 @@ function createTypeChecker(host) {
75888
75798
  const sourceFile = getSourceFileOfNode(parent);
75889
75799
  const range = isJSDocTemplateTag(parent) ? rangeOfNode(parent) : rangeOfTypeParameters(sourceFile, parent.typeParameters);
75890
75800
  const only = parent.typeParameters.length === 1;
75891
- const message = only ? Diagnostics._0_is_declared_but_its_value_is_never_read : Diagnostics.All_type_parameters_are_unused;
75892
- const arg0 = only ? name : void 0;
75893
- addDiagnostic(typeParameter, 1 /* Parameter */, createFileDiagnostic(sourceFile, range.pos, range.end - range.pos, message, arg0));
75801
+ const messageAndArg = only ? [Diagnostics._0_is_declared_but_its_value_is_never_read, name] : [Diagnostics.All_type_parameters_are_unused];
75802
+ addDiagnostic(typeParameter, 1 /* Parameter */, createFileDiagnostic(sourceFile, range.pos, range.end - range.pos, ...messageAndArg));
75894
75803
  }
75895
75804
  } else {
75896
75805
  addDiagnostic(typeParameter, 1 /* Parameter */, createDiagnosticForNode(typeParameter, Diagnostics._0_is_declared_but_its_value_is_never_read, name));
@@ -77448,7 +77357,7 @@ function createTypeChecker(host) {
77448
77357
  forEachKey(catchClause.locals, (caughtName) => {
77449
77358
  const blockLocal = blockLocals.get(caughtName);
77450
77359
  if ((blockLocal == null ? void 0 : blockLocal.valueDeclaration) && (blockLocal.flags & 2 /* BlockScopedVariable */) !== 0) {
77451
- grammarErrorOnNode(blockLocal.valueDeclaration, Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause, caughtName);
77360
+ grammarErrorOnNode(blockLocal.valueDeclaration, Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause, unescapeLeadingUnderscores(caughtName));
77452
77361
  }
77453
77362
  });
77454
77363
  }
@@ -79044,6 +78953,9 @@ function createTypeChecker(host) {
79044
78953
  ) && !getSymbolLinks(getSymbolOfDeclaration(statement)).constEnumReferenced;
79045
78954
  }
79046
78955
  function checkImportsForTypeOnlyConversion(sourceFile) {
78956
+ if (!canCollectSymbolAliasAccessabilityData) {
78957
+ return;
78958
+ }
79047
78959
  for (const statement of sourceFile.statements) {
79048
78960
  if (canConvertImportDeclarationToTypeOnly(statement) || canConvertImportEqualsDeclarationToTypeOnly(statement)) {
79049
78961
  error(
@@ -79129,14 +79041,14 @@ function createTypeChecker(host) {
79129
79041
  markAliasReferenced(sym, id);
79130
79042
  if (getAllSymbolFlags(sym) & 111551 /* Value */) {
79131
79043
  checkExpressionCached(id);
79132
- if (!isIllegalExportDefaultInCJS && compilerOptions.verbatimModuleSyntax && getTypeOnlyAliasDeclaration(sym, 111551 /* Value */)) {
79044
+ if (!isIllegalExportDefaultInCJS && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax && getTypeOnlyAliasDeclaration(sym, 111551 /* Value */)) {
79133
79045
  error(
79134
79046
  id,
79135
79047
  node.isExportEquals ? Diagnostics.An_export_declaration_must_reference_a_real_value_when_verbatimModuleSyntax_is_enabled_but_0_resolves_to_a_type_only_declaration : Diagnostics.An_export_default_must_reference_a_real_value_when_verbatimModuleSyntax_is_enabled_but_0_resolves_to_a_type_only_declaration,
79136
79048
  idText(id)
79137
79049
  );
79138
79050
  }
79139
- } else if (!isIllegalExportDefaultInCJS && compilerOptions.verbatimModuleSyntax) {
79051
+ } else if (!isIllegalExportDefaultInCJS && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax) {
79140
79052
  error(
79141
79053
  id,
79142
79054
  node.isExportEquals ? Diagnostics.An_export_declaration_must_reference_a_value_when_verbatimModuleSyntax_is_enabled_but_0_only_refers_to_a_type : Diagnostics.An_export_default_must_reference_a_value_when_verbatimModuleSyntax_is_enabled_but_0_only_refers_to_a_type,
@@ -80473,7 +80385,7 @@ function createTypeChecker(host) {
80473
80385
  return false;
80474
80386
  }
80475
80387
  function isValueAliasDeclaration(node) {
80476
- Debug.assert(!compilerOptions.verbatimModuleSyntax);
80388
+ Debug.assert(canCollectSymbolAliasAccessabilityData);
80477
80389
  switch (node.kind) {
80478
80390
  case 269 /* ImportEqualsDeclaration */:
80479
80391
  return isAliasResolvedToValue(getSymbolOfDeclaration(node));
@@ -80514,7 +80426,7 @@ function createTypeChecker(host) {
80514
80426
  return isConstEnumSymbol(s) || !!s.constEnumOnlyModule;
80515
80427
  }
80516
80428
  function isReferencedAliasDeclaration(node, checkChildren) {
80517
- Debug.assert(!compilerOptions.verbatimModuleSyntax);
80429
+ Debug.assert(canCollectSymbolAliasAccessabilityData);
80518
80430
  if (isAliasSymbolDeclaration(node)) {
80519
80431
  const symbol = getSymbolOfDeclaration(node);
80520
80432
  const links = symbol && getSymbolLinks(symbol);
@@ -80852,12 +80764,12 @@ function createTypeChecker(host) {
80852
80764
  isDeclarationWithCollidingName,
80853
80765
  isValueAliasDeclaration: (nodeIn) => {
80854
80766
  const node = getParseTreeNode(nodeIn);
80855
- return node ? isValueAliasDeclaration(node) : true;
80767
+ return node && canCollectSymbolAliasAccessabilityData ? isValueAliasDeclaration(node) : true;
80856
80768
  },
80857
80769
  hasGlobalName,
80858
80770
  isReferencedAliasDeclaration: (nodeIn, checkChildren) => {
80859
80771
  const node = getParseTreeNode(nodeIn);
80860
- return node ? isReferencedAliasDeclaration(node, checkChildren) : true;
80772
+ return node && canCollectSymbolAliasAccessabilityData ? isReferencedAliasDeclaration(node, checkChildren) : true;
80861
80773
  },
80862
80774
  getNodeCheckFlags: (nodeIn) => {
80863
80775
  const node = getParseTreeNode(nodeIn);
@@ -81989,10 +81901,10 @@ function createTypeChecker(host) {
81989
81901
  currentKind = 2 /* SetAccessor */;
81990
81902
  break;
81991
81903
  default:
81992
- throw Debug.assertNever(prop, "Unexpected syntax kind:" + prop.kind);
81904
+ Debug.assertNever(prop, "Unexpected syntax kind:" + prop.kind);
81993
81905
  }
81994
81906
  if (!inDestructuring) {
81995
- const effectiveName = getPropertyNameForPropertyNameNode(name);
81907
+ const effectiveName = getEffectivePropertyNameForPropertyNameNode(name);
81996
81908
  if (effectiveName === void 0) {
81997
81909
  continue;
81998
81910
  }
@@ -82461,12 +82373,12 @@ function createTypeChecker(host) {
82461
82373
  switch (node.keywordToken) {
82462
82374
  case 104 /* NewKeyword */:
82463
82375
  if (escapedText !== "target") {
82464
- return grammarErrorOnNode(node.name, Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, node.name.escapedText, tokenToString(node.keywordToken), "target");
82376
+ return grammarErrorOnNode(node.name, Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, unescapeLeadingUnderscores(node.name.escapedText), tokenToString(node.keywordToken), "target");
82465
82377
  }
82466
82378
  break;
82467
82379
  case 101 /* ImportKeyword */:
82468
82380
  if (escapedText !== "meta") {
82469
- return grammarErrorOnNode(node.name, Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, node.name.escapedText, tokenToString(node.keywordToken), "meta");
82381
+ return grammarErrorOnNode(node.name, Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, unescapeLeadingUnderscores(node.name.escapedText), tokenToString(node.keywordToken), "meta");
82470
82382
  }
82471
82383
  break;
82472
82384
  }
@@ -82474,35 +82386,35 @@ function createTypeChecker(host) {
82474
82386
  function hasParseDiagnostics(sourceFile) {
82475
82387
  return sourceFile.parseDiagnostics.length > 0;
82476
82388
  }
82477
- function grammarErrorOnFirstToken(node, message, arg0, arg1, arg2) {
82389
+ function grammarErrorOnFirstToken(node, message, ...args) {
82478
82390
  const sourceFile = getSourceFileOfNode(node);
82479
82391
  if (!hasParseDiagnostics(sourceFile)) {
82480
82392
  const span = getSpanOfTokenAtPosition(sourceFile, node.pos);
82481
- diagnostics.add(createFileDiagnostic(sourceFile, span.start, span.length, message, arg0, arg1, arg2));
82393
+ diagnostics.add(createFileDiagnostic(sourceFile, span.start, span.length, message, ...args));
82482
82394
  return true;
82483
82395
  }
82484
82396
  return false;
82485
82397
  }
82486
- function grammarErrorAtPos(nodeForSourceFile, start, length2, message, arg0, arg1, arg2) {
82398
+ function grammarErrorAtPos(nodeForSourceFile, start, length2, message, ...args) {
82487
82399
  const sourceFile = getSourceFileOfNode(nodeForSourceFile);
82488
82400
  if (!hasParseDiagnostics(sourceFile)) {
82489
- diagnostics.add(createFileDiagnostic(sourceFile, start, length2, message, arg0, arg1, arg2));
82401
+ diagnostics.add(createFileDiagnostic(sourceFile, start, length2, message, ...args));
82490
82402
  return true;
82491
82403
  }
82492
82404
  return false;
82493
82405
  }
82494
- function grammarErrorOnNodeSkippedOn(key, node, message, arg0, arg1, arg2) {
82406
+ function grammarErrorOnNodeSkippedOn(key, node, message, ...args) {
82495
82407
  const sourceFile = getSourceFileOfNode(node);
82496
82408
  if (!hasParseDiagnostics(sourceFile)) {
82497
- errorSkippedOn(key, node, message, arg0, arg1, arg2);
82409
+ errorSkippedOn(key, node, message, ...args);
82498
82410
  return true;
82499
82411
  }
82500
82412
  return false;
82501
82413
  }
82502
- function grammarErrorOnNode(node, message, arg0, arg1, arg2) {
82414
+ function grammarErrorOnNode(node, message, ...args) {
82503
82415
  const sourceFile = getSourceFileOfNode(node);
82504
82416
  if (!hasParseDiagnostics(sourceFile)) {
82505
- diagnostics.add(createDiagnosticForNode(node, message, arg0, arg1, arg2));
82417
+ diagnostics.add(createDiagnosticForNode(node, message, ...args));
82506
82418
  return true;
82507
82419
  }
82508
82420
  return false;
@@ -82647,7 +82559,7 @@ function createTypeChecker(host) {
82647
82559
  }
82648
82560
  return false;
82649
82561
  }
82650
- function grammarErrorAfterFirstToken(node, message, arg0, arg1, arg2) {
82562
+ function grammarErrorAfterFirstToken(node, message, ...args) {
82651
82563
  const sourceFile = getSourceFileOfNode(node);
82652
82564
  if (!hasParseDiagnostics(sourceFile)) {
82653
82565
  const span = getSpanOfTokenAtPosition(sourceFile, node.pos);
@@ -82657,9 +82569,7 @@ function createTypeChecker(host) {
82657
82569
  /*length*/
82658
82570
  0,
82659
82571
  message,
82660
- arg0,
82661
- arg1,
82662
- arg2
82572
+ ...args
82663
82573
  ));
82664
82574
  return true;
82665
82575
  }
@@ -82805,6 +82715,10 @@ function createTypeChecker(host) {
82805
82715
  }
82806
82716
  return void 0;
82807
82717
  }
82718
+ function getEffectivePropertyNameForPropertyNameNode(node) {
82719
+ const name = getPropertyNameForPropertyNameNode(node);
82720
+ return name ? name : isComputedPropertyName(node) && isEntityNameExpression(node.expression) ? tryGetNameFromEntityNameExpression(node.expression) : void 0;
82721
+ }
82808
82722
  }
82809
82723
  function isNotAccessor(declaration) {
82810
82724
  return !isAccessor(declaration);
@@ -94698,10 +94612,13 @@ function transformJsx(context) {
94698
94612
  return Debug.failBadSyntaxKind(node);
94699
94613
  }
94700
94614
  }
94615
+ function hasProto(obj) {
94616
+ return obj.properties.some((p) => isPropertyAssignment(p) && (isIdentifier(p.name) && idText(p.name) === "__proto__" || isStringLiteral(p.name) && p.name.text === "__proto__"));
94617
+ }
94701
94618
  function hasKeyAfterPropsSpread(node) {
94702
94619
  let spread = false;
94703
94620
  for (const elem of node.attributes.properties) {
94704
- if (isJsxSpreadAttribute(elem)) {
94621
+ if (isJsxSpreadAttribute(elem) && (!isObjectLiteralExpression(elem.expression) || elem.expression.properties.some(isSpreadAssignment))) {
94705
94622
  spread = true;
94706
94623
  } else if (spread && isJsxAttribute(elem) && elem.name.escapedText === "key") {
94707
94624
  return true;
@@ -94867,7 +94784,10 @@ function transformJsx(context) {
94867
94784
  }
94868
94785
  return element;
94869
94786
  }
94870
- function transformJsxSpreadAttributeToSpreadAssignment(node) {
94787
+ function transformJsxSpreadAttributeToProps(node) {
94788
+ if (isObjectLiteralExpression(node.expression) && !hasProto(node.expression)) {
94789
+ return node.expression.properties;
94790
+ }
94871
94791
  return factory2.createSpreadAssignment(Debug.checkDefined(visitNode(node.expression, visitor, isExpression)));
94872
94792
  }
94873
94793
  function transformJsxAttributesToObjectProps(attrs, children) {
@@ -94875,30 +94795,48 @@ function transformJsx(context) {
94875
94795
  return target && target >= 5 /* ES2018 */ ? factory2.createObjectLiteralExpression(transformJsxAttributesToProps(attrs, children)) : transformJsxAttributesToExpression(attrs, children);
94876
94796
  }
94877
94797
  function transformJsxAttributesToProps(attrs, children) {
94878
- const props = flatten(spanMap(attrs, isJsxSpreadAttribute, (attrs2, isSpread) => map(attrs2, (attr) => isSpread ? transformJsxSpreadAttributeToSpreadAssignment(attr) : transformJsxAttributeToObjectLiteralElement(attr))));
94798
+ const props = flatten(spanMap(attrs, isJsxSpreadAttribute, (attrs2, isSpread) => flatten(map(attrs2, (attr) => isSpread ? transformJsxSpreadAttributeToProps(attr) : transformJsxAttributeToObjectLiteralElement(attr)))));
94879
94799
  if (children) {
94880
94800
  props.push(children);
94881
94801
  }
94882
94802
  return props;
94883
94803
  }
94884
94804
  function transformJsxAttributesToExpression(attrs, children) {
94885
- const expressions = flatten(
94886
- spanMap(
94887
- attrs,
94888
- isJsxSpreadAttribute,
94889
- (attrs2, isSpread) => isSpread ? map(attrs2, transformJsxSpreadAttributeToExpression) : factory2.createObjectLiteralExpression(map(attrs2, transformJsxAttributeToObjectLiteralElement))
94890
- )
94891
- );
94892
- if (isJsxSpreadAttribute(attrs[0])) {
94893
- expressions.unshift(factory2.createObjectLiteralExpression());
94805
+ const expressions = [];
94806
+ let properties = [];
94807
+ for (const attr of attrs) {
94808
+ if (isJsxSpreadAttribute(attr)) {
94809
+ if (isObjectLiteralExpression(attr.expression) && !hasProto(attr.expression)) {
94810
+ for (const prop of attr.expression.properties) {
94811
+ if (isSpreadAssignment(prop)) {
94812
+ finishObjectLiteralIfNeeded();
94813
+ expressions.push(prop.expression);
94814
+ continue;
94815
+ }
94816
+ properties.push(prop);
94817
+ }
94818
+ continue;
94819
+ }
94820
+ finishObjectLiteralIfNeeded();
94821
+ expressions.push(attr.expression);
94822
+ continue;
94823
+ }
94824
+ properties.push(transformJsxAttributeToObjectLiteralElement(attr));
94894
94825
  }
94895
94826
  if (children) {
94896
- expressions.push(factory2.createObjectLiteralExpression([children]));
94827
+ properties.push(children);
94828
+ }
94829
+ finishObjectLiteralIfNeeded();
94830
+ if (expressions.length && !isObjectLiteralExpression(expressions[0])) {
94831
+ expressions.unshift(factory2.createObjectLiteralExpression());
94897
94832
  }
94898
94833
  return singleOrUndefined(expressions) || emitHelpers().createAssignHelper(expressions);
94899
- }
94900
- function transformJsxSpreadAttributeToExpression(node) {
94901
- return Debug.checkDefined(visitNode(node.expression, visitor, isExpression));
94834
+ function finishObjectLiteralIfNeeded() {
94835
+ if (properties.length) {
94836
+ expressions.push(factory2.createObjectLiteralExpression(properties));
94837
+ properties = [];
94838
+ }
94839
+ }
94902
94840
  }
94903
94841
  function transformJsxAttributeToObjectLiteralElement(node) {
94904
94842
  const name = getAttributeName(node);
@@ -106975,8 +106913,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
106975
106913
  }
106976
106914
  }
106977
106915
  function createBuildInfo(program, bundle) {
106978
- const version2 = version;
106979
- return { bundle, program, version: version2 };
106916
+ return { bundle, program, version };
106980
106917
  }
106981
106918
  function getBuildInfoText(buildInfo) {
106982
106919
  return JSON.stringify(buildInfo);
@@ -107064,10 +107001,10 @@ function emitUsingBuildInfo(config, host, getCommandLine, customTransformers) {
107064
107001
  /*separateBeginAndEnd*/
107065
107002
  true
107066
107003
  );
107067
- ts_performance_exports.mark("beforeEmit");
107004
+ mark("beforeEmit");
107068
107005
  const result = emitUsingBuildInfoWorker(config, host, getCommandLine, customTransformers);
107069
- ts_performance_exports.mark("afterEmit");
107070
- ts_performance_exports.measure("Emit", "beforeEmit", "afterEmit");
107006
+ mark("afterEmit");
107007
+ measure("Emit", "beforeEmit", "afterEmit");
107071
107008
  (_b = tracing) == null ? void 0 : _b.pop();
107072
107009
  return result;
107073
107010
  }
@@ -111081,12 +111018,12 @@ function createPrinter(printerOptions = {}, handlers = {}) {
111081
111018
  return cache[nodeId] || (cache[nodeId] = generateNameForNode(node, privateName, flags != null ? flags : 0 /* None */, formatGeneratedNamePart(prefix, generateName), formatGeneratedNamePart(suffix)));
111082
111019
  }
111083
111020
  function isUniqueName(name, privateName) {
111084
- return isFileLevelUniqueName2(name, privateName) && !isReservedName(name, privateName) && !generatedNames.has(name);
111021
+ return isFileLevelUniqueNameInCurrentFile(name, privateName) && !isReservedName(name, privateName) && !generatedNames.has(name);
111085
111022
  }
111086
111023
  function isReservedName(name, privateName) {
111087
111024
  return privateName ? !!(reservedPrivateNames == null ? void 0 : reservedPrivateNames.has(name)) : !!(reservedNames == null ? void 0 : reservedNames.has(name));
111088
111025
  }
111089
- function isFileLevelUniqueName2(name, _isPrivate) {
111026
+ function isFileLevelUniqueNameInCurrentFile(name, _isPrivate) {
111090
111027
  return currentSourceFile ? isFileLevelUniqueName(currentSourceFile, name, hasGlobalName) : true;
111091
111028
  }
111092
111029
  function isUniqueLocalName(name, container) {
@@ -111205,7 +111142,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
111205
111142
  function makeFileLevelOptimisticUniqueName(name) {
111206
111143
  return makeUniqueName(
111207
111144
  name,
111208
- isFileLevelUniqueName2,
111145
+ isFileLevelUniqueNameInCurrentFile,
111209
111146
  /*optimistic*/
111210
111147
  true,
111211
111148
  /*scoped*/
@@ -111385,7 +111322,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
111385
111322
  case 3 /* Unique */:
111386
111323
  return makeUniqueName(
111387
111324
  idText(name),
111388
- autoGenerate.flags & 32 /* FileLevel */ ? isFileLevelUniqueName2 : isUniqueName,
111325
+ autoGenerate.flags & 32 /* FileLevel */ ? isFileLevelUniqueNameInCurrentFile : isUniqueName,
111389
111326
  !!(autoGenerate.flags & 16 /* Optimistic */),
111390
111327
  !!(autoGenerate.flags & 8 /* ReservedInNestedScopes */),
111391
111328
  isPrivateIdentifier(name),
@@ -114406,12 +114343,12 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
114406
114343
  }
114407
114344
  }
114408
114345
  }
114409
- function createDiagnosticForNodeArray2(nodes, message, arg0, arg1, arg2) {
114346
+ function createDiagnosticForNodeArray2(nodes, message, ...args) {
114410
114347
  const start = nodes.pos;
114411
- return createFileDiagnostic(sourceFile, start, nodes.end - start, message, arg0, arg1, arg2);
114348
+ return createFileDiagnostic(sourceFile, start, nodes.end - start, message, ...args);
114412
114349
  }
114413
- function createDiagnosticForNode2(node, message, arg0, arg1, arg2) {
114414
- return createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2);
114350
+ function createDiagnosticForNode2(node, message, ...args) {
114351
+ return createDiagnosticForNodeInSourceFile(sourceFile, node, message, ...args);
114415
114352
  }
114416
114353
  });
114417
114354
  }
@@ -115076,11 +115013,12 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
115076
115013
  const unqualifiedLibName = removeSuffix(removePrefix(libName, "lib."), ".d.ts");
115077
115014
  const suggestion = getSpellingSuggestion(unqualifiedLibName, libs, identity);
115078
115015
  const diagnostic = suggestion ? Diagnostics.Cannot_find_lib_definition_for_0_Did_you_mean_1 : Diagnostics.Cannot_find_lib_definition_for_0;
115016
+ const args = suggestion ? [libName, suggestion] : [libName];
115079
115017
  (fileProcessingDiagnostics || (fileProcessingDiagnostics = [])).push({
115080
115018
  kind: 0 /* FilePreprocessingReferencedDiagnostic */,
115081
115019
  reason: { kind: 7 /* LibReferenceDirective */, file: file.path, index },
115082
115020
  diagnostic,
115083
- args: [libName, suggestion]
115021
+ args
115084
115022
  });
115085
115023
  }
115086
115024
  });
@@ -115545,7 +115483,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
115545
115483
  }
115546
115484
  }
115547
115485
  function verifyDeprecatedCompilerOptions() {
115548
- function createDiagnostic(name, value, useInstead, message, arg0, arg1, arg2, arg3) {
115486
+ function createDiagnostic(name, value, useInstead, message, ...args) {
115549
115487
  if (useInstead) {
115550
115488
  const details = chainDiagnosticMessages(
115551
115489
  /*details*/
@@ -115553,7 +115491,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
115553
115491
  Diagnostics.Use_0_instead,
115554
115492
  useInstead
115555
115493
  );
115556
- const chain = chainDiagnosticMessages(details, message, arg0, arg1, arg2, arg3);
115494
+ const chain = chainDiagnosticMessages(details, message, ...args);
115557
115495
  createDiagnosticForOption(
115558
115496
  /*onKey*/
115559
115497
  !value,
@@ -115570,10 +115508,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
115570
115508
  /*option2*/
115571
115509
  void 0,
115572
115510
  message,
115573
- arg0,
115574
- arg1,
115575
- arg2,
115576
- arg3
115511
+ ...args
115577
115512
  );
115578
115513
  }
115579
115514
  }
@@ -115626,8 +115561,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
115626
115561
  });
115627
115562
  }
115628
115563
  function verifyDeprecatedProjectReference(ref, parentFile, index) {
115629
- function createDiagnostic(_name, _value, _useInstead, message, arg0, arg1, arg2, arg3) {
115630
- createDiagnosticForReference(parentFile, index, message, arg0, arg1, arg2, arg3);
115564
+ function createDiagnostic(_name, _value, _useInstead, message, ...args) {
115565
+ createDiagnosticForReference(parentFile, index, message, ...args);
115631
115566
  }
115632
115567
  checkDeprecations("5.0", "5.5", createDiagnostic, (createDeprecatedDiagnostic) => {
115633
115568
  if (ref.prepend) {
@@ -115739,8 +115674,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
115739
115674
  if (!referenceInfo)
115740
115675
  return void 0;
115741
115676
  const { sourceFile, index } = referenceInfo;
115742
- const referencesSyntax = firstDefined(
115743
- getTsConfigPropArray(sourceFile, "references"),
115677
+ const referencesSyntax = forEachTsConfigPropArray(
115678
+ sourceFile,
115679
+ "references",
115744
115680
  (property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0
115745
115681
  );
115746
115682
  return referencesSyntax && referencesSyntax.elements.length > index ? createDiagnosticForNodeInSourceFile(
@@ -115809,28 +115745,26 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
115809
115745
  }
115810
115746
  });
115811
115747
  }
115812
- function createDiagnosticForOptionPathKeyValue(key, valueIndex, message, arg0, arg1, arg2) {
115748
+ function createDiagnosticForOptionPathKeyValue(key, valueIndex, message, ...args) {
115813
115749
  let needCompilerDiagnostic = true;
115814
- const pathsSyntax = getOptionPathsSyntax();
115815
- for (const pathProp of pathsSyntax) {
115750
+ forEachOptionPathsSyntax((pathProp) => {
115816
115751
  if (isObjectLiteralExpression(pathProp.initializer)) {
115817
- for (const keyProps of getPropertyAssignment(pathProp.initializer, key)) {
115752
+ forEachPropertyAssignment(pathProp.initializer, key, (keyProps) => {
115818
115753
  const initializer = keyProps.initializer;
115819
115754
  if (isArrayLiteralExpression(initializer) && initializer.elements.length > valueIndex) {
115820
- programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, initializer.elements[valueIndex], message, arg0, arg1, arg2));
115755
+ programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, initializer.elements[valueIndex], message, ...args));
115821
115756
  needCompilerDiagnostic = false;
115822
115757
  }
115823
- }
115758
+ });
115824
115759
  }
115825
- }
115760
+ });
115826
115761
  if (needCompilerDiagnostic) {
115827
- programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1, arg2));
115762
+ programDiagnostics.add(createCompilerDiagnostic(message, ...args));
115828
115763
  }
115829
115764
  }
115830
- function createDiagnosticForOptionPaths(onKey, key, message, arg0) {
115765
+ function createDiagnosticForOptionPaths(onKey, key, message, ...args) {
115831
115766
  let needCompilerDiagnostic = true;
115832
- const pathsSyntax = getOptionPathsSyntax();
115833
- for (const pathProp of pathsSyntax) {
115767
+ forEachOptionPathsSyntax((pathProp) => {
115834
115768
  if (isObjectLiteralExpression(pathProp.initializer) && createOptionDiagnosticInObjectLiteralSyntax(
115835
115769
  pathProp.initializer,
115836
115770
  onKey,
@@ -115838,25 +115772,23 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
115838
115772
  /*key2*/
115839
115773
  void 0,
115840
115774
  message,
115841
- arg0
115775
+ ...args
115842
115776
  )) {
115843
115777
  needCompilerDiagnostic = false;
115844
115778
  }
115845
- }
115779
+ });
115846
115780
  if (needCompilerDiagnostic) {
115847
- programDiagnostics.add(createCompilerDiagnostic(message, arg0));
115781
+ programDiagnostics.add(createCompilerDiagnostic(message, ...args));
115848
115782
  }
115849
115783
  }
115850
- function getOptionsSyntaxByName(name) {
115851
- const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax();
115852
- return compilerOptionsObjectLiteralSyntax && getPropertyAssignment(compilerOptionsObjectLiteralSyntax, name);
115784
+ function forEachOptionsSyntaxByName(name, callback) {
115785
+ return forEachPropertyAssignment(getCompilerOptionsObjectLiteralSyntax(), name, callback);
115853
115786
  }
115854
- function getOptionPathsSyntax() {
115855
- return getOptionsSyntaxByName("paths") || emptyArray;
115787
+ function forEachOptionPathsSyntax(callback) {
115788
+ return forEachOptionsSyntaxByName("paths", callback);
115856
115789
  }
115857
115790
  function getOptionsSyntaxByValue(name, value) {
115858
- const syntaxByName = getOptionsSyntaxByName(name);
115859
- return syntaxByName && firstDefined(syntaxByName, (property) => isStringLiteral(property.initializer) && property.initializer.text === value ? property.initializer : void 0);
115791
+ return forEachOptionsSyntaxByName(name, (property) => isStringLiteral(property.initializer) && property.initializer.text === value ? property.initializer : void 0);
115860
115792
  }
115861
115793
  function getOptionsSyntaxByArrayElementValue(name, value) {
115862
115794
  const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax();
@@ -115874,7 +115806,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
115874
115806
  option3
115875
115807
  );
115876
115808
  }
115877
- function createOptionValueDiagnostic(option1, message, arg0, arg1) {
115809
+ function createOptionValueDiagnostic(option1, message, ...args) {
115878
115810
  createDiagnosticForOption(
115879
115811
  /*onKey*/
115880
115812
  false,
@@ -115882,57 +115814,53 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
115882
115814
  /*option2*/
115883
115815
  void 0,
115884
115816
  message,
115885
- arg0,
115886
- arg1
115817
+ ...args
115887
115818
  );
115888
115819
  }
115889
- function createDiagnosticForReference(sourceFile, index, message, arg0, arg1, arg2, arg3) {
115890
- const referencesSyntax = firstDefined(
115891
- getTsConfigPropArray(sourceFile || options.configFile, "references"),
115820
+ function createDiagnosticForReference(sourceFile, index, message, ...args) {
115821
+ const referencesSyntax = forEachTsConfigPropArray(
115822
+ sourceFile || options.configFile,
115823
+ "references",
115892
115824
  (property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0
115893
115825
  );
115894
115826
  if (referencesSyntax && referencesSyntax.elements.length > index) {
115895
- programDiagnostics.add(createDiagnosticForNodeInSourceFile(sourceFile || options.configFile, referencesSyntax.elements[index], message, arg0, arg1, arg2, arg3));
115827
+ programDiagnostics.add(createDiagnosticForNodeInSourceFile(sourceFile || options.configFile, referencesSyntax.elements[index], message, ...args));
115896
115828
  } else {
115897
- programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1, arg2, arg3));
115829
+ programDiagnostics.add(createCompilerDiagnostic(message, ...args));
115898
115830
  }
115899
115831
  }
115900
- function createDiagnosticForOption(onKey, option1, option2, message, arg0, arg1, arg2, arg3) {
115832
+ function createDiagnosticForOption(onKey, option1, option2, message, ...args) {
115901
115833
  const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax();
115902
- const needCompilerDiagnostic = !compilerOptionsObjectLiteralSyntax || !createOptionDiagnosticInObjectLiteralSyntax(compilerOptionsObjectLiteralSyntax, onKey, option1, option2, message, arg0, arg1, arg2, arg3);
115834
+ const needCompilerDiagnostic = !compilerOptionsObjectLiteralSyntax || !createOptionDiagnosticInObjectLiteralSyntax(compilerOptionsObjectLiteralSyntax, onKey, option1, option2, message, ...args);
115903
115835
  if (needCompilerDiagnostic) {
115904
115836
  if ("messageText" in message) {
115905
115837
  programDiagnostics.add(createCompilerDiagnosticFromMessageChain(message));
115906
115838
  } else {
115907
- programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1, arg2, arg3));
115839
+ programDiagnostics.add(createCompilerDiagnostic(message, ...args));
115908
115840
  }
115909
115841
  }
115910
115842
  }
115911
115843
  function getCompilerOptionsObjectLiteralSyntax() {
115912
115844
  if (_compilerOptionsObjectLiteralSyntax === void 0) {
115913
- _compilerOptionsObjectLiteralSyntax = false;
115914
- const jsonObjectLiteral = getTsConfigObjectLiteralExpression(options.configFile);
115915
- if (jsonObjectLiteral) {
115916
- for (const prop of getPropertyAssignment(jsonObjectLiteral, "compilerOptions")) {
115917
- if (isObjectLiteralExpression(prop.initializer)) {
115918
- _compilerOptionsObjectLiteralSyntax = prop.initializer;
115919
- break;
115920
- }
115921
- }
115922
- }
115845
+ _compilerOptionsObjectLiteralSyntax = forEachPropertyAssignment(
115846
+ getTsConfigObjectLiteralExpression(options.configFile),
115847
+ "compilerOptions",
115848
+ (prop) => isObjectLiteralExpression(prop.initializer) ? prop.initializer : void 0
115849
+ ) || false;
115923
115850
  }
115924
115851
  return _compilerOptionsObjectLiteralSyntax || void 0;
115925
115852
  }
115926
- function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral, onKey, key1, key2, message, arg0, arg1, arg2, arg3) {
115927
- const props = getPropertyAssignment(objectLiteral, key1, key2);
115928
- for (const prop of props) {
115853
+ function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral, onKey, key1, key2, message, ...args) {
115854
+ let needsCompilerDiagnostic = false;
115855
+ forEachPropertyAssignment(objectLiteral, key1, (prop) => {
115929
115856
  if ("messageText" in message) {
115930
115857
  programDiagnostics.add(createDiagnosticForNodeFromMessageChain(options.configFile, onKey ? prop.name : prop.initializer, message));
115931
115858
  } else {
115932
- programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message, arg0, arg1, arg2, arg3));
115859
+ programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message, ...args));
115933
115860
  }
115934
- }
115935
- return !!props.length;
115861
+ needsCompilerDiagnostic = true;
115862
+ }, key2);
115863
+ return needsCompilerDiagnostic;
115936
115864
  }
115937
115865
  function createRedundantOptionDiagnostic(errorOnOption, redundantWithOption) {
115938
115866
  const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax();
@@ -116830,16 +116758,16 @@ function convertToDiagnostics(diagnostics, newProgram) {
116830
116758
  return emptyArray;
116831
116759
  let buildInfoDirectory;
116832
116760
  return diagnostics.map((diagnostic) => {
116833
- const result = convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPath3);
116761
+ const result = convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPathInBuildInfoDirectory);
116834
116762
  result.reportsUnnecessary = diagnostic.reportsUnnecessary;
116835
116763
  result.reportsDeprecated = diagnostic.reportDeprecated;
116836
116764
  result.source = diagnostic.source;
116837
116765
  result.skippedOn = diagnostic.skippedOn;
116838
116766
  const { relatedInformation } = diagnostic;
116839
- result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map((r) => convertToDiagnosticRelatedInformation(r, newProgram, toPath3)) : [] : void 0;
116767
+ result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map((r) => convertToDiagnosticRelatedInformation(r, newProgram, toPathInBuildInfoDirectory)) : [] : void 0;
116840
116768
  return result;
116841
116769
  });
116842
- function toPath3(path) {
116770
+ function toPathInBuildInfoDirectory(path) {
116843
116771
  buildInfoDirectory != null ? buildInfoDirectory : buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(getTsBuildInfoEmitOutputFilePath(newProgram.getCompilerOptions()), newProgram.getCurrentDirectory()));
116844
116772
  return toPath(path, buildInfoDirectory, newProgram.getCanonicalFileName);
116845
116773
  }
@@ -117742,7 +117670,7 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
117742
117670
  const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
117743
117671
  const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
117744
117672
  let state;
117745
- const filePaths = (_a2 = program.fileNames) == null ? void 0 : _a2.map(toPath3);
117673
+ const filePaths = (_a2 = program.fileNames) == null ? void 0 : _a2.map(toPathInBuildInfoDirectory);
117746
117674
  let filePathsSetList;
117747
117675
  const latestChangedDtsFile = program.latestChangedDtsFile ? toAbsolutePath(program.latestChangedDtsFile) : void 0;
117748
117676
  if (isProgramBundleEmitBuildInfo(program)) {
@@ -117823,7 +117751,7 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
117823
117751
  close: noop,
117824
117752
  hasChangedEmitSignature: returnFalse
117825
117753
  };
117826
- function toPath3(path) {
117754
+ function toPathInBuildInfoDirectory(path) {
117827
117755
  return toPath(path, buildInfoDirectory, getCanonicalFileName);
117828
117756
  }
117829
117757
  function toAbsolutePath(path) {
@@ -118862,15 +118790,13 @@ function getErrorSummaryText(errorCount, filesInError, newLine, host) {
118862
118790
  const nonNilFiles = filesInError.filter((fileInError) => fileInError !== void 0);
118863
118791
  const distinctFileNamesWithLines = nonNilFiles.map((fileInError) => `${fileInError.fileName}:${fileInError.line}`).filter((value, index, self) => self.indexOf(value) === index);
118864
118792
  const firstFileReference = nonNilFiles[0] && prettyPathForFileError(nonNilFiles[0], host.getCurrentDirectory());
118865
- const d = errorCount === 1 ? createCompilerDiagnostic(
118866
- filesInError[0] !== void 0 ? Diagnostics.Found_1_error_in_1 : Diagnostics.Found_1_error,
118867
- errorCount,
118868
- firstFileReference
118869
- ) : createCompilerDiagnostic(
118870
- distinctFileNamesWithLines.length === 0 ? Diagnostics.Found_0_errors : distinctFileNamesWithLines.length === 1 ? Diagnostics.Found_0_errors_in_the_same_file_starting_at_Colon_1 : Diagnostics.Found_0_errors_in_1_files,
118871
- errorCount,
118872
- distinctFileNamesWithLines.length === 1 ? firstFileReference : distinctFileNamesWithLines.length
118873
- );
118793
+ let messageAndArgs;
118794
+ if (errorCount === 1) {
118795
+ messageAndArgs = filesInError[0] !== void 0 ? [Diagnostics.Found_1_error_in_0, firstFileReference] : [Diagnostics.Found_1_error];
118796
+ } else {
118797
+ messageAndArgs = distinctFileNamesWithLines.length === 0 ? [Diagnostics.Found_0_errors, errorCount] : distinctFileNamesWithLines.length === 1 ? [Diagnostics.Found_0_errors_in_the_same_file_starting_at_Colon_1, errorCount, firstFileReference] : [Diagnostics.Found_0_errors_in_1_files, errorCount, distinctFileNamesWithLines.length];
118798
+ }
118799
+ const d = createCompilerDiagnostic(...messageAndArgs);
118874
118800
  const suffix = distinctFileNamesWithLines.length > 1 ? createTabularErrorsDisplay(nonNilFiles, host) : "";
118875
118801
  return `${newLine}${flattenDiagnosticMessageText(d.messageText, newLine)}${newLine}${newLine}${suffix}`;
118876
118802
  }
@@ -119080,15 +119006,15 @@ function fileIncludeReasonToDiagnostics(program, reason, fileNameConvertor) {
119080
119006
  toFileName(referencedResolvedRef.sourceFile.fileName, fileNameConvertor),
119081
119007
  options.outFile ? "--outFile" : "--out"
119082
119008
  );
119083
- case 8 /* AutomaticTypeDirectiveFile */:
119009
+ case 8 /* AutomaticTypeDirectiveFile */: {
119010
+ const messageAndArgs = options.types ? reason.packageId ? [Diagnostics.Entry_point_of_type_library_0_specified_in_compilerOptions_with_packageId_1, reason.typeReference, packageIdToString(reason.packageId)] : [Diagnostics.Entry_point_of_type_library_0_specified_in_compilerOptions, reason.typeReference] : reason.packageId ? [Diagnostics.Entry_point_for_implicit_type_library_0_with_packageId_1, reason.typeReference, packageIdToString(reason.packageId)] : [Diagnostics.Entry_point_for_implicit_type_library_0, reason.typeReference];
119084
119011
  return chainDiagnosticMessages(
119085
119012
  /*details*/
119086
119013
  void 0,
119087
- options.types ? reason.packageId ? Diagnostics.Entry_point_of_type_library_0_specified_in_compilerOptions_with_packageId_1 : Diagnostics.Entry_point_of_type_library_0_specified_in_compilerOptions : reason.packageId ? Diagnostics.Entry_point_for_implicit_type_library_0_with_packageId_1 : Diagnostics.Entry_point_for_implicit_type_library_0,
119088
- reason.typeReference,
119089
- reason.packageId && packageIdToString(reason.packageId)
119014
+ ...messageAndArgs
119090
119015
  );
119091
- case 6 /* LibFile */:
119016
+ }
119017
+ case 6 /* LibFile */: {
119092
119018
  if (reason.index !== void 0)
119093
119019
  return chainDiagnosticMessages(
119094
119020
  /*details*/
@@ -119097,12 +119023,13 @@ function fileIncludeReasonToDiagnostics(program, reason, fileNameConvertor) {
119097
119023
  options.lib[reason.index]
119098
119024
  );
119099
119025
  const target = forEachEntry(targetOptionDeclaration.type, (value, key) => value === getEmitScriptTarget(options) ? key : void 0);
119026
+ const messageAndArgs = target ? [Diagnostics.Default_library_for_target_0, target] : [Diagnostics.Default_library];
119100
119027
  return chainDiagnosticMessages(
119101
119028
  /*details*/
119102
119029
  void 0,
119103
- target ? Diagnostics.Default_library_for_target_0 : Diagnostics.Default_library,
119104
- target
119030
+ ...messageAndArgs
119105
119031
  );
119032
+ }
119106
119033
  default:
119107
119034
  Debug.assertNever(reason);
119108
119035
  }