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/typescript.js CHANGED
@@ -35,7 +35,7 @@ var ts = (() => {
35
35
  "src/compiler/corePublic.ts"() {
36
36
  "use strict";
37
37
  versionMajorMinor = "5.1";
38
- version = `${versionMajorMinor}.0-dev.20230320`;
38
+ version = `${versionMajorMinor}.0-dev.20230322`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -7944,6 +7944,7 @@ ${lanes.join("\n")}
7944
7944
  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?"),
7945
7945
  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."),
7946
7946
  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."),
7947
+ 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}."),
7947
7948
  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}'."),
7948
7949
  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}'."),
7949
7950
  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}'."),
@@ -8389,13 +8390,14 @@ ${lanes.join("\n")}
8389
8390
  Output_Formatting: diag(6256, 3 /* Message */, "Output_Formatting_6256", "Output Formatting"),
8390
8391
  Completeness: diag(6257, 3 /* Message */, "Completeness_6257", "Completeness"),
8391
8392
  _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"),
8392
- Found_1_error_in_1: diag(6259, 3 /* Message */, "Found_1_error_in_1_6259", "Found 1 error in {1}"),
8393
+ Found_1_error_in_0: diag(6259, 3 /* Message */, "Found_1_error_in_0_6259", "Found 1 error in {0}"),
8393
8394
  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}"),
8394
8395
  Found_0_errors_in_1_files: diag(6261, 3 /* Message */, "Found_0_errors_in_1_files_6261", "Found {0} errors in {1} files."),
8395
8396
  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."),
8396
8397
  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."),
8397
8398
  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."),
8398
8399
  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."),
8400
+ 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."),
8399
8401
  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."),
8400
8402
  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}'."),
8401
8403
  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."),
@@ -13858,17 +13860,17 @@ ${lanes.join("\n")}
13858
13860
  return Debug.assertNever(name);
13859
13861
  }
13860
13862
  }
13861
- function createDiagnosticForNode(node, message, arg0, arg1, arg2, arg3) {
13863
+ function createDiagnosticForNode(node, message, ...args) {
13862
13864
  const sourceFile = getSourceFileOfNode(node);
13863
- return createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2, arg3);
13865
+ return createDiagnosticForNodeInSourceFile(sourceFile, node, message, ...args);
13864
13866
  }
13865
- function createDiagnosticForNodeArray(sourceFile, nodes, message, arg0, arg1, arg2, arg3) {
13867
+ function createDiagnosticForNodeArray(sourceFile, nodes, message, ...args) {
13866
13868
  const start = skipTrivia(sourceFile.text, nodes.pos);
13867
- return createFileDiagnostic(sourceFile, start, nodes.end - start, message, arg0, arg1, arg2, arg3);
13869
+ return createFileDiagnostic(sourceFile, start, nodes.end - start, message, ...args);
13868
13870
  }
13869
- function createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2, arg3) {
13871
+ function createDiagnosticForNodeInSourceFile(sourceFile, node, message, ...args) {
13870
13872
  const span = getErrorSpanForNode(sourceFile, node);
13871
- return createFileDiagnostic(sourceFile, span.start, span.length, message, arg0, arg1, arg2, arg3);
13873
+ return createFileDiagnostic(sourceFile, span.start, span.length, message, ...args);
13872
13874
  }
13873
13875
  function createDiagnosticForNodeFromMessageChain(sourceFile, node, messageChain, relatedInformation) {
13874
13876
  const span = getErrorSpanForNode(sourceFile, node);
@@ -14321,17 +14323,20 @@ ${lanes.join("\n")}
14321
14323
  function isThisTypePredicate(predicate) {
14322
14324
  return predicate && predicate.kind === 0 /* This */;
14323
14325
  }
14324
- function getPropertyAssignment(objectLiteral, key, key2) {
14325
- return objectLiteral.properties.filter((property) => {
14326
- if (property.kind === 300 /* PropertyAssignment */) {
14327
- const propName = tryGetTextOfPropertyName(property.name);
14328
- return key === propName || !!key2 && key2 === propName;
14329
- }
14330
- return false;
14326
+ function forEachPropertyAssignment(objectLiteral, key, callback, key2) {
14327
+ return forEach(objectLiteral == null ? void 0 : objectLiteral.properties, (property) => {
14328
+ if (!isPropertyAssignment(property))
14329
+ return void 0;
14330
+ const propName = tryGetTextOfPropertyName(property.name);
14331
+ return key === propName || key2 && key2 === propName ? callback(property) : void 0;
14331
14332
  });
14332
14333
  }
14333
14334
  function getPropertyArrayElementValue(objectLiteral, propKey, elementValue) {
14334
- return firstDefined(getPropertyAssignment(objectLiteral, propKey), (property) => isArrayLiteralExpression(property.initializer) ? find(property.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : void 0);
14335
+ return forEachPropertyAssignment(
14336
+ objectLiteral,
14337
+ propKey,
14338
+ (property) => isArrayLiteralExpression(property.initializer) ? find(property.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : void 0
14339
+ );
14335
14340
  }
14336
14341
  function getTsConfigObjectLiteralExpression(tsConfigSourceFile) {
14337
14342
  if (tsConfigSourceFile && tsConfigSourceFile.statements.length) {
@@ -14340,11 +14345,10 @@ ${lanes.join("\n")}
14340
14345
  }
14341
14346
  }
14342
14347
  function getTsConfigPropArrayElementValue(tsConfigSourceFile, propKey, elementValue) {
14343
- return firstDefined(getTsConfigPropArray(tsConfigSourceFile, propKey), (property) => isArrayLiteralExpression(property.initializer) ? find(property.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : void 0);
14348
+ return forEachTsConfigPropArray(tsConfigSourceFile, propKey, (property) => isArrayLiteralExpression(property.initializer) ? find(property.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : void 0);
14344
14349
  }
14345
- function getTsConfigPropArray(tsConfigSourceFile, propKey) {
14346
- const jsonObjectLiteral = getTsConfigObjectLiteralExpression(tsConfigSourceFile);
14347
- return jsonObjectLiteral ? getPropertyAssignment(jsonObjectLiteral, propKey) : emptyArray;
14350
+ function forEachTsConfigPropArray(tsConfigSourceFile, propKey, callback) {
14351
+ return forEachPropertyAssignment(getTsConfigObjectLiteralExpression(tsConfigSourceFile), propKey, callback);
14348
14352
  }
14349
14353
  function getContainingFunction(node) {
14350
14354
  return findAncestor(node.parent, isFunctionLike);
@@ -15684,6 +15688,12 @@ ${lanes.join("\n")}
15684
15688
  function isKeyword(token) {
15685
15689
  return 82 /* FirstKeyword */ <= token && token <= 163 /* LastKeyword */;
15686
15690
  }
15691
+ function isPunctuation(token) {
15692
+ return 18 /* FirstPunctuation */ <= token && token <= 78 /* LastPunctuation */;
15693
+ }
15694
+ function isKeywordOrPunctuation(token) {
15695
+ return isKeyword(token) || isPunctuation(token);
15696
+ }
15687
15697
  function isContextualKeyword(token) {
15688
15698
  return 127 /* FirstContextualKeyword */ <= token && token <= 163 /* LastContextualKeyword */;
15689
15699
  }
@@ -27997,7 +28007,6 @@ ${lanes.join("\n")}
27997
28007
  "src/compiler/parser.ts"() {
27998
28008
  "use strict";
27999
28009
  init_ts2();
28000
- init_ts2();
28001
28010
  init_ts_performance();
28002
28011
  parseBaseNodeFactory = {
28003
28012
  createBaseSourceFileNode: (kind) => new (SourceFileConstructor || (SourceFileConstructor = objectAllocator.getSourceFileConstructor()))(kind, -1, -1),
@@ -28533,14 +28542,12 @@ ${lanes.join("\n")}
28533
28542
  scriptKind2 = ensureScriptKind(fileName2, scriptKind2);
28534
28543
  if (scriptKind2 === 6 /* JSON */) {
28535
28544
  const result2 = parseJsonText2(fileName2, sourceText2, languageVersion2, syntaxCursor2, setParentNodes);
28536
- convertToObjectWorker(
28545
+ convertToJson(
28537
28546
  result2,
28538
28547
  (_a2 = result2.statements[0]) == null ? void 0 : _a2.expression,
28539
28548
  result2.parseDiagnostics,
28540
28549
  /*returnValue*/
28541
28550
  false,
28542
- /*knownRootOptions*/
28543
- void 0,
28544
28551
  /*jsonConversionNotifier*/
28545
28552
  void 0
28546
28553
  );
@@ -28972,24 +28979,24 @@ ${lanes.join("\n")}
28972
28979
  function inAwaitContext() {
28973
28980
  return inContext(32768 /* AwaitContext */);
28974
28981
  }
28975
- function parseErrorAtCurrentToken(message, arg0) {
28976
- return parseErrorAt(scanner2.getTokenStart(), scanner2.getTokenEnd(), message, arg0);
28982
+ function parseErrorAtCurrentToken(message, ...args) {
28983
+ return parseErrorAt(scanner2.getTokenStart(), scanner2.getTokenEnd(), message, ...args);
28977
28984
  }
28978
- function parseErrorAtPosition(start, length2, message, arg0) {
28985
+ function parseErrorAtPosition(start, length2, message, ...args) {
28979
28986
  const lastError = lastOrUndefined(parseDiagnostics);
28980
28987
  let result;
28981
28988
  if (!lastError || start !== lastError.start) {
28982
- result = createDetachedDiagnostic(fileName, start, length2, message, arg0);
28989
+ result = createDetachedDiagnostic(fileName, start, length2, message, ...args);
28983
28990
  parseDiagnostics.push(result);
28984
28991
  }
28985
28992
  parseErrorBeforeNextFinishedNode = true;
28986
28993
  return result;
28987
28994
  }
28988
- function parseErrorAt(start, end, message, arg0) {
28989
- return parseErrorAtPosition(start, end - start, message, arg0);
28995
+ function parseErrorAt(start, end, message, ...args) {
28996
+ return parseErrorAtPosition(start, end - start, message, ...args);
28990
28997
  }
28991
- function parseErrorAtRange(range, message, arg0) {
28992
- parseErrorAt(range.pos, range.end, message, arg0);
28998
+ function parseErrorAtRange(range, message, ...args) {
28999
+ parseErrorAt(range.pos, range.end, message, ...args);
28993
29000
  }
28994
29001
  function scanError(message, length2) {
28995
29002
  parseErrorAtPosition(scanner2.getTokenEnd(), length2, message);
@@ -29195,6 +29202,7 @@ ${lanes.join("\n")}
29195
29202
  nextTokenJSDoc();
29196
29203
  return true;
29197
29204
  }
29205
+ Debug.assert(isKeywordOrPunctuation(kind));
29198
29206
  parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(kind));
29199
29207
  return false;
29200
29208
  }
@@ -29243,7 +29251,11 @@ ${lanes.join("\n")}
29243
29251
  );
29244
29252
  }
29245
29253
  function parseExpectedTokenJSDoc(t) {
29246
- return parseOptionalTokenJSDoc(t) || createMissingNode(
29254
+ const optional = parseOptionalTokenJSDoc(t);
29255
+ if (optional)
29256
+ return optional;
29257
+ Debug.assert(isKeywordOrPunctuation(t));
29258
+ return createMissingNode(
29247
29259
  t,
29248
29260
  /*reportAtCurrentPosition*/
29249
29261
  false,
@@ -29297,11 +29309,11 @@ ${lanes.join("\n")}
29297
29309
  }
29298
29310
  return node;
29299
29311
  }
29300
- function createMissingNode(kind, reportAtCurrentPosition, diagnosticMessage, arg0) {
29312
+ function createMissingNode(kind, reportAtCurrentPosition, diagnosticMessage, ...args) {
29301
29313
  if (reportAtCurrentPosition) {
29302
- parseErrorAtPosition(scanner2.getTokenFullStart(), 0, diagnosticMessage, arg0);
29314
+ parseErrorAtPosition(scanner2.getTokenFullStart(), 0, diagnosticMessage, ...args);
29303
29315
  } else if (diagnosticMessage) {
29304
- parseErrorAtCurrentToken(diagnosticMessage, arg0);
29316
+ parseErrorAtCurrentToken(diagnosticMessage, ...args);
29305
29317
  }
29306
29318
  const pos = getNodePos();
29307
29319
  const result = kind === 79 /* Identifier */ ? factoryCreateIdentifier(
@@ -31660,6 +31672,7 @@ ${lanes.join("\n")}
31660
31672
  if (simpleUnaryExpression.kind === 214 /* TypeAssertionExpression */) {
31661
31673
  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);
31662
31674
  } else {
31675
+ Debug.assert(isKeywordOrPunctuation(unaryOperator));
31663
31676
  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));
31664
31677
  }
31665
31678
  }
@@ -34607,14 +34620,14 @@ ${lanes.join("\n")}
34607
34620
  }
34608
34621
  function parseReturnTag(start2, tagName, indent2, indentText) {
34609
34622
  if (some(tags, isJSDocReturnTag)) {
34610
- parseErrorAt(tagName.pos, scanner2.getTokenStart(), Diagnostics._0_tag_already_specified, tagName.escapedText);
34623
+ parseErrorAt(tagName.pos, scanner2.getTokenStart(), Diagnostics._0_tag_already_specified, unescapeLeadingUnderscores(tagName.escapedText));
34611
34624
  }
34612
34625
  const typeExpression = tryParseTypeExpression();
34613
34626
  return finishNode(factory2.createJSDocReturnTag(tagName, typeExpression, parseTrailingTagComments(start2, getNodePos(), indent2, indentText)), start2);
34614
34627
  }
34615
34628
  function parseTypeTag(start2, tagName, indent2, indentText) {
34616
34629
  if (some(tags, isJSDocTypeTag)) {
34617
- parseErrorAt(tagName.pos, scanner2.getTokenStart(), Diagnostics._0_tag_already_specified, tagName.escapedText);
34630
+ parseErrorAt(tagName.pos, scanner2.getTokenStart(), Diagnostics._0_tag_already_specified, unescapeLeadingUnderscores(tagName.escapedText));
34618
34631
  }
34619
34632
  const typeExpression = parseJSDocTypeExpression(
34620
34633
  /*mayOmitBraces*/
@@ -35427,13 +35440,13 @@ ${lanes.join("\n")}
35427
35440
  function getOptionName(option) {
35428
35441
  return option.name;
35429
35442
  }
35430
- function createUnknownOptionError(unknownOption, diagnostics, createDiagnostics, unknownOptionErrorText) {
35443
+ function createUnknownOptionError(unknownOption, diagnostics, unknownOptionErrorText, node, sourceFile) {
35431
35444
  var _a2;
35432
35445
  if ((_a2 = diagnostics.alternateMode) == null ? void 0 : _a2.getOptionsNameMap().optionsNameMap.has(unknownOption.toLowerCase())) {
35433
- return createDiagnostics(diagnostics.alternateMode.diagnostic, unknownOption);
35446
+ return createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.alternateMode.diagnostic, unknownOption);
35434
35447
  }
35435
35448
  const possibleOption = getSpellingSuggestion(unknownOption, diagnostics.optionDeclarations, getOptionName);
35436
- return possibleOption ? createDiagnostics(diagnostics.unknownDidYouMeanDiagnostic, unknownOptionErrorText || unknownOption, possibleOption.name) : createDiagnostics(diagnostics.unknownOptionDiagnostic, unknownOptionErrorText || unknownOption);
35449
+ return possibleOption ? createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.unknownDidYouMeanDiagnostic, unknownOptionErrorText || unknownOption, possibleOption.name) : createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.unknownOptionDiagnostic, unknownOptionErrorText || unknownOption);
35437
35450
  }
35438
35451
  function parseCommandLineWorker(diagnostics, commandLine, readFile) {
35439
35452
  const options = {};
@@ -35474,7 +35487,7 @@ ${lanes.join("\n")}
35474
35487
  if (watchOpt) {
35475
35488
  i = parseOptionValue(args, i, watchOptionsDidYouMeanDiagnostics, watchOpt, watchOptions || (watchOptions = {}), errors);
35476
35489
  } else {
35477
- errors.push(createUnknownOptionError(inputOptionName, diagnostics, createCompilerDiagnostic, s));
35490
+ errors.push(createUnknownOptionError(inputOptionName, diagnostics, s));
35478
35491
  }
35479
35492
  }
35480
35493
  } else {
@@ -35664,9 +35677,7 @@ ${lanes.join("\n")}
35664
35677
  config: convertConfigFileToObject(
35665
35678
  jsonSourceFile,
35666
35679
  jsonSourceFile.parseDiagnostics,
35667
- /*reportOptionsErrors*/
35668
- false,
35669
- /*optionsIterator*/
35680
+ /*jsonConversionNotifier*/
35670
35681
  void 0
35671
35682
  ),
35672
35683
  error: jsonSourceFile.parseDiagnostics.length ? jsonSourceFile.parseDiagnostics[0] : void 0
@@ -35707,24 +35718,9 @@ ${lanes.join("\n")}
35707
35718
  // should never be needed since this is root
35708
35719
  type: "object",
35709
35720
  elementOptions: commandLineOptionsToMap([
35710
- {
35711
- name: "compilerOptions",
35712
- type: "object",
35713
- elementOptions: getCommandLineCompilerOptionsMap(),
35714
- extraKeyDiagnostics: compilerOptionsDidYouMeanDiagnostics
35715
- },
35716
- {
35717
- name: "watchOptions",
35718
- type: "object",
35719
- elementOptions: getCommandLineWatchOptionsMap(),
35720
- extraKeyDiagnostics: watchOptionsDidYouMeanDiagnostics
35721
- },
35722
- {
35723
- name: "typeAcquisition",
35724
- type: "object",
35725
- elementOptions: getCommandLineTypeAcquisitionMap(),
35726
- extraKeyDiagnostics: typeAcquisitionDidYouMeanDiagnostics
35727
- },
35721
+ compilerOptionsDeclaration,
35722
+ watchOptionsDeclaration,
35723
+ typeAcquisitionDeclaration,
35728
35724
  extendsOptionDeclaration,
35729
35725
  {
35730
35726
  name: "references",
@@ -35770,10 +35766,9 @@ ${lanes.join("\n")}
35770
35766
  }
35771
35767
  return _tsconfigRootOptions;
35772
35768
  }
35773
- function convertConfigFileToObject(sourceFile, errors, reportOptionsErrors, optionsIterator) {
35769
+ function convertConfigFileToObject(sourceFile, errors, jsonConversionNotifier) {
35774
35770
  var _a2;
35775
35771
  const rootExpression = (_a2 = sourceFile.statements[0]) == null ? void 0 : _a2.expression;
35776
- const knownRootOptions = reportOptionsErrors ? getTsconfigRootOptionsMap() : void 0;
35777
35772
  if (rootExpression && rootExpression.kind !== 208 /* ObjectLiteralExpression */) {
35778
35773
  errors.push(createDiagnosticForNodeInSourceFile(
35779
35774
  sourceFile,
@@ -35784,52 +35779,46 @@ ${lanes.join("\n")}
35784
35779
  if (isArrayLiteralExpression(rootExpression)) {
35785
35780
  const firstObject = find(rootExpression.elements, isObjectLiteralExpression);
35786
35781
  if (firstObject) {
35787
- return convertToObjectWorker(
35782
+ return convertToJson(
35788
35783
  sourceFile,
35789
35784
  firstObject,
35790
35785
  errors,
35791
35786
  /*returnValue*/
35792
35787
  true,
35793
- knownRootOptions,
35794
- optionsIterator
35788
+ jsonConversionNotifier
35795
35789
  );
35796
35790
  }
35797
35791
  }
35798
35792
  return {};
35799
35793
  }
35800
- return convertToObjectWorker(
35794
+ return convertToJson(
35801
35795
  sourceFile,
35802
35796
  rootExpression,
35803
35797
  errors,
35804
35798
  /*returnValue*/
35805
35799
  true,
35806
- knownRootOptions,
35807
- optionsIterator
35800
+ jsonConversionNotifier
35808
35801
  );
35809
35802
  }
35810
35803
  function convertToObject(sourceFile, errors) {
35811
35804
  var _a2;
35812
- return convertToObjectWorker(
35805
+ return convertToJson(
35813
35806
  sourceFile,
35814
35807
  (_a2 = sourceFile.statements[0]) == null ? void 0 : _a2.expression,
35815
35808
  errors,
35816
35809
  /*returnValue*/
35817
35810
  true,
35818
- /*knownRootOptions*/
35819
- void 0,
35820
35811
  /*jsonConversionNotifier*/
35821
35812
  void 0
35822
35813
  );
35823
35814
  }
35824
- function convertToObjectWorker(sourceFile, rootExpression, errors, returnValue, knownRootOptions, jsonConversionNotifier) {
35815
+ function convertToJson(sourceFile, rootExpression, errors, returnValue, jsonConversionNotifier) {
35825
35816
  if (!rootExpression) {
35826
35817
  return returnValue ? {} : void 0;
35827
35818
  }
35828
- return convertPropertyValueToJson(rootExpression, knownRootOptions);
35829
- function isRootOptionMap(knownOptions) {
35830
- return knownRootOptions && knownRootOptions.elementOptions === knownOptions;
35831
- }
35832
- function convertObjectLiteralExpressionToJson(node, knownOptions, extraKeyDiagnostics, parentOption) {
35819
+ return convertPropertyValueToJson(rootExpression, jsonConversionNotifier == null ? void 0 : jsonConversionNotifier.rootOptions);
35820
+ function convertObjectLiteralExpressionToJson(node, objectOption) {
35821
+ var _a2;
35833
35822
  const result = returnValue ? {} : void 0;
35834
35823
  for (const element of node.properties) {
35835
35824
  if (element.kind !== 300 /* PropertyAssignment */) {
@@ -35844,38 +35833,13 @@ ${lanes.join("\n")}
35844
35833
  }
35845
35834
  const textOfKey = isComputedNonLiteralName(element.name) ? void 0 : getTextOfPropertyName(element.name);
35846
35835
  const keyText = textOfKey && unescapeLeadingUnderscores(textOfKey);
35847
- const option = keyText && knownOptions ? knownOptions.get(keyText) : void 0;
35848
- if (keyText && extraKeyDiagnostics && !option) {
35849
- if (knownOptions) {
35850
- errors.push(createUnknownOptionError(
35851
- keyText,
35852
- extraKeyDiagnostics,
35853
- (message, arg0, arg1) => createDiagnosticForNodeInSourceFile(sourceFile, element.name, message, arg0, arg1)
35854
- ));
35855
- } else {
35856
- errors.push(createDiagnosticForNodeInSourceFile(sourceFile, element.name, extraKeyDiagnostics.unknownOptionDiagnostic, keyText));
35857
- }
35858
- }
35836
+ const option = keyText ? (_a2 = objectOption == null ? void 0 : objectOption.elementOptions) == null ? void 0 : _a2.get(keyText) : void 0;
35859
35837
  const value = convertPropertyValueToJson(element.initializer, option);
35860
35838
  if (typeof keyText !== "undefined") {
35861
35839
  if (returnValue) {
35862
35840
  result[keyText] = value;
35863
35841
  }
35864
- if (jsonConversionNotifier && // Current callbacks are only on known parent option or if we are setting values in the root
35865
- (parentOption || isRootOptionMap(knownOptions))) {
35866
- const isValidOptionValue = isCompilerOptionsValue(option, value);
35867
- if (parentOption) {
35868
- if (isValidOptionValue) {
35869
- jsonConversionNotifier.onSetValidOptionKeyValueInParent(parentOption, option, value);
35870
- }
35871
- } else if (isRootOptionMap(knownOptions)) {
35872
- if (isValidOptionValue) {
35873
- jsonConversionNotifier.onSetValidOptionKeyValueInRoot(keyText, element.name, value, element.initializer);
35874
- } else if (!option) {
35875
- jsonConversionNotifier.onSetUnknownOptionKeyValueInRoot(keyText, element.name, value, element.initializer);
35876
- }
35877
- }
35878
- }
35842
+ jsonConversionNotifier == null ? void 0 : jsonConversionNotifier.onPropertySet(keyText, value, element, objectOption, option);
35879
35843
  }
35880
35844
  }
35881
35845
  return result;
@@ -35888,112 +35852,40 @@ ${lanes.join("\n")}
35888
35852
  return filter(elements.map((element) => convertPropertyValueToJson(element, elementOption)), (v) => v !== void 0);
35889
35853
  }
35890
35854
  function convertPropertyValueToJson(valueExpression, option) {
35891
- let invalidReported;
35892
35855
  switch (valueExpression.kind) {
35893
35856
  case 111 /* TrueKeyword */:
35894
- reportInvalidOptionValue(option && option.type !== "boolean" && (option.type !== "listOrElement" || option.element.type !== "boolean"));
35895
- return validateValue(
35896
- /*value*/
35897
- true
35898
- );
35857
+ return true;
35899
35858
  case 96 /* FalseKeyword */:
35900
- reportInvalidOptionValue(option && option.type !== "boolean" && (option.type !== "listOrElement" || option.element.type !== "boolean"));
35901
- return validateValue(
35902
- /*value*/
35903
- false
35904
- );
35859
+ return false;
35905
35860
  case 105 /* NullKeyword */:
35906
- reportInvalidOptionValue(option && option.name === "extends");
35907
- return validateValue(
35908
- /*value*/
35909
- null
35910
- );
35861
+ return null;
35911
35862
  case 10 /* StringLiteral */:
35912
35863
  if (!isDoubleQuotedString(valueExpression)) {
35913
35864
  errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, Diagnostics.String_literal_with_double_quotes_expected));
35914
35865
  }
35915
- reportInvalidOptionValue(option && isString(option.type) && option.type !== "string" && (option.type !== "listOrElement" || isString(option.element.type) && option.element.type !== "string"));
35916
- const text = valueExpression.text;
35917
- if (option) {
35918
- Debug.assert(option.type !== "listOrElement" || option.element.type === "string", "Only string or array of string is handled for now");
35919
- }
35920
- if (option && !isString(option.type)) {
35921
- const customOption = option;
35922
- if (!customOption.type.has(text.toLowerCase())) {
35923
- errors.push(
35924
- createDiagnosticForInvalidCustomType(
35925
- customOption,
35926
- (message, arg0, arg1) => createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, message, arg0, arg1)
35927
- )
35928
- );
35929
- invalidReported = true;
35930
- }
35931
- }
35932
- return validateValue(text);
35866
+ return valueExpression.text;
35933
35867
  case 8 /* NumericLiteral */:
35934
- reportInvalidOptionValue(option && option.type !== "number" && (option.type !== "listOrElement" || option.element.type !== "number"));
35935
- return validateValue(Number(valueExpression.text));
35868
+ return Number(valueExpression.text);
35936
35869
  case 222 /* PrefixUnaryExpression */:
35937
35870
  if (valueExpression.operator !== 40 /* MinusToken */ || valueExpression.operand.kind !== 8 /* NumericLiteral */) {
35938
35871
  break;
35939
35872
  }
35940
- reportInvalidOptionValue(option && option.type !== "number" && (option.type !== "listOrElement" || option.element.type !== "number"));
35941
- return validateValue(-Number(valueExpression.operand.text));
35873
+ return -Number(valueExpression.operand.text);
35942
35874
  case 208 /* ObjectLiteralExpression */:
35943
- reportInvalidOptionValue(option && option.type !== "object" && (option.type !== "listOrElement" || option.element.type !== "object"));
35944
35875
  const objectLiteralExpression = valueExpression;
35945
- if (option) {
35946
- const { elementOptions, extraKeyDiagnostics, name: optionName } = option;
35947
- return validateValue(convertObjectLiteralExpressionToJson(
35948
- objectLiteralExpression,
35949
- elementOptions,
35950
- extraKeyDiagnostics,
35951
- optionName
35952
- ));
35953
- } else {
35954
- return validateValue(convertObjectLiteralExpressionToJson(
35955
- objectLiteralExpression,
35956
- /* knownOptions*/
35957
- void 0,
35958
- /*extraKeyDiagnosticMessage */
35959
- void 0,
35960
- /*parentOption*/
35961
- void 0
35962
- ));
35963
- }
35876
+ return convertObjectLiteralExpressionToJson(objectLiteralExpression, option);
35964
35877
  case 207 /* ArrayLiteralExpression */:
35965
- reportInvalidOptionValue(option && option.type !== "list" && option.type !== "listOrElement");
35966
- return validateValue(convertArrayLiteralExpressionToJson(
35878
+ return convertArrayLiteralExpressionToJson(
35967
35879
  valueExpression.elements,
35968
35880
  option && option.element
35969
- ));
35881
+ );
35970
35882
  }
35971
35883
  if (option) {
35972
- reportInvalidOptionValue(
35973
- /*isError*/
35974
- true
35975
- );
35884
+ errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, Diagnostics.Compiler_option_0_requires_a_value_of_type_1, option.name, getCompilerOptionValueTypeString(option)));
35976
35885
  } else {
35977
35886
  errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, Diagnostics.Property_value_can_only_be_string_literal_numeric_literal_true_false_null_object_literal_or_array_literal));
35978
35887
  }
35979
35888
  return void 0;
35980
- function validateValue(value) {
35981
- var _a2;
35982
- if (!invalidReported) {
35983
- const diagnostic = (_a2 = option == null ? void 0 : option.extraValidation) == null ? void 0 : _a2.call(option, value);
35984
- if (diagnostic) {
35985
- errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, ...diagnostic));
35986
- return void 0;
35987
- }
35988
- }
35989
- return value;
35990
- }
35991
- function reportInvalidOptionValue(isError) {
35992
- if (isError) {
35993
- errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, Diagnostics.Compiler_option_0_requires_a_value_of_type_1, option.name, getCompilerOptionValueTypeString(option)));
35994
- invalidReported = true;
35995
- }
35996
- }
35997
35889
  }
35998
35890
  function isDoubleQuotedString(node) {
35999
35891
  return isStringLiteral(node) && isStringDoubleQuoted(node, sourceFile);
@@ -36005,7 +35897,7 @@ ${lanes.join("\n")}
36005
35897
  function isCompilerOptionsValue(option, value) {
36006
35898
  if (option) {
36007
35899
  if (isNullOrUndefined(value))
36008
- return true;
35900
+ return !option.disallowNullOrUndefined;
36009
35901
  if (option.type === "list") {
36010
35902
  return isArray(value);
36011
35903
  }
@@ -36364,8 +36256,8 @@ ${lanes.join("\n")}
36364
36256
  if (sourceFile) {
36365
36257
  const fileName = configFileName || "tsconfig.json";
36366
36258
  const diagnosticMessage = Diagnostics.The_files_list_in_config_file_0_is_empty;
36367
- const nodeValue = firstDefined(getTsConfigPropArray(sourceFile, "files"), (property) => property.initializer);
36368
- const error = nodeValue ? createDiagnosticForNodeInSourceFile(sourceFile, nodeValue, diagnosticMessage, fileName) : createCompilerDiagnostic(diagnosticMessage, fileName);
36259
+ const nodeValue = forEachTsConfigPropArray(sourceFile, "files", (property) => property.initializer);
36260
+ const error = createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, nodeValue, diagnosticMessage, fileName);
36369
36261
  errors.push(error);
36370
36262
  } else {
36371
36263
  createCompilerDiagnosticOnlyIfJson(Diagnostics.The_files_list_in_config_file_0_is_empty, configFileName || "tsconfig.json");
@@ -36467,9 +36359,9 @@ ${lanes.join("\n")}
36467
36359
  }
36468
36360
  return "no-prop";
36469
36361
  }
36470
- function createCompilerDiagnosticOnlyIfJson(message, arg0, arg1) {
36362
+ function createCompilerDiagnosticOnlyIfJson(message, ...args) {
36471
36363
  if (!sourceFile) {
36472
- errors.push(createCompilerDiagnostic(message, arg0, arg1));
36364
+ errors.push(createCompilerDiagnostic(message, ...args));
36473
36365
  }
36474
36366
  }
36475
36367
  }
@@ -36568,27 +36460,42 @@ ${lanes.join("\n")}
36568
36460
  const typeAcquisition = convertTypeAcquisitionFromJsonWorker(json.typeAcquisition, basePath, errors, configFileName);
36569
36461
  const watchOptions = convertWatchOptionsFromJsonWorker(json.watchOptions, basePath, errors);
36570
36462
  json.compileOnSave = convertCompileOnSaveOptionFromJson(json, basePath, errors);
36463
+ const extendedConfigPath = json.extends || json.extends === "" ? getExtendsConfigPathOrArray(json.extends, host, basePath, configFileName, errors) : void 0;
36464
+ return { raw: json, options, watchOptions, typeAcquisition, extendedConfigPath };
36465
+ }
36466
+ function getExtendsConfigPathOrArray(value, host, basePath, configFileName, errors, propertyAssignment, valueExpression, sourceFile) {
36571
36467
  let extendedConfigPath;
36572
- if (json.extends || json.extends === "") {
36573
- if (!isCompilerOptionsValue(extendsOptionDeclaration, json.extends)) {
36574
- errors.push(createCompilerDiagnostic(Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "extends", getCompilerOptionValueTypeString(extendsOptionDeclaration)));
36575
- } else {
36576
- const newBase = configFileName ? directoryOfCombinedPath(configFileName, basePath) : basePath;
36577
- if (isString(json.extends)) {
36578
- extendedConfigPath = getExtendsConfigPath(json.extends, host, newBase, errors, createCompilerDiagnostic);
36468
+ const newBase = configFileName ? directoryOfCombinedPath(configFileName, basePath) : basePath;
36469
+ if (isString(value)) {
36470
+ extendedConfigPath = getExtendsConfigPath(
36471
+ value,
36472
+ host,
36473
+ newBase,
36474
+ errors,
36475
+ valueExpression,
36476
+ sourceFile
36477
+ );
36478
+ } else if (isArray(value)) {
36479
+ extendedConfigPath = [];
36480
+ for (let index = 0; index < value.length; index++) {
36481
+ const fileName = value[index];
36482
+ if (isString(fileName)) {
36483
+ extendedConfigPath = append(extendedConfigPath, getExtendsConfigPath(
36484
+ fileName,
36485
+ host,
36486
+ newBase,
36487
+ errors,
36488
+ valueExpression == null ? void 0 : valueExpression.elements[index],
36489
+ sourceFile
36490
+ ));
36579
36491
  } else {
36580
- extendedConfigPath = [];
36581
- for (const fileName of json.extends) {
36582
- if (isString(fileName)) {
36583
- extendedConfigPath = append(extendedConfigPath, getExtendsConfigPath(fileName, host, newBase, errors, createCompilerDiagnostic));
36584
- } else {
36585
- errors.push(createCompilerDiagnostic(Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "extends", getCompilerOptionValueTypeString(extendsOptionDeclaration.element)));
36586
- }
36587
- }
36492
+ convertJsonOption(extendsOptionDeclaration.element, value, basePath, errors, propertyAssignment, valueExpression == null ? void 0 : valueExpression.elements[index], sourceFile);
36588
36493
  }
36589
36494
  }
36495
+ } else {
36496
+ convertJsonOption(extendsOptionDeclaration, value, basePath, errors, propertyAssignment, valueExpression, sourceFile);
36590
36497
  }
36591
- return { raw: json, options, watchOptions, typeAcquisition, extendedConfigPath };
36498
+ return extendedConfigPath;
36592
36499
  }
36593
36500
  function parseOwnConfigOfJsonSourceFile(sourceFile, host, basePath, configFileName, errors) {
36594
36501
  const options = getDefaultCompilerOptions(configFileName);
@@ -36596,69 +36503,11 @@ ${lanes.join("\n")}
36596
36503
  let watchOptions;
36597
36504
  let extendedConfigPath;
36598
36505
  let rootCompilerOptions;
36599
- const optionsIterator = {
36600
- onSetValidOptionKeyValueInParent(parentOption, option, value) {
36601
- let currentOption;
36602
- switch (parentOption) {
36603
- case "compilerOptions":
36604
- currentOption = options;
36605
- break;
36606
- case "watchOptions":
36607
- currentOption = watchOptions || (watchOptions = {});
36608
- break;
36609
- case "typeAcquisition":
36610
- currentOption = typeAcquisition || (typeAcquisition = getDefaultTypeAcquisition(configFileName));
36611
- break;
36612
- default:
36613
- Debug.fail("Unknown option");
36614
- }
36615
- currentOption[option.name] = normalizeOptionValue(option, basePath, value);
36616
- },
36617
- onSetValidOptionKeyValueInRoot(key, _keyNode, value, valueNode) {
36618
- switch (key) {
36619
- case "extends":
36620
- const newBase = configFileName ? directoryOfCombinedPath(configFileName, basePath) : basePath;
36621
- if (isString(value)) {
36622
- extendedConfigPath = getExtendsConfigPath(
36623
- value,
36624
- host,
36625
- newBase,
36626
- errors,
36627
- (message, arg0) => createDiagnosticForNodeInSourceFile(sourceFile, valueNode, message, arg0)
36628
- );
36629
- } else {
36630
- extendedConfigPath = [];
36631
- for (let index = 0; index < value.length; index++) {
36632
- const fileName = value[index];
36633
- if (isString(fileName)) {
36634
- extendedConfigPath = append(extendedConfigPath, getExtendsConfigPath(
36635
- fileName,
36636
- host,
36637
- newBase,
36638
- errors,
36639
- (message, arg0) => createDiagnosticForNodeInSourceFile(sourceFile, valueNode.elements[index], message, arg0)
36640
- ));
36641
- }
36642
- }
36643
- }
36644
- return;
36645
- }
36646
- },
36647
- onSetUnknownOptionKeyValueInRoot(key, keyNode, _value, _valueNode) {
36648
- if (key === "excludes") {
36649
- errors.push(createDiagnosticForNodeInSourceFile(sourceFile, keyNode, Diagnostics.Unknown_option_excludes_Did_you_mean_exclude));
36650
- }
36651
- if (find(commandOptionsWithoutBuild, (opt) => opt.name === key)) {
36652
- rootCompilerOptions = append(rootCompilerOptions, keyNode);
36653
- }
36654
- }
36655
- };
36506
+ const rootOptions = getTsconfigRootOptionsMap();
36656
36507
  const json = convertConfigFileToObject(
36657
36508
  sourceFile,
36658
36509
  errors,
36659
- /*reportOptionsErrors*/
36660
- true,
36661
- optionsIterator
36510
+ { rootOptions, onPropertySet }
36662
36511
  );
36663
36512
  if (!typeAcquisition) {
36664
36513
  typeAcquisition = getDefaultTypeAcquisition(configFileName);
@@ -36667,15 +36516,57 @@ ${lanes.join("\n")}
36667
36516
  errors.push(createDiagnosticForNodeInSourceFile(sourceFile, rootCompilerOptions[0], Diagnostics._0_should_be_set_inside_the_compilerOptions_object_of_the_config_json_file, getTextOfPropertyName(rootCompilerOptions[0])));
36668
36517
  }
36669
36518
  return { raw: json, options, watchOptions, typeAcquisition, extendedConfigPath };
36519
+ function onPropertySet(keyText, value, propertyAssignment, parentOption, option) {
36520
+ if (option && option !== extendsOptionDeclaration)
36521
+ value = convertJsonOption(option, value, basePath, errors, propertyAssignment, propertyAssignment.initializer, sourceFile);
36522
+ if (parentOption == null ? void 0 : parentOption.name) {
36523
+ if (option) {
36524
+ let currentOption;
36525
+ if (parentOption === compilerOptionsDeclaration)
36526
+ currentOption = options;
36527
+ else if (parentOption === watchOptionsDeclaration)
36528
+ currentOption = watchOptions != null ? watchOptions : watchOptions = {};
36529
+ else if (parentOption === typeAcquisitionDeclaration)
36530
+ currentOption = typeAcquisition != null ? typeAcquisition : typeAcquisition = getDefaultTypeAcquisition(configFileName);
36531
+ else
36532
+ Debug.fail("Unknown option");
36533
+ currentOption[option.name] = value;
36534
+ } else if (keyText && (parentOption == null ? void 0 : parentOption.extraKeyDiagnostics)) {
36535
+ if (parentOption.elementOptions) {
36536
+ errors.push(createUnknownOptionError(
36537
+ keyText,
36538
+ parentOption.extraKeyDiagnostics,
36539
+ /*unknownOptionErrorText*/
36540
+ void 0,
36541
+ propertyAssignment.name,
36542
+ sourceFile
36543
+ ));
36544
+ } else {
36545
+ errors.push(createDiagnosticForNodeInSourceFile(sourceFile, propertyAssignment.name, parentOption.extraKeyDiagnostics.unknownOptionDiagnostic, keyText));
36546
+ }
36547
+ }
36548
+ } else if (parentOption === rootOptions) {
36549
+ if (option === extendsOptionDeclaration) {
36550
+ extendedConfigPath = getExtendsConfigPathOrArray(value, host, basePath, configFileName, errors, propertyAssignment, propertyAssignment.initializer, sourceFile);
36551
+ } else if (!option) {
36552
+ if (keyText === "excludes") {
36553
+ errors.push(createDiagnosticForNodeInSourceFile(sourceFile, propertyAssignment.name, Diagnostics.Unknown_option_excludes_Did_you_mean_exclude));
36554
+ }
36555
+ if (find(commandOptionsWithoutBuild, (opt) => opt.name === keyText)) {
36556
+ rootCompilerOptions = append(rootCompilerOptions, propertyAssignment.name);
36557
+ }
36558
+ }
36559
+ }
36560
+ }
36670
36561
  }
36671
- function getExtendsConfigPath(extendedConfig, host, basePath, errors, createDiagnostic) {
36562
+ function getExtendsConfigPath(extendedConfig, host, basePath, errors, valueExpression, sourceFile) {
36672
36563
  extendedConfig = normalizeSlashes(extendedConfig);
36673
36564
  if (isRootedDiskPath(extendedConfig) || startsWith(extendedConfig, "./") || startsWith(extendedConfig, "../")) {
36674
36565
  let extendedConfigPath = getNormalizedAbsolutePath(extendedConfig, basePath);
36675
36566
  if (!host.fileExists(extendedConfigPath) && !endsWith(extendedConfigPath, ".json" /* Json */)) {
36676
36567
  extendedConfigPath = `${extendedConfigPath}.json`;
36677
36568
  if (!host.fileExists(extendedConfigPath)) {
36678
- errors.push(createDiagnostic(Diagnostics.File_0_not_found, extendedConfig));
36569
+ errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, valueExpression, Diagnostics.File_0_not_found, extendedConfig));
36679
36570
  return void 0;
36680
36571
  }
36681
36572
  }
@@ -36686,9 +36577,9 @@ ${lanes.join("\n")}
36686
36577
  return resolved.resolvedModule.resolvedFileName;
36687
36578
  }
36688
36579
  if (extendedConfig === "") {
36689
- errors.push(createDiagnostic(Diagnostics.Compiler_option_0_cannot_be_given_an_empty_string, "extends"));
36580
+ errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, valueExpression, Diagnostics.Compiler_option_0_cannot_be_given_an_empty_string, "extends"));
36690
36581
  } else {
36691
- errors.push(createDiagnostic(Diagnostics.File_0_not_found, extendedConfig));
36582
+ errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, valueExpression, Diagnostics.File_0_not_found, extendedConfig));
36692
36583
  }
36693
36584
  return void 0;
36694
36585
  }
@@ -36790,43 +36681,34 @@ ${lanes.join("\n")}
36790
36681
  if (opt) {
36791
36682
  (defaultOptions || (defaultOptions = {}))[opt.name] = convertJsonOption(opt, jsonOptions[id], basePath, errors);
36792
36683
  } else {
36793
- errors.push(createUnknownOptionError(id, diagnostics, createCompilerDiagnostic));
36684
+ errors.push(createUnknownOptionError(id, diagnostics));
36794
36685
  }
36795
36686
  }
36796
36687
  return defaultOptions;
36797
36688
  }
36798
- function convertJsonOption(opt, value, basePath, errors) {
36689
+ function createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, message, ...args) {
36690
+ return sourceFile && node ? createDiagnosticForNodeInSourceFile(sourceFile, node, message, ...args) : createCompilerDiagnostic(message, ...args);
36691
+ }
36692
+ function convertJsonOption(opt, value, basePath, errors, propertyAssignment, valueExpression, sourceFile) {
36693
+ if (opt.isCommandLineOnly) {
36694
+ errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, propertyAssignment == null ? void 0 : propertyAssignment.name, Diagnostics.Option_0_can_only_be_specified_on_command_line, opt.name));
36695
+ return void 0;
36696
+ }
36799
36697
  if (isCompilerOptionsValue(opt, value)) {
36800
36698
  const optType = opt.type;
36801
36699
  if (optType === "list" && isArray(value)) {
36802
- return convertJsonOptionOfListType(opt, value, basePath, errors);
36700
+ return convertJsonOptionOfListType(opt, value, basePath, errors, propertyAssignment, valueExpression, sourceFile);
36803
36701
  } else if (optType === "listOrElement") {
36804
- return isArray(value) ? convertJsonOptionOfListType(opt, value, basePath, errors) : convertJsonOption(opt.element, value, basePath, errors);
36702
+ return isArray(value) ? convertJsonOptionOfListType(opt, value, basePath, errors, propertyAssignment, valueExpression, sourceFile) : convertJsonOption(opt.element, value, basePath, errors, propertyAssignment, valueExpression, sourceFile);
36805
36703
  } else if (!isString(opt.type)) {
36806
- return convertJsonOptionOfCustomType(opt, value, errors);
36704
+ return convertJsonOptionOfCustomType(opt, value, errors, valueExpression, sourceFile);
36807
36705
  }
36808
- const validatedValue = validateJsonOptionValue(opt, value, errors);
36706
+ const validatedValue = validateJsonOptionValue(opt, value, errors, valueExpression, sourceFile);
36809
36707
  return isNullOrUndefined(validatedValue) ? validatedValue : normalizeNonListOptionValue(opt, basePath, validatedValue);
36810
36708
  } else {
36811
- errors.push(createCompilerDiagnostic(Diagnostics.Compiler_option_0_requires_a_value_of_type_1, opt.name, getCompilerOptionValueTypeString(opt)));
36709
+ errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, valueExpression, Diagnostics.Compiler_option_0_requires_a_value_of_type_1, opt.name, getCompilerOptionValueTypeString(opt)));
36812
36710
  }
36813
36711
  }
36814
- function normalizeOptionValue(option, basePath, value) {
36815
- if (isNullOrUndefined(value))
36816
- return void 0;
36817
- if (option.type === "listOrElement" && !isArray(value))
36818
- return normalizeOptionValue(option.element, basePath, value);
36819
- else if (option.type === "list" || option.type === "listOrElement") {
36820
- const listOption = option;
36821
- if (listOption.element.isFilePath || !isString(listOption.element.type)) {
36822
- return filter(map(value, (v) => normalizeOptionValue(listOption.element, basePath, v)), (v) => listOption.listPreserveFalsyValues ? true : !!v);
36823
- }
36824
- return value;
36825
- } else if (!isString(option.type)) {
36826
- return option.type.get(isString(value) ? value.toLowerCase() : value);
36827
- }
36828
- return normalizeNonListOptionValue(option, basePath, value);
36829
- }
36830
36712
  function normalizeNonListOptionValue(option, basePath, value) {
36831
36713
  if (option.isFilePath) {
36832
36714
  value = getNormalizedAbsolutePath(value, basePath);
@@ -36836,29 +36718,29 @@ ${lanes.join("\n")}
36836
36718
  }
36837
36719
  return value;
36838
36720
  }
36839
- function validateJsonOptionValue(opt, value, errors) {
36721
+ function validateJsonOptionValue(opt, value, errors, valueExpression, sourceFile) {
36840
36722
  var _a2;
36841
36723
  if (isNullOrUndefined(value))
36842
36724
  return void 0;
36843
36725
  const d = (_a2 = opt.extraValidation) == null ? void 0 : _a2.call(opt, value);
36844
36726
  if (!d)
36845
36727
  return value;
36846
- errors.push(createCompilerDiagnostic(...d));
36728
+ errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, valueExpression, ...d));
36847
36729
  return void 0;
36848
36730
  }
36849
- function convertJsonOptionOfCustomType(opt, value, errors) {
36731
+ function convertJsonOptionOfCustomType(opt, value, errors, valueExpression, sourceFile) {
36850
36732
  if (isNullOrUndefined(value))
36851
36733
  return void 0;
36852
36734
  const key = value.toLowerCase();
36853
36735
  const val = opt.type.get(key);
36854
36736
  if (val !== void 0) {
36855
- return validateJsonOptionValue(opt, val, errors);
36737
+ return validateJsonOptionValue(opt, val, errors, valueExpression, sourceFile);
36856
36738
  } else {
36857
- errors.push(createCompilerDiagnosticForInvalidCustomType(opt));
36739
+ errors.push(createDiagnosticForInvalidCustomType(opt, (message, ...args) => createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, valueExpression, message, ...args)));
36858
36740
  }
36859
36741
  }
36860
- function convertJsonOptionOfListType(option, values, basePath, errors) {
36861
- return filter(map(values, (v) => convertJsonOption(option.element, v, basePath, errors)), (v) => option.listPreserveFalsyValues ? true : !!v);
36742
+ function convertJsonOptionOfListType(option, values, basePath, errors, propertyAssignment, valueExpression, sourceFile) {
36743
+ 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);
36862
36744
  }
36863
36745
  function getFileNamesFromConfigSpecs(configFileSpecs, basePath, options, host, extraFileExtensions = emptyArray) {
36864
36746
  basePath = normalizePath(basePath);
@@ -36965,7 +36847,7 @@ ${lanes.join("\n")}
36965
36847
  });
36966
36848
  function createDiagnostic(message, spec) {
36967
36849
  const element = getTsConfigPropArrayElementValue(jsonSourceFile, specKey, spec);
36968
- return element ? createDiagnosticForNodeInSourceFile(jsonSourceFile, element, message, spec) : createCompilerDiagnostic(message, spec);
36850
+ return createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(jsonSourceFile, element, message, spec);
36969
36851
  }
36970
36852
  }
36971
36853
  function specToDiagnostic(spec, disallowTrailingRecursion) {
@@ -37076,6 +36958,8 @@ ${lanes.join("\n")}
37076
36958
  return out;
37077
36959
  }
37078
36960
  function getOptionValueWithEmptyStrings(value, option) {
36961
+ if (value === void 0)
36962
+ return value;
37079
36963
  switch (option.type) {
37080
36964
  case "object":
37081
36965
  return "";
@@ -37090,7 +36974,7 @@ ${lanes.join("\n")}
37090
36974
  return getOptionValueWithEmptyStrings(value, option.element);
37091
36975
  case "list":
37092
36976
  const elementType = option.element;
37093
- return isArray(value) ? value.map((v) => getOptionValueWithEmptyStrings(v, elementType)) : "";
36977
+ return isArray(value) ? mapDefined(value, (v) => getOptionValueWithEmptyStrings(v, elementType)) : "";
37094
36978
  default:
37095
36979
  return forEachEntry(option.type, (optionEnumValue, optionStringValue) => {
37096
36980
  if (optionEnumValue === value) {
@@ -37121,7 +37005,7 @@ ${lanes.join("\n")}
37121
37005
  return Debug.fail("Expected 'option.type' to have entries.");
37122
37006
  }
37123
37007
  }
37124
- var compileOnSaveCommandLineOption, jsxOptionMap, inverseJsxOptionMap, libEntries, libs, libMap, optionsForWatch, commonOptionsWithBuild, targetOptionDeclaration, moduleOptionDeclaration, commandOptionsWithoutBuild, optionDeclarations, semanticDiagnosticsOptionDeclarations, affectsEmitOptionDeclarations, affectsDeclarationPathOptionDeclarations, moduleResolutionOptionDeclarations, sourceFileAffectingCompilerOptions, optionsAffectingProgramStructure, transpileOptionValueCompilerOptions, optionsForBuild, buildOpts, typeAcquisitionDeclarations, optionsNameMapCache, compilerOptionsAlternateMode, defaultInitCompilerOptions, compilerOptionsDidYouMeanDiagnostics, buildOptionsNameMapCache, buildOptionsAlternateMode, buildOptionsDidYouMeanDiagnostics, typeAcquisitionDidYouMeanDiagnostics, watchOptionsNameMapCache, watchOptionsDidYouMeanDiagnostics, commandLineCompilerOptionsMapCache, commandLineWatchOptionsMapCache, commandLineTypeAcquisitionMapCache, extendsOptionDeclaration, _tsconfigRootOptions, defaultIncludeSpec, invalidTrailingRecursionPattern, wildcardDirectoryPattern;
37008
+ var compileOnSaveCommandLineOption, jsxOptionMap, inverseJsxOptionMap, libEntries, libs, libMap, optionsForWatch, commonOptionsWithBuild, targetOptionDeclaration, moduleOptionDeclaration, commandOptionsWithoutBuild, optionDeclarations, semanticDiagnosticsOptionDeclarations, affectsEmitOptionDeclarations, affectsDeclarationPathOptionDeclarations, moduleResolutionOptionDeclarations, sourceFileAffectingCompilerOptions, optionsAffectingProgramStructure, transpileOptionValueCompilerOptions, optionsForBuild, buildOpts, typeAcquisitionDeclarations, optionsNameMapCache, compilerOptionsAlternateMode, defaultInitCompilerOptions, compilerOptionsDidYouMeanDiagnostics, buildOptionsNameMapCache, buildOptionsAlternateMode, buildOptionsDidYouMeanDiagnostics, typeAcquisitionDidYouMeanDiagnostics, watchOptionsNameMapCache, watchOptionsDidYouMeanDiagnostics, commandLineCompilerOptionsMapCache, commandLineWatchOptionsMapCache, commandLineTypeAcquisitionMapCache, extendsOptionDeclaration, compilerOptionsDeclaration, watchOptionsDeclaration, typeAcquisitionDeclaration, _tsconfigRootOptions, defaultIncludeSpec, invalidTrailingRecursionPattern, wildcardDirectoryPattern;
37125
37009
  var init_commandLineParser = __esm({
37126
37010
  "src/compiler/commandLineParser.ts"() {
37127
37011
  "use strict";
@@ -38627,7 +38511,26 @@ ${lanes.join("\n")}
38627
38511
  name: "extends",
38628
38512
  type: "string"
38629
38513
  },
38630
- category: Diagnostics.File_Management
38514
+ category: Diagnostics.File_Management,
38515
+ disallowNullOrUndefined: true
38516
+ };
38517
+ compilerOptionsDeclaration = {
38518
+ name: "compilerOptions",
38519
+ type: "object",
38520
+ elementOptions: getCommandLineCompilerOptionsMap(),
38521
+ extraKeyDiagnostics: compilerOptionsDidYouMeanDiagnostics
38522
+ };
38523
+ watchOptionsDeclaration = {
38524
+ name: "watchOptions",
38525
+ type: "object",
38526
+ elementOptions: getCommandLineWatchOptionsMap(),
38527
+ extraKeyDiagnostics: watchOptionsDidYouMeanDiagnostics
38528
+ };
38529
+ typeAcquisitionDeclaration = {
38530
+ name: "typeAcquisition",
38531
+ type: "object",
38532
+ elementOptions: getCommandLineTypeAcquisitionMap(),
38533
+ extraKeyDiagnostics: typeAcquisitionDidYouMeanDiagnostics
38631
38534
  };
38632
38535
  defaultIncludeSpec = "**/*";
38633
38536
  invalidTrailingRecursionPattern = /(^|\/)\*\*\/?$/;
@@ -41355,8 +41258,8 @@ ${lanes.join("\n")}
41355
41258
  var reportedUnreachableFlow = { flags: 1 /* Unreachable */ };
41356
41259
  var bindBinaryExpressionFlow = createBindBinaryExpressionFlow();
41357
41260
  return bindSourceFile2;
41358
- function createDiagnosticForNode2(node, message, arg0, arg1, arg2) {
41359
- return createDiagnosticForNodeInSourceFile(getSourceFileOfNode(node) || file, node, message, arg0, arg1, arg2);
41261
+ function createDiagnosticForNode2(node, message, ...args) {
41262
+ return createDiagnosticForNodeInSourceFile(getSourceFileOfNode(node) || file, node, message, ...args);
41360
41263
  }
41361
41264
  function bindSourceFile2(f, opts) {
41362
41265
  var _a2, _b;
@@ -41550,7 +41453,7 @@ ${lanes.join("\n")}
41550
41453
  const declarationName = getNameOfDeclaration(node) || node;
41551
41454
  forEach(symbol.declarations, (declaration, index) => {
41552
41455
  const decl = getNameOfDeclaration(declaration) || declaration;
41553
- const diag3 = createDiagnosticForNode2(decl, message, messageNeedsName ? getDisplayName(declaration) : void 0);
41456
+ const diag3 = messageNeedsName ? createDiagnosticForNode2(decl, message, getDisplayName(declaration)) : createDiagnosticForNode2(decl, message);
41554
41457
  file.bindDiagnostics.push(
41555
41458
  multipleDefaultExports ? addRelatedInfo(diag3, createDiagnosticForNode2(declarationName, index === 0 ? Diagnostics.Another_export_default_is_here : Diagnostics.and_here)) : diag3
41556
41459
  );
@@ -41558,7 +41461,7 @@ ${lanes.join("\n")}
41558
41461
  relatedInformation.push(createDiagnosticForNode2(decl, Diagnostics.The_first_export_default_is_here));
41559
41462
  }
41560
41463
  });
41561
- const diag2 = createDiagnosticForNode2(declarationName, message, messageNeedsName ? getDisplayName(node) : void 0);
41464
+ const diag2 = messageNeedsName ? createDiagnosticForNode2(declarationName, message, getDisplayName(node)) : createDiagnosticForNode2(declarationName, message);
41562
41465
  file.bindDiagnostics.push(addRelatedInfo(diag2, ...relatedInformation));
41563
41466
  symbol = createSymbol(0 /* None */, name);
41564
41467
  }
@@ -43019,9 +42922,9 @@ ${lanes.join("\n")}
43019
42922
  }
43020
42923
  }
43021
42924
  }
43022
- function errorOnFirstToken(node, message, arg0, arg1, arg2) {
42925
+ function errorOnFirstToken(node, message, ...args) {
43023
42926
  const span = getSpanOfTokenAtPosition(file, node.pos);
43024
- file.bindDiagnostics.push(createFileDiagnostic(file, span.start, span.length, message, arg0, arg1, arg2));
42927
+ file.bindDiagnostics.push(createFileDiagnostic(file, span.start, span.length, message, ...args));
43025
42928
  }
43026
42929
  function errorOrSuggestionOnNode(isError, node, message) {
43027
42930
  errorOrSuggestionOnRange(isError, node, node, message);
@@ -45087,6 +44990,7 @@ ${lanes.join("\n")}
45087
44990
  var argumentsSymbol = createSymbol(4 /* Property */, "arguments");
45088
44991
  var requireSymbol = createSymbol(4 /* Property */, "require");
45089
44992
  var isolatedModulesLikeFlagName = compilerOptions.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules";
44993
+ var canCollectSymbolAliasAccessabilityData = !compilerOptions.verbatimModuleSyntax || !!compilerOptions.importsNotUsedAsValues;
45090
44994
  var apparentArgumentCount;
45091
44995
  const checker = {
45092
44996
  getNodeCount: () => reduceLeft(host.getSourceFiles(), (n, s) => n + s.nodeCount, 0),
@@ -45914,8 +45818,8 @@ ${lanes.join("\n")}
45914
45818
  getDiagnostics2(sourceFile, cancellationToken2);
45915
45819
  return emitResolver;
45916
45820
  }
45917
- function lookupOrIssueError(location, message, arg0, arg1, arg2, arg3) {
45918
- const diagnostic = location ? createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : createCompilerDiagnostic(message, arg0, arg1, arg2, arg3);
45821
+ function lookupOrIssueError(location, message, ...args) {
45822
+ const diagnostic = location ? createDiagnosticForNode(location, message, ...args) : createCompilerDiagnostic(message, ...args);
45919
45823
  const existing = diagnostics.lookup(diagnostic);
45920
45824
  if (existing) {
45921
45825
  return existing;
@@ -45924,16 +45828,16 @@ ${lanes.join("\n")}
45924
45828
  return diagnostic;
45925
45829
  }
45926
45830
  }
45927
- function errorSkippedOn(key, location, message, arg0, arg1, arg2, arg3) {
45928
- const diagnostic = error(location, message, arg0, arg1, arg2, arg3);
45831
+ function errorSkippedOn(key, location, message, ...args) {
45832
+ const diagnostic = error(location, message, ...args);
45929
45833
  diagnostic.skippedOn = key;
45930
45834
  return diagnostic;
45931
45835
  }
45932
- function createError(location, message, arg0, arg1, arg2, arg3) {
45933
- return location ? createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : createCompilerDiagnostic(message, arg0, arg1, arg2, arg3);
45836
+ function createError(location, message, ...args) {
45837
+ return location ? createDiagnosticForNode(location, message, ...args) : createCompilerDiagnostic(message, ...args);
45934
45838
  }
45935
- function error(location, message, arg0, arg1, arg2, arg3) {
45936
- const diagnostic = createError(location, message, arg0, arg1, arg2, arg3);
45839
+ function error(location, message, ...args) {
45840
+ const diagnostic = createError(location, message, ...args);
45937
45841
  diagnostics.add(diagnostic);
45938
45842
  return diagnostic;
45939
45843
  }
@@ -45944,19 +45848,19 @@ ${lanes.join("\n")}
45944
45848
  suggestionDiagnostics.add({ ...diagnostic, category: 2 /* Suggestion */ });
45945
45849
  }
45946
45850
  }
45947
- function errorOrSuggestion(isError, location, message, arg0, arg1, arg2, arg3) {
45851
+ function errorOrSuggestion(isError, location, message, ...args) {
45948
45852
  if (location.pos < 0 || location.end < 0) {
45949
45853
  if (!isError) {
45950
45854
  return;
45951
45855
  }
45952
45856
  const file = getSourceFileOfNode(location);
45953
- addErrorOrSuggestion(isError, "message" in message ? createFileDiagnostic(file, 0, 0, message, arg0, arg1, arg2, arg3) : createDiagnosticForFileFromMessageChain(file, message));
45857
+ addErrorOrSuggestion(isError, "message" in message ? createFileDiagnostic(file, 0, 0, message, ...args) : createDiagnosticForFileFromMessageChain(file, message));
45954
45858
  return;
45955
45859
  }
45956
- addErrorOrSuggestion(isError, "message" in message ? createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(location), location, message));
45860
+ addErrorOrSuggestion(isError, "message" in message ? createDiagnosticForNode(location, message, ...args) : createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(location), location, message));
45957
45861
  }
45958
- function errorAndMaybeSuggestAwait(location, maybeMissingAwait, message, arg0, arg1, arg2, arg3) {
45959
- const diagnostic = error(location, message, arg0, arg1, arg2, arg3);
45862
+ function errorAndMaybeSuggestAwait(location, maybeMissingAwait, message, ...args) {
45863
+ const diagnostic = error(location, message, ...args);
45960
45864
  if (maybeMissingAwait) {
45961
45865
  const related = createDiagnosticForNode(location, Diagnostics.Did_you_forget_to_use_await);
45962
45866
  addRelatedInfo(diagnostic, related);
@@ -47830,7 +47734,7 @@ ${lanes.join("\n")}
47830
47734
  return void 0;
47831
47735
  }
47832
47736
  function markExportAsReferenced(node) {
47833
- if (compilerOptions.verbatimModuleSyntax) {
47737
+ if (!canCollectSymbolAliasAccessabilityData) {
47834
47738
  return;
47835
47739
  }
47836
47740
  const symbol = getSymbolOfDeclaration(node);
@@ -47843,7 +47747,7 @@ ${lanes.join("\n")}
47843
47747
  }
47844
47748
  }
47845
47749
  function markAliasSymbolAsReferenced(symbol) {
47846
- Debug.assert(!compilerOptions.verbatimModuleSyntax);
47750
+ Debug.assert(canCollectSymbolAliasAccessabilityData);
47847
47751
  const links = getSymbolLinks(symbol);
47848
47752
  if (!links.referenced) {
47849
47753
  links.referenced = true;
@@ -47974,6 +47878,9 @@ ${lanes.join("\n")}
47974
47878
  }
47975
47879
  }
47976
47880
  symbol = getMergedSymbol(getSymbol2(getExportsOfSymbol(namespace), right.escapedText, meaning));
47881
+ if (!symbol && namespace.flags & 2097152 /* Alias */) {
47882
+ symbol = getMergedSymbol(getSymbol2(getExportsOfSymbol(resolveAlias(namespace)), right.escapedText, meaning));
47883
+ }
47977
47884
  if (!symbol) {
47978
47885
  if (!ignoreErrors) {
47979
47886
  const namespaceName = getFullyQualifiedName(namespace);
@@ -48010,7 +47917,7 @@ ${lanes.join("\n")}
48010
47917
  return void 0;
48011
47918
  }
48012
47919
  } else {
48013
- throw Debug.assertNever(name, "Unknown entity name kind.");
47920
+ Debug.assertNever(name, "Unknown entity name kind.");
48014
47921
  }
48015
47922
  Debug.assert((getCheckFlags(symbol) & 1 /* Instantiated */) === 0, "Should never get an instantiated symbol here.");
48016
47923
  if (!nodeIsSynthesized(name) && isEntityName(name) && (symbol.flags & 2097152 /* Alias */ || name.parent.kind === 275 /* ExportAssignment */)) {
@@ -49723,8 +49630,11 @@ ${lanes.join("\n")}
49723
49630
  }
49724
49631
  return typeToTypeNodeHelper(type2, context);
49725
49632
  }
49633
+ function isMappedTypeHomomorphic(type2) {
49634
+ return !!getHomomorphicTypeVariable(type2);
49635
+ }
49726
49636
  function isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type2) {
49727
- return isMappedTypeWithKeyofConstraintDeclaration(type2) && !(getModifiersTypeFromMappedType(type2).flags & 262144 /* TypeParameter */);
49637
+ return !!type2.target && isMappedTypeHomomorphic(type2.target) && !isMappedTypeHomomorphic(type2);
49728
49638
  }
49729
49639
  function createMappedTypeNodeFromType(type2) {
49730
49640
  Debug.assert(!!(type2.flags & 524288 /* Object */));
@@ -55892,7 +55802,7 @@ ${lanes.join("\n")}
55892
55802
  return simplified !== type ? simplified : getConstraintOfType(type);
55893
55803
  }
55894
55804
  function getConstraintFromIndexedAccess(type) {
55895
- if (isMappedTypeGenericIndexedAccess(type)) {
55805
+ if (isMappedTypeGenericIndexedAccess(type) || isGenericMappedType(type.objectType)) {
55896
55806
  return substituteIndexedMappedType(type.objectType, type.indexType);
55897
55807
  }
55898
55808
  const indexConstraint = getSimplifiedTypeOrConstraint(type.indexType);
@@ -56128,7 +56038,7 @@ ${lanes.join("\n")}
56128
56038
  const typeVariable = getHomomorphicTypeVariable(type);
56129
56039
  if (typeVariable && !type.declaration.nameType) {
56130
56040
  const constraint = getConstraintOfTypeParameter(typeVariable);
56131
- if (constraint && isArrayType(constraint)) {
56041
+ if (constraint && everyType(constraint, isArrayOrTupleType)) {
56132
56042
  return instantiateType(type, prependTypeMapping(typeVariable, constraint, type.mapper));
56133
56043
  }
56134
56044
  }
@@ -58280,6 +58190,12 @@ ${lanes.join("\n")}
58280
58190
  i--;
58281
58191
  const source = types[i];
58282
58192
  if (hasEmptyObject || source.flags & 469499904 /* StructuredOrInstantiable */) {
58193
+ if (source.flags & 262144 /* TypeParameter */ && getBaseConstraintOrType(source).flags & 1048576 /* Union */) {
58194
+ if (isTypeRelatedTo(source, getUnionType(map(types, (t) => t === source ? neverType : t)), strictSubtypeRelation)) {
58195
+ orderedRemoveItemAt(types, i);
58196
+ }
58197
+ continue;
58198
+ }
58283
58199
  const keyProperty = source.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 58982400 /* InstantiableNonPrimitive */) ? find(getPropertiesOfType(source), (p) => isUnitType(getTypeOfSymbol(p))) : void 0;
58284
58200
  const keyPropertyType = keyProperty && getRegularTypeOfLiteralType(getTypeOfSymbol(keyProperty));
58285
58201
  for (const target of types) {
@@ -58847,7 +58763,7 @@ ${lanes.join("\n")}
58847
58763
  links.resolvedType = getTypeFromTypeNode(node.type);
58848
58764
  break;
58849
58765
  default:
58850
- throw Debug.assertNever(node.operator);
58766
+ Debug.assertNever(node.operator);
58851
58767
  }
58852
58768
  }
58853
58769
  return links.resolvedType;
@@ -58931,7 +58847,7 @@ ${lanes.join("\n")}
58931
58847
  return type;
58932
58848
  }
58933
58849
  function getStringMappingType(symbol, type) {
58934
- 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)) : (
58850
+ 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)) : (
58935
58851
  // Mapping<Mapping<T>> === Mapping<T>
58936
58852
  type.flags & 268435456 /* StringMapping */ && symbol === type.symbol ? type : type.flags & (1 /* Any */ | 4 /* String */ | 268435456 /* StringMapping */) || isGenericIndexType(type) ? getStringMappingTypeForGenericType(symbol, type) : (
58937
58853
  // This handles Mapping<`${number}`> and Mapping<`${bigint}`>
@@ -59814,7 +59730,10 @@ ${lanes.join("\n")}
59814
59730
  const declarations = concatenate(leftProp.declarations, rightProp.declarations);
59815
59731
  const flags = 4 /* Property */ | leftProp.flags & 16777216 /* Optional */;
59816
59732
  const result = createSymbol(flags, leftProp.escapedName);
59817
- result.links.type = getUnionType([getTypeOfSymbol(leftProp), removeMissingOrUndefinedType(rightType)], 2 /* Subtype */);
59733
+ const leftType = getTypeOfSymbol(leftProp);
59734
+ const leftTypeWithoutUndefined = removeMissingOrUndefinedType(leftType);
59735
+ const rightTypeWithoutUndefined = removeMissingOrUndefinedType(rightType);
59736
+ result.links.type = leftTypeWithoutUndefined === rightTypeWithoutUndefined ? leftType : getUnionType([leftType, rightTypeWithoutUndefined], 2 /* Subtype */);
59818
59737
  result.links.leftSpread = leftProp;
59819
59738
  result.links.rightSpread = rightProp;
59820
59739
  result.declarations = declarations;
@@ -60605,7 +60524,13 @@ ${lanes.join("\n")}
60605
60524
  return hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node);
60606
60525
  }
60607
60526
  function hasContextSensitiveReturnExpression(node) {
60608
- return !node.typeParameters && !getEffectiveReturnTypeNode(node) && !!node.body && node.body.kind !== 239 /* Block */ && isContextSensitive(node.body);
60527
+ if (node.typeParameters || getEffectiveReturnTypeNode(node) || !node.body) {
60528
+ return false;
60529
+ }
60530
+ if (node.body.kind !== 239 /* Block */) {
60531
+ return isContextSensitive(node.body);
60532
+ }
60533
+ return !!forEachReturnStatement(node.body, (statement) => !!statement.expression && isContextSensitive(statement.expression));
60609
60534
  }
60610
60535
  function isContextSensitiveFunctionOrObjectLiteralMethod(func) {
60611
60536
  return (isFunctionExpressionOrArrowFunction(func) || isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func);
@@ -61231,6 +61156,9 @@ ${lanes.join("\n")}
61231
61156
  const targetCount = getParameterCount(target);
61232
61157
  const sourceHasMoreParameters = !hasEffectiveRestParameter(target) && (checkMode & 8 /* StrictArity */ ? hasEffectiveRestParameter(source) || getParameterCount(source) > targetCount : getMinArgumentCount(source) > targetCount);
61233
61158
  if (sourceHasMoreParameters) {
61159
+ if (reportErrors2 && !(checkMode & 8 /* StrictArity */)) {
61160
+ errorReporter(Diagnostics.Target_signature_provides_too_few_arguments_Expected_0_or_more_but_got_1, getMinArgumentCount(source), targetCount);
61161
+ }
61234
61162
  return 0 /* False */;
61235
61163
  }
61236
61164
  if (source.typeParameters && source.typeParameters !== target.typeParameters) {
@@ -61274,7 +61202,12 @@ ${lanes.join("\n")}
61274
61202
  const paramCount = sourceRestType || targetRestType ? Math.min(sourceCount, targetCount) : Math.max(sourceCount, targetCount);
61275
61203
  const restIndex = sourceRestType || targetRestType ? paramCount - 1 : -1;
61276
61204
  for (let i = 0; i < paramCount; i++) {
61277
- const sourceType = i === restIndex ? getRestTypeAtPosition(source, i) : tryGetTypeAtPosition(source, i);
61205
+ const sourceType = i === restIndex ? getRestTypeAtPosition(
61206
+ source,
61207
+ i,
61208
+ /*readonly*/
61209
+ true
61210
+ ) : tryGetTypeAtPosition(source, i);
61278
61211
  const targetType = i === restIndex ? getRestTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
61279
61212
  if (sourceType && targetType) {
61280
61213
  const sourceSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
@@ -61540,7 +61473,7 @@ ${lanes.join("\n")}
61540
61473
  }
61541
61474
  function getNormalizedType(type, writing) {
61542
61475
  while (true) {
61543
- 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;
61476
+ 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;
61544
61477
  if (t === type)
61545
61478
  return t;
61546
61479
  type = t;
@@ -61559,6 +61492,11 @@ ${lanes.join("\n")}
61559
61492
  }
61560
61493
  return type;
61561
61494
  }
61495
+ function getNormalizedTupleType(type, writing) {
61496
+ const elements = getTypeArguments(type);
61497
+ const normalizedElements = sameMap(elements, (t) => t.flags & 25165824 /* Simplifiable */ ? getSimplifiedType(t, writing) : t);
61498
+ return elements !== normalizedElements ? createNormalizedTupleType(type.target, normalizedElements) : type;
61499
+ }
61562
61500
  function checkTypeRelatedTo(source, target, relation, errorNode, headMessage, containingMessageChain, errorOutputContainer) {
61563
61501
  var _a2;
61564
61502
  let errorInfo;
@@ -61648,10 +61586,10 @@ ${lanes.join("\n")}
61648
61586
  relatedInfo: relatedInfo == null ? void 0 : relatedInfo.slice()
61649
61587
  };
61650
61588
  }
61651
- function reportIncompatibleError(message, arg0, arg1, arg2, arg3) {
61589
+ function reportIncompatibleError(message, ...args) {
61652
61590
  overrideNextErrorInfo++;
61653
61591
  lastSkippedInfo = void 0;
61654
- (incompatibleStack || (incompatibleStack = [])).push([message, arg0, arg1, arg2, arg3]);
61592
+ (incompatibleStack || (incompatibleStack = [])).push([message, ...args]);
61655
61593
  }
61656
61594
  function reportIncompatibleStack() {
61657
61595
  const stack = incompatibleStack || [];
@@ -61743,13 +61681,13 @@ ${lanes.join("\n")}
61743
61681
  );
61744
61682
  }
61745
61683
  }
61746
- function reportError(message, arg0, arg1, arg2, arg3) {
61684
+ function reportError(message, ...args) {
61747
61685
  Debug.assert(!!errorNode);
61748
61686
  if (incompatibleStack)
61749
61687
  reportIncompatibleStack();
61750
61688
  if (message.elidedInCompatabilityPyramid)
61751
61689
  return;
61752
- errorInfo = chainDiagnosticMessages(errorInfo, message, arg0, arg1, arg2, arg3);
61690
+ errorInfo = chainDiagnosticMessages(errorInfo, message, ...args);
61753
61691
  }
61754
61692
  function associateRelatedInfo(info) {
61755
61693
  Debug.assert(!!errorInfo);
@@ -62929,6 +62867,26 @@ ${lanes.join("\n")}
62929
62867
  )) {
62930
62868
  return result2;
62931
62869
  }
62870
+ if (sourceFlags & 8388608 /* IndexedAccess */) {
62871
+ const indexType = source2.indexType;
62872
+ if (indexType.flags & 4194304 /* Index */) {
62873
+ const unresolvedIndexConstraint = getBaseConstraintOfType(indexType.type);
62874
+ const indexConstraint = unresolvedIndexConstraint && unresolvedIndexConstraint !== noConstraintType ? getIndexType(unresolvedIndexConstraint) : keyofConstraintType;
62875
+ const constraint2 = getIndexedAccessType(source2.objectType, indexConstraint);
62876
+ if (result2 = isRelatedTo(
62877
+ constraint2,
62878
+ target2,
62879
+ 1 /* Source */,
62880
+ /*reportErrors*/
62881
+ false,
62882
+ /*headMessage*/
62883
+ void 0,
62884
+ intersectionState
62885
+ )) {
62886
+ return result2;
62887
+ }
62888
+ }
62889
+ }
62932
62890
  if (isMappedTypeGenericIndexedAccess(source2)) {
62933
62891
  const indexConstraint = getConstraintOfType(source2.indexType);
62934
62892
  if (indexConstraint) {
@@ -63036,7 +62994,7 @@ ${lanes.join("\n")}
63036
62994
  if (varianceResult !== void 0) {
63037
62995
  return varianceResult;
63038
62996
  }
63039
- } else if (isReadonlyArrayType(target2) ? isArrayOrTupleType(source2) : isArrayType(target2) && isTupleType(source2) && !source2.target.readonly) {
62997
+ } else if (isReadonlyArrayType(target2) ? everyType(source2, isArrayOrTupleType) : isArrayType(target2) && everyType(source2, (t) => isTupleType(t) && !t.target.readonly)) {
63040
62998
  if (relation !== identityRelation) {
63041
62999
  return isRelatedTo(getIndexTypeOfType(source2, numberType) || anyType, getIndexTypeOfType(target2, numberType) || anyType, 3 /* Both */, reportErrors2);
63042
63000
  } else {
@@ -63919,22 +63877,7 @@ ${lanes.join("\n")}
63919
63877
  if (match === -1) {
63920
63878
  return defaultValue;
63921
63879
  }
63922
- let nextMatch = discriminable.indexOf(
63923
- /*searchElement*/
63924
- true,
63925
- match + 1
63926
- );
63927
- while (nextMatch !== -1) {
63928
- if (!isTypeIdenticalTo(target.types[match], target.types[nextMatch])) {
63929
- return defaultValue;
63930
- }
63931
- nextMatch = discriminable.indexOf(
63932
- /*searchElement*/
63933
- true,
63934
- nextMatch + 1
63935
- );
63936
- }
63937
- return target.types[match];
63880
+ return getUnionType(target.types.filter((_, index) => discriminable[index]));
63938
63881
  }
63939
63882
  function isWeakType(type) {
63940
63883
  if (type.flags & 524288 /* Object */) {
@@ -65378,21 +65321,19 @@ ${lanes.join("\n")}
65378
65321
  const saveInferencePriority = inferencePriority;
65379
65322
  inferencePriority = 2048 /* MaxValue */;
65380
65323
  const saveExpandingFlags = expandingFlags;
65381
- const sourceIdentity = getRecursionIdentity(source);
65382
- const targetIdentity = getRecursionIdentity(target);
65383
- if (contains(sourceStack, sourceIdentity))
65324
+ (sourceStack != null ? sourceStack : sourceStack = []).push(source);
65325
+ (targetStack != null ? targetStack : targetStack = []).push(target);
65326
+ if (isDeeplyNestedType(source, sourceStack, sourceStack.length, 2))
65384
65327
  expandingFlags |= 1 /* Source */;
65385
- if (contains(targetStack, targetIdentity))
65328
+ if (isDeeplyNestedType(target, targetStack, targetStack.length, 2))
65386
65329
  expandingFlags |= 2 /* Target */;
65387
65330
  if (expandingFlags !== 3 /* Both */) {
65388
- (sourceStack || (sourceStack = [])).push(sourceIdentity);
65389
- (targetStack || (targetStack = [])).push(targetIdentity);
65390
65331
  action(source, target);
65391
- targetStack.pop();
65392
- sourceStack.pop();
65393
65332
  } else {
65394
65333
  inferencePriority = -1 /* Circularity */;
65395
65334
  }
65335
+ targetStack.pop();
65336
+ sourceStack.pop();
65396
65337
  expandingFlags = saveExpandingFlags;
65397
65338
  visited.set(key, inferencePriority);
65398
65339
  inferencePriority = Math.min(inferencePriority, saveInferencePriority);
@@ -65534,7 +65475,11 @@ ${lanes.join("\n")}
65534
65475
  return true;
65535
65476
  }
65536
65477
  if (constraintType.flags & 262144 /* TypeParameter */) {
65537
- inferWithPriority(getIndexType(source), constraintType, 32 /* MappedTypeConstraint */);
65478
+ inferWithPriority(getIndexType(
65479
+ source,
65480
+ /*indexFlags*/
65481
+ !!source.pattern ? 2 /* NoIndexSignatures */ : 0 /* None */
65482
+ ), constraintType, 32 /* MappedTypeConstraint */);
65538
65483
  const extendedConstraint = getConstraintOfType(constraintType);
65539
65484
  if (extendedConstraint && inferToMappedType(source, target, extendedConstraint)) {
65540
65485
  return true;
@@ -66007,36 +65952,34 @@ ${lanes.join("\n")}
66007
65952
  return type.flags & 8192 /* UniqueESSymbol */ ? type.escapedName : type.flags & 384 /* StringOrNumberLiteral */ ? escapeLeadingUnderscores("" + type.value) : void 0;
66008
65953
  }
66009
65954
  function tryGetElementAccessExpressionName(node) {
66010
- if (isStringOrNumericLiteralLike(node.argumentExpression)) {
66011
- return escapeLeadingUnderscores(node.argumentExpression.text);
65955
+ return isStringOrNumericLiteralLike(node.argumentExpression) ? escapeLeadingUnderscores(node.argumentExpression.text) : isEntityNameExpression(node.argumentExpression) ? tryGetNameFromEntityNameExpression(node.argumentExpression) : void 0;
65956
+ }
65957
+ function tryGetNameFromEntityNameExpression(node) {
65958
+ const symbol = resolveEntityName(
65959
+ node,
65960
+ 111551 /* Value */,
65961
+ /*ignoreErrors*/
65962
+ true
65963
+ );
65964
+ if (!symbol || !(isConstVariable(symbol) || symbol.flags & 8 /* EnumMember */))
65965
+ return void 0;
65966
+ const declaration = symbol.valueDeclaration;
65967
+ if (declaration === void 0)
65968
+ return void 0;
65969
+ const type = tryGetTypeFromEffectiveTypeNode(declaration);
65970
+ if (type) {
65971
+ const name = tryGetNameFromType(type);
65972
+ if (name !== void 0) {
65973
+ return name;
65974
+ }
66012
65975
  }
66013
- if (isEntityNameExpression(node.argumentExpression)) {
66014
- const symbol = resolveEntityName(
66015
- node.argumentExpression,
66016
- 111551 /* Value */,
66017
- /*ignoreErrors*/
66018
- true
66019
- );
66020
- if (!symbol || !(isConstVariable(symbol) || symbol.flags & 8 /* EnumMember */))
66021
- return void 0;
66022
- const declaration = symbol.valueDeclaration;
66023
- if (declaration === void 0)
66024
- return void 0;
66025
- const type = tryGetTypeFromEffectiveTypeNode(declaration);
66026
- if (type) {
66027
- const name = tryGetNameFromType(type);
66028
- if (name !== void 0) {
66029
- return name;
66030
- }
65976
+ if (hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node)) {
65977
+ const initializer = getEffectiveInitializer(declaration);
65978
+ if (initializer) {
65979
+ return tryGetNameFromType(getTypeOfExpression(initializer));
66031
65980
  }
66032
- if (hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node.argumentExpression)) {
66033
- const initializer = getEffectiveInitializer(declaration);
66034
- if (initializer) {
66035
- return tryGetNameFromType(getTypeOfExpression(initializer));
66036
- }
66037
- if (isEnumMember(declaration)) {
66038
- return getTextOfPropertyName(declaration.name);
66039
- }
65981
+ if (isEnumMember(declaration)) {
65982
+ return getTextOfPropertyName(declaration.name);
66040
65983
  }
66041
65984
  }
66042
65985
  return void 0;
@@ -67954,7 +67897,7 @@ ${lanes.join("\n")}
67954
67897
  });
67955
67898
  }
67956
67899
  function markAliasReferenced(symbol, location) {
67957
- if (compilerOptions.verbatimModuleSyntax) {
67900
+ if (!canCollectSymbolAliasAccessabilityData) {
67958
67901
  return;
67959
67902
  }
67960
67903
  if (isNonLocalAlias(
@@ -69246,7 +69189,11 @@ ${lanes.join("\n")}
69246
69189
  if (instantiatedType && !(contextFlags && contextFlags & 2 /* NoConstraints */ && instantiatedType.flags & 8650752 /* TypeVariable */)) {
69247
69190
  const apparentType = mapType(
69248
69191
  instantiatedType,
69249
- getApparentType,
69192
+ // When obtaining apparent type of *contextual* type we don't want to get apparent type of mapped types.
69193
+ // That would evaluate mapped types with array or tuple type constraints too eagerly
69194
+ // and thus it would prevent `getTypeOfPropertyOfContextualType` from obtaining per-position contextual type for elements of array literal expressions.
69195
+ // Apparent type of other mapped types is already the mapped type itself so we can just avoid calling `getApparentType` here for all mapped types.
69196
+ (t) => getObjectFlags(t) & 32 /* Mapped */ ? t : getApparentType(t),
69250
69197
  /*noReductions*/
69251
69198
  true
69252
69199
  );
@@ -70511,7 +70458,7 @@ ${lanes.join("\n")}
70511
70458
  }
70512
70459
  if (jsxFactorySym) {
70513
70460
  jsxFactorySym.isReferenced = 67108863 /* All */;
70514
- if (!compilerOptions.verbatimModuleSyntax && jsxFactorySym.flags & 2097152 /* Alias */ && !getTypeOnlyAliasDeclaration(jsxFactorySym)) {
70461
+ if (canCollectSymbolAliasAccessabilityData && jsxFactorySym.flags & 2097152 /* Alias */ && !getTypeOnlyAliasDeclaration(jsxFactorySym)) {
70515
70462
  markAliasSymbolAsReferenced(jsxFactorySym);
70516
70463
  }
70517
70464
  }
@@ -72085,16 +72032,16 @@ ${lanes.join("\n")}
72085
72032
  }
72086
72033
  return { start, length: length2, sourceFile };
72087
72034
  }
72088
- function getDiagnosticForCallNode(node, message, arg0, arg1, arg2, arg3) {
72035
+ function getDiagnosticForCallNode(node, message, ...args) {
72089
72036
  if (isCallExpression(node)) {
72090
72037
  const { sourceFile, start, length: length2 } = getDiagnosticSpanForCallNode(node);
72091
72038
  if ("message" in message) {
72092
- return createFileDiagnostic(sourceFile, start, length2, message, arg0, arg1, arg2, arg3);
72039
+ return createFileDiagnostic(sourceFile, start, length2, message, ...args);
72093
72040
  }
72094
72041
  return createDiagnosticForFileFromMessageChain(sourceFile, message);
72095
72042
  } else {
72096
72043
  if ("message" in message) {
72097
- return createDiagnosticForNode(node, message, arg0, arg1, arg2, arg3);
72044
+ return createDiagnosticForNode(node, message, ...args);
72098
72045
  }
72099
72046
  return createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(node), node, message);
72100
72047
  }
@@ -72182,11 +72129,8 @@ ${lanes.join("\n")}
72182
72129
  }
72183
72130
  const parameter = (_a2 = closestSignature == null ? void 0 : closestSignature.declaration) == null ? void 0 : _a2.parameters[closestSignature.thisParameter ? args.length + 1 : args.length];
72184
72131
  if (parameter) {
72185
- const parameterError = createDiagnosticForNode(
72186
- parameter,
72187
- 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,
72188
- !parameter.name ? args.length : !isBindingPattern(parameter.name) ? idText(getFirstIdentifier(parameter.name)) : void 0
72189
- );
72132
+ 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))];
72133
+ const parameterError = createDiagnosticForNode(parameter, ...messageAndArgs);
72190
72134
  return addRelatedInfo(diagnostic, parameterError);
72191
72135
  }
72192
72136
  return diagnostic;
@@ -73117,7 +73061,7 @@ ${lanes.join("\n")}
73117
73061
  case 283 /* JsxSelfClosingElement */:
73118
73062
  return resolveJsxOpeningLikeElement(node, candidatesOutArray, checkMode);
73119
73063
  }
73120
- throw Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable.");
73064
+ Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable.");
73121
73065
  }
73122
73066
  function getResolvedSignature(node, candidatesOutArray, checkMode) {
73123
73067
  const links = getNodeLinks(node);
@@ -73791,12 +73735,12 @@ ${lanes.join("\n")}
73791
73735
  }
73792
73736
  return void 0;
73793
73737
  }
73794
- function getRestTypeAtPosition(source, pos) {
73738
+ function getRestTypeAtPosition(source, pos, readonly = false) {
73795
73739
  const parameterCount = getParameterCount(source);
73796
73740
  const minArgumentCount = getMinArgumentCount(source);
73797
73741
  const restType = getEffectiveRestType(source);
73798
73742
  if (restType && pos >= parameterCount - 1) {
73799
- return pos === parameterCount - 1 ? restType : createArrayType(getIndexedAccessType(restType, numberType));
73743
+ return pos === parameterCount - 1 ? restType : createArrayType(getIndexedAccessType(restType, numberType), readonly);
73800
73744
  }
73801
73745
  const types = [];
73802
73746
  const flags = [];
@@ -73814,13 +73758,7 @@ ${lanes.join("\n")}
73814
73758
  names.push(name);
73815
73759
  }
73816
73760
  }
73817
- return createTupleType(
73818
- types,
73819
- flags,
73820
- /*readonly*/
73821
- false,
73822
- length(names) === length(types) ? names : void 0
73823
- );
73761
+ return createTupleType(types, flags, readonly, length(names) === length(types) ? names : void 0);
73824
73762
  }
73825
73763
  function getParameterCount(signature) {
73826
73764
  const length2 = signature.parameters.length;
@@ -77526,9 +77464,9 @@ ${lanes.join("\n")}
77526
77464
  }
77527
77465
  }
77528
77466
  }
77529
- function getAwaitedTypeOfPromise(type, errorNode, diagnosticMessage, arg0) {
77467
+ function getAwaitedTypeOfPromise(type, errorNode, diagnosticMessage, ...args) {
77530
77468
  const promisedType = getPromisedTypeOfPromise(type, errorNode);
77531
- return promisedType && getAwaitedType(promisedType, errorNode, diagnosticMessage, arg0);
77469
+ return promisedType && getAwaitedType(promisedType, errorNode, diagnosticMessage, ...args);
77532
77470
  }
77533
77471
  function getPromisedTypeOfPromise(type, errorNode, thisTypeForErrorOut) {
77534
77472
  if (isTypeAny(type)) {
@@ -77591,8 +77529,8 @@ ${lanes.join("\n")}
77591
77529
  }
77592
77530
  return typeAsPromise.promisedTypeOfPromise = getUnionType(map(onfulfilledParameterSignatures, getTypeOfFirstParameterOfSignature), 2 /* Subtype */);
77593
77531
  }
77594
- function checkAwaitedType(type, withAlias, errorNode, diagnosticMessage, arg0) {
77595
- const awaitedType = withAlias ? getAwaitedType(type, errorNode, diagnosticMessage, arg0) : getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage, arg0);
77532
+ function checkAwaitedType(type, withAlias, errorNode, diagnosticMessage, ...args) {
77533
+ const awaitedType = withAlias ? getAwaitedType(type, errorNode, diagnosticMessage, ...args) : getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage, ...args);
77596
77534
  return awaitedType || errorType;
77597
77535
  }
77598
77536
  function isThenableType(type) {
@@ -77648,11 +77586,11 @@ ${lanes.join("\n")}
77648
77586
  Debug.assert(isAwaitedTypeInstantiation(type) || getPromisedTypeOfPromise(type) === void 0, "type provided should not be a non-generic 'promise'-like.");
77649
77587
  return type;
77650
77588
  }
77651
- function getAwaitedType(type, errorNode, diagnosticMessage, arg0) {
77652
- const awaitedType = getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage, arg0);
77589
+ function getAwaitedType(type, errorNode, diagnosticMessage, ...args) {
77590
+ const awaitedType = getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage, ...args);
77653
77591
  return awaitedType && createAwaitedTypeIfNeeded(awaitedType);
77654
77592
  }
77655
- function getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage, arg0) {
77593
+ function getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage, ...args) {
77656
77594
  if (isTypeAny(type)) {
77657
77595
  return type;
77658
77596
  }
@@ -77670,7 +77608,7 @@ ${lanes.join("\n")}
77670
77608
  }
77671
77609
  return void 0;
77672
77610
  }
77673
- const mapper = errorNode ? (constituentType) => getAwaitedTypeNoAlias(constituentType, errorNode, diagnosticMessage, arg0) : getAwaitedTypeNoAlias;
77611
+ const mapper = errorNode ? (constituentType) => getAwaitedTypeNoAlias(constituentType, errorNode, diagnosticMessage, ...args) : getAwaitedTypeNoAlias;
77674
77612
  awaitedTypeStack.push(type.id);
77675
77613
  const mapped = mapType(type, mapper);
77676
77614
  awaitedTypeStack.pop();
@@ -77694,7 +77632,7 @@ ${lanes.join("\n")}
77694
77632
  return void 0;
77695
77633
  }
77696
77634
  awaitedTypeStack.push(type.id);
77697
- const awaitedType = getAwaitedTypeNoAlias(promisedType, errorNode, diagnosticMessage, arg0);
77635
+ const awaitedType = getAwaitedTypeNoAlias(promisedType, errorNode, diagnosticMessage, ...args);
77698
77636
  awaitedTypeStack.pop();
77699
77637
  if (!awaitedType) {
77700
77638
  return void 0;
@@ -77708,7 +77646,7 @@ ${lanes.join("\n")}
77708
77646
  if (thisTypeForErrorOut.value) {
77709
77647
  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));
77710
77648
  }
77711
- chain = chainDiagnosticMessages(chain, diagnosticMessage, arg0);
77649
+ chain = chainDiagnosticMessages(chain, diagnosticMessage, ...args);
77712
77650
  diagnostics.add(createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(errorNode), errorNode, chain));
77713
77651
  }
77714
77652
  return void 0;
@@ -77886,7 +77824,7 @@ ${lanes.join("\n")}
77886
77824
  true
77887
77825
  );
77888
77826
  if (rootSymbol && rootSymbol.flags & 2097152 /* Alias */) {
77889
- if (!compilerOptions.verbatimModuleSyntax && symbolIsValue(rootSymbol) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol)) && !getTypeOnlyAliasDeclaration(rootSymbol)) {
77827
+ if (canCollectSymbolAliasAccessabilityData && symbolIsValue(rootSymbol) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol)) && !getTypeOnlyAliasDeclaration(rootSymbol)) {
77890
77828
  markAliasSymbolAsReferenced(rootSymbol);
77891
77829
  } else if (forDecoratorMetadata && getIsolatedModules(compilerOptions) && getEmitModuleKind(compilerOptions) >= 5 /* ES2015 */ && !symbolIsValue(rootSymbol) && !some(rootSymbol.declarations, isTypeOnlyImportOrExportDeclaration)) {
77892
77830
  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);
@@ -78295,9 +78233,8 @@ ${lanes.join("\n")}
78295
78233
  const sourceFile = getSourceFileOfNode(parent2);
78296
78234
  const range = isJSDocTemplateTag(parent2) ? rangeOfNode(parent2) : rangeOfTypeParameters(sourceFile, parent2.typeParameters);
78297
78235
  const only = parent2.typeParameters.length === 1;
78298
- const message = only ? Diagnostics._0_is_declared_but_its_value_is_never_read : Diagnostics.All_type_parameters_are_unused;
78299
- const arg0 = only ? name : void 0;
78300
- addDiagnostic(typeParameter, 1 /* Parameter */, createFileDiagnostic(sourceFile, range.pos, range.end - range.pos, message, arg0));
78236
+ const messageAndArg = only ? [Diagnostics._0_is_declared_but_its_value_is_never_read, name] : [Diagnostics.All_type_parameters_are_unused];
78237
+ addDiagnostic(typeParameter, 1 /* Parameter */, createFileDiagnostic(sourceFile, range.pos, range.end - range.pos, ...messageAndArg));
78301
78238
  }
78302
78239
  } else {
78303
78240
  addDiagnostic(typeParameter, 1 /* Parameter */, createDiagnosticForNode(typeParameter, Diagnostics._0_is_declared_but_its_value_is_never_read, name));
@@ -79855,7 +79792,7 @@ ${lanes.join("\n")}
79855
79792
  forEachKey(catchClause.locals, (caughtName) => {
79856
79793
  const blockLocal = blockLocals.get(caughtName);
79857
79794
  if ((blockLocal == null ? void 0 : blockLocal.valueDeclaration) && (blockLocal.flags & 2 /* BlockScopedVariable */) !== 0) {
79858
- grammarErrorOnNode(blockLocal.valueDeclaration, Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause, caughtName);
79795
+ grammarErrorOnNode(blockLocal.valueDeclaration, Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause, unescapeLeadingUnderscores(caughtName));
79859
79796
  }
79860
79797
  });
79861
79798
  }
@@ -81451,6 +81388,9 @@ ${lanes.join("\n")}
81451
81388
  ) && !getSymbolLinks(getSymbolOfDeclaration(statement)).constEnumReferenced;
81452
81389
  }
81453
81390
  function checkImportsForTypeOnlyConversion(sourceFile) {
81391
+ if (!canCollectSymbolAliasAccessabilityData) {
81392
+ return;
81393
+ }
81454
81394
  for (const statement of sourceFile.statements) {
81455
81395
  if (canConvertImportDeclarationToTypeOnly(statement) || canConvertImportEqualsDeclarationToTypeOnly(statement)) {
81456
81396
  error(
@@ -81536,14 +81476,14 @@ ${lanes.join("\n")}
81536
81476
  markAliasReferenced(sym, id);
81537
81477
  if (getAllSymbolFlags(sym) & 111551 /* Value */) {
81538
81478
  checkExpressionCached(id);
81539
- if (!isIllegalExportDefaultInCJS && compilerOptions.verbatimModuleSyntax && getTypeOnlyAliasDeclaration(sym, 111551 /* Value */)) {
81479
+ if (!isIllegalExportDefaultInCJS && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax && getTypeOnlyAliasDeclaration(sym, 111551 /* Value */)) {
81540
81480
  error(
81541
81481
  id,
81542
81482
  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,
81543
81483
  idText(id)
81544
81484
  );
81545
81485
  }
81546
- } else if (!isIllegalExportDefaultInCJS && compilerOptions.verbatimModuleSyntax) {
81486
+ } else if (!isIllegalExportDefaultInCJS && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax) {
81547
81487
  error(
81548
81488
  id,
81549
81489
  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,
@@ -82880,7 +82820,7 @@ ${lanes.join("\n")}
82880
82820
  return false;
82881
82821
  }
82882
82822
  function isValueAliasDeclaration(node) {
82883
- Debug.assert(!compilerOptions.verbatimModuleSyntax);
82823
+ Debug.assert(canCollectSymbolAliasAccessabilityData);
82884
82824
  switch (node.kind) {
82885
82825
  case 269 /* ImportEqualsDeclaration */:
82886
82826
  return isAliasResolvedToValue(getSymbolOfDeclaration(node));
@@ -82921,7 +82861,7 @@ ${lanes.join("\n")}
82921
82861
  return isConstEnumSymbol(s) || !!s.constEnumOnlyModule;
82922
82862
  }
82923
82863
  function isReferencedAliasDeclaration(node, checkChildren) {
82924
- Debug.assert(!compilerOptions.verbatimModuleSyntax);
82864
+ Debug.assert(canCollectSymbolAliasAccessabilityData);
82925
82865
  if (isAliasSymbolDeclaration2(node)) {
82926
82866
  const symbol = getSymbolOfDeclaration(node);
82927
82867
  const links = symbol && getSymbolLinks(symbol);
@@ -83259,12 +83199,12 @@ ${lanes.join("\n")}
83259
83199
  isDeclarationWithCollidingName,
83260
83200
  isValueAliasDeclaration: (nodeIn) => {
83261
83201
  const node = getParseTreeNode(nodeIn);
83262
- return node ? isValueAliasDeclaration(node) : true;
83202
+ return node && canCollectSymbolAliasAccessabilityData ? isValueAliasDeclaration(node) : true;
83263
83203
  },
83264
83204
  hasGlobalName,
83265
83205
  isReferencedAliasDeclaration: (nodeIn, checkChildren) => {
83266
83206
  const node = getParseTreeNode(nodeIn);
83267
- return node ? isReferencedAliasDeclaration(node, checkChildren) : true;
83207
+ return node && canCollectSymbolAliasAccessabilityData ? isReferencedAliasDeclaration(node, checkChildren) : true;
83268
83208
  },
83269
83209
  getNodeCheckFlags: (nodeIn) => {
83270
83210
  const node = getParseTreeNode(nodeIn);
@@ -84396,10 +84336,10 @@ ${lanes.join("\n")}
84396
84336
  currentKind = 2 /* SetAccessor */;
84397
84337
  break;
84398
84338
  default:
84399
- throw Debug.assertNever(prop, "Unexpected syntax kind:" + prop.kind);
84339
+ Debug.assertNever(prop, "Unexpected syntax kind:" + prop.kind);
84400
84340
  }
84401
84341
  if (!inDestructuring) {
84402
- const effectiveName = getPropertyNameForPropertyNameNode(name);
84342
+ const effectiveName = getEffectivePropertyNameForPropertyNameNode(name);
84403
84343
  if (effectiveName === void 0) {
84404
84344
  continue;
84405
84345
  }
@@ -84868,12 +84808,12 @@ ${lanes.join("\n")}
84868
84808
  switch (node.keywordToken) {
84869
84809
  case 104 /* NewKeyword */:
84870
84810
  if (escapedText !== "target") {
84871
- 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");
84811
+ 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");
84872
84812
  }
84873
84813
  break;
84874
84814
  case 101 /* ImportKeyword */:
84875
84815
  if (escapedText !== "meta") {
84876
- 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");
84816
+ 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");
84877
84817
  }
84878
84818
  break;
84879
84819
  }
@@ -84881,35 +84821,35 @@ ${lanes.join("\n")}
84881
84821
  function hasParseDiagnostics(sourceFile) {
84882
84822
  return sourceFile.parseDiagnostics.length > 0;
84883
84823
  }
84884
- function grammarErrorOnFirstToken(node, message, arg0, arg1, arg2) {
84824
+ function grammarErrorOnFirstToken(node, message, ...args) {
84885
84825
  const sourceFile = getSourceFileOfNode(node);
84886
84826
  if (!hasParseDiagnostics(sourceFile)) {
84887
84827
  const span = getSpanOfTokenAtPosition(sourceFile, node.pos);
84888
- diagnostics.add(createFileDiagnostic(sourceFile, span.start, span.length, message, arg0, arg1, arg2));
84828
+ diagnostics.add(createFileDiagnostic(sourceFile, span.start, span.length, message, ...args));
84889
84829
  return true;
84890
84830
  }
84891
84831
  return false;
84892
84832
  }
84893
- function grammarErrorAtPos(nodeForSourceFile, start, length2, message, arg0, arg1, arg2) {
84833
+ function grammarErrorAtPos(nodeForSourceFile, start, length2, message, ...args) {
84894
84834
  const sourceFile = getSourceFileOfNode(nodeForSourceFile);
84895
84835
  if (!hasParseDiagnostics(sourceFile)) {
84896
- diagnostics.add(createFileDiagnostic(sourceFile, start, length2, message, arg0, arg1, arg2));
84836
+ diagnostics.add(createFileDiagnostic(sourceFile, start, length2, message, ...args));
84897
84837
  return true;
84898
84838
  }
84899
84839
  return false;
84900
84840
  }
84901
- function grammarErrorOnNodeSkippedOn(key, node, message, arg0, arg1, arg2) {
84841
+ function grammarErrorOnNodeSkippedOn(key, node, message, ...args) {
84902
84842
  const sourceFile = getSourceFileOfNode(node);
84903
84843
  if (!hasParseDiagnostics(sourceFile)) {
84904
- errorSkippedOn(key, node, message, arg0, arg1, arg2);
84844
+ errorSkippedOn(key, node, message, ...args);
84905
84845
  return true;
84906
84846
  }
84907
84847
  return false;
84908
84848
  }
84909
- function grammarErrorOnNode(node, message, arg0, arg1, arg2) {
84849
+ function grammarErrorOnNode(node, message, ...args) {
84910
84850
  const sourceFile = getSourceFileOfNode(node);
84911
84851
  if (!hasParseDiagnostics(sourceFile)) {
84912
- diagnostics.add(createDiagnosticForNode(node, message, arg0, arg1, arg2));
84852
+ diagnostics.add(createDiagnosticForNode(node, message, ...args));
84913
84853
  return true;
84914
84854
  }
84915
84855
  return false;
@@ -85054,7 +84994,7 @@ ${lanes.join("\n")}
85054
84994
  }
85055
84995
  return false;
85056
84996
  }
85057
- function grammarErrorAfterFirstToken(node, message, arg0, arg1, arg2) {
84997
+ function grammarErrorAfterFirstToken(node, message, ...args) {
85058
84998
  const sourceFile = getSourceFileOfNode(node);
85059
84999
  if (!hasParseDiagnostics(sourceFile)) {
85060
85000
  const span = getSpanOfTokenAtPosition(sourceFile, node.pos);
@@ -85064,9 +85004,7 @@ ${lanes.join("\n")}
85064
85004
  /*length*/
85065
85005
  0,
85066
85006
  message,
85067
- arg0,
85068
- arg1,
85069
- arg2
85007
+ ...args
85070
85008
  ));
85071
85009
  return true;
85072
85010
  }
@@ -85212,6 +85150,10 @@ ${lanes.join("\n")}
85212
85150
  }
85213
85151
  return void 0;
85214
85152
  }
85153
+ function getEffectivePropertyNameForPropertyNameNode(node) {
85154
+ const name = getPropertyNameForPropertyNameNode(node);
85155
+ return name ? name : isComputedPropertyName(node) && isEntityNameExpression(node.expression) ? tryGetNameFromEntityNameExpression(node.expression) : void 0;
85156
+ }
85215
85157
  }
85216
85158
  function isNotAccessor(declaration) {
85217
85159
  return !isAccessor(declaration);
@@ -97511,10 +97453,13 @@ ${lanes.join("\n")}
97511
97453
  return Debug.failBadSyntaxKind(node);
97512
97454
  }
97513
97455
  }
97456
+ function hasProto(obj) {
97457
+ return obj.properties.some((p) => isPropertyAssignment(p) && (isIdentifier(p.name) && idText(p.name) === "__proto__" || isStringLiteral(p.name) && p.name.text === "__proto__"));
97458
+ }
97514
97459
  function hasKeyAfterPropsSpread(node) {
97515
97460
  let spread = false;
97516
97461
  for (const elem of node.attributes.properties) {
97517
- if (isJsxSpreadAttribute(elem)) {
97462
+ if (isJsxSpreadAttribute(elem) && (!isObjectLiteralExpression(elem.expression) || elem.expression.properties.some(isSpreadAssignment))) {
97518
97463
  spread = true;
97519
97464
  } else if (spread && isJsxAttribute(elem) && elem.name.escapedText === "key") {
97520
97465
  return true;
@@ -97680,7 +97625,10 @@ ${lanes.join("\n")}
97680
97625
  }
97681
97626
  return element;
97682
97627
  }
97683
- function transformJsxSpreadAttributeToSpreadAssignment(node) {
97628
+ function transformJsxSpreadAttributeToProps(node) {
97629
+ if (isObjectLiteralExpression(node.expression) && !hasProto(node.expression)) {
97630
+ return node.expression.properties;
97631
+ }
97684
97632
  return factory2.createSpreadAssignment(Debug.checkDefined(visitNode(node.expression, visitor, isExpression)));
97685
97633
  }
97686
97634
  function transformJsxAttributesToObjectProps(attrs, children) {
@@ -97688,30 +97636,48 @@ ${lanes.join("\n")}
97688
97636
  return target && target >= 5 /* ES2018 */ ? factory2.createObjectLiteralExpression(transformJsxAttributesToProps(attrs, children)) : transformJsxAttributesToExpression(attrs, children);
97689
97637
  }
97690
97638
  function transformJsxAttributesToProps(attrs, children) {
97691
- const props = flatten(spanMap(attrs, isJsxSpreadAttribute, (attrs2, isSpread) => map(attrs2, (attr) => isSpread ? transformJsxSpreadAttributeToSpreadAssignment(attr) : transformJsxAttributeToObjectLiteralElement(attr))));
97639
+ const props = flatten(spanMap(attrs, isJsxSpreadAttribute, (attrs2, isSpread) => flatten(map(attrs2, (attr) => isSpread ? transformJsxSpreadAttributeToProps(attr) : transformJsxAttributeToObjectLiteralElement(attr)))));
97692
97640
  if (children) {
97693
97641
  props.push(children);
97694
97642
  }
97695
97643
  return props;
97696
97644
  }
97697
97645
  function transformJsxAttributesToExpression(attrs, children) {
97698
- const expressions = flatten(
97699
- spanMap(
97700
- attrs,
97701
- isJsxSpreadAttribute,
97702
- (attrs2, isSpread) => isSpread ? map(attrs2, transformJsxSpreadAttributeToExpression) : factory2.createObjectLiteralExpression(map(attrs2, transformJsxAttributeToObjectLiteralElement))
97703
- )
97704
- );
97705
- if (isJsxSpreadAttribute(attrs[0])) {
97706
- expressions.unshift(factory2.createObjectLiteralExpression());
97646
+ const expressions = [];
97647
+ let properties = [];
97648
+ for (const attr of attrs) {
97649
+ if (isJsxSpreadAttribute(attr)) {
97650
+ if (isObjectLiteralExpression(attr.expression) && !hasProto(attr.expression)) {
97651
+ for (const prop of attr.expression.properties) {
97652
+ if (isSpreadAssignment(prop)) {
97653
+ finishObjectLiteralIfNeeded();
97654
+ expressions.push(prop.expression);
97655
+ continue;
97656
+ }
97657
+ properties.push(prop);
97658
+ }
97659
+ continue;
97660
+ }
97661
+ finishObjectLiteralIfNeeded();
97662
+ expressions.push(attr.expression);
97663
+ continue;
97664
+ }
97665
+ properties.push(transformJsxAttributeToObjectLiteralElement(attr));
97707
97666
  }
97708
97667
  if (children) {
97709
- expressions.push(factory2.createObjectLiteralExpression([children]));
97668
+ properties.push(children);
97669
+ }
97670
+ finishObjectLiteralIfNeeded();
97671
+ if (expressions.length && !isObjectLiteralExpression(expressions[0])) {
97672
+ expressions.unshift(factory2.createObjectLiteralExpression());
97710
97673
  }
97711
97674
  return singleOrUndefined(expressions) || emitHelpers().createAssignHelper(expressions);
97712
- }
97713
- function transformJsxSpreadAttributeToExpression(node) {
97714
- return Debug.checkDefined(visitNode(node.expression, visitor, isExpression));
97675
+ function finishObjectLiteralIfNeeded() {
97676
+ if (properties.length) {
97677
+ expressions.push(factory2.createObjectLiteralExpression(properties));
97678
+ properties = [];
97679
+ }
97680
+ }
97715
97681
  }
97716
97682
  function transformJsxAttributeToObjectLiteralElement(node) {
97717
97683
  const name = getAttributeName(node);
@@ -109876,8 +109842,7 @@ ${lanes.join("\n")}
109876
109842
  }
109877
109843
  }
109878
109844
  function createBuildInfo(program, bundle) {
109879
- const version2 = version;
109880
- return { bundle, program, version: version2 };
109845
+ return { bundle, program, version };
109881
109846
  }
109882
109847
  function getBuildInfoText(buildInfo) {
109883
109848
  return JSON.stringify(buildInfo);
@@ -109922,10 +109887,10 @@ ${lanes.join("\n")}
109922
109887
  /*separateBeginAndEnd*/
109923
109888
  true
109924
109889
  );
109925
- ts_performance_exports.mark("beforeEmit");
109890
+ mark("beforeEmit");
109926
109891
  const result = emitUsingBuildInfoWorker(config, host, getCommandLine, customTransformers);
109927
- ts_performance_exports.mark("afterEmit");
109928
- ts_performance_exports.measure("Emit", "beforeEmit", "afterEmit");
109892
+ mark("afterEmit");
109893
+ measure("Emit", "beforeEmit", "afterEmit");
109929
109894
  (_b = tracing) == null ? void 0 : _b.pop();
109930
109895
  return result;
109931
109896
  }
@@ -113935,12 +113900,12 @@ ${lanes.join("\n")}
113935
113900
  return cache[nodeId] || (cache[nodeId] = generateNameForNode(node, privateName, flags != null ? flags : 0 /* None */, formatGeneratedNamePart(prefix, generateName), formatGeneratedNamePart(suffix)));
113936
113901
  }
113937
113902
  function isUniqueName(name, privateName) {
113938
- return isFileLevelUniqueName2(name, privateName) && !isReservedName(name, privateName) && !generatedNames.has(name);
113903
+ return isFileLevelUniqueNameInCurrentFile(name, privateName) && !isReservedName(name, privateName) && !generatedNames.has(name);
113939
113904
  }
113940
113905
  function isReservedName(name, privateName) {
113941
113906
  return privateName ? !!(reservedPrivateNames == null ? void 0 : reservedPrivateNames.has(name)) : !!(reservedNames == null ? void 0 : reservedNames.has(name));
113942
113907
  }
113943
- function isFileLevelUniqueName2(name, _isPrivate) {
113908
+ function isFileLevelUniqueNameInCurrentFile(name, _isPrivate) {
113944
113909
  return currentSourceFile ? isFileLevelUniqueName(currentSourceFile, name, hasGlobalName) : true;
113945
113910
  }
113946
113911
  function isUniqueLocalName(name, container) {
@@ -114059,7 +114024,7 @@ ${lanes.join("\n")}
114059
114024
  function makeFileLevelOptimisticUniqueName(name) {
114060
114025
  return makeUniqueName2(
114061
114026
  name,
114062
- isFileLevelUniqueName2,
114027
+ isFileLevelUniqueNameInCurrentFile,
114063
114028
  /*optimistic*/
114064
114029
  true,
114065
114030
  /*scoped*/
@@ -114239,7 +114204,7 @@ ${lanes.join("\n")}
114239
114204
  case 3 /* Unique */:
114240
114205
  return makeUniqueName2(
114241
114206
  idText(name),
114242
- autoGenerate.flags & 32 /* FileLevel */ ? isFileLevelUniqueName2 : isUniqueName,
114207
+ autoGenerate.flags & 32 /* FileLevel */ ? isFileLevelUniqueNameInCurrentFile : isUniqueName,
114243
114208
  !!(autoGenerate.flags & 16 /* Optimistic */),
114244
114209
  !!(autoGenerate.flags & 8 /* ReservedInNestedScopes */),
114245
114210
  isPrivateIdentifier(name),
@@ -115257,7 +115222,6 @@ ${lanes.join("\n")}
115257
115222
  "src/compiler/watchUtilities.ts"() {
115258
115223
  "use strict";
115259
115224
  init_ts2();
115260
- init_ts2();
115261
115225
  ConfigFileProgramReloadLevel = /* @__PURE__ */ ((ConfigFileProgramReloadLevel2) => {
115262
115226
  ConfigFileProgramReloadLevel2[ConfigFileProgramReloadLevel2["None"] = 0] = "None";
115263
115227
  ConfigFileProgramReloadLevel2[ConfigFileProgramReloadLevel2["Partial"] = 1] = "Partial";
@@ -117257,12 +117221,12 @@ ${lanes.join("\n")}
117257
117221
  }
117258
117222
  }
117259
117223
  }
117260
- function createDiagnosticForNodeArray2(nodes, message, arg0, arg1, arg2) {
117224
+ function createDiagnosticForNodeArray2(nodes, message, ...args) {
117261
117225
  const start = nodes.pos;
117262
- return createFileDiagnostic(sourceFile, start, nodes.end - start, message, arg0, arg1, arg2);
117226
+ return createFileDiagnostic(sourceFile, start, nodes.end - start, message, ...args);
117263
117227
  }
117264
- function createDiagnosticForNode2(node, message, arg0, arg1, arg2) {
117265
- return createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2);
117228
+ function createDiagnosticForNode2(node, message, ...args) {
117229
+ return createDiagnosticForNodeInSourceFile(sourceFile, node, message, ...args);
117266
117230
  }
117267
117231
  });
117268
117232
  }
@@ -117927,11 +117891,12 @@ ${lanes.join("\n")}
117927
117891
  const unqualifiedLibName = removeSuffix(removePrefix(libName, "lib."), ".d.ts");
117928
117892
  const suggestion = getSpellingSuggestion(unqualifiedLibName, libs, identity);
117929
117893
  const diagnostic = suggestion ? Diagnostics.Cannot_find_lib_definition_for_0_Did_you_mean_1 : Diagnostics.Cannot_find_lib_definition_for_0;
117894
+ const args = suggestion ? [libName, suggestion] : [libName];
117930
117895
  (fileProcessingDiagnostics || (fileProcessingDiagnostics = [])).push({
117931
117896
  kind: 0 /* FilePreprocessingReferencedDiagnostic */,
117932
117897
  reason: { kind: 7 /* LibReferenceDirective */, file: file.path, index },
117933
117898
  diagnostic,
117934
- args: [libName, suggestion]
117899
+ args
117935
117900
  });
117936
117901
  }
117937
117902
  });
@@ -118396,7 +118361,7 @@ ${lanes.join("\n")}
118396
118361
  }
118397
118362
  }
118398
118363
  function verifyDeprecatedCompilerOptions() {
118399
- function createDiagnostic(name, value, useInstead, message, arg0, arg1, arg2, arg3) {
118364
+ function createDiagnostic(name, value, useInstead, message, ...args) {
118400
118365
  if (useInstead) {
118401
118366
  const details = chainDiagnosticMessages(
118402
118367
  /*details*/
@@ -118404,7 +118369,7 @@ ${lanes.join("\n")}
118404
118369
  Diagnostics.Use_0_instead,
118405
118370
  useInstead
118406
118371
  );
118407
- const chain = chainDiagnosticMessages(details, message, arg0, arg1, arg2, arg3);
118372
+ const chain = chainDiagnosticMessages(details, message, ...args);
118408
118373
  createDiagnosticForOption(
118409
118374
  /*onKey*/
118410
118375
  !value,
@@ -118421,10 +118386,7 @@ ${lanes.join("\n")}
118421
118386
  /*option2*/
118422
118387
  void 0,
118423
118388
  message,
118424
- arg0,
118425
- arg1,
118426
- arg2,
118427
- arg3
118389
+ ...args
118428
118390
  );
118429
118391
  }
118430
118392
  }
@@ -118477,8 +118439,8 @@ ${lanes.join("\n")}
118477
118439
  });
118478
118440
  }
118479
118441
  function verifyDeprecatedProjectReference(ref, parentFile, index) {
118480
- function createDiagnostic(_name, _value, _useInstead, message, arg0, arg1, arg2, arg3) {
118481
- createDiagnosticForReference(parentFile, index, message, arg0, arg1, arg2, arg3);
118442
+ function createDiagnostic(_name, _value, _useInstead, message, ...args) {
118443
+ createDiagnosticForReference(parentFile, index, message, ...args);
118482
118444
  }
118483
118445
  checkDeprecations("5.0", "5.5", createDiagnostic, (createDeprecatedDiagnostic) => {
118484
118446
  if (ref.prepend) {
@@ -118590,8 +118552,9 @@ ${lanes.join("\n")}
118590
118552
  if (!referenceInfo)
118591
118553
  return void 0;
118592
118554
  const { sourceFile, index } = referenceInfo;
118593
- const referencesSyntax = firstDefined(
118594
- getTsConfigPropArray(sourceFile, "references"),
118555
+ const referencesSyntax = forEachTsConfigPropArray(
118556
+ sourceFile,
118557
+ "references",
118595
118558
  (property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0
118596
118559
  );
118597
118560
  return referencesSyntax && referencesSyntax.elements.length > index ? createDiagnosticForNodeInSourceFile(
@@ -118660,28 +118623,26 @@ ${lanes.join("\n")}
118660
118623
  }
118661
118624
  });
118662
118625
  }
118663
- function createDiagnosticForOptionPathKeyValue(key, valueIndex, message, arg0, arg1, arg2) {
118626
+ function createDiagnosticForOptionPathKeyValue(key, valueIndex, message, ...args) {
118664
118627
  let needCompilerDiagnostic = true;
118665
- const pathsSyntax = getOptionPathsSyntax();
118666
- for (const pathProp of pathsSyntax) {
118628
+ forEachOptionPathsSyntax((pathProp) => {
118667
118629
  if (isObjectLiteralExpression(pathProp.initializer)) {
118668
- for (const keyProps of getPropertyAssignment(pathProp.initializer, key)) {
118630
+ forEachPropertyAssignment(pathProp.initializer, key, (keyProps) => {
118669
118631
  const initializer = keyProps.initializer;
118670
118632
  if (isArrayLiteralExpression(initializer) && initializer.elements.length > valueIndex) {
118671
- programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, initializer.elements[valueIndex], message, arg0, arg1, arg2));
118633
+ programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, initializer.elements[valueIndex], message, ...args));
118672
118634
  needCompilerDiagnostic = false;
118673
118635
  }
118674
- }
118636
+ });
118675
118637
  }
118676
- }
118638
+ });
118677
118639
  if (needCompilerDiagnostic) {
118678
- programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1, arg2));
118640
+ programDiagnostics.add(createCompilerDiagnostic(message, ...args));
118679
118641
  }
118680
118642
  }
118681
- function createDiagnosticForOptionPaths(onKey, key, message, arg0) {
118643
+ function createDiagnosticForOptionPaths(onKey, key, message, ...args) {
118682
118644
  let needCompilerDiagnostic = true;
118683
- const pathsSyntax = getOptionPathsSyntax();
118684
- for (const pathProp of pathsSyntax) {
118645
+ forEachOptionPathsSyntax((pathProp) => {
118685
118646
  if (isObjectLiteralExpression(pathProp.initializer) && createOptionDiagnosticInObjectLiteralSyntax(
118686
118647
  pathProp.initializer,
118687
118648
  onKey,
@@ -118689,25 +118650,23 @@ ${lanes.join("\n")}
118689
118650
  /*key2*/
118690
118651
  void 0,
118691
118652
  message,
118692
- arg0
118653
+ ...args
118693
118654
  )) {
118694
118655
  needCompilerDiagnostic = false;
118695
118656
  }
118696
- }
118657
+ });
118697
118658
  if (needCompilerDiagnostic) {
118698
- programDiagnostics.add(createCompilerDiagnostic(message, arg0));
118659
+ programDiagnostics.add(createCompilerDiagnostic(message, ...args));
118699
118660
  }
118700
118661
  }
118701
- function getOptionsSyntaxByName(name) {
118702
- const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax();
118703
- return compilerOptionsObjectLiteralSyntax && getPropertyAssignment(compilerOptionsObjectLiteralSyntax, name);
118662
+ function forEachOptionsSyntaxByName(name, callback) {
118663
+ return forEachPropertyAssignment(getCompilerOptionsObjectLiteralSyntax(), name, callback);
118704
118664
  }
118705
- function getOptionPathsSyntax() {
118706
- return getOptionsSyntaxByName("paths") || emptyArray;
118665
+ function forEachOptionPathsSyntax(callback) {
118666
+ return forEachOptionsSyntaxByName("paths", callback);
118707
118667
  }
118708
118668
  function getOptionsSyntaxByValue(name, value) {
118709
- const syntaxByName = getOptionsSyntaxByName(name);
118710
- return syntaxByName && firstDefined(syntaxByName, (property) => isStringLiteral(property.initializer) && property.initializer.text === value ? property.initializer : void 0);
118669
+ return forEachOptionsSyntaxByName(name, (property) => isStringLiteral(property.initializer) && property.initializer.text === value ? property.initializer : void 0);
118711
118670
  }
118712
118671
  function getOptionsSyntaxByArrayElementValue(name, value) {
118713
118672
  const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax();
@@ -118725,7 +118684,7 @@ ${lanes.join("\n")}
118725
118684
  option3
118726
118685
  );
118727
118686
  }
118728
- function createOptionValueDiagnostic(option1, message, arg0, arg1) {
118687
+ function createOptionValueDiagnostic(option1, message, ...args) {
118729
118688
  createDiagnosticForOption(
118730
118689
  /*onKey*/
118731
118690
  false,
@@ -118733,57 +118692,53 @@ ${lanes.join("\n")}
118733
118692
  /*option2*/
118734
118693
  void 0,
118735
118694
  message,
118736
- arg0,
118737
- arg1
118695
+ ...args
118738
118696
  );
118739
118697
  }
118740
- function createDiagnosticForReference(sourceFile, index, message, arg0, arg1, arg2, arg3) {
118741
- const referencesSyntax = firstDefined(
118742
- getTsConfigPropArray(sourceFile || options.configFile, "references"),
118698
+ function createDiagnosticForReference(sourceFile, index, message, ...args) {
118699
+ const referencesSyntax = forEachTsConfigPropArray(
118700
+ sourceFile || options.configFile,
118701
+ "references",
118743
118702
  (property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0
118744
118703
  );
118745
118704
  if (referencesSyntax && referencesSyntax.elements.length > index) {
118746
- programDiagnostics.add(createDiagnosticForNodeInSourceFile(sourceFile || options.configFile, referencesSyntax.elements[index], message, arg0, arg1, arg2, arg3));
118705
+ programDiagnostics.add(createDiagnosticForNodeInSourceFile(sourceFile || options.configFile, referencesSyntax.elements[index], message, ...args));
118747
118706
  } else {
118748
- programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1, arg2, arg3));
118707
+ programDiagnostics.add(createCompilerDiagnostic(message, ...args));
118749
118708
  }
118750
118709
  }
118751
- function createDiagnosticForOption(onKey, option1, option2, message, arg0, arg1, arg2, arg3) {
118710
+ function createDiagnosticForOption(onKey, option1, option2, message, ...args) {
118752
118711
  const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax();
118753
- const needCompilerDiagnostic = !compilerOptionsObjectLiteralSyntax || !createOptionDiagnosticInObjectLiteralSyntax(compilerOptionsObjectLiteralSyntax, onKey, option1, option2, message, arg0, arg1, arg2, arg3);
118712
+ const needCompilerDiagnostic = !compilerOptionsObjectLiteralSyntax || !createOptionDiagnosticInObjectLiteralSyntax(compilerOptionsObjectLiteralSyntax, onKey, option1, option2, message, ...args);
118754
118713
  if (needCompilerDiagnostic) {
118755
118714
  if ("messageText" in message) {
118756
118715
  programDiagnostics.add(createCompilerDiagnosticFromMessageChain(message));
118757
118716
  } else {
118758
- programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1, arg2, arg3));
118717
+ programDiagnostics.add(createCompilerDiagnostic(message, ...args));
118759
118718
  }
118760
118719
  }
118761
118720
  }
118762
118721
  function getCompilerOptionsObjectLiteralSyntax() {
118763
118722
  if (_compilerOptionsObjectLiteralSyntax === void 0) {
118764
- _compilerOptionsObjectLiteralSyntax = false;
118765
- const jsonObjectLiteral = getTsConfigObjectLiteralExpression(options.configFile);
118766
- if (jsonObjectLiteral) {
118767
- for (const prop of getPropertyAssignment(jsonObjectLiteral, "compilerOptions")) {
118768
- if (isObjectLiteralExpression(prop.initializer)) {
118769
- _compilerOptionsObjectLiteralSyntax = prop.initializer;
118770
- break;
118771
- }
118772
- }
118773
- }
118723
+ _compilerOptionsObjectLiteralSyntax = forEachPropertyAssignment(
118724
+ getTsConfigObjectLiteralExpression(options.configFile),
118725
+ "compilerOptions",
118726
+ (prop) => isObjectLiteralExpression(prop.initializer) ? prop.initializer : void 0
118727
+ ) || false;
118774
118728
  }
118775
118729
  return _compilerOptionsObjectLiteralSyntax || void 0;
118776
118730
  }
118777
- function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral, onKey, key1, key2, message, arg0, arg1, arg2, arg3) {
118778
- const props = getPropertyAssignment(objectLiteral, key1, key2);
118779
- for (const prop of props) {
118731
+ function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral, onKey, key1, key2, message, ...args) {
118732
+ let needsCompilerDiagnostic = false;
118733
+ forEachPropertyAssignment(objectLiteral, key1, (prop) => {
118780
118734
  if ("messageText" in message) {
118781
118735
  programDiagnostics.add(createDiagnosticForNodeFromMessageChain(options.configFile, onKey ? prop.name : prop.initializer, message));
118782
118736
  } else {
118783
- programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message, arg0, arg1, arg2, arg3));
118737
+ programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message, ...args));
118784
118738
  }
118785
- }
118786
- return !!props.length;
118739
+ needsCompilerDiagnostic = true;
118740
+ }, key2);
118741
+ return needsCompilerDiagnostic;
118787
118742
  }
118788
118743
  function createRedundantOptionDiagnostic(errorOnOption, redundantWithOption) {
118789
118744
  const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax();
@@ -119118,7 +119073,6 @@ ${lanes.join("\n")}
119118
119073
  "src/compiler/program.ts"() {
119119
119074
  "use strict";
119120
119075
  init_ts2();
119121
- init_ts2();
119122
119076
  init_ts_performance();
119123
119077
  ForegroundColorEscapeSequences = /* @__PURE__ */ ((ForegroundColorEscapeSequences2) => {
119124
119078
  ForegroundColorEscapeSequences2["Grey"] = "\x1B[90m";
@@ -119833,16 +119787,16 @@ ${lanes.join("\n")}
119833
119787
  return emptyArray;
119834
119788
  let buildInfoDirectory;
119835
119789
  return diagnostics.map((diagnostic) => {
119836
- const result = convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPath3);
119790
+ const result = convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPathInBuildInfoDirectory);
119837
119791
  result.reportsUnnecessary = diagnostic.reportsUnnecessary;
119838
119792
  result.reportsDeprecated = diagnostic.reportDeprecated;
119839
119793
  result.source = diagnostic.source;
119840
119794
  result.skippedOn = diagnostic.skippedOn;
119841
119795
  const { relatedInformation } = diagnostic;
119842
- result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map((r) => convertToDiagnosticRelatedInformation(r, newProgram, toPath3)) : [] : void 0;
119796
+ result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map((r) => convertToDiagnosticRelatedInformation(r, newProgram, toPathInBuildInfoDirectory)) : [] : void 0;
119843
119797
  return result;
119844
119798
  });
119845
- function toPath3(path) {
119799
+ function toPathInBuildInfoDirectory(path) {
119846
119800
  buildInfoDirectory != null ? buildInfoDirectory : buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(getTsBuildInfoEmitOutputFilePath(newProgram.getCompilerOptions()), newProgram.getCurrentDirectory()));
119847
119801
  return toPath(path, buildInfoDirectory, newProgram.getCanonicalFileName);
119848
119802
  }
@@ -120745,7 +120699,7 @@ ${lanes.join("\n")}
120745
120699
  const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
120746
120700
  const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
120747
120701
  let state;
120748
- const filePaths = (_a2 = program.fileNames) == null ? void 0 : _a2.map(toPath3);
120702
+ const filePaths = (_a2 = program.fileNames) == null ? void 0 : _a2.map(toPathInBuildInfoDirectory);
120749
120703
  let filePathsSetList;
120750
120704
  const latestChangedDtsFile = program.latestChangedDtsFile ? toAbsolutePath(program.latestChangedDtsFile) : void 0;
120751
120705
  if (isProgramBundleEmitBuildInfo(program)) {
@@ -120826,7 +120780,7 @@ ${lanes.join("\n")}
120826
120780
  close: noop,
120827
120781
  hasChangedEmitSignature: returnFalse
120828
120782
  };
120829
- function toPath3(path) {
120783
+ function toPathInBuildInfoDirectory(path) {
120830
120784
  return toPath(path, buildInfoDirectory, getCanonicalFileName);
120831
120785
  }
120832
120786
  function toAbsolutePath(path) {
@@ -120908,7 +120862,6 @@ ${lanes.join("\n")}
120908
120862
  "src/compiler/builder.ts"() {
120909
120863
  "use strict";
120910
120864
  init_ts2();
120911
- init_ts2();
120912
120865
  BuilderFileEmit = /* @__PURE__ */ ((BuilderFileEmit2) => {
120913
120866
  BuilderFileEmit2[BuilderFileEmit2["None"] = 0] = "None";
120914
120867
  BuilderFileEmit2[BuilderFileEmit2["Js"] = 1] = "Js";
@@ -121788,7 +121741,6 @@ ${lanes.join("\n")}
121788
121741
  "src/compiler/resolutionCache.ts"() {
121789
121742
  "use strict";
121790
121743
  init_ts2();
121791
- init_ts2();
121792
121744
  }
121793
121745
  });
121794
121746
 
@@ -121901,15 +121853,13 @@ ${lanes.join("\n")}
121901
121853
  const nonNilFiles = filesInError.filter((fileInError) => fileInError !== void 0);
121902
121854
  const distinctFileNamesWithLines = nonNilFiles.map((fileInError) => `${fileInError.fileName}:${fileInError.line}`).filter((value, index, self) => self.indexOf(value) === index);
121903
121855
  const firstFileReference = nonNilFiles[0] && prettyPathForFileError(nonNilFiles[0], host.getCurrentDirectory());
121904
- const d = errorCount === 1 ? createCompilerDiagnostic(
121905
- filesInError[0] !== void 0 ? Diagnostics.Found_1_error_in_1 : Diagnostics.Found_1_error,
121906
- errorCount,
121907
- firstFileReference
121908
- ) : createCompilerDiagnostic(
121909
- 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,
121910
- errorCount,
121911
- distinctFileNamesWithLines.length === 1 ? firstFileReference : distinctFileNamesWithLines.length
121912
- );
121856
+ let messageAndArgs;
121857
+ if (errorCount === 1) {
121858
+ messageAndArgs = filesInError[0] !== void 0 ? [Diagnostics.Found_1_error_in_0, firstFileReference] : [Diagnostics.Found_1_error];
121859
+ } else {
121860
+ 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];
121861
+ }
121862
+ const d = createCompilerDiagnostic(...messageAndArgs);
121913
121863
  const suffix = distinctFileNamesWithLines.length > 1 ? createTabularErrorsDisplay(nonNilFiles, host) : "";
121914
121864
  return `${newLine}${flattenDiagnosticMessageText(d.messageText, newLine)}${newLine}${newLine}${suffix}`;
121915
121865
  }
@@ -122119,15 +122069,15 @@ ${lanes.join("\n")}
122119
122069
  toFileName(referencedResolvedRef.sourceFile.fileName, fileNameConvertor),
122120
122070
  options.outFile ? "--outFile" : "--out"
122121
122071
  );
122122
- case 8 /* AutomaticTypeDirectiveFile */:
122072
+ case 8 /* AutomaticTypeDirectiveFile */: {
122073
+ 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];
122123
122074
  return chainDiagnosticMessages(
122124
122075
  /*details*/
122125
122076
  void 0,
122126
- 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,
122127
- reason.typeReference,
122128
- reason.packageId && packageIdToString(reason.packageId)
122077
+ ...messageAndArgs
122129
122078
  );
122130
- case 6 /* LibFile */:
122079
+ }
122080
+ case 6 /* LibFile */: {
122131
122081
  if (reason.index !== void 0)
122132
122082
  return chainDiagnosticMessages(
122133
122083
  /*details*/
@@ -122136,12 +122086,13 @@ ${lanes.join("\n")}
122136
122086
  options.lib[reason.index]
122137
122087
  );
122138
122088
  const target = forEachEntry(targetOptionDeclaration.type, (value, key) => value === getEmitScriptTarget(options) ? key : void 0);
122089
+ const messageAndArgs = target ? [Diagnostics.Default_library_for_target_0, target] : [Diagnostics.Default_library];
122139
122090
  return chainDiagnosticMessages(
122140
122091
  /*details*/
122141
122092
  void 0,
122142
- target ? Diagnostics.Default_library_for_target_0 : Diagnostics.Default_library,
122143
- target
122093
+ ...messageAndArgs
122144
122094
  );
122095
+ }
122145
122096
  default:
122146
122097
  Debug.assertNever(reason);
122147
122098
  }
@@ -123183,7 +123134,6 @@ ${lanes.join("\n")}
123183
123134
  "src/compiler/watchPublic.ts"() {
123184
123135
  "use strict";
123185
123136
  init_ts2();
123186
- init_ts2();
123187
123137
  }
123188
123138
  });
123189
123139
 
@@ -125203,7 +125153,6 @@ ${lanes.join("\n")}
125203
125153
  "src/compiler/tsbuildPublic.ts"() {
125204
125154
  "use strict";
125205
125155
  init_ts2();
125206
- init_ts2();
125207
125156
  init_ts_performance();
125208
125157
  minimumDate = /* @__PURE__ */ new Date(-864e13);
125209
125158
  maximumDate = /* @__PURE__ */ new Date(864e13);
@@ -125533,7 +125482,7 @@ ${lanes.join("\n")}
125533
125482
  case 0 /* Ok */:
125534
125483
  return Debug.fail();
125535
125484
  default:
125536
- throw Debug.assertNever(result);
125485
+ Debug.assertNever(result);
125537
125486
  }
125538
125487
  }
125539
125488
  var unprefixedNodeCoreModuleList, prefixedNodeCoreModuleList, nodeCoreModuleList, nodeCoreModules, NameValidationResult, maxPackageNameLength;
@@ -127293,9 +127242,6 @@ ${lanes.join("\n")}
127293
127242
  const { types, checker } = type;
127294
127243
  return types.length === 2 && (areIntersectedTypesAvoidingStringReduction(checker, types[0], types[1]) || areIntersectedTypesAvoidingStringReduction(checker, types[1], types[0]));
127295
127244
  }
127296
- function isPunctuation(kind) {
127297
- return 18 /* FirstPunctuation */ <= kind && kind <= 78 /* LastPunctuation */;
127298
- }
127299
127245
  function isInsideTemplateLiteral(node, position, sourceFile) {
127300
127246
  return isTemplateLiteralKind(node.kind) && (node.getStart(sourceFile) < position && position < node.end) || !!node.isUnterminated && position === node.end;
127301
127247
  }
@@ -128752,6 +128698,7 @@ ${lanes.join("\n")}
128752
128698
  147 /* ReadonlyKeyword */,
128753
128699
  153 /* StringKeyword */,
128754
128700
  154 /* SymbolKeyword */,
128701
+ 113 /* TypeOfKeyword */,
128755
128702
  111 /* TrueKeyword */,
128756
128703
  115 /* VoidKeyword */,
128757
128704
  156 /* UndefinedKeyword */,
@@ -131772,7 +131719,6 @@ ${lanes.join("\n")}
131772
131719
  "src/services/sourcemaps.ts"() {
131773
131720
  "use strict";
131774
131721
  init_ts4();
131775
- init_ts4();
131776
131722
  base64UrlRegExp = /^data:(?:application\/json(?:;charset=[uU][tT][fF]-8);base64,([A-Za-z0-9+\/=]+)$)?/;
131777
131723
  }
131778
131724
  });
@@ -133002,6 +132948,241 @@ ${lanes.join("\n")}
133002
132948
  }
133003
132949
  });
133004
132950
 
132951
+ // src/services/classifier2020.ts
132952
+ function getSemanticClassifications2(program, cancellationToken, sourceFile, span) {
132953
+ const classifications = getEncodedSemanticClassifications2(program, cancellationToken, sourceFile, span);
132954
+ Debug.assert(classifications.spans.length % 3 === 0);
132955
+ const dense = classifications.spans;
132956
+ const result = [];
132957
+ for (let i = 0; i < dense.length; i += 3) {
132958
+ result.push({
132959
+ textSpan: createTextSpan(dense[i], dense[i + 1]),
132960
+ classificationType: dense[i + 2]
132961
+ });
132962
+ }
132963
+ return result;
132964
+ }
132965
+ function getEncodedSemanticClassifications2(program, cancellationToken, sourceFile, span) {
132966
+ return {
132967
+ spans: getSemanticTokens(program, sourceFile, span, cancellationToken),
132968
+ endOfLineState: 0 /* None */
132969
+ };
132970
+ }
132971
+ function getSemanticTokens(program, sourceFile, span, cancellationToken) {
132972
+ const resultTokens = [];
132973
+ const collector = (node, typeIdx, modifierSet) => {
132974
+ resultTokens.push(node.getStart(sourceFile), node.getWidth(sourceFile), (typeIdx + 1 << 8 /* typeOffset */) + modifierSet);
132975
+ };
132976
+ if (program && sourceFile) {
132977
+ collectTokens(program, sourceFile, span, collector, cancellationToken);
132978
+ }
132979
+ return resultTokens;
132980
+ }
132981
+ function collectTokens(program, sourceFile, span, collector, cancellationToken) {
132982
+ const typeChecker = program.getTypeChecker();
132983
+ let inJSXElement = false;
132984
+ function visit(node) {
132985
+ switch (node.kind) {
132986
+ case 265 /* ModuleDeclaration */:
132987
+ case 261 /* ClassDeclaration */:
132988
+ case 262 /* InterfaceDeclaration */:
132989
+ case 260 /* FunctionDeclaration */:
132990
+ case 229 /* ClassExpression */:
132991
+ case 216 /* FunctionExpression */:
132992
+ case 217 /* ArrowFunction */:
132993
+ cancellationToken.throwIfCancellationRequested();
132994
+ }
132995
+ if (!node || !textSpanIntersectsWith(span, node.pos, node.getFullWidth()) || node.getFullWidth() === 0) {
132996
+ return;
132997
+ }
132998
+ const prevInJSXElement = inJSXElement;
132999
+ if (isJsxElement(node) || isJsxSelfClosingElement(node)) {
133000
+ inJSXElement = true;
133001
+ }
133002
+ if (isJsxExpression(node)) {
133003
+ inJSXElement = false;
133004
+ }
133005
+ if (isIdentifier(node) && !inJSXElement && !inImportClause(node) && !isInfinityOrNaNString(node.escapedText)) {
133006
+ let symbol = typeChecker.getSymbolAtLocation(node);
133007
+ if (symbol) {
133008
+ if (symbol.flags & 2097152 /* Alias */) {
133009
+ symbol = typeChecker.getAliasedSymbol(symbol);
133010
+ }
133011
+ let typeIdx = classifySymbol2(symbol, getMeaningFromLocation(node));
133012
+ if (typeIdx !== void 0) {
133013
+ let modifierSet = 0;
133014
+ if (node.parent) {
133015
+ const parentIsDeclaration = isBindingElement(node.parent) || tokenFromDeclarationMapping.get(node.parent.kind) === typeIdx;
133016
+ if (parentIsDeclaration && node.parent.name === node) {
133017
+ modifierSet = 1 << 0 /* declaration */;
133018
+ }
133019
+ }
133020
+ if (typeIdx === 6 /* parameter */ && isRightSideOfQualifiedNameOrPropertyAccess2(node)) {
133021
+ typeIdx = 9 /* property */;
133022
+ }
133023
+ typeIdx = reclassifyByType(typeChecker, node, typeIdx);
133024
+ const decl = symbol.valueDeclaration;
133025
+ if (decl) {
133026
+ const modifiers = getCombinedModifierFlags(decl);
133027
+ const nodeFlags = getCombinedNodeFlags(decl);
133028
+ if (modifiers & 32 /* Static */) {
133029
+ modifierSet |= 1 << 1 /* static */;
133030
+ }
133031
+ if (modifiers & 512 /* Async */) {
133032
+ modifierSet |= 1 << 2 /* async */;
133033
+ }
133034
+ if (typeIdx !== 0 /* class */ && typeIdx !== 2 /* interface */) {
133035
+ if (modifiers & 64 /* Readonly */ || nodeFlags & 2 /* Const */ || symbol.getFlags() & 8 /* EnumMember */) {
133036
+ modifierSet |= 1 << 3 /* readonly */;
133037
+ }
133038
+ }
133039
+ if ((typeIdx === 7 /* variable */ || typeIdx === 10 /* function */) && isLocalDeclaration(decl, sourceFile)) {
133040
+ modifierSet |= 1 << 5 /* local */;
133041
+ }
133042
+ if (program.isSourceFileDefaultLibrary(decl.getSourceFile())) {
133043
+ modifierSet |= 1 << 4 /* defaultLibrary */;
133044
+ }
133045
+ } else if (symbol.declarations && symbol.declarations.some((d) => program.isSourceFileDefaultLibrary(d.getSourceFile()))) {
133046
+ modifierSet |= 1 << 4 /* defaultLibrary */;
133047
+ }
133048
+ collector(node, typeIdx, modifierSet);
133049
+ }
133050
+ }
133051
+ }
133052
+ forEachChild(node, visit);
133053
+ inJSXElement = prevInJSXElement;
133054
+ }
133055
+ visit(sourceFile);
133056
+ }
133057
+ function classifySymbol2(symbol, meaning) {
133058
+ const flags = symbol.getFlags();
133059
+ if (flags & 32 /* Class */) {
133060
+ return 0 /* class */;
133061
+ } else if (flags & 384 /* Enum */) {
133062
+ return 1 /* enum */;
133063
+ } else if (flags & 524288 /* TypeAlias */) {
133064
+ return 5 /* type */;
133065
+ } else if (flags & 64 /* Interface */) {
133066
+ if (meaning & 2 /* Type */) {
133067
+ return 2 /* interface */;
133068
+ }
133069
+ } else if (flags & 262144 /* TypeParameter */) {
133070
+ return 4 /* typeParameter */;
133071
+ }
133072
+ let decl = symbol.valueDeclaration || symbol.declarations && symbol.declarations[0];
133073
+ if (decl && isBindingElement(decl)) {
133074
+ decl = getDeclarationForBindingElement(decl);
133075
+ }
133076
+ return decl && tokenFromDeclarationMapping.get(decl.kind);
133077
+ }
133078
+ function reclassifyByType(typeChecker, node, typeIdx) {
133079
+ if (typeIdx === 7 /* variable */ || typeIdx === 9 /* property */ || typeIdx === 6 /* parameter */) {
133080
+ const type = typeChecker.getTypeAtLocation(node);
133081
+ if (type) {
133082
+ const test = (condition) => {
133083
+ return condition(type) || type.isUnion() && type.types.some(condition);
133084
+ };
133085
+ if (typeIdx !== 6 /* parameter */ && test((t) => t.getConstructSignatures().length > 0)) {
133086
+ return 0 /* class */;
133087
+ }
133088
+ if (test((t) => t.getCallSignatures().length > 0) && !test((t) => t.getProperties().length > 0) || isExpressionInCallExpression(node)) {
133089
+ return typeIdx === 9 /* property */ ? 11 /* member */ : 10 /* function */;
133090
+ }
133091
+ }
133092
+ }
133093
+ return typeIdx;
133094
+ }
133095
+ function isLocalDeclaration(decl, sourceFile) {
133096
+ if (isBindingElement(decl)) {
133097
+ decl = getDeclarationForBindingElement(decl);
133098
+ }
133099
+ if (isVariableDeclaration(decl)) {
133100
+ return (!isSourceFile(decl.parent.parent.parent) || isCatchClause(decl.parent)) && decl.getSourceFile() === sourceFile;
133101
+ } else if (isFunctionDeclaration(decl)) {
133102
+ return !isSourceFile(decl.parent) && decl.getSourceFile() === sourceFile;
133103
+ }
133104
+ return false;
133105
+ }
133106
+ function getDeclarationForBindingElement(element) {
133107
+ while (true) {
133108
+ if (isBindingElement(element.parent.parent)) {
133109
+ element = element.parent.parent;
133110
+ } else {
133111
+ return element.parent.parent;
133112
+ }
133113
+ }
133114
+ }
133115
+ function inImportClause(node) {
133116
+ const parent2 = node.parent;
133117
+ return parent2 && (isImportClause(parent2) || isImportSpecifier(parent2) || isNamespaceImport(parent2));
133118
+ }
133119
+ function isExpressionInCallExpression(node) {
133120
+ while (isRightSideOfQualifiedNameOrPropertyAccess2(node)) {
133121
+ node = node.parent;
133122
+ }
133123
+ return isCallExpression(node.parent) && node.parent.expression === node;
133124
+ }
133125
+ function isRightSideOfQualifiedNameOrPropertyAccess2(node) {
133126
+ return isQualifiedName(node.parent) && node.parent.right === node || isPropertyAccessExpression(node.parent) && node.parent.name === node;
133127
+ }
133128
+ var TokenEncodingConsts, TokenType, TokenModifier, tokenFromDeclarationMapping;
133129
+ var init_classifier2020 = __esm({
133130
+ "src/services/classifier2020.ts"() {
133131
+ "use strict";
133132
+ init_ts4();
133133
+ TokenEncodingConsts = /* @__PURE__ */ ((TokenEncodingConsts2) => {
133134
+ TokenEncodingConsts2[TokenEncodingConsts2["typeOffset"] = 8] = "typeOffset";
133135
+ TokenEncodingConsts2[TokenEncodingConsts2["modifierMask"] = 255] = "modifierMask";
133136
+ return TokenEncodingConsts2;
133137
+ })(TokenEncodingConsts || {});
133138
+ TokenType = /* @__PURE__ */ ((TokenType2) => {
133139
+ TokenType2[TokenType2["class"] = 0] = "class";
133140
+ TokenType2[TokenType2["enum"] = 1] = "enum";
133141
+ TokenType2[TokenType2["interface"] = 2] = "interface";
133142
+ TokenType2[TokenType2["namespace"] = 3] = "namespace";
133143
+ TokenType2[TokenType2["typeParameter"] = 4] = "typeParameter";
133144
+ TokenType2[TokenType2["type"] = 5] = "type";
133145
+ TokenType2[TokenType2["parameter"] = 6] = "parameter";
133146
+ TokenType2[TokenType2["variable"] = 7] = "variable";
133147
+ TokenType2[TokenType2["enumMember"] = 8] = "enumMember";
133148
+ TokenType2[TokenType2["property"] = 9] = "property";
133149
+ TokenType2[TokenType2["function"] = 10] = "function";
133150
+ TokenType2[TokenType2["member"] = 11] = "member";
133151
+ return TokenType2;
133152
+ })(TokenType || {});
133153
+ TokenModifier = /* @__PURE__ */ ((TokenModifier2) => {
133154
+ TokenModifier2[TokenModifier2["declaration"] = 0] = "declaration";
133155
+ TokenModifier2[TokenModifier2["static"] = 1] = "static";
133156
+ TokenModifier2[TokenModifier2["async"] = 2] = "async";
133157
+ TokenModifier2[TokenModifier2["readonly"] = 3] = "readonly";
133158
+ TokenModifier2[TokenModifier2["defaultLibrary"] = 4] = "defaultLibrary";
133159
+ TokenModifier2[TokenModifier2["local"] = 5] = "local";
133160
+ return TokenModifier2;
133161
+ })(TokenModifier || {});
133162
+ tokenFromDeclarationMapping = /* @__PURE__ */ new Map([
133163
+ [258 /* VariableDeclaration */, 7 /* variable */],
133164
+ [167 /* Parameter */, 6 /* parameter */],
133165
+ [170 /* PropertyDeclaration */, 9 /* property */],
133166
+ [265 /* ModuleDeclaration */, 3 /* namespace */],
133167
+ [264 /* EnumDeclaration */, 1 /* enum */],
133168
+ [303 /* EnumMember */, 8 /* enumMember */],
133169
+ [261 /* ClassDeclaration */, 0 /* class */],
133170
+ [172 /* MethodDeclaration */, 11 /* member */],
133171
+ [260 /* FunctionDeclaration */, 10 /* function */],
133172
+ [216 /* FunctionExpression */, 10 /* function */],
133173
+ [171 /* MethodSignature */, 11 /* member */],
133174
+ [175 /* GetAccessor */, 9 /* property */],
133175
+ [176 /* SetAccessor */, 9 /* property */],
133176
+ [169 /* PropertySignature */, 9 /* property */],
133177
+ [262 /* InterfaceDeclaration */, 2 /* interface */],
133178
+ [263 /* TypeAliasDeclaration */, 5 /* type */],
133179
+ [166 /* TypeParameter */, 4 /* typeParameter */],
133180
+ [300 /* PropertyAssignment */, 9 /* property */],
133181
+ [301 /* ShorthandPropertyAssignment */, 9 /* property */]
133182
+ ]);
133183
+ }
133184
+ });
133185
+
133005
133186
  // src/services/services.ts
133006
133187
  function createNode(kind, pos, end, parent2) {
133007
133188
  const node = isNodeKind(kind) ? new NodeObject(kind, pos, end) : kind === 79 /* Identifier */ ? new IdentifierObject(79 /* Identifier */, pos, end) : kind === 80 /* PrivateIdentifier */ ? new PrivateIdentifierObject(80 /* PrivateIdentifier */, pos, end) : new TokenObject(kind, pos, end);
@@ -133768,7 +133949,7 @@ ${lanes.join("\n")}
133768
133949
  synchronizeHostData();
133769
133950
  const responseFormat = format || "original" /* Original */;
133770
133951
  if (responseFormat === "2020" /* TwentyTwenty */) {
133771
- return ts_classifier_exports.v2020.getSemanticClassifications(program, cancellationToken, getValidSourceFile(fileName), span);
133952
+ return getSemanticClassifications2(program, cancellationToken, getValidSourceFile(fileName), span);
133772
133953
  } else {
133773
133954
  return getSemanticClassifications(program.getTypeChecker(), cancellationToken, getValidSourceFile(fileName), program.getClassifiableNames(), span);
133774
133955
  }
@@ -133779,7 +133960,7 @@ ${lanes.join("\n")}
133779
133960
  if (responseFormat === "original" /* Original */) {
133780
133961
  return getEncodedSemanticClassifications(program.getTypeChecker(), cancellationToken, getValidSourceFile(fileName), program.getClassifiableNames(), span);
133781
133962
  } else {
133782
- return ts_classifier_exports.v2020.getEncodedSemanticClassifications(program, cancellationToken, getValidSourceFile(fileName), span);
133963
+ return getEncodedSemanticClassifications2(program, cancellationToken, getValidSourceFile(fileName), span);
133783
133964
  }
133784
133965
  }
133785
133966
  function getSyntacticClassifications2(fileName, span) {
@@ -134439,9 +134620,10 @@ ${lanes.join("\n")}
134439
134620
  "src/services/services.ts"() {
134440
134621
  "use strict";
134441
134622
  init_ts4();
134442
- init_ts4();
134443
134623
  init_ts_NavigateTo();
134444
134624
  init_ts_NavigationBar();
134625
+ init_classifier();
134626
+ init_classifier2020();
134445
134627
  servicesVersion = "0.8";
134446
134628
  NodeObject = class {
134447
134629
  constructor(kind, pos, end) {
@@ -137043,241 +137225,6 @@ ${lanes.join("\n")}
137043
137225
  }
137044
137226
  });
137045
137227
 
137046
- // src/services/classifier2020.ts
137047
- function getSemanticClassifications2(program, cancellationToken, sourceFile, span) {
137048
- const classifications = getEncodedSemanticClassifications2(program, cancellationToken, sourceFile, span);
137049
- Debug.assert(classifications.spans.length % 3 === 0);
137050
- const dense = classifications.spans;
137051
- const result = [];
137052
- for (let i = 0; i < dense.length; i += 3) {
137053
- result.push({
137054
- textSpan: createTextSpan(dense[i], dense[i + 1]),
137055
- classificationType: dense[i + 2]
137056
- });
137057
- }
137058
- return result;
137059
- }
137060
- function getEncodedSemanticClassifications2(program, cancellationToken, sourceFile, span) {
137061
- return {
137062
- spans: getSemanticTokens(program, sourceFile, span, cancellationToken),
137063
- endOfLineState: 0 /* None */
137064
- };
137065
- }
137066
- function getSemanticTokens(program, sourceFile, span, cancellationToken) {
137067
- const resultTokens = [];
137068
- const collector = (node, typeIdx, modifierSet) => {
137069
- resultTokens.push(node.getStart(sourceFile), node.getWidth(sourceFile), (typeIdx + 1 << 8 /* typeOffset */) + modifierSet);
137070
- };
137071
- if (program && sourceFile) {
137072
- collectTokens(program, sourceFile, span, collector, cancellationToken);
137073
- }
137074
- return resultTokens;
137075
- }
137076
- function collectTokens(program, sourceFile, span, collector, cancellationToken) {
137077
- const typeChecker = program.getTypeChecker();
137078
- let inJSXElement = false;
137079
- function visit(node) {
137080
- switch (node.kind) {
137081
- case 265 /* ModuleDeclaration */:
137082
- case 261 /* ClassDeclaration */:
137083
- case 262 /* InterfaceDeclaration */:
137084
- case 260 /* FunctionDeclaration */:
137085
- case 229 /* ClassExpression */:
137086
- case 216 /* FunctionExpression */:
137087
- case 217 /* ArrowFunction */:
137088
- cancellationToken.throwIfCancellationRequested();
137089
- }
137090
- if (!node || !textSpanIntersectsWith(span, node.pos, node.getFullWidth()) || node.getFullWidth() === 0) {
137091
- return;
137092
- }
137093
- const prevInJSXElement = inJSXElement;
137094
- if (isJsxElement(node) || isJsxSelfClosingElement(node)) {
137095
- inJSXElement = true;
137096
- }
137097
- if (isJsxExpression(node)) {
137098
- inJSXElement = false;
137099
- }
137100
- if (isIdentifier(node) && !inJSXElement && !inImportClause(node) && !isInfinityOrNaNString(node.escapedText)) {
137101
- let symbol = typeChecker.getSymbolAtLocation(node);
137102
- if (symbol) {
137103
- if (symbol.flags & 2097152 /* Alias */) {
137104
- symbol = typeChecker.getAliasedSymbol(symbol);
137105
- }
137106
- let typeIdx = classifySymbol2(symbol, getMeaningFromLocation(node));
137107
- if (typeIdx !== void 0) {
137108
- let modifierSet = 0;
137109
- if (node.parent) {
137110
- const parentIsDeclaration = isBindingElement(node.parent) || tokenFromDeclarationMapping.get(node.parent.kind) === typeIdx;
137111
- if (parentIsDeclaration && node.parent.name === node) {
137112
- modifierSet = 1 << 0 /* declaration */;
137113
- }
137114
- }
137115
- if (typeIdx === 6 /* parameter */ && isRightSideOfQualifiedNameOrPropertyAccess2(node)) {
137116
- typeIdx = 9 /* property */;
137117
- }
137118
- typeIdx = reclassifyByType(typeChecker, node, typeIdx);
137119
- const decl = symbol.valueDeclaration;
137120
- if (decl) {
137121
- const modifiers = getCombinedModifierFlags(decl);
137122
- const nodeFlags = getCombinedNodeFlags(decl);
137123
- if (modifiers & 32 /* Static */) {
137124
- modifierSet |= 1 << 1 /* static */;
137125
- }
137126
- if (modifiers & 512 /* Async */) {
137127
- modifierSet |= 1 << 2 /* async */;
137128
- }
137129
- if (typeIdx !== 0 /* class */ && typeIdx !== 2 /* interface */) {
137130
- if (modifiers & 64 /* Readonly */ || nodeFlags & 2 /* Const */ || symbol.getFlags() & 8 /* EnumMember */) {
137131
- modifierSet |= 1 << 3 /* readonly */;
137132
- }
137133
- }
137134
- if ((typeIdx === 7 /* variable */ || typeIdx === 10 /* function */) && isLocalDeclaration(decl, sourceFile)) {
137135
- modifierSet |= 1 << 5 /* local */;
137136
- }
137137
- if (program.isSourceFileDefaultLibrary(decl.getSourceFile())) {
137138
- modifierSet |= 1 << 4 /* defaultLibrary */;
137139
- }
137140
- } else if (symbol.declarations && symbol.declarations.some((d) => program.isSourceFileDefaultLibrary(d.getSourceFile()))) {
137141
- modifierSet |= 1 << 4 /* defaultLibrary */;
137142
- }
137143
- collector(node, typeIdx, modifierSet);
137144
- }
137145
- }
137146
- }
137147
- forEachChild(node, visit);
137148
- inJSXElement = prevInJSXElement;
137149
- }
137150
- visit(sourceFile);
137151
- }
137152
- function classifySymbol2(symbol, meaning) {
137153
- const flags = symbol.getFlags();
137154
- if (flags & 32 /* Class */) {
137155
- return 0 /* class */;
137156
- } else if (flags & 384 /* Enum */) {
137157
- return 1 /* enum */;
137158
- } else if (flags & 524288 /* TypeAlias */) {
137159
- return 5 /* type */;
137160
- } else if (flags & 64 /* Interface */) {
137161
- if (meaning & 2 /* Type */) {
137162
- return 2 /* interface */;
137163
- }
137164
- } else if (flags & 262144 /* TypeParameter */) {
137165
- return 4 /* typeParameter */;
137166
- }
137167
- let decl = symbol.valueDeclaration || symbol.declarations && symbol.declarations[0];
137168
- if (decl && isBindingElement(decl)) {
137169
- decl = getDeclarationForBindingElement(decl);
137170
- }
137171
- return decl && tokenFromDeclarationMapping.get(decl.kind);
137172
- }
137173
- function reclassifyByType(typeChecker, node, typeIdx) {
137174
- if (typeIdx === 7 /* variable */ || typeIdx === 9 /* property */ || typeIdx === 6 /* parameter */) {
137175
- const type = typeChecker.getTypeAtLocation(node);
137176
- if (type) {
137177
- const test = (condition) => {
137178
- return condition(type) || type.isUnion() && type.types.some(condition);
137179
- };
137180
- if (typeIdx !== 6 /* parameter */ && test((t) => t.getConstructSignatures().length > 0)) {
137181
- return 0 /* class */;
137182
- }
137183
- if (test((t) => t.getCallSignatures().length > 0) && !test((t) => t.getProperties().length > 0) || isExpressionInCallExpression(node)) {
137184
- return typeIdx === 9 /* property */ ? 11 /* member */ : 10 /* function */;
137185
- }
137186
- }
137187
- }
137188
- return typeIdx;
137189
- }
137190
- function isLocalDeclaration(decl, sourceFile) {
137191
- if (isBindingElement(decl)) {
137192
- decl = getDeclarationForBindingElement(decl);
137193
- }
137194
- if (isVariableDeclaration(decl)) {
137195
- return (!isSourceFile(decl.parent.parent.parent) || isCatchClause(decl.parent)) && decl.getSourceFile() === sourceFile;
137196
- } else if (isFunctionDeclaration(decl)) {
137197
- return !isSourceFile(decl.parent) && decl.getSourceFile() === sourceFile;
137198
- }
137199
- return false;
137200
- }
137201
- function getDeclarationForBindingElement(element) {
137202
- while (true) {
137203
- if (isBindingElement(element.parent.parent)) {
137204
- element = element.parent.parent;
137205
- } else {
137206
- return element.parent.parent;
137207
- }
137208
- }
137209
- }
137210
- function inImportClause(node) {
137211
- const parent2 = node.parent;
137212
- return parent2 && (isImportClause(parent2) || isImportSpecifier(parent2) || isNamespaceImport(parent2));
137213
- }
137214
- function isExpressionInCallExpression(node) {
137215
- while (isRightSideOfQualifiedNameOrPropertyAccess2(node)) {
137216
- node = node.parent;
137217
- }
137218
- return isCallExpression(node.parent) && node.parent.expression === node;
137219
- }
137220
- function isRightSideOfQualifiedNameOrPropertyAccess2(node) {
137221
- return isQualifiedName(node.parent) && node.parent.right === node || isPropertyAccessExpression(node.parent) && node.parent.name === node;
137222
- }
137223
- var TokenEncodingConsts, TokenType, TokenModifier, tokenFromDeclarationMapping;
137224
- var init_classifier2020 = __esm({
137225
- "src/services/classifier2020.ts"() {
137226
- "use strict";
137227
- init_ts4();
137228
- TokenEncodingConsts = /* @__PURE__ */ ((TokenEncodingConsts2) => {
137229
- TokenEncodingConsts2[TokenEncodingConsts2["typeOffset"] = 8] = "typeOffset";
137230
- TokenEncodingConsts2[TokenEncodingConsts2["modifierMask"] = 255] = "modifierMask";
137231
- return TokenEncodingConsts2;
137232
- })(TokenEncodingConsts || {});
137233
- TokenType = /* @__PURE__ */ ((TokenType2) => {
137234
- TokenType2[TokenType2["class"] = 0] = "class";
137235
- TokenType2[TokenType2["enum"] = 1] = "enum";
137236
- TokenType2[TokenType2["interface"] = 2] = "interface";
137237
- TokenType2[TokenType2["namespace"] = 3] = "namespace";
137238
- TokenType2[TokenType2["typeParameter"] = 4] = "typeParameter";
137239
- TokenType2[TokenType2["type"] = 5] = "type";
137240
- TokenType2[TokenType2["parameter"] = 6] = "parameter";
137241
- TokenType2[TokenType2["variable"] = 7] = "variable";
137242
- TokenType2[TokenType2["enumMember"] = 8] = "enumMember";
137243
- TokenType2[TokenType2["property"] = 9] = "property";
137244
- TokenType2[TokenType2["function"] = 10] = "function";
137245
- TokenType2[TokenType2["member"] = 11] = "member";
137246
- return TokenType2;
137247
- })(TokenType || {});
137248
- TokenModifier = /* @__PURE__ */ ((TokenModifier2) => {
137249
- TokenModifier2[TokenModifier2["declaration"] = 0] = "declaration";
137250
- TokenModifier2[TokenModifier2["static"] = 1] = "static";
137251
- TokenModifier2[TokenModifier2["async"] = 2] = "async";
137252
- TokenModifier2[TokenModifier2["readonly"] = 3] = "readonly";
137253
- TokenModifier2[TokenModifier2["defaultLibrary"] = 4] = "defaultLibrary";
137254
- TokenModifier2[TokenModifier2["local"] = 5] = "local";
137255
- return TokenModifier2;
137256
- })(TokenModifier || {});
137257
- tokenFromDeclarationMapping = /* @__PURE__ */ new Map([
137258
- [258 /* VariableDeclaration */, 7 /* variable */],
137259
- [167 /* Parameter */, 6 /* parameter */],
137260
- [170 /* PropertyDeclaration */, 9 /* property */],
137261
- [265 /* ModuleDeclaration */, 3 /* namespace */],
137262
- [264 /* EnumDeclaration */, 1 /* enum */],
137263
- [303 /* EnumMember */, 8 /* enumMember */],
137264
- [261 /* ClassDeclaration */, 0 /* class */],
137265
- [172 /* MethodDeclaration */, 11 /* member */],
137266
- [260 /* FunctionDeclaration */, 10 /* function */],
137267
- [216 /* FunctionExpression */, 10 /* function */],
137268
- [171 /* MethodSignature */, 11 /* member */],
137269
- [175 /* GetAccessor */, 9 /* property */],
137270
- [176 /* SetAccessor */, 9 /* property */],
137271
- [169 /* PropertySignature */, 9 /* property */],
137272
- [262 /* InterfaceDeclaration */, 2 /* interface */],
137273
- [263 /* TypeAliasDeclaration */, 5 /* type */],
137274
- [166 /* TypeParameter */, 4 /* typeParameter */],
137275
- [300 /* PropertyAssignment */, 9 /* property */],
137276
- [301 /* ShorthandPropertyAssignment */, 9 /* property */]
137277
- ]);
137278
- }
137279
- });
137280
-
137281
137228
  // src/services/_namespaces/ts.classifier.v2020.ts
137282
137229
  var ts_classifier_v2020_exports = {};
137283
137230
  __export(ts_classifier_v2020_exports, {
@@ -147049,7 +146996,7 @@ ${lanes.join("\n")}
147049
146996
  /*checkArgumentIsStringLiteralLike*/
147050
146997
  true
147051
146998
  )) {
147052
- throw Debug.failBadSyntaxKind(parent2);
146999
+ Debug.failBadSyntaxKind(parent2);
147053
147000
  }
147054
147001
  const decl = cast(parent2.parent, isVariableDeclaration);
147055
147002
  const defaultImportName = tryCast(decl.name, isIdentifier);
@@ -150515,7 +150462,7 @@ ${lanes.join("\n")}
150515
150462
  return true;
150516
150463
  }
150517
150464
  }
150518
- return isDeclarationName(contextToken2) && !isShorthandPropertyAssignment(contextToken2.parent) && !isJsxAttribute(contextToken2.parent) && !(isClassLike(contextToken2.parent) && (contextToken2 !== previousToken || position > previousToken.end));
150465
+ return isDeclarationName(contextToken2) && !isShorthandPropertyAssignment(contextToken2.parent) && !isJsxAttribute(contextToken2.parent) && !((isClassLike(contextToken2.parent) || isInterfaceDeclaration(contextToken2.parent)) && (contextToken2 !== previousToken || position > previousToken.end));
150519
150466
  }
150520
150467
  function isPreviousPropertyDeclarationTerminated(contextToken2, position2) {
150521
150468
  return contextToken2.kind !== 63 /* EqualsToken */ && (contextToken2.kind === 26 /* SemicolonToken */ || !positionsAreOnSameLine(contextToken2.end, position2, sourceFile));
@@ -160665,7 +160612,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
160665
160612
  case 176 /* SetAccessor */:
160666
160613
  return `'set ${scope.name.getText()}'`;
160667
160614
  default:
160668
- throw Debug.assertNever(scope, `Unexpected scope kind ${scope.kind}`);
160615
+ Debug.assertNever(scope, `Unexpected scope kind ${scope.kind}`);
160669
160616
  }
160670
160617
  }
160671
160618
  function getDescriptionForClassLikeDeclaration(scope) {
@@ -167868,8 +167815,8 @@ ${options.prefix}` : "\n" : options.prefix
167868
167815
  });
167869
167816
 
167870
167817
  // src/typescript/_namespaces/ts.ts
167871
- var ts_exports3 = {};
167872
- __export(ts_exports3, {
167818
+ var ts_exports2 = {};
167819
+ __export(ts_exports2, {
167873
167820
  ANONYMOUS: () => ANONYMOUS,
167874
167821
  AccessFlags: () => AccessFlags,
167875
167822
  AssertionLevel: () => AssertionLevel,
@@ -168172,8 +168119,8 @@ ${options.prefix}` : "\n" : options.prefix
168172
168119
  convertCompilerOptionsFromJson: () => convertCompilerOptionsFromJson,
168173
168120
  convertJsonOption: () => convertJsonOption,
168174
168121
  convertToBase64: () => convertToBase64,
168122
+ convertToJson: () => convertToJson,
168175
168123
  convertToObject: () => convertToObject,
168176
- convertToObjectWorker: () => convertToObjectWorker,
168177
168124
  convertToOptionsWithAbsolutePaths: () => convertToOptionsWithAbsolutePaths,
168178
168125
  convertToRelativePath: () => convertToRelativePath,
168179
168126
  convertToTSConfig: () => convertToTSConfig,
@@ -168438,10 +168385,12 @@ ${options.prefix}` : "\n" : options.prefix
168438
168385
  forEachKey: () => forEachKey,
168439
168386
  forEachLeadingCommentRange: () => forEachLeadingCommentRange,
168440
168387
  forEachNameInAccessChainWalkingLeft: () => forEachNameInAccessChainWalkingLeft,
168388
+ forEachPropertyAssignment: () => forEachPropertyAssignment,
168441
168389
  forEachResolvedProjectReference: () => forEachResolvedProjectReference,
168442
168390
  forEachReturnStatement: () => forEachReturnStatement,
168443
168391
  forEachRight: () => forEachRight,
168444
168392
  forEachTrailingCommentRange: () => forEachTrailingCommentRange,
168393
+ forEachTsConfigPropArray: () => forEachTsConfigPropArray,
168445
168394
  forEachUnique: () => forEachUnique,
168446
168395
  forEachYieldExpression: () => forEachYieldExpression,
168447
168396
  forSomeAncestorDirectory: () => forSomeAncestorDirectory,
@@ -168774,7 +168723,6 @@ ${options.prefix}` : "\n" : options.prefix
168774
168723
  getProperties: () => getProperties,
168775
168724
  getProperty: () => getProperty,
168776
168725
  getPropertyArrayElementValue: () => getPropertyArrayElementValue,
168777
- getPropertyAssignment: () => getPropertyAssignment,
168778
168726
  getPropertyAssignmentAliasLikeExpression: () => getPropertyAssignmentAliasLikeExpression,
168779
168727
  getPropertyNameForPropertyNameNode: () => getPropertyNameForPropertyNameNode,
168780
168728
  getPropertyNameForUniqueESSymbol: () => getPropertyNameForUniqueESSymbol,
@@ -168879,7 +168827,6 @@ ${options.prefix}` : "\n" : options.prefix
168879
168827
  getTransformers: () => getTransformers,
168880
168828
  getTsBuildInfoEmitOutputFilePath: () => getTsBuildInfoEmitOutputFilePath,
168881
168829
  getTsConfigObjectLiteralExpression: () => getTsConfigObjectLiteralExpression,
168882
- getTsConfigPropArray: () => getTsConfigPropArray,
168883
168830
  getTsConfigPropArrayElementValue: () => getTsConfigPropArrayElementValue,
168884
168831
  getTypeAnnotationNode: () => getTypeAnnotationNode,
168885
168832
  getTypeArgumentOrTypeParameterList: () => getTypeArgumentOrTypeParameterList,
@@ -169319,6 +169266,7 @@ ${options.prefix}` : "\n" : options.prefix
169319
169266
  isJsxText: () => isJsxText,
169320
169267
  isJumpStatementTarget: () => isJumpStatementTarget,
169321
169268
  isKeyword: () => isKeyword,
169269
+ isKeywordOrPunctuation: () => isKeywordOrPunctuation,
169322
169270
  isKnownSymbol: () => isKnownSymbol,
169323
169271
  isLabelName: () => isLabelName,
169324
169272
  isLabelOfLabeledStatement: () => isLabelOfLabeledStatement,
@@ -170146,7 +170094,7 @@ ${options.prefix}` : "\n" : options.prefix
170146
170094
  }
170147
170095
  };
170148
170096
  }
170149
- module2.exports = ts_exports3;
170097
+ module2.exports = ts_exports2;
170150
170098
  }
170151
170099
  });
170152
170100
  return require_typescript();