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/tsserver.js CHANGED
@@ -338,8 +338,8 @@ __export(server_exports, {
338
338
  convertCompilerOptionsFromJson: () => convertCompilerOptionsFromJson,
339
339
  convertJsonOption: () => convertJsonOption,
340
340
  convertToBase64: () => convertToBase64,
341
+ convertToJson: () => convertToJson,
341
342
  convertToObject: () => convertToObject,
342
- convertToObjectWorker: () => convertToObjectWorker,
343
343
  convertToOptionsWithAbsolutePaths: () => convertToOptionsWithAbsolutePaths,
344
344
  convertToRelativePath: () => convertToRelativePath,
345
345
  convertToTSConfig: () => convertToTSConfig,
@@ -604,10 +604,12 @@ __export(server_exports, {
604
604
  forEachKey: () => forEachKey,
605
605
  forEachLeadingCommentRange: () => forEachLeadingCommentRange,
606
606
  forEachNameInAccessChainWalkingLeft: () => forEachNameInAccessChainWalkingLeft,
607
+ forEachPropertyAssignment: () => forEachPropertyAssignment,
607
608
  forEachResolvedProjectReference: () => forEachResolvedProjectReference,
608
609
  forEachReturnStatement: () => forEachReturnStatement,
609
610
  forEachRight: () => forEachRight,
610
611
  forEachTrailingCommentRange: () => forEachTrailingCommentRange,
612
+ forEachTsConfigPropArray: () => forEachTsConfigPropArray,
611
613
  forEachUnique: () => forEachUnique,
612
614
  forEachYieldExpression: () => forEachYieldExpression,
613
615
  forSomeAncestorDirectory: () => forSomeAncestorDirectory,
@@ -940,7 +942,6 @@ __export(server_exports, {
940
942
  getProperties: () => getProperties,
941
943
  getProperty: () => getProperty,
942
944
  getPropertyArrayElementValue: () => getPropertyArrayElementValue,
943
- getPropertyAssignment: () => getPropertyAssignment,
944
945
  getPropertyAssignmentAliasLikeExpression: () => getPropertyAssignmentAliasLikeExpression,
945
946
  getPropertyNameForPropertyNameNode: () => getPropertyNameForPropertyNameNode,
946
947
  getPropertyNameForUniqueESSymbol: () => getPropertyNameForUniqueESSymbol,
@@ -1045,7 +1046,6 @@ __export(server_exports, {
1045
1046
  getTransformers: () => getTransformers,
1046
1047
  getTsBuildInfoEmitOutputFilePath: () => getTsBuildInfoEmitOutputFilePath,
1047
1048
  getTsConfigObjectLiteralExpression: () => getTsConfigObjectLiteralExpression,
1048
- getTsConfigPropArray: () => getTsConfigPropArray,
1049
1049
  getTsConfigPropArrayElementValue: () => getTsConfigPropArrayElementValue,
1050
1050
  getTypeAnnotationNode: () => getTypeAnnotationNode,
1051
1051
  getTypeArgumentOrTypeParameterList: () => getTypeArgumentOrTypeParameterList,
@@ -1485,6 +1485,7 @@ __export(server_exports, {
1485
1485
  isJsxText: () => isJsxText,
1486
1486
  isJumpStatementTarget: () => isJumpStatementTarget,
1487
1487
  isKeyword: () => isKeyword,
1488
+ isKeywordOrPunctuation: () => isKeywordOrPunctuation,
1488
1489
  isKnownSymbol: () => isKnownSymbol,
1489
1490
  isLabelName: () => isLabelName,
1490
1491
  isLabelOfLabeledStatement: () => isLabelOfLabeledStatement,
@@ -2285,7 +2286,7 @@ module.exports = __toCommonJS(server_exports);
2285
2286
 
2286
2287
  // src/compiler/corePublic.ts
2287
2288
  var versionMajorMinor = "5.1";
2288
- var version = `${versionMajorMinor}.0-dev.20230320`;
2289
+ var version = `${versionMajorMinor}.0-dev.20230322`;
2289
2290
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2290
2291
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2291
2292
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -10120,6 +10121,7 @@ var Diagnostics = {
10120
10121
  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?"),
10121
10122
  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."),
10122
10123
  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."),
10124
+ 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}."),
10123
10125
  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}'."),
10124
10126
  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}'."),
10125
10127
  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}'."),
@@ -10565,13 +10567,14 @@ var Diagnostics = {
10565
10567
  Output_Formatting: diag(6256, 3 /* Message */, "Output_Formatting_6256", "Output Formatting"),
10566
10568
  Completeness: diag(6257, 3 /* Message */, "Completeness_6257", "Completeness"),
10567
10569
  _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"),
10568
- Found_1_error_in_1: diag(6259, 3 /* Message */, "Found_1_error_in_1_6259", "Found 1 error in {1}"),
10570
+ Found_1_error_in_0: diag(6259, 3 /* Message */, "Found_1_error_in_0_6259", "Found 1 error in {0}"),
10569
10571
  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}"),
10570
10572
  Found_0_errors_in_1_files: diag(6261, 3 /* Message */, "Found_0_errors_in_1_files_6261", "Found {0} errors in {1} files."),
10571
10573
  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."),
10572
10574
  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."),
10573
10575
  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."),
10574
10576
  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."),
10577
+ 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."),
10575
10578
  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."),
10576
10579
  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}'."),
10577
10580
  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."),
@@ -16031,17 +16034,17 @@ function entityNameToString(name) {
16031
16034
  return Debug.assertNever(name);
16032
16035
  }
16033
16036
  }
16034
- function createDiagnosticForNode(node, message, arg0, arg1, arg2, arg3) {
16037
+ function createDiagnosticForNode(node, message, ...args) {
16035
16038
  const sourceFile = getSourceFileOfNode(node);
16036
- return createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2, arg3);
16039
+ return createDiagnosticForNodeInSourceFile(sourceFile, node, message, ...args);
16037
16040
  }
16038
- function createDiagnosticForNodeArray(sourceFile, nodes, message, arg0, arg1, arg2, arg3) {
16041
+ function createDiagnosticForNodeArray(sourceFile, nodes, message, ...args) {
16039
16042
  const start2 = skipTrivia(sourceFile.text, nodes.pos);
16040
- return createFileDiagnostic(sourceFile, start2, nodes.end - start2, message, arg0, arg1, arg2, arg3);
16043
+ return createFileDiagnostic(sourceFile, start2, nodes.end - start2, message, ...args);
16041
16044
  }
16042
- function createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2, arg3) {
16045
+ function createDiagnosticForNodeInSourceFile(sourceFile, node, message, ...args) {
16043
16046
  const span = getErrorSpanForNode(sourceFile, node);
16044
- return createFileDiagnostic(sourceFile, span.start, span.length, message, arg0, arg1, arg2, arg3);
16047
+ return createFileDiagnostic(sourceFile, span.start, span.length, message, ...args);
16045
16048
  }
16046
16049
  function createDiagnosticForNodeFromMessageChain(sourceFile, node, messageChain, relatedInformation) {
16047
16050
  const span = getErrorSpanForNode(sourceFile, node);
@@ -16498,17 +16501,20 @@ function isIdentifierTypePredicate(predicate) {
16498
16501
  function isThisTypePredicate(predicate) {
16499
16502
  return predicate && predicate.kind === 0 /* This */;
16500
16503
  }
16501
- function getPropertyAssignment(objectLiteral, key, key2) {
16502
- return objectLiteral.properties.filter((property) => {
16503
- if (property.kind === 300 /* PropertyAssignment */) {
16504
- const propName = tryGetTextOfPropertyName(property.name);
16505
- return key === propName || !!key2 && key2 === propName;
16506
- }
16507
- return false;
16504
+ function forEachPropertyAssignment(objectLiteral, key, callback, key2) {
16505
+ return forEach(objectLiteral == null ? void 0 : objectLiteral.properties, (property) => {
16506
+ if (!isPropertyAssignment(property))
16507
+ return void 0;
16508
+ const propName = tryGetTextOfPropertyName(property.name);
16509
+ return key === propName || key2 && key2 === propName ? callback(property) : void 0;
16508
16510
  });
16509
16511
  }
16510
16512
  function getPropertyArrayElementValue(objectLiteral, propKey, elementValue) {
16511
- return firstDefined(getPropertyAssignment(objectLiteral, propKey), (property) => isArrayLiteralExpression(property.initializer) ? find(property.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : void 0);
16513
+ return forEachPropertyAssignment(
16514
+ objectLiteral,
16515
+ propKey,
16516
+ (property) => isArrayLiteralExpression(property.initializer) ? find(property.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : void 0
16517
+ );
16512
16518
  }
16513
16519
  function getTsConfigObjectLiteralExpression(tsConfigSourceFile) {
16514
16520
  if (tsConfigSourceFile && tsConfigSourceFile.statements.length) {
@@ -16517,11 +16523,10 @@ function getTsConfigObjectLiteralExpression(tsConfigSourceFile) {
16517
16523
  }
16518
16524
  }
16519
16525
  function getTsConfigPropArrayElementValue(tsConfigSourceFile, propKey, elementValue) {
16520
- return firstDefined(getTsConfigPropArray(tsConfigSourceFile, propKey), (property) => isArrayLiteralExpression(property.initializer) ? find(property.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : void 0);
16526
+ return forEachTsConfigPropArray(tsConfigSourceFile, propKey, (property) => isArrayLiteralExpression(property.initializer) ? find(property.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : void 0);
16521
16527
  }
16522
- function getTsConfigPropArray(tsConfigSourceFile, propKey) {
16523
- const jsonObjectLiteral = getTsConfigObjectLiteralExpression(tsConfigSourceFile);
16524
- return jsonObjectLiteral ? getPropertyAssignment(jsonObjectLiteral, propKey) : emptyArray;
16528
+ function forEachTsConfigPropArray(tsConfigSourceFile, propKey, callback) {
16529
+ return forEachPropertyAssignment(getTsConfigObjectLiteralExpression(tsConfigSourceFile), propKey, callback);
16525
16530
  }
16526
16531
  function getContainingFunction(node) {
16527
16532
  return findAncestor(node.parent, isFunctionLike);
@@ -17867,6 +17872,12 @@ function getAncestor(node, kind) {
17867
17872
  function isKeyword(token) {
17868
17873
  return 82 /* FirstKeyword */ <= token && token <= 163 /* LastKeyword */;
17869
17874
  }
17875
+ function isPunctuation(token) {
17876
+ return 18 /* FirstPunctuation */ <= token && token <= 78 /* LastPunctuation */;
17877
+ }
17878
+ function isKeywordOrPunctuation(token) {
17879
+ return isKeyword(token) || isPunctuation(token);
17880
+ }
17870
17881
  function isContextualKeyword(token) {
17871
17882
  return 127 /* FirstContextualKeyword */ <= token && token <= 163 /* LastContextualKeyword */;
17872
17883
  }
@@ -30421,14 +30432,12 @@ var Parser;
30421
30432
  scriptKind2 = ensureScriptKind(fileName2, scriptKind2);
30422
30433
  if (scriptKind2 === 6 /* JSON */) {
30423
30434
  const result2 = parseJsonText2(fileName2, sourceText2, languageVersion2, syntaxCursor2, setParentNodes);
30424
- convertToObjectWorker(
30435
+ convertToJson(
30425
30436
  result2,
30426
30437
  (_a2 = result2.statements[0]) == null ? void 0 : _a2.expression,
30427
30438
  result2.parseDiagnostics,
30428
30439
  /*returnValue*/
30429
30440
  false,
30430
- /*knownRootOptions*/
30431
- void 0,
30432
30441
  /*jsonConversionNotifier*/
30433
30442
  void 0
30434
30443
  );
@@ -30860,24 +30869,24 @@ var Parser;
30860
30869
  function inAwaitContext() {
30861
30870
  return inContext(32768 /* AwaitContext */);
30862
30871
  }
30863
- function parseErrorAtCurrentToken(message, arg0) {
30864
- return parseErrorAt(scanner2.getTokenStart(), scanner2.getTokenEnd(), message, arg0);
30872
+ function parseErrorAtCurrentToken(message, ...args) {
30873
+ return parseErrorAt(scanner2.getTokenStart(), scanner2.getTokenEnd(), message, ...args);
30865
30874
  }
30866
- function parseErrorAtPosition(start2, length2, message, arg0) {
30875
+ function parseErrorAtPosition(start2, length2, message, ...args) {
30867
30876
  const lastError = lastOrUndefined(parseDiagnostics);
30868
30877
  let result;
30869
30878
  if (!lastError || start2 !== lastError.start) {
30870
- result = createDetachedDiagnostic(fileName, start2, length2, message, arg0);
30879
+ result = createDetachedDiagnostic(fileName, start2, length2, message, ...args);
30871
30880
  parseDiagnostics.push(result);
30872
30881
  }
30873
30882
  parseErrorBeforeNextFinishedNode = true;
30874
30883
  return result;
30875
30884
  }
30876
- function parseErrorAt(start2, end, message, arg0) {
30877
- return parseErrorAtPosition(start2, end - start2, message, arg0);
30885
+ function parseErrorAt(start2, end, message, ...args) {
30886
+ return parseErrorAtPosition(start2, end - start2, message, ...args);
30878
30887
  }
30879
- function parseErrorAtRange(range, message, arg0) {
30880
- parseErrorAt(range.pos, range.end, message, arg0);
30888
+ function parseErrorAtRange(range, message, ...args) {
30889
+ parseErrorAt(range.pos, range.end, message, ...args);
30881
30890
  }
30882
30891
  function scanError(message, length2) {
30883
30892
  parseErrorAtPosition(scanner2.getTokenEnd(), length2, message);
@@ -31083,6 +31092,7 @@ var Parser;
31083
31092
  nextTokenJSDoc();
31084
31093
  return true;
31085
31094
  }
31095
+ Debug.assert(isKeywordOrPunctuation(kind));
31086
31096
  parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(kind));
31087
31097
  return false;
31088
31098
  }
@@ -31131,7 +31141,11 @@ var Parser;
31131
31141
  );
31132
31142
  }
31133
31143
  function parseExpectedTokenJSDoc(t) {
31134
- return parseOptionalTokenJSDoc(t) || createMissingNode(
31144
+ const optional = parseOptionalTokenJSDoc(t);
31145
+ if (optional)
31146
+ return optional;
31147
+ Debug.assert(isKeywordOrPunctuation(t));
31148
+ return createMissingNode(
31135
31149
  t,
31136
31150
  /*reportAtCurrentPosition*/
31137
31151
  false,
@@ -31185,11 +31199,11 @@ var Parser;
31185
31199
  }
31186
31200
  return node;
31187
31201
  }
31188
- function createMissingNode(kind, reportAtCurrentPosition, diagnosticMessage, arg0) {
31202
+ function createMissingNode(kind, reportAtCurrentPosition, diagnosticMessage, ...args) {
31189
31203
  if (reportAtCurrentPosition) {
31190
- parseErrorAtPosition(scanner2.getTokenFullStart(), 0, diagnosticMessage, arg0);
31204
+ parseErrorAtPosition(scanner2.getTokenFullStart(), 0, diagnosticMessage, ...args);
31191
31205
  } else if (diagnosticMessage) {
31192
- parseErrorAtCurrentToken(diagnosticMessage, arg0);
31206
+ parseErrorAtCurrentToken(diagnosticMessage, ...args);
31193
31207
  }
31194
31208
  const pos = getNodePos();
31195
31209
  const result = kind === 79 /* Identifier */ ? factoryCreateIdentifier(
@@ -33548,6 +33562,7 @@ var Parser;
33548
33562
  if (simpleUnaryExpression.kind === 214 /* TypeAssertionExpression */) {
33549
33563
  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);
33550
33564
  } else {
33565
+ Debug.assert(isKeywordOrPunctuation(unaryOperator));
33551
33566
  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));
33552
33567
  }
33553
33568
  }
@@ -36495,14 +36510,14 @@ var Parser;
36495
36510
  }
36496
36511
  function parseReturnTag(start3, tagName, indent3, indentText) {
36497
36512
  if (some(tags, isJSDocReturnTag)) {
36498
- parseErrorAt(tagName.pos, scanner2.getTokenStart(), Diagnostics._0_tag_already_specified, tagName.escapedText);
36513
+ parseErrorAt(tagName.pos, scanner2.getTokenStart(), Diagnostics._0_tag_already_specified, unescapeLeadingUnderscores(tagName.escapedText));
36499
36514
  }
36500
36515
  const typeExpression = tryParseTypeExpression();
36501
36516
  return finishNode(factory2.createJSDocReturnTag(tagName, typeExpression, parseTrailingTagComments(start3, getNodePos(), indent3, indentText)), start3);
36502
36517
  }
36503
36518
  function parseTypeTag(start3, tagName, indent3, indentText) {
36504
36519
  if (some(tags, isJSDocTypeTag)) {
36505
- parseErrorAt(tagName.pos, scanner2.getTokenStart(), Diagnostics._0_tag_already_specified, tagName.escapedText);
36520
+ parseErrorAt(tagName.pos, scanner2.getTokenStart(), Diagnostics._0_tag_already_specified, unescapeLeadingUnderscores(tagName.escapedText));
36506
36521
  }
36507
36522
  const typeExpression = parseJSDocTypeExpression(
36508
36523
  /*mayOmitBraces*/
@@ -38987,13 +39002,13 @@ function parseListTypeOption(opt, value = "", errors) {
38987
39002
  function getOptionName(option) {
38988
39003
  return option.name;
38989
39004
  }
38990
- function createUnknownOptionError(unknownOption, diagnostics, createDiagnostics, unknownOptionErrorText) {
39005
+ function createUnknownOptionError(unknownOption, diagnostics, unknownOptionErrorText, node, sourceFile) {
38991
39006
  var _a2;
38992
39007
  if ((_a2 = diagnostics.alternateMode) == null ? void 0 : _a2.getOptionsNameMap().optionsNameMap.has(unknownOption.toLowerCase())) {
38993
- return createDiagnostics(diagnostics.alternateMode.diagnostic, unknownOption);
39008
+ return createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.alternateMode.diagnostic, unknownOption);
38994
39009
  }
38995
39010
  const possibleOption = getSpellingSuggestion(unknownOption, diagnostics.optionDeclarations, getOptionName);
38996
- return possibleOption ? createDiagnostics(diagnostics.unknownDidYouMeanDiagnostic, unknownOptionErrorText || unknownOption, possibleOption.name) : createDiagnostics(diagnostics.unknownOptionDiagnostic, unknownOptionErrorText || unknownOption);
39011
+ return possibleOption ? createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.unknownDidYouMeanDiagnostic, unknownOptionErrorText || unknownOption, possibleOption.name) : createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.unknownOptionDiagnostic, unknownOptionErrorText || unknownOption);
38997
39012
  }
38998
39013
  function parseCommandLineWorker(diagnostics, commandLine, readFile) {
38999
39014
  const options = {};
@@ -39034,7 +39049,7 @@ function parseCommandLineWorker(diagnostics, commandLine, readFile) {
39034
39049
  if (watchOpt) {
39035
39050
  i = parseOptionValue(args, i, watchOptionsDidYouMeanDiagnostics, watchOpt, watchOptions || (watchOptions = {}), errors);
39036
39051
  } else {
39037
- errors.push(createUnknownOptionError(inputOptionName, diagnostics, createCompilerDiagnostic, s));
39052
+ errors.push(createUnknownOptionError(inputOptionName, diagnostics, s));
39038
39053
  }
39039
39054
  }
39040
39055
  } else {
@@ -39245,9 +39260,7 @@ function parseConfigFileTextToJson(fileName, jsonText) {
39245
39260
  config: convertConfigFileToObject(
39246
39261
  jsonSourceFile,
39247
39262
  jsonSourceFile.parseDiagnostics,
39248
- /*reportOptionsErrors*/
39249
- false,
39250
- /*optionsIterator*/
39263
+ /*jsonConversionNotifier*/
39251
39264
  void 0
39252
39265
  ),
39253
39266
  error: jsonSourceFile.parseDiagnostics.length ? jsonSourceFile.parseDiagnostics[0] : void 0
@@ -39304,7 +39317,26 @@ var extendsOptionDeclaration = {
39304
39317
  name: "extends",
39305
39318
  type: "string"
39306
39319
  },
39307
- category: Diagnostics.File_Management
39320
+ category: Diagnostics.File_Management,
39321
+ disallowNullOrUndefined: true
39322
+ };
39323
+ var compilerOptionsDeclaration = {
39324
+ name: "compilerOptions",
39325
+ type: "object",
39326
+ elementOptions: getCommandLineCompilerOptionsMap(),
39327
+ extraKeyDiagnostics: compilerOptionsDidYouMeanDiagnostics
39328
+ };
39329
+ var watchOptionsDeclaration = {
39330
+ name: "watchOptions",
39331
+ type: "object",
39332
+ elementOptions: getCommandLineWatchOptionsMap(),
39333
+ extraKeyDiagnostics: watchOptionsDidYouMeanDiagnostics
39334
+ };
39335
+ var typeAcquisitionDeclaration = {
39336
+ name: "typeAcquisition",
39337
+ type: "object",
39338
+ elementOptions: getCommandLineTypeAcquisitionMap(),
39339
+ extraKeyDiagnostics: typeAcquisitionDidYouMeanDiagnostics
39308
39340
  };
39309
39341
  var _tsconfigRootOptions;
39310
39342
  function getTsconfigRootOptionsMap() {
@@ -39314,24 +39346,9 @@ function getTsconfigRootOptionsMap() {
39314
39346
  // should never be needed since this is root
39315
39347
  type: "object",
39316
39348
  elementOptions: commandLineOptionsToMap([
39317
- {
39318
- name: "compilerOptions",
39319
- type: "object",
39320
- elementOptions: getCommandLineCompilerOptionsMap(),
39321
- extraKeyDiagnostics: compilerOptionsDidYouMeanDiagnostics
39322
- },
39323
- {
39324
- name: "watchOptions",
39325
- type: "object",
39326
- elementOptions: getCommandLineWatchOptionsMap(),
39327
- extraKeyDiagnostics: watchOptionsDidYouMeanDiagnostics
39328
- },
39329
- {
39330
- name: "typeAcquisition",
39331
- type: "object",
39332
- elementOptions: getCommandLineTypeAcquisitionMap(),
39333
- extraKeyDiagnostics: typeAcquisitionDidYouMeanDiagnostics
39334
- },
39349
+ compilerOptionsDeclaration,
39350
+ watchOptionsDeclaration,
39351
+ typeAcquisitionDeclaration,
39335
39352
  extendsOptionDeclaration,
39336
39353
  {
39337
39354
  name: "references",
@@ -39377,10 +39394,9 @@ function getTsconfigRootOptionsMap() {
39377
39394
  }
39378
39395
  return _tsconfigRootOptions;
39379
39396
  }
39380
- function convertConfigFileToObject(sourceFile, errors, reportOptionsErrors, optionsIterator) {
39397
+ function convertConfigFileToObject(sourceFile, errors, jsonConversionNotifier) {
39381
39398
  var _a2;
39382
39399
  const rootExpression = (_a2 = sourceFile.statements[0]) == null ? void 0 : _a2.expression;
39383
- const knownRootOptions = reportOptionsErrors ? getTsconfigRootOptionsMap() : void 0;
39384
39400
  if (rootExpression && rootExpression.kind !== 208 /* ObjectLiteralExpression */) {
39385
39401
  errors.push(createDiagnosticForNodeInSourceFile(
39386
39402
  sourceFile,
@@ -39391,52 +39407,46 @@ function convertConfigFileToObject(sourceFile, errors, reportOptionsErrors, opti
39391
39407
  if (isArrayLiteralExpression(rootExpression)) {
39392
39408
  const firstObject = find(rootExpression.elements, isObjectLiteralExpression);
39393
39409
  if (firstObject) {
39394
- return convertToObjectWorker(
39410
+ return convertToJson(
39395
39411
  sourceFile,
39396
39412
  firstObject,
39397
39413
  errors,
39398
39414
  /*returnValue*/
39399
39415
  true,
39400
- knownRootOptions,
39401
- optionsIterator
39416
+ jsonConversionNotifier
39402
39417
  );
39403
39418
  }
39404
39419
  }
39405
39420
  return {};
39406
39421
  }
39407
- return convertToObjectWorker(
39422
+ return convertToJson(
39408
39423
  sourceFile,
39409
39424
  rootExpression,
39410
39425
  errors,
39411
39426
  /*returnValue*/
39412
39427
  true,
39413
- knownRootOptions,
39414
- optionsIterator
39428
+ jsonConversionNotifier
39415
39429
  );
39416
39430
  }
39417
39431
  function convertToObject(sourceFile, errors) {
39418
39432
  var _a2;
39419
- return convertToObjectWorker(
39433
+ return convertToJson(
39420
39434
  sourceFile,
39421
39435
  (_a2 = sourceFile.statements[0]) == null ? void 0 : _a2.expression,
39422
39436
  errors,
39423
39437
  /*returnValue*/
39424
39438
  true,
39425
- /*knownRootOptions*/
39426
- void 0,
39427
39439
  /*jsonConversionNotifier*/
39428
39440
  void 0
39429
39441
  );
39430
39442
  }
39431
- function convertToObjectWorker(sourceFile, rootExpression, errors, returnValue, knownRootOptions, jsonConversionNotifier) {
39443
+ function convertToJson(sourceFile, rootExpression, errors, returnValue, jsonConversionNotifier) {
39432
39444
  if (!rootExpression) {
39433
39445
  return returnValue ? {} : void 0;
39434
39446
  }
39435
- return convertPropertyValueToJson(rootExpression, knownRootOptions);
39436
- function isRootOptionMap(knownOptions) {
39437
- return knownRootOptions && knownRootOptions.elementOptions === knownOptions;
39438
- }
39439
- function convertObjectLiteralExpressionToJson(node, knownOptions, extraKeyDiagnostics, parentOption) {
39447
+ return convertPropertyValueToJson(rootExpression, jsonConversionNotifier == null ? void 0 : jsonConversionNotifier.rootOptions);
39448
+ function convertObjectLiteralExpressionToJson(node, objectOption) {
39449
+ var _a2;
39440
39450
  const result = returnValue ? {} : void 0;
39441
39451
  for (const element of node.properties) {
39442
39452
  if (element.kind !== 300 /* PropertyAssignment */) {
@@ -39451,38 +39461,13 @@ function convertToObjectWorker(sourceFile, rootExpression, errors, returnValue,
39451
39461
  }
39452
39462
  const textOfKey = isComputedNonLiteralName(element.name) ? void 0 : getTextOfPropertyName(element.name);
39453
39463
  const keyText = textOfKey && unescapeLeadingUnderscores(textOfKey);
39454
- const option = keyText && knownOptions ? knownOptions.get(keyText) : void 0;
39455
- if (keyText && extraKeyDiagnostics && !option) {
39456
- if (knownOptions) {
39457
- errors.push(createUnknownOptionError(
39458
- keyText,
39459
- extraKeyDiagnostics,
39460
- (message, arg0, arg1) => createDiagnosticForNodeInSourceFile(sourceFile, element.name, message, arg0, arg1)
39461
- ));
39462
- } else {
39463
- errors.push(createDiagnosticForNodeInSourceFile(sourceFile, element.name, extraKeyDiagnostics.unknownOptionDiagnostic, keyText));
39464
- }
39465
- }
39464
+ const option = keyText ? (_a2 = objectOption == null ? void 0 : objectOption.elementOptions) == null ? void 0 : _a2.get(keyText) : void 0;
39466
39465
  const value = convertPropertyValueToJson(element.initializer, option);
39467
39466
  if (typeof keyText !== "undefined") {
39468
39467
  if (returnValue) {
39469
39468
  result[keyText] = value;
39470
39469
  }
39471
- if (jsonConversionNotifier && // Current callbacks are only on known parent option or if we are setting values in the root
39472
- (parentOption || isRootOptionMap(knownOptions))) {
39473
- const isValidOptionValue = isCompilerOptionsValue(option, value);
39474
- if (parentOption) {
39475
- if (isValidOptionValue) {
39476
- jsonConversionNotifier.onSetValidOptionKeyValueInParent(parentOption, option, value);
39477
- }
39478
- } else if (isRootOptionMap(knownOptions)) {
39479
- if (isValidOptionValue) {
39480
- jsonConversionNotifier.onSetValidOptionKeyValueInRoot(keyText, element.name, value, element.initializer);
39481
- } else if (!option) {
39482
- jsonConversionNotifier.onSetUnknownOptionKeyValueInRoot(keyText, element.name, value, element.initializer);
39483
- }
39484
- }
39485
- }
39470
+ jsonConversionNotifier == null ? void 0 : jsonConversionNotifier.onPropertySet(keyText, value, element, objectOption, option);
39486
39471
  }
39487
39472
  }
39488
39473
  return result;
@@ -39495,112 +39480,40 @@ function convertToObjectWorker(sourceFile, rootExpression, errors, returnValue,
39495
39480
  return filter(elements.map((element) => convertPropertyValueToJson(element, elementOption)), (v) => v !== void 0);
39496
39481
  }
39497
39482
  function convertPropertyValueToJson(valueExpression, option) {
39498
- let invalidReported;
39499
39483
  switch (valueExpression.kind) {
39500
39484
  case 111 /* TrueKeyword */:
39501
- reportInvalidOptionValue(option && option.type !== "boolean" && (option.type !== "listOrElement" || option.element.type !== "boolean"));
39502
- return validateValue(
39503
- /*value*/
39504
- true
39505
- );
39485
+ return true;
39506
39486
  case 96 /* FalseKeyword */:
39507
- reportInvalidOptionValue(option && option.type !== "boolean" && (option.type !== "listOrElement" || option.element.type !== "boolean"));
39508
- return validateValue(
39509
- /*value*/
39510
- false
39511
- );
39487
+ return false;
39512
39488
  case 105 /* NullKeyword */:
39513
- reportInvalidOptionValue(option && option.name === "extends");
39514
- return validateValue(
39515
- /*value*/
39516
- null
39517
- );
39489
+ return null;
39518
39490
  case 10 /* StringLiteral */:
39519
39491
  if (!isDoubleQuotedString(valueExpression)) {
39520
39492
  errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, Diagnostics.String_literal_with_double_quotes_expected));
39521
39493
  }
39522
- reportInvalidOptionValue(option && isString(option.type) && option.type !== "string" && (option.type !== "listOrElement" || isString(option.element.type) && option.element.type !== "string"));
39523
- const text = valueExpression.text;
39524
- if (option) {
39525
- Debug.assert(option.type !== "listOrElement" || option.element.type === "string", "Only string or array of string is handled for now");
39526
- }
39527
- if (option && !isString(option.type)) {
39528
- const customOption = option;
39529
- if (!customOption.type.has(text.toLowerCase())) {
39530
- errors.push(
39531
- createDiagnosticForInvalidCustomType(
39532
- customOption,
39533
- (message, arg0, arg1) => createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, message, arg0, arg1)
39534
- )
39535
- );
39536
- invalidReported = true;
39537
- }
39538
- }
39539
- return validateValue(text);
39494
+ return valueExpression.text;
39540
39495
  case 8 /* NumericLiteral */:
39541
- reportInvalidOptionValue(option && option.type !== "number" && (option.type !== "listOrElement" || option.element.type !== "number"));
39542
- return validateValue(Number(valueExpression.text));
39496
+ return Number(valueExpression.text);
39543
39497
  case 222 /* PrefixUnaryExpression */:
39544
39498
  if (valueExpression.operator !== 40 /* MinusToken */ || valueExpression.operand.kind !== 8 /* NumericLiteral */) {
39545
39499
  break;
39546
39500
  }
39547
- reportInvalidOptionValue(option && option.type !== "number" && (option.type !== "listOrElement" || option.element.type !== "number"));
39548
- return validateValue(-Number(valueExpression.operand.text));
39501
+ return -Number(valueExpression.operand.text);
39549
39502
  case 208 /* ObjectLiteralExpression */:
39550
- reportInvalidOptionValue(option && option.type !== "object" && (option.type !== "listOrElement" || option.element.type !== "object"));
39551
39503
  const objectLiteralExpression = valueExpression;
39552
- if (option) {
39553
- const { elementOptions, extraKeyDiagnostics, name: optionName } = option;
39554
- return validateValue(convertObjectLiteralExpressionToJson(
39555
- objectLiteralExpression,
39556
- elementOptions,
39557
- extraKeyDiagnostics,
39558
- optionName
39559
- ));
39560
- } else {
39561
- return validateValue(convertObjectLiteralExpressionToJson(
39562
- objectLiteralExpression,
39563
- /* knownOptions*/
39564
- void 0,
39565
- /*extraKeyDiagnosticMessage */
39566
- void 0,
39567
- /*parentOption*/
39568
- void 0
39569
- ));
39570
- }
39504
+ return convertObjectLiteralExpressionToJson(objectLiteralExpression, option);
39571
39505
  case 207 /* ArrayLiteralExpression */:
39572
- reportInvalidOptionValue(option && option.type !== "list" && option.type !== "listOrElement");
39573
- return validateValue(convertArrayLiteralExpressionToJson(
39506
+ return convertArrayLiteralExpressionToJson(
39574
39507
  valueExpression.elements,
39575
39508
  option && option.element
39576
- ));
39509
+ );
39577
39510
  }
39578
39511
  if (option) {
39579
- reportInvalidOptionValue(
39580
- /*isError*/
39581
- true
39582
- );
39512
+ errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, Diagnostics.Compiler_option_0_requires_a_value_of_type_1, option.name, getCompilerOptionValueTypeString(option)));
39583
39513
  } else {
39584
39514
  errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, Diagnostics.Property_value_can_only_be_string_literal_numeric_literal_true_false_null_object_literal_or_array_literal));
39585
39515
  }
39586
39516
  return void 0;
39587
- function validateValue(value) {
39588
- var _a2;
39589
- if (!invalidReported) {
39590
- const diagnostic = (_a2 = option == null ? void 0 : option.extraValidation) == null ? void 0 : _a2.call(option, value);
39591
- if (diagnostic) {
39592
- errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, ...diagnostic));
39593
- return void 0;
39594
- }
39595
- }
39596
- return value;
39597
- }
39598
- function reportInvalidOptionValue(isError) {
39599
- if (isError) {
39600
- errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, Diagnostics.Compiler_option_0_requires_a_value_of_type_1, option.name, getCompilerOptionValueTypeString(option)));
39601
- invalidReported = true;
39602
- }
39603
- }
39604
39517
  }
39605
39518
  function isDoubleQuotedString(node) {
39606
39519
  return isStringLiteral(node) && isStringDoubleQuoted(node, sourceFile);
@@ -39612,7 +39525,7 @@ function getCompilerOptionValueTypeString(option) {
39612
39525
  function isCompilerOptionsValue(option, value) {
39613
39526
  if (option) {
39614
39527
  if (isNullOrUndefined(value))
39615
- return true;
39528
+ return !option.disallowNullOrUndefined;
39616
39529
  if (option.type === "list") {
39617
39530
  return isArray(value);
39618
39531
  }
@@ -39972,8 +39885,8 @@ function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, exis
39972
39885
  if (sourceFile) {
39973
39886
  const fileName = configFileName || "tsconfig.json";
39974
39887
  const diagnosticMessage = Diagnostics.The_files_list_in_config_file_0_is_empty;
39975
- const nodeValue = firstDefined(getTsConfigPropArray(sourceFile, "files"), (property) => property.initializer);
39976
- const error = nodeValue ? createDiagnosticForNodeInSourceFile(sourceFile, nodeValue, diagnosticMessage, fileName) : createCompilerDiagnostic(diagnosticMessage, fileName);
39888
+ const nodeValue = forEachTsConfigPropArray(sourceFile, "files", (property) => property.initializer);
39889
+ const error = createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, nodeValue, diagnosticMessage, fileName);
39977
39890
  errors.push(error);
39978
39891
  } else {
39979
39892
  createCompilerDiagnosticOnlyIfJson(Diagnostics.The_files_list_in_config_file_0_is_empty, configFileName || "tsconfig.json");
@@ -40075,9 +39988,9 @@ function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, exis
40075
39988
  }
40076
39989
  return "no-prop";
40077
39990
  }
40078
- function createCompilerDiagnosticOnlyIfJson(message, arg0, arg1) {
39991
+ function createCompilerDiagnosticOnlyIfJson(message, ...args) {
40079
39992
  if (!sourceFile) {
40080
- errors.push(createCompilerDiagnostic(message, arg0, arg1));
39993
+ errors.push(createCompilerDiagnostic(message, ...args));
40081
39994
  }
40082
39995
  }
40083
39996
  }
@@ -40176,27 +40089,42 @@ function parseOwnConfigOfJson(json, host, basePath, configFileName, errors) {
40176
40089
  const typeAcquisition = convertTypeAcquisitionFromJsonWorker(json.typeAcquisition, basePath, errors, configFileName);
40177
40090
  const watchOptions = convertWatchOptionsFromJsonWorker(json.watchOptions, basePath, errors);
40178
40091
  json.compileOnSave = convertCompileOnSaveOptionFromJson(json, basePath, errors);
40092
+ const extendedConfigPath = json.extends || json.extends === "" ? getExtendsConfigPathOrArray(json.extends, host, basePath, configFileName, errors) : void 0;
40093
+ return { raw: json, options, watchOptions, typeAcquisition, extendedConfigPath };
40094
+ }
40095
+ function getExtendsConfigPathOrArray(value, host, basePath, configFileName, errors, propertyAssignment, valueExpression, sourceFile) {
40179
40096
  let extendedConfigPath;
40180
- if (json.extends || json.extends === "") {
40181
- if (!isCompilerOptionsValue(extendsOptionDeclaration, json.extends)) {
40182
- errors.push(createCompilerDiagnostic(Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "extends", getCompilerOptionValueTypeString(extendsOptionDeclaration)));
40183
- } else {
40184
- const newBase = configFileName ? directoryOfCombinedPath(configFileName, basePath) : basePath;
40185
- if (isString(json.extends)) {
40186
- extendedConfigPath = getExtendsConfigPath(json.extends, host, newBase, errors, createCompilerDiagnostic);
40097
+ const newBase = configFileName ? directoryOfCombinedPath(configFileName, basePath) : basePath;
40098
+ if (isString(value)) {
40099
+ extendedConfigPath = getExtendsConfigPath(
40100
+ value,
40101
+ host,
40102
+ newBase,
40103
+ errors,
40104
+ valueExpression,
40105
+ sourceFile
40106
+ );
40107
+ } else if (isArray(value)) {
40108
+ extendedConfigPath = [];
40109
+ for (let index = 0; index < value.length; index++) {
40110
+ const fileName = value[index];
40111
+ if (isString(fileName)) {
40112
+ extendedConfigPath = append(extendedConfigPath, getExtendsConfigPath(
40113
+ fileName,
40114
+ host,
40115
+ newBase,
40116
+ errors,
40117
+ valueExpression == null ? void 0 : valueExpression.elements[index],
40118
+ sourceFile
40119
+ ));
40187
40120
  } else {
40188
- extendedConfigPath = [];
40189
- for (const fileName of json.extends) {
40190
- if (isString(fileName)) {
40191
- extendedConfigPath = append(extendedConfigPath, getExtendsConfigPath(fileName, host, newBase, errors, createCompilerDiagnostic));
40192
- } else {
40193
- errors.push(createCompilerDiagnostic(Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "extends", getCompilerOptionValueTypeString(extendsOptionDeclaration.element)));
40194
- }
40195
- }
40121
+ convertJsonOption(extendsOptionDeclaration.element, value, basePath, errors, propertyAssignment, valueExpression == null ? void 0 : valueExpression.elements[index], sourceFile);
40196
40122
  }
40197
40123
  }
40124
+ } else {
40125
+ convertJsonOption(extendsOptionDeclaration, value, basePath, errors, propertyAssignment, valueExpression, sourceFile);
40198
40126
  }
40199
- return { raw: json, options, watchOptions, typeAcquisition, extendedConfigPath };
40127
+ return extendedConfigPath;
40200
40128
  }
40201
40129
  function parseOwnConfigOfJsonSourceFile(sourceFile, host, basePath, configFileName, errors) {
40202
40130
  const options = getDefaultCompilerOptions(configFileName);
@@ -40204,69 +40132,11 @@ function parseOwnConfigOfJsonSourceFile(sourceFile, host, basePath, configFileNa
40204
40132
  let watchOptions;
40205
40133
  let extendedConfigPath;
40206
40134
  let rootCompilerOptions;
40207
- const optionsIterator = {
40208
- onSetValidOptionKeyValueInParent(parentOption, option, value) {
40209
- let currentOption;
40210
- switch (parentOption) {
40211
- case "compilerOptions":
40212
- currentOption = options;
40213
- break;
40214
- case "watchOptions":
40215
- currentOption = watchOptions || (watchOptions = {});
40216
- break;
40217
- case "typeAcquisition":
40218
- currentOption = typeAcquisition || (typeAcquisition = getDefaultTypeAcquisition(configFileName));
40219
- break;
40220
- default:
40221
- Debug.fail("Unknown option");
40222
- }
40223
- currentOption[option.name] = normalizeOptionValue(option, basePath, value);
40224
- },
40225
- onSetValidOptionKeyValueInRoot(key, _keyNode, value, valueNode) {
40226
- switch (key) {
40227
- case "extends":
40228
- const newBase = configFileName ? directoryOfCombinedPath(configFileName, basePath) : basePath;
40229
- if (isString(value)) {
40230
- extendedConfigPath = getExtendsConfigPath(
40231
- value,
40232
- host,
40233
- newBase,
40234
- errors,
40235
- (message, arg0) => createDiagnosticForNodeInSourceFile(sourceFile, valueNode, message, arg0)
40236
- );
40237
- } else {
40238
- extendedConfigPath = [];
40239
- for (let index = 0; index < value.length; index++) {
40240
- const fileName = value[index];
40241
- if (isString(fileName)) {
40242
- extendedConfigPath = append(extendedConfigPath, getExtendsConfigPath(
40243
- fileName,
40244
- host,
40245
- newBase,
40246
- errors,
40247
- (message, arg0) => createDiagnosticForNodeInSourceFile(sourceFile, valueNode.elements[index], message, arg0)
40248
- ));
40249
- }
40250
- }
40251
- }
40252
- return;
40253
- }
40254
- },
40255
- onSetUnknownOptionKeyValueInRoot(key, keyNode, _value, _valueNode) {
40256
- if (key === "excludes") {
40257
- errors.push(createDiagnosticForNodeInSourceFile(sourceFile, keyNode, Diagnostics.Unknown_option_excludes_Did_you_mean_exclude));
40258
- }
40259
- if (find(commandOptionsWithoutBuild, (opt) => opt.name === key)) {
40260
- rootCompilerOptions = append(rootCompilerOptions, keyNode);
40261
- }
40262
- }
40263
- };
40135
+ const rootOptions = getTsconfigRootOptionsMap();
40264
40136
  const json = convertConfigFileToObject(
40265
40137
  sourceFile,
40266
40138
  errors,
40267
- /*reportOptionsErrors*/
40268
- true,
40269
- optionsIterator
40139
+ { rootOptions, onPropertySet }
40270
40140
  );
40271
40141
  if (!typeAcquisition) {
40272
40142
  typeAcquisition = getDefaultTypeAcquisition(configFileName);
@@ -40275,15 +40145,57 @@ function parseOwnConfigOfJsonSourceFile(sourceFile, host, basePath, configFileNa
40275
40145
  errors.push(createDiagnosticForNodeInSourceFile(sourceFile, rootCompilerOptions[0], Diagnostics._0_should_be_set_inside_the_compilerOptions_object_of_the_config_json_file, getTextOfPropertyName(rootCompilerOptions[0])));
40276
40146
  }
40277
40147
  return { raw: json, options, watchOptions, typeAcquisition, extendedConfigPath };
40148
+ function onPropertySet(keyText, value, propertyAssignment, parentOption, option) {
40149
+ if (option && option !== extendsOptionDeclaration)
40150
+ value = convertJsonOption(option, value, basePath, errors, propertyAssignment, propertyAssignment.initializer, sourceFile);
40151
+ if (parentOption == null ? void 0 : parentOption.name) {
40152
+ if (option) {
40153
+ let currentOption;
40154
+ if (parentOption === compilerOptionsDeclaration)
40155
+ currentOption = options;
40156
+ else if (parentOption === watchOptionsDeclaration)
40157
+ currentOption = watchOptions != null ? watchOptions : watchOptions = {};
40158
+ else if (parentOption === typeAcquisitionDeclaration)
40159
+ currentOption = typeAcquisition != null ? typeAcquisition : typeAcquisition = getDefaultTypeAcquisition(configFileName);
40160
+ else
40161
+ Debug.fail("Unknown option");
40162
+ currentOption[option.name] = value;
40163
+ } else if (keyText && (parentOption == null ? void 0 : parentOption.extraKeyDiagnostics)) {
40164
+ if (parentOption.elementOptions) {
40165
+ errors.push(createUnknownOptionError(
40166
+ keyText,
40167
+ parentOption.extraKeyDiagnostics,
40168
+ /*unknownOptionErrorText*/
40169
+ void 0,
40170
+ propertyAssignment.name,
40171
+ sourceFile
40172
+ ));
40173
+ } else {
40174
+ errors.push(createDiagnosticForNodeInSourceFile(sourceFile, propertyAssignment.name, parentOption.extraKeyDiagnostics.unknownOptionDiagnostic, keyText));
40175
+ }
40176
+ }
40177
+ } else if (parentOption === rootOptions) {
40178
+ if (option === extendsOptionDeclaration) {
40179
+ extendedConfigPath = getExtendsConfigPathOrArray(value, host, basePath, configFileName, errors, propertyAssignment, propertyAssignment.initializer, sourceFile);
40180
+ } else if (!option) {
40181
+ if (keyText === "excludes") {
40182
+ errors.push(createDiagnosticForNodeInSourceFile(sourceFile, propertyAssignment.name, Diagnostics.Unknown_option_excludes_Did_you_mean_exclude));
40183
+ }
40184
+ if (find(commandOptionsWithoutBuild, (opt) => opt.name === keyText)) {
40185
+ rootCompilerOptions = append(rootCompilerOptions, propertyAssignment.name);
40186
+ }
40187
+ }
40188
+ }
40189
+ }
40278
40190
  }
40279
- function getExtendsConfigPath(extendedConfig, host, basePath, errors, createDiagnostic) {
40191
+ function getExtendsConfigPath(extendedConfig, host, basePath, errors, valueExpression, sourceFile) {
40280
40192
  extendedConfig = normalizeSlashes(extendedConfig);
40281
40193
  if (isRootedDiskPath(extendedConfig) || startsWith(extendedConfig, "./") || startsWith(extendedConfig, "../")) {
40282
40194
  let extendedConfigPath = getNormalizedAbsolutePath(extendedConfig, basePath);
40283
40195
  if (!host.fileExists(extendedConfigPath) && !endsWith(extendedConfigPath, ".json" /* Json */)) {
40284
40196
  extendedConfigPath = `${extendedConfigPath}.json`;
40285
40197
  if (!host.fileExists(extendedConfigPath)) {
40286
- errors.push(createDiagnostic(Diagnostics.File_0_not_found, extendedConfig));
40198
+ errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, valueExpression, Diagnostics.File_0_not_found, extendedConfig));
40287
40199
  return void 0;
40288
40200
  }
40289
40201
  }
@@ -40294,9 +40206,9 @@ function getExtendsConfigPath(extendedConfig, host, basePath, errors, createDiag
40294
40206
  return resolved.resolvedModule.resolvedFileName;
40295
40207
  }
40296
40208
  if (extendedConfig === "") {
40297
- errors.push(createDiagnostic(Diagnostics.Compiler_option_0_cannot_be_given_an_empty_string, "extends"));
40209
+ errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, valueExpression, Diagnostics.Compiler_option_0_cannot_be_given_an_empty_string, "extends"));
40298
40210
  } else {
40299
- errors.push(createDiagnostic(Diagnostics.File_0_not_found, extendedConfig));
40211
+ errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, valueExpression, Diagnostics.File_0_not_found, extendedConfig));
40300
40212
  }
40301
40213
  return void 0;
40302
40214
  }
@@ -40398,42 +40310,33 @@ function convertOptionsFromJson(optionsNameMap, jsonOptions, basePath, defaultOp
40398
40310
  if (opt) {
40399
40311
  (defaultOptions || (defaultOptions = {}))[opt.name] = convertJsonOption(opt, jsonOptions[id], basePath, errors);
40400
40312
  } else {
40401
- errors.push(createUnknownOptionError(id, diagnostics, createCompilerDiagnostic));
40313
+ errors.push(createUnknownOptionError(id, diagnostics));
40402
40314
  }
40403
40315
  }
40404
40316
  return defaultOptions;
40405
40317
  }
40406
- function convertJsonOption(opt, value, basePath, errors) {
40318
+ function createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, message, ...args) {
40319
+ return sourceFile && node ? createDiagnosticForNodeInSourceFile(sourceFile, node, message, ...args) : createCompilerDiagnostic(message, ...args);
40320
+ }
40321
+ function convertJsonOption(opt, value, basePath, errors, propertyAssignment, valueExpression, sourceFile) {
40322
+ if (opt.isCommandLineOnly) {
40323
+ errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, propertyAssignment == null ? void 0 : propertyAssignment.name, Diagnostics.Option_0_can_only_be_specified_on_command_line, opt.name));
40324
+ return void 0;
40325
+ }
40407
40326
  if (isCompilerOptionsValue(opt, value)) {
40408
40327
  const optType = opt.type;
40409
40328
  if (optType === "list" && isArray(value)) {
40410
- return convertJsonOptionOfListType(opt, value, basePath, errors);
40329
+ return convertJsonOptionOfListType(opt, value, basePath, errors, propertyAssignment, valueExpression, sourceFile);
40411
40330
  } else if (optType === "listOrElement") {
40412
- return isArray(value) ? convertJsonOptionOfListType(opt, value, basePath, errors) : convertJsonOption(opt.element, value, basePath, errors);
40331
+ return isArray(value) ? convertJsonOptionOfListType(opt, value, basePath, errors, propertyAssignment, valueExpression, sourceFile) : convertJsonOption(opt.element, value, basePath, errors, propertyAssignment, valueExpression, sourceFile);
40413
40332
  } else if (!isString(opt.type)) {
40414
- return convertJsonOptionOfCustomType(opt, value, errors);
40333
+ return convertJsonOptionOfCustomType(opt, value, errors, valueExpression, sourceFile);
40415
40334
  }
40416
- const validatedValue = validateJsonOptionValue(opt, value, errors);
40335
+ const validatedValue = validateJsonOptionValue(opt, value, errors, valueExpression, sourceFile);
40417
40336
  return isNullOrUndefined(validatedValue) ? validatedValue : normalizeNonListOptionValue(opt, basePath, validatedValue);
40418
40337
  } else {
40419
- errors.push(createCompilerDiagnostic(Diagnostics.Compiler_option_0_requires_a_value_of_type_1, opt.name, getCompilerOptionValueTypeString(opt)));
40420
- }
40421
- }
40422
- function normalizeOptionValue(option, basePath, value) {
40423
- if (isNullOrUndefined(value))
40424
- return void 0;
40425
- if (option.type === "listOrElement" && !isArray(value))
40426
- return normalizeOptionValue(option.element, basePath, value);
40427
- else if (option.type === "list" || option.type === "listOrElement") {
40428
- const listOption = option;
40429
- if (listOption.element.isFilePath || !isString(listOption.element.type)) {
40430
- return filter(map(value, (v) => normalizeOptionValue(listOption.element, basePath, v)), (v) => listOption.listPreserveFalsyValues ? true : !!v);
40431
- }
40432
- return value;
40433
- } else if (!isString(option.type)) {
40434
- return option.type.get(isString(value) ? value.toLowerCase() : value);
40338
+ errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, valueExpression, Diagnostics.Compiler_option_0_requires_a_value_of_type_1, opt.name, getCompilerOptionValueTypeString(opt)));
40435
40339
  }
40436
- return normalizeNonListOptionValue(option, basePath, value);
40437
40340
  }
40438
40341
  function normalizeNonListOptionValue(option, basePath, value) {
40439
40342
  if (option.isFilePath) {
@@ -40444,29 +40347,29 @@ function normalizeNonListOptionValue(option, basePath, value) {
40444
40347
  }
40445
40348
  return value;
40446
40349
  }
40447
- function validateJsonOptionValue(opt, value, errors) {
40350
+ function validateJsonOptionValue(opt, value, errors, valueExpression, sourceFile) {
40448
40351
  var _a2;
40449
40352
  if (isNullOrUndefined(value))
40450
40353
  return void 0;
40451
40354
  const d = (_a2 = opt.extraValidation) == null ? void 0 : _a2.call(opt, value);
40452
40355
  if (!d)
40453
40356
  return value;
40454
- errors.push(createCompilerDiagnostic(...d));
40357
+ errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, valueExpression, ...d));
40455
40358
  return void 0;
40456
40359
  }
40457
- function convertJsonOptionOfCustomType(opt, value, errors) {
40360
+ function convertJsonOptionOfCustomType(opt, value, errors, valueExpression, sourceFile) {
40458
40361
  if (isNullOrUndefined(value))
40459
40362
  return void 0;
40460
40363
  const key = value.toLowerCase();
40461
40364
  const val = opt.type.get(key);
40462
40365
  if (val !== void 0) {
40463
- return validateJsonOptionValue(opt, val, errors);
40366
+ return validateJsonOptionValue(opt, val, errors, valueExpression, sourceFile);
40464
40367
  } else {
40465
- errors.push(createCompilerDiagnosticForInvalidCustomType(opt));
40368
+ errors.push(createDiagnosticForInvalidCustomType(opt, (message, ...args) => createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, valueExpression, message, ...args)));
40466
40369
  }
40467
40370
  }
40468
- function convertJsonOptionOfListType(option, values, basePath, errors) {
40469
- return filter(map(values, (v) => convertJsonOption(option.element, v, basePath, errors)), (v) => option.listPreserveFalsyValues ? true : !!v);
40371
+ function convertJsonOptionOfListType(option, values, basePath, errors, propertyAssignment, valueExpression, sourceFile) {
40372
+ 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);
40470
40373
  }
40471
40374
  var invalidTrailingRecursionPattern = /(^|\/)\*\*\/?$/;
40472
40375
  var wildcardDirectoryPattern = /^[^*?]*(?=\/[^/]*[*?])/;
@@ -40575,7 +40478,7 @@ function validateSpecs(specs, errors, disallowTrailingRecursion, jsonSourceFile,
40575
40478
  });
40576
40479
  function createDiagnostic(message, spec) {
40577
40480
  const element = getTsConfigPropArrayElementValue(jsonSourceFile, specKey, spec);
40578
- return element ? createDiagnosticForNodeInSourceFile(jsonSourceFile, element, message, spec) : createCompilerDiagnostic(message, spec);
40481
+ return createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(jsonSourceFile, element, message, spec);
40579
40482
  }
40580
40483
  }
40581
40484
  function specToDiagnostic(spec, disallowTrailingRecursion) {
@@ -40686,6 +40589,8 @@ function convertCompilerOptionsForTelemetry(opts) {
40686
40589
  return out;
40687
40590
  }
40688
40591
  function getOptionValueWithEmptyStrings(value, option) {
40592
+ if (value === void 0)
40593
+ return value;
40689
40594
  switch (option.type) {
40690
40595
  case "object":
40691
40596
  return "";
@@ -40700,7 +40605,7 @@ function getOptionValueWithEmptyStrings(value, option) {
40700
40605
  return getOptionValueWithEmptyStrings(value, option.element);
40701
40606
  case "list":
40702
40607
  const elementType = option.element;
40703
- return isArray(value) ? value.map((v) => getOptionValueWithEmptyStrings(v, elementType)) : "";
40608
+ return isArray(value) ? mapDefined(value, (v) => getOptionValueWithEmptyStrings(v, elementType)) : "";
40704
40609
  default:
40705
40610
  return forEachEntry(option.type, (optionEnumValue, optionStringValue) => {
40706
40611
  if (optionEnumValue === value) {
@@ -43453,8 +43358,8 @@ function createBinder() {
43453
43358
  var reportedUnreachableFlow = { flags: 1 /* Unreachable */ };
43454
43359
  var bindBinaryExpressionFlow = createBindBinaryExpressionFlow();
43455
43360
  return bindSourceFile2;
43456
- function createDiagnosticForNode2(node, message, arg0, arg1, arg2) {
43457
- return createDiagnosticForNodeInSourceFile(getSourceFileOfNode(node) || file, node, message, arg0, arg1, arg2);
43361
+ function createDiagnosticForNode2(node, message, ...args) {
43362
+ return createDiagnosticForNodeInSourceFile(getSourceFileOfNode(node) || file, node, message, ...args);
43458
43363
  }
43459
43364
  function bindSourceFile2(f, opts) {
43460
43365
  var _a2, _b;
@@ -43648,7 +43553,7 @@ function createBinder() {
43648
43553
  const declarationName = getNameOfDeclaration(node) || node;
43649
43554
  forEach(symbol.declarations, (declaration, index) => {
43650
43555
  const decl = getNameOfDeclaration(declaration) || declaration;
43651
- const diag3 = createDiagnosticForNode2(decl, message, messageNeedsName ? getDisplayName(declaration) : void 0);
43556
+ const diag3 = messageNeedsName ? createDiagnosticForNode2(decl, message, getDisplayName(declaration)) : createDiagnosticForNode2(decl, message);
43652
43557
  file.bindDiagnostics.push(
43653
43558
  multipleDefaultExports ? addRelatedInfo(diag3, createDiagnosticForNode2(declarationName, index === 0 ? Diagnostics.Another_export_default_is_here : Diagnostics.and_here)) : diag3
43654
43559
  );
@@ -43656,7 +43561,7 @@ function createBinder() {
43656
43561
  relatedInformation.push(createDiagnosticForNode2(decl, Diagnostics.The_first_export_default_is_here));
43657
43562
  }
43658
43563
  });
43659
- const diag2 = createDiagnosticForNode2(declarationName, message, messageNeedsName ? getDisplayName(node) : void 0);
43564
+ const diag2 = messageNeedsName ? createDiagnosticForNode2(declarationName, message, getDisplayName(node)) : createDiagnosticForNode2(declarationName, message);
43660
43565
  file.bindDiagnostics.push(addRelatedInfo(diag2, ...relatedInformation));
43661
43566
  symbol = createSymbol(0 /* None */, name);
43662
43567
  }
@@ -45117,9 +45022,9 @@ function createBinder() {
45117
45022
  }
45118
45023
  }
45119
45024
  }
45120
- function errorOnFirstToken(node, message, arg0, arg1, arg2) {
45025
+ function errorOnFirstToken(node, message, ...args) {
45121
45026
  const span = getSpanOfTokenAtPosition(file, node.pos);
45122
- file.bindDiagnostics.push(createFileDiagnostic(file, span.start, span.length, message, arg0, arg1, arg2));
45027
+ file.bindDiagnostics.push(createFileDiagnostic(file, span.start, span.length, message, ...args));
45123
45028
  }
45124
45029
  function errorOrSuggestionOnNode(isError, node, message) {
45125
45030
  errorOrSuggestionOnRange(isError, node, node, message);
@@ -47277,6 +47182,7 @@ function createTypeChecker(host) {
47277
47182
  var argumentsSymbol = createSymbol(4 /* Property */, "arguments");
47278
47183
  var requireSymbol = createSymbol(4 /* Property */, "require");
47279
47184
  var isolatedModulesLikeFlagName = compilerOptions.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules";
47185
+ var canCollectSymbolAliasAccessabilityData = !compilerOptions.verbatimModuleSyntax || !!compilerOptions.importsNotUsedAsValues;
47280
47186
  var apparentArgumentCount;
47281
47187
  const checker = {
47282
47188
  getNodeCount: () => reduceLeft(host.getSourceFiles(), (n, s) => n + s.nodeCount, 0),
@@ -48104,8 +48010,8 @@ function createTypeChecker(host) {
48104
48010
  getDiagnostics2(sourceFile, cancellationToken2);
48105
48011
  return emitResolver;
48106
48012
  }
48107
- function lookupOrIssueError(location, message, arg0, arg1, arg2, arg3) {
48108
- const diagnostic = location ? createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : createCompilerDiagnostic(message, arg0, arg1, arg2, arg3);
48013
+ function lookupOrIssueError(location, message, ...args) {
48014
+ const diagnostic = location ? createDiagnosticForNode(location, message, ...args) : createCompilerDiagnostic(message, ...args);
48109
48015
  const existing = diagnostics.lookup(diagnostic);
48110
48016
  if (existing) {
48111
48017
  return existing;
@@ -48114,16 +48020,16 @@ function createTypeChecker(host) {
48114
48020
  return diagnostic;
48115
48021
  }
48116
48022
  }
48117
- function errorSkippedOn(key, location, message, arg0, arg1, arg2, arg3) {
48118
- const diagnostic = error(location, message, arg0, arg1, arg2, arg3);
48023
+ function errorSkippedOn(key, location, message, ...args) {
48024
+ const diagnostic = error(location, message, ...args);
48119
48025
  diagnostic.skippedOn = key;
48120
48026
  return diagnostic;
48121
48027
  }
48122
- function createError(location, message, arg0, arg1, arg2, arg3) {
48123
- return location ? createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : createCompilerDiagnostic(message, arg0, arg1, arg2, arg3);
48028
+ function createError(location, message, ...args) {
48029
+ return location ? createDiagnosticForNode(location, message, ...args) : createCompilerDiagnostic(message, ...args);
48124
48030
  }
48125
- function error(location, message, arg0, arg1, arg2, arg3) {
48126
- const diagnostic = createError(location, message, arg0, arg1, arg2, arg3);
48031
+ function error(location, message, ...args) {
48032
+ const diagnostic = createError(location, message, ...args);
48127
48033
  diagnostics.add(diagnostic);
48128
48034
  return diagnostic;
48129
48035
  }
@@ -48134,19 +48040,19 @@ function createTypeChecker(host) {
48134
48040
  suggestionDiagnostics.add({ ...diagnostic, category: 2 /* Suggestion */ });
48135
48041
  }
48136
48042
  }
48137
- function errorOrSuggestion(isError, location, message, arg0, arg1, arg2, arg3) {
48043
+ function errorOrSuggestion(isError, location, message, ...args) {
48138
48044
  if (location.pos < 0 || location.end < 0) {
48139
48045
  if (!isError) {
48140
48046
  return;
48141
48047
  }
48142
48048
  const file = getSourceFileOfNode(location);
48143
- addErrorOrSuggestion(isError, "message" in message ? createFileDiagnostic(file, 0, 0, message, arg0, arg1, arg2, arg3) : createDiagnosticForFileFromMessageChain(file, message));
48049
+ addErrorOrSuggestion(isError, "message" in message ? createFileDiagnostic(file, 0, 0, message, ...args) : createDiagnosticForFileFromMessageChain(file, message));
48144
48050
  return;
48145
48051
  }
48146
- addErrorOrSuggestion(isError, "message" in message ? createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(location), location, message));
48052
+ addErrorOrSuggestion(isError, "message" in message ? createDiagnosticForNode(location, message, ...args) : createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(location), location, message));
48147
48053
  }
48148
- function errorAndMaybeSuggestAwait(location, maybeMissingAwait, message, arg0, arg1, arg2, arg3) {
48149
- const diagnostic = error(location, message, arg0, arg1, arg2, arg3);
48054
+ function errorAndMaybeSuggestAwait(location, maybeMissingAwait, message, ...args) {
48055
+ const diagnostic = error(location, message, ...args);
48150
48056
  if (maybeMissingAwait) {
48151
48057
  const related = createDiagnosticForNode(location, Diagnostics.Did_you_forget_to_use_await);
48152
48058
  addRelatedInfo(diagnostic, related);
@@ -50020,7 +49926,7 @@ function createTypeChecker(host) {
50020
49926
  return void 0;
50021
49927
  }
50022
49928
  function markExportAsReferenced(node) {
50023
- if (compilerOptions.verbatimModuleSyntax) {
49929
+ if (!canCollectSymbolAliasAccessabilityData) {
50024
49930
  return;
50025
49931
  }
50026
49932
  const symbol = getSymbolOfDeclaration(node);
@@ -50033,7 +49939,7 @@ function createTypeChecker(host) {
50033
49939
  }
50034
49940
  }
50035
49941
  function markAliasSymbolAsReferenced(symbol) {
50036
- Debug.assert(!compilerOptions.verbatimModuleSyntax);
49942
+ Debug.assert(canCollectSymbolAliasAccessabilityData);
50037
49943
  const links = getSymbolLinks(symbol);
50038
49944
  if (!links.referenced) {
50039
49945
  links.referenced = true;
@@ -50164,6 +50070,9 @@ function createTypeChecker(host) {
50164
50070
  }
50165
50071
  }
50166
50072
  symbol = getMergedSymbol(getSymbol2(getExportsOfSymbol(namespace), right.escapedText, meaning));
50073
+ if (!symbol && namespace.flags & 2097152 /* Alias */) {
50074
+ symbol = getMergedSymbol(getSymbol2(getExportsOfSymbol(resolveAlias(namespace)), right.escapedText, meaning));
50075
+ }
50167
50076
  if (!symbol) {
50168
50077
  if (!ignoreErrors) {
50169
50078
  const namespaceName = getFullyQualifiedName(namespace);
@@ -50200,7 +50109,7 @@ function createTypeChecker(host) {
50200
50109
  return void 0;
50201
50110
  }
50202
50111
  } else {
50203
- throw Debug.assertNever(name, "Unknown entity name kind.");
50112
+ Debug.assertNever(name, "Unknown entity name kind.");
50204
50113
  }
50205
50114
  Debug.assert((getCheckFlags(symbol) & 1 /* Instantiated */) === 0, "Should never get an instantiated symbol here.");
50206
50115
  if (!nodeIsSynthesized(name) && isEntityName(name) && (symbol.flags & 2097152 /* Alias */ || name.parent.kind === 275 /* ExportAssignment */)) {
@@ -51913,8 +51822,11 @@ function createTypeChecker(host) {
51913
51822
  }
51914
51823
  return typeToTypeNodeHelper(type2, context);
51915
51824
  }
51825
+ function isMappedTypeHomomorphic(type2) {
51826
+ return !!getHomomorphicTypeVariable(type2);
51827
+ }
51916
51828
  function isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type2) {
51917
- return isMappedTypeWithKeyofConstraintDeclaration(type2) && !(getModifiersTypeFromMappedType(type2).flags & 262144 /* TypeParameter */);
51829
+ return !!type2.target && isMappedTypeHomomorphic(type2.target) && !isMappedTypeHomomorphic(type2);
51918
51830
  }
51919
51831
  function createMappedTypeNodeFromType(type2) {
51920
51832
  Debug.assert(!!(type2.flags & 524288 /* Object */));
@@ -58082,7 +57994,7 @@ function createTypeChecker(host) {
58082
57994
  return simplified !== type ? simplified : getConstraintOfType(type);
58083
57995
  }
58084
57996
  function getConstraintFromIndexedAccess(type) {
58085
- if (isMappedTypeGenericIndexedAccess(type)) {
57997
+ if (isMappedTypeGenericIndexedAccess(type) || isGenericMappedType(type.objectType)) {
58086
57998
  return substituteIndexedMappedType(type.objectType, type.indexType);
58087
57999
  }
58088
58000
  const indexConstraint = getSimplifiedTypeOrConstraint(type.indexType);
@@ -58318,7 +58230,7 @@ function createTypeChecker(host) {
58318
58230
  const typeVariable = getHomomorphicTypeVariable(type);
58319
58231
  if (typeVariable && !type.declaration.nameType) {
58320
58232
  const constraint = getConstraintOfTypeParameter(typeVariable);
58321
- if (constraint && isArrayType(constraint)) {
58233
+ if (constraint && everyType(constraint, isArrayOrTupleType)) {
58322
58234
  return instantiateType(type, prependTypeMapping(typeVariable, constraint, type.mapper));
58323
58235
  }
58324
58236
  }
@@ -60470,6 +60382,12 @@ function createTypeChecker(host) {
60470
60382
  i--;
60471
60383
  const source = types[i];
60472
60384
  if (hasEmptyObject || source.flags & 469499904 /* StructuredOrInstantiable */) {
60385
+ if (source.flags & 262144 /* TypeParameter */ && getBaseConstraintOrType(source).flags & 1048576 /* Union */) {
60386
+ if (isTypeRelatedTo(source, getUnionType(map(types, (t) => t === source ? neverType : t)), strictSubtypeRelation)) {
60387
+ orderedRemoveItemAt(types, i);
60388
+ }
60389
+ continue;
60390
+ }
60473
60391
  const keyProperty = source.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 58982400 /* InstantiableNonPrimitive */) ? find(getPropertiesOfType(source), (p) => isUnitType(getTypeOfSymbol(p))) : void 0;
60474
60392
  const keyPropertyType = keyProperty && getRegularTypeOfLiteralType(getTypeOfSymbol(keyProperty));
60475
60393
  for (const target of types) {
@@ -61037,7 +60955,7 @@ function createTypeChecker(host) {
61037
60955
  links.resolvedType = getTypeFromTypeNode(node.type);
61038
60956
  break;
61039
60957
  default:
61040
- throw Debug.assertNever(node.operator);
60958
+ Debug.assertNever(node.operator);
61041
60959
  }
61042
60960
  }
61043
60961
  return links.resolvedType;
@@ -61121,7 +61039,7 @@ function createTypeChecker(host) {
61121
61039
  return type;
61122
61040
  }
61123
61041
  function getStringMappingType(symbol, type) {
61124
- 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)) : (
61042
+ 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)) : (
61125
61043
  // Mapping<Mapping<T>> === Mapping<T>
61126
61044
  type.flags & 268435456 /* StringMapping */ && symbol === type.symbol ? type : type.flags & (1 /* Any */ | 4 /* String */ | 268435456 /* StringMapping */) || isGenericIndexType(type) ? getStringMappingTypeForGenericType(symbol, type) : (
61127
61045
  // This handles Mapping<`${number}`> and Mapping<`${bigint}`>
@@ -62004,7 +61922,10 @@ function createTypeChecker(host) {
62004
61922
  const declarations = concatenate(leftProp.declarations, rightProp.declarations);
62005
61923
  const flags = 4 /* Property */ | leftProp.flags & 16777216 /* Optional */;
62006
61924
  const result = createSymbol(flags, leftProp.escapedName);
62007
- result.links.type = getUnionType([getTypeOfSymbol(leftProp), removeMissingOrUndefinedType(rightType)], 2 /* Subtype */);
61925
+ const leftType = getTypeOfSymbol(leftProp);
61926
+ const leftTypeWithoutUndefined = removeMissingOrUndefinedType(leftType);
61927
+ const rightTypeWithoutUndefined = removeMissingOrUndefinedType(rightType);
61928
+ result.links.type = leftTypeWithoutUndefined === rightTypeWithoutUndefined ? leftType : getUnionType([leftType, rightTypeWithoutUndefined], 2 /* Subtype */);
62008
61929
  result.links.leftSpread = leftProp;
62009
61930
  result.links.rightSpread = rightProp;
62010
61931
  result.declarations = declarations;
@@ -62795,7 +62716,13 @@ function createTypeChecker(host) {
62795
62716
  return hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node);
62796
62717
  }
62797
62718
  function hasContextSensitiveReturnExpression(node) {
62798
- return !node.typeParameters && !getEffectiveReturnTypeNode(node) && !!node.body && node.body.kind !== 239 /* Block */ && isContextSensitive(node.body);
62719
+ if (node.typeParameters || getEffectiveReturnTypeNode(node) || !node.body) {
62720
+ return false;
62721
+ }
62722
+ if (node.body.kind !== 239 /* Block */) {
62723
+ return isContextSensitive(node.body);
62724
+ }
62725
+ return !!forEachReturnStatement(node.body, (statement) => !!statement.expression && isContextSensitive(statement.expression));
62799
62726
  }
62800
62727
  function isContextSensitiveFunctionOrObjectLiteralMethod(func) {
62801
62728
  return (isFunctionExpressionOrArrowFunction(func) || isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func);
@@ -63421,6 +63348,9 @@ function createTypeChecker(host) {
63421
63348
  const targetCount = getParameterCount(target);
63422
63349
  const sourceHasMoreParameters = !hasEffectiveRestParameter(target) && (checkMode & 8 /* StrictArity */ ? hasEffectiveRestParameter(source) || getParameterCount(source) > targetCount : getMinArgumentCount(source) > targetCount);
63423
63350
  if (sourceHasMoreParameters) {
63351
+ if (reportErrors2 && !(checkMode & 8 /* StrictArity */)) {
63352
+ errorReporter(Diagnostics.Target_signature_provides_too_few_arguments_Expected_0_or_more_but_got_1, getMinArgumentCount(source), targetCount);
63353
+ }
63424
63354
  return 0 /* False */;
63425
63355
  }
63426
63356
  if (source.typeParameters && source.typeParameters !== target.typeParameters) {
@@ -63464,7 +63394,12 @@ function createTypeChecker(host) {
63464
63394
  const paramCount = sourceRestType || targetRestType ? Math.min(sourceCount, targetCount) : Math.max(sourceCount, targetCount);
63465
63395
  const restIndex = sourceRestType || targetRestType ? paramCount - 1 : -1;
63466
63396
  for (let i = 0; i < paramCount; i++) {
63467
- const sourceType = i === restIndex ? getRestTypeAtPosition(source, i) : tryGetTypeAtPosition(source, i);
63397
+ const sourceType = i === restIndex ? getRestTypeAtPosition(
63398
+ source,
63399
+ i,
63400
+ /*readonly*/
63401
+ true
63402
+ ) : tryGetTypeAtPosition(source, i);
63468
63403
  const targetType = i === restIndex ? getRestTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
63469
63404
  if (sourceType && targetType) {
63470
63405
  const sourceSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
@@ -63730,7 +63665,7 @@ function createTypeChecker(host) {
63730
63665
  }
63731
63666
  function getNormalizedType(type, writing) {
63732
63667
  while (true) {
63733
- 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;
63668
+ 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;
63734
63669
  if (t === type)
63735
63670
  return t;
63736
63671
  type = t;
@@ -63749,6 +63684,11 @@ function createTypeChecker(host) {
63749
63684
  }
63750
63685
  return type;
63751
63686
  }
63687
+ function getNormalizedTupleType(type, writing) {
63688
+ const elements = getTypeArguments(type);
63689
+ const normalizedElements = sameMap(elements, (t) => t.flags & 25165824 /* Simplifiable */ ? getSimplifiedType(t, writing) : t);
63690
+ return elements !== normalizedElements ? createNormalizedTupleType(type.target, normalizedElements) : type;
63691
+ }
63752
63692
  function checkTypeRelatedTo(source, target, relation, errorNode, headMessage, containingMessageChain, errorOutputContainer) {
63753
63693
  var _a2;
63754
63694
  let errorInfo;
@@ -63838,10 +63778,10 @@ function createTypeChecker(host) {
63838
63778
  relatedInfo: relatedInfo == null ? void 0 : relatedInfo.slice()
63839
63779
  };
63840
63780
  }
63841
- function reportIncompatibleError(message, arg0, arg1, arg2, arg3) {
63781
+ function reportIncompatibleError(message, ...args) {
63842
63782
  overrideNextErrorInfo++;
63843
63783
  lastSkippedInfo = void 0;
63844
- (incompatibleStack || (incompatibleStack = [])).push([message, arg0, arg1, arg2, arg3]);
63784
+ (incompatibleStack || (incompatibleStack = [])).push([message, ...args]);
63845
63785
  }
63846
63786
  function reportIncompatibleStack() {
63847
63787
  const stack = incompatibleStack || [];
@@ -63933,13 +63873,13 @@ function createTypeChecker(host) {
63933
63873
  );
63934
63874
  }
63935
63875
  }
63936
- function reportError(message, arg0, arg1, arg2, arg3) {
63876
+ function reportError(message, ...args) {
63937
63877
  Debug.assert(!!errorNode);
63938
63878
  if (incompatibleStack)
63939
63879
  reportIncompatibleStack();
63940
63880
  if (message.elidedInCompatabilityPyramid)
63941
63881
  return;
63942
- errorInfo = chainDiagnosticMessages(errorInfo, message, arg0, arg1, arg2, arg3);
63882
+ errorInfo = chainDiagnosticMessages(errorInfo, message, ...args);
63943
63883
  }
63944
63884
  function associateRelatedInfo(info) {
63945
63885
  Debug.assert(!!errorInfo);
@@ -65119,6 +65059,26 @@ function createTypeChecker(host) {
65119
65059
  )) {
65120
65060
  return result2;
65121
65061
  }
65062
+ if (sourceFlags & 8388608 /* IndexedAccess */) {
65063
+ const indexType = source2.indexType;
65064
+ if (indexType.flags & 4194304 /* Index */) {
65065
+ const unresolvedIndexConstraint = getBaseConstraintOfType(indexType.type);
65066
+ const indexConstraint = unresolvedIndexConstraint && unresolvedIndexConstraint !== noConstraintType ? getIndexType(unresolvedIndexConstraint) : keyofConstraintType;
65067
+ const constraint2 = getIndexedAccessType(source2.objectType, indexConstraint);
65068
+ if (result2 = isRelatedTo(
65069
+ constraint2,
65070
+ target2,
65071
+ 1 /* Source */,
65072
+ /*reportErrors*/
65073
+ false,
65074
+ /*headMessage*/
65075
+ void 0,
65076
+ intersectionState
65077
+ )) {
65078
+ return result2;
65079
+ }
65080
+ }
65081
+ }
65122
65082
  if (isMappedTypeGenericIndexedAccess(source2)) {
65123
65083
  const indexConstraint = getConstraintOfType(source2.indexType);
65124
65084
  if (indexConstraint) {
@@ -65226,7 +65186,7 @@ function createTypeChecker(host) {
65226
65186
  if (varianceResult !== void 0) {
65227
65187
  return varianceResult;
65228
65188
  }
65229
- } else if (isReadonlyArrayType(target2) ? isArrayOrTupleType(source2) : isArrayType(target2) && isTupleType(source2) && !source2.target.readonly) {
65189
+ } else if (isReadonlyArrayType(target2) ? everyType(source2, isArrayOrTupleType) : isArrayType(target2) && everyType(source2, (t) => isTupleType(t) && !t.target.readonly)) {
65230
65190
  if (relation !== identityRelation) {
65231
65191
  return isRelatedTo(getIndexTypeOfType(source2, numberType) || anyType, getIndexTypeOfType(target2, numberType) || anyType, 3 /* Both */, reportErrors2);
65232
65192
  } else {
@@ -66109,22 +66069,7 @@ function createTypeChecker(host) {
66109
66069
  if (match === -1) {
66110
66070
  return defaultValue;
66111
66071
  }
66112
- let nextMatch = discriminable.indexOf(
66113
- /*searchElement*/
66114
- true,
66115
- match + 1
66116
- );
66117
- while (nextMatch !== -1) {
66118
- if (!isTypeIdenticalTo(target.types[match], target.types[nextMatch])) {
66119
- return defaultValue;
66120
- }
66121
- nextMatch = discriminable.indexOf(
66122
- /*searchElement*/
66123
- true,
66124
- nextMatch + 1
66125
- );
66126
- }
66127
- return target.types[match];
66072
+ return getUnionType(target.types.filter((_, index) => discriminable[index]));
66128
66073
  }
66129
66074
  function isWeakType(type) {
66130
66075
  if (type.flags & 524288 /* Object */) {
@@ -67568,21 +67513,19 @@ function createTypeChecker(host) {
67568
67513
  const saveInferencePriority = inferencePriority;
67569
67514
  inferencePriority = 2048 /* MaxValue */;
67570
67515
  const saveExpandingFlags = expandingFlags;
67571
- const sourceIdentity = getRecursionIdentity(source);
67572
- const targetIdentity = getRecursionIdentity(target);
67573
- if (contains(sourceStack, sourceIdentity))
67516
+ (sourceStack != null ? sourceStack : sourceStack = []).push(source);
67517
+ (targetStack != null ? targetStack : targetStack = []).push(target);
67518
+ if (isDeeplyNestedType(source, sourceStack, sourceStack.length, 2))
67574
67519
  expandingFlags |= 1 /* Source */;
67575
- if (contains(targetStack, targetIdentity))
67520
+ if (isDeeplyNestedType(target, targetStack, targetStack.length, 2))
67576
67521
  expandingFlags |= 2 /* Target */;
67577
67522
  if (expandingFlags !== 3 /* Both */) {
67578
- (sourceStack || (sourceStack = [])).push(sourceIdentity);
67579
- (targetStack || (targetStack = [])).push(targetIdentity);
67580
67523
  action(source, target);
67581
- targetStack.pop();
67582
- sourceStack.pop();
67583
67524
  } else {
67584
67525
  inferencePriority = -1 /* Circularity */;
67585
67526
  }
67527
+ targetStack.pop();
67528
+ sourceStack.pop();
67586
67529
  expandingFlags = saveExpandingFlags;
67587
67530
  visited.set(key, inferencePriority);
67588
67531
  inferencePriority = Math.min(inferencePriority, saveInferencePriority);
@@ -67724,7 +67667,11 @@ function createTypeChecker(host) {
67724
67667
  return true;
67725
67668
  }
67726
67669
  if (constraintType.flags & 262144 /* TypeParameter */) {
67727
- inferWithPriority(getIndexType(source), constraintType, 32 /* MappedTypeConstraint */);
67670
+ inferWithPriority(getIndexType(
67671
+ source,
67672
+ /*indexFlags*/
67673
+ !!source.pattern ? 2 /* NoIndexSignatures */ : 0 /* None */
67674
+ ), constraintType, 32 /* MappedTypeConstraint */);
67728
67675
  const extendedConstraint = getConstraintOfType(constraintType);
67729
67676
  if (extendedConstraint && inferToMappedType(source, target, extendedConstraint)) {
67730
67677
  return true;
@@ -68197,36 +68144,34 @@ function createTypeChecker(host) {
68197
68144
  return type.flags & 8192 /* UniqueESSymbol */ ? type.escapedName : type.flags & 384 /* StringOrNumberLiteral */ ? escapeLeadingUnderscores("" + type.value) : void 0;
68198
68145
  }
68199
68146
  function tryGetElementAccessExpressionName(node) {
68200
- if (isStringOrNumericLiteralLike(node.argumentExpression)) {
68201
- return escapeLeadingUnderscores(node.argumentExpression.text);
68147
+ return isStringOrNumericLiteralLike(node.argumentExpression) ? escapeLeadingUnderscores(node.argumentExpression.text) : isEntityNameExpression(node.argumentExpression) ? tryGetNameFromEntityNameExpression(node.argumentExpression) : void 0;
68148
+ }
68149
+ function tryGetNameFromEntityNameExpression(node) {
68150
+ const symbol = resolveEntityName(
68151
+ node,
68152
+ 111551 /* Value */,
68153
+ /*ignoreErrors*/
68154
+ true
68155
+ );
68156
+ if (!symbol || !(isConstVariable(symbol) || symbol.flags & 8 /* EnumMember */))
68157
+ return void 0;
68158
+ const declaration = symbol.valueDeclaration;
68159
+ if (declaration === void 0)
68160
+ return void 0;
68161
+ const type = tryGetTypeFromEffectiveTypeNode(declaration);
68162
+ if (type) {
68163
+ const name = tryGetNameFromType(type);
68164
+ if (name !== void 0) {
68165
+ return name;
68166
+ }
68202
68167
  }
68203
- if (isEntityNameExpression(node.argumentExpression)) {
68204
- const symbol = resolveEntityName(
68205
- node.argumentExpression,
68206
- 111551 /* Value */,
68207
- /*ignoreErrors*/
68208
- true
68209
- );
68210
- if (!symbol || !(isConstVariable(symbol) || symbol.flags & 8 /* EnumMember */))
68211
- return void 0;
68212
- const declaration = symbol.valueDeclaration;
68213
- if (declaration === void 0)
68214
- return void 0;
68215
- const type = tryGetTypeFromEffectiveTypeNode(declaration);
68216
- if (type) {
68217
- const name = tryGetNameFromType(type);
68218
- if (name !== void 0) {
68219
- return name;
68220
- }
68168
+ if (hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node)) {
68169
+ const initializer = getEffectiveInitializer(declaration);
68170
+ if (initializer) {
68171
+ return tryGetNameFromType(getTypeOfExpression(initializer));
68221
68172
  }
68222
- if (hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node.argumentExpression)) {
68223
- const initializer = getEffectiveInitializer(declaration);
68224
- if (initializer) {
68225
- return tryGetNameFromType(getTypeOfExpression(initializer));
68226
- }
68227
- if (isEnumMember(declaration)) {
68228
- return getTextOfPropertyName(declaration.name);
68229
- }
68173
+ if (isEnumMember(declaration)) {
68174
+ return getTextOfPropertyName(declaration.name);
68230
68175
  }
68231
68176
  }
68232
68177
  return void 0;
@@ -70144,7 +70089,7 @@ function createTypeChecker(host) {
70144
70089
  });
70145
70090
  }
70146
70091
  function markAliasReferenced(symbol, location) {
70147
- if (compilerOptions.verbatimModuleSyntax) {
70092
+ if (!canCollectSymbolAliasAccessabilityData) {
70148
70093
  return;
70149
70094
  }
70150
70095
  if (isNonLocalAlias(
@@ -71436,7 +71381,11 @@ function createTypeChecker(host) {
71436
71381
  if (instantiatedType && !(contextFlags && contextFlags & 2 /* NoConstraints */ && instantiatedType.flags & 8650752 /* TypeVariable */)) {
71437
71382
  const apparentType = mapType(
71438
71383
  instantiatedType,
71439
- getApparentType,
71384
+ // When obtaining apparent type of *contextual* type we don't want to get apparent type of mapped types.
71385
+ // That would evaluate mapped types with array or tuple type constraints too eagerly
71386
+ // and thus it would prevent `getTypeOfPropertyOfContextualType` from obtaining per-position contextual type for elements of array literal expressions.
71387
+ // Apparent type of other mapped types is already the mapped type itself so we can just avoid calling `getApparentType` here for all mapped types.
71388
+ (t) => getObjectFlags(t) & 32 /* Mapped */ ? t : getApparentType(t),
71440
71389
  /*noReductions*/
71441
71390
  true
71442
71391
  );
@@ -72701,7 +72650,7 @@ function createTypeChecker(host) {
72701
72650
  }
72702
72651
  if (jsxFactorySym) {
72703
72652
  jsxFactorySym.isReferenced = 67108863 /* All */;
72704
- if (!compilerOptions.verbatimModuleSyntax && jsxFactorySym.flags & 2097152 /* Alias */ && !getTypeOnlyAliasDeclaration(jsxFactorySym)) {
72653
+ if (canCollectSymbolAliasAccessabilityData && jsxFactorySym.flags & 2097152 /* Alias */ && !getTypeOnlyAliasDeclaration(jsxFactorySym)) {
72705
72654
  markAliasSymbolAsReferenced(jsxFactorySym);
72706
72655
  }
72707
72656
  }
@@ -74275,16 +74224,16 @@ function createTypeChecker(host) {
74275
74224
  }
74276
74225
  return { start: start2, length: length2, sourceFile };
74277
74226
  }
74278
- function getDiagnosticForCallNode(node, message, arg0, arg1, arg2, arg3) {
74227
+ function getDiagnosticForCallNode(node, message, ...args) {
74279
74228
  if (isCallExpression(node)) {
74280
74229
  const { sourceFile, start: start2, length: length2 } = getDiagnosticSpanForCallNode(node);
74281
74230
  if ("message" in message) {
74282
- return createFileDiagnostic(sourceFile, start2, length2, message, arg0, arg1, arg2, arg3);
74231
+ return createFileDiagnostic(sourceFile, start2, length2, message, ...args);
74283
74232
  }
74284
74233
  return createDiagnosticForFileFromMessageChain(sourceFile, message);
74285
74234
  } else {
74286
74235
  if ("message" in message) {
74287
- return createDiagnosticForNode(node, message, arg0, arg1, arg2, arg3);
74236
+ return createDiagnosticForNode(node, message, ...args);
74288
74237
  }
74289
74238
  return createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(node), node, message);
74290
74239
  }
@@ -74372,11 +74321,8 @@ function createTypeChecker(host) {
74372
74321
  }
74373
74322
  const parameter = (_a2 = closestSignature == null ? void 0 : closestSignature.declaration) == null ? void 0 : _a2.parameters[closestSignature.thisParameter ? args.length + 1 : args.length];
74374
74323
  if (parameter) {
74375
- const parameterError = createDiagnosticForNode(
74376
- parameter,
74377
- 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,
74378
- !parameter.name ? args.length : !isBindingPattern(parameter.name) ? idText(getFirstIdentifier(parameter.name)) : void 0
74379
- );
74324
+ 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))];
74325
+ const parameterError = createDiagnosticForNode(parameter, ...messageAndArgs);
74380
74326
  return addRelatedInfo(diagnostic, parameterError);
74381
74327
  }
74382
74328
  return diagnostic;
@@ -75307,7 +75253,7 @@ function createTypeChecker(host) {
75307
75253
  case 283 /* JsxSelfClosingElement */:
75308
75254
  return resolveJsxOpeningLikeElement(node, candidatesOutArray, checkMode);
75309
75255
  }
75310
- throw Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable.");
75256
+ Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable.");
75311
75257
  }
75312
75258
  function getResolvedSignature(node, candidatesOutArray, checkMode) {
75313
75259
  const links = getNodeLinks(node);
@@ -75981,12 +75927,12 @@ function createTypeChecker(host) {
75981
75927
  }
75982
75928
  return void 0;
75983
75929
  }
75984
- function getRestTypeAtPosition(source, pos) {
75930
+ function getRestTypeAtPosition(source, pos, readonly = false) {
75985
75931
  const parameterCount = getParameterCount(source);
75986
75932
  const minArgumentCount = getMinArgumentCount(source);
75987
75933
  const restType = getEffectiveRestType(source);
75988
75934
  if (restType && pos >= parameterCount - 1) {
75989
- return pos === parameterCount - 1 ? restType : createArrayType(getIndexedAccessType(restType, numberType));
75935
+ return pos === parameterCount - 1 ? restType : createArrayType(getIndexedAccessType(restType, numberType), readonly);
75990
75936
  }
75991
75937
  const types = [];
75992
75938
  const flags = [];
@@ -76004,13 +75950,7 @@ function createTypeChecker(host) {
76004
75950
  names.push(name);
76005
75951
  }
76006
75952
  }
76007
- return createTupleType(
76008
- types,
76009
- flags,
76010
- /*readonly*/
76011
- false,
76012
- length(names) === length(types) ? names : void 0
76013
- );
75953
+ return createTupleType(types, flags, readonly, length(names) === length(types) ? names : void 0);
76014
75954
  }
76015
75955
  function getParameterCount(signature) {
76016
75956
  const length2 = signature.parameters.length;
@@ -79716,9 +79656,9 @@ function createTypeChecker(host) {
79716
79656
  }
79717
79657
  }
79718
79658
  }
79719
- function getAwaitedTypeOfPromise(type, errorNode, diagnosticMessage, arg0) {
79659
+ function getAwaitedTypeOfPromise(type, errorNode, diagnosticMessage, ...args) {
79720
79660
  const promisedType = getPromisedTypeOfPromise(type, errorNode);
79721
- return promisedType && getAwaitedType(promisedType, errorNode, diagnosticMessage, arg0);
79661
+ return promisedType && getAwaitedType(promisedType, errorNode, diagnosticMessage, ...args);
79722
79662
  }
79723
79663
  function getPromisedTypeOfPromise(type, errorNode, thisTypeForErrorOut) {
79724
79664
  if (isTypeAny(type)) {
@@ -79781,8 +79721,8 @@ function createTypeChecker(host) {
79781
79721
  }
79782
79722
  return typeAsPromise.promisedTypeOfPromise = getUnionType(map(onfulfilledParameterSignatures, getTypeOfFirstParameterOfSignature), 2 /* Subtype */);
79783
79723
  }
79784
- function checkAwaitedType(type, withAlias, errorNode, diagnosticMessage, arg0) {
79785
- const awaitedType = withAlias ? getAwaitedType(type, errorNode, diagnosticMessage, arg0) : getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage, arg0);
79724
+ function checkAwaitedType(type, withAlias, errorNode, diagnosticMessage, ...args) {
79725
+ const awaitedType = withAlias ? getAwaitedType(type, errorNode, diagnosticMessage, ...args) : getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage, ...args);
79786
79726
  return awaitedType || errorType;
79787
79727
  }
79788
79728
  function isThenableType(type) {
@@ -79838,11 +79778,11 @@ function createTypeChecker(host) {
79838
79778
  Debug.assert(isAwaitedTypeInstantiation(type) || getPromisedTypeOfPromise(type) === void 0, "type provided should not be a non-generic 'promise'-like.");
79839
79779
  return type;
79840
79780
  }
79841
- function getAwaitedType(type, errorNode, diagnosticMessage, arg0) {
79842
- const awaitedType = getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage, arg0);
79781
+ function getAwaitedType(type, errorNode, diagnosticMessage, ...args) {
79782
+ const awaitedType = getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage, ...args);
79843
79783
  return awaitedType && createAwaitedTypeIfNeeded(awaitedType);
79844
79784
  }
79845
- function getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage, arg0) {
79785
+ function getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage, ...args) {
79846
79786
  if (isTypeAny(type)) {
79847
79787
  return type;
79848
79788
  }
@@ -79860,7 +79800,7 @@ function createTypeChecker(host) {
79860
79800
  }
79861
79801
  return void 0;
79862
79802
  }
79863
- const mapper = errorNode ? (constituentType) => getAwaitedTypeNoAlias(constituentType, errorNode, diagnosticMessage, arg0) : getAwaitedTypeNoAlias;
79803
+ const mapper = errorNode ? (constituentType) => getAwaitedTypeNoAlias(constituentType, errorNode, diagnosticMessage, ...args) : getAwaitedTypeNoAlias;
79864
79804
  awaitedTypeStack.push(type.id);
79865
79805
  const mapped = mapType(type, mapper);
79866
79806
  awaitedTypeStack.pop();
@@ -79884,7 +79824,7 @@ function createTypeChecker(host) {
79884
79824
  return void 0;
79885
79825
  }
79886
79826
  awaitedTypeStack.push(type.id);
79887
- const awaitedType = getAwaitedTypeNoAlias(promisedType, errorNode, diagnosticMessage, arg0);
79827
+ const awaitedType = getAwaitedTypeNoAlias(promisedType, errorNode, diagnosticMessage, ...args);
79888
79828
  awaitedTypeStack.pop();
79889
79829
  if (!awaitedType) {
79890
79830
  return void 0;
@@ -79898,7 +79838,7 @@ function createTypeChecker(host) {
79898
79838
  if (thisTypeForErrorOut.value) {
79899
79839
  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));
79900
79840
  }
79901
- chain = chainDiagnosticMessages(chain, diagnosticMessage, arg0);
79841
+ chain = chainDiagnosticMessages(chain, diagnosticMessage, ...args);
79902
79842
  diagnostics.add(createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(errorNode), errorNode, chain));
79903
79843
  }
79904
79844
  return void 0;
@@ -80076,7 +80016,7 @@ function createTypeChecker(host) {
80076
80016
  true
80077
80017
  );
80078
80018
  if (rootSymbol && rootSymbol.flags & 2097152 /* Alias */) {
80079
- if (!compilerOptions.verbatimModuleSyntax && symbolIsValue(rootSymbol) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol)) && !getTypeOnlyAliasDeclaration(rootSymbol)) {
80019
+ if (canCollectSymbolAliasAccessabilityData && symbolIsValue(rootSymbol) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol)) && !getTypeOnlyAliasDeclaration(rootSymbol)) {
80080
80020
  markAliasSymbolAsReferenced(rootSymbol);
80081
80021
  } else if (forDecoratorMetadata && getIsolatedModules(compilerOptions) && getEmitModuleKind(compilerOptions) >= 5 /* ES2015 */ && !symbolIsValue(rootSymbol) && !some(rootSymbol.declarations, isTypeOnlyImportOrExportDeclaration)) {
80082
80022
  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);
@@ -80485,9 +80425,8 @@ function createTypeChecker(host) {
80485
80425
  const sourceFile = getSourceFileOfNode(parent2);
80486
80426
  const range = isJSDocTemplateTag(parent2) ? rangeOfNode(parent2) : rangeOfTypeParameters(sourceFile, parent2.typeParameters);
80487
80427
  const only = parent2.typeParameters.length === 1;
80488
- const message = only ? Diagnostics._0_is_declared_but_its_value_is_never_read : Diagnostics.All_type_parameters_are_unused;
80489
- const arg0 = only ? name : void 0;
80490
- addDiagnostic(typeParameter, 1 /* Parameter */, createFileDiagnostic(sourceFile, range.pos, range.end - range.pos, message, arg0));
80428
+ const messageAndArg = only ? [Diagnostics._0_is_declared_but_its_value_is_never_read, name] : [Diagnostics.All_type_parameters_are_unused];
80429
+ addDiagnostic(typeParameter, 1 /* Parameter */, createFileDiagnostic(sourceFile, range.pos, range.end - range.pos, ...messageAndArg));
80491
80430
  }
80492
80431
  } else {
80493
80432
  addDiagnostic(typeParameter, 1 /* Parameter */, createDiagnosticForNode(typeParameter, Diagnostics._0_is_declared_but_its_value_is_never_read, name));
@@ -82045,7 +81984,7 @@ function createTypeChecker(host) {
82045
81984
  forEachKey(catchClause.locals, (caughtName) => {
82046
81985
  const blockLocal = blockLocals.get(caughtName);
82047
81986
  if ((blockLocal == null ? void 0 : blockLocal.valueDeclaration) && (blockLocal.flags & 2 /* BlockScopedVariable */) !== 0) {
82048
- grammarErrorOnNode(blockLocal.valueDeclaration, Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause, caughtName);
81987
+ grammarErrorOnNode(blockLocal.valueDeclaration, Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause, unescapeLeadingUnderscores(caughtName));
82049
81988
  }
82050
81989
  });
82051
81990
  }
@@ -83641,6 +83580,9 @@ function createTypeChecker(host) {
83641
83580
  ) && !getSymbolLinks(getSymbolOfDeclaration(statement)).constEnumReferenced;
83642
83581
  }
83643
83582
  function checkImportsForTypeOnlyConversion(sourceFile) {
83583
+ if (!canCollectSymbolAliasAccessabilityData) {
83584
+ return;
83585
+ }
83644
83586
  for (const statement of sourceFile.statements) {
83645
83587
  if (canConvertImportDeclarationToTypeOnly(statement) || canConvertImportEqualsDeclarationToTypeOnly(statement)) {
83646
83588
  error(
@@ -83726,14 +83668,14 @@ function createTypeChecker(host) {
83726
83668
  markAliasReferenced(sym, id);
83727
83669
  if (getAllSymbolFlags(sym) & 111551 /* Value */) {
83728
83670
  checkExpressionCached(id);
83729
- if (!isIllegalExportDefaultInCJS && compilerOptions.verbatimModuleSyntax && getTypeOnlyAliasDeclaration(sym, 111551 /* Value */)) {
83671
+ if (!isIllegalExportDefaultInCJS && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax && getTypeOnlyAliasDeclaration(sym, 111551 /* Value */)) {
83730
83672
  error(
83731
83673
  id,
83732
83674
  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,
83733
83675
  idText(id)
83734
83676
  );
83735
83677
  }
83736
- } else if (!isIllegalExportDefaultInCJS && compilerOptions.verbatimModuleSyntax) {
83678
+ } else if (!isIllegalExportDefaultInCJS && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax) {
83737
83679
  error(
83738
83680
  id,
83739
83681
  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,
@@ -85070,7 +85012,7 @@ function createTypeChecker(host) {
85070
85012
  return false;
85071
85013
  }
85072
85014
  function isValueAliasDeclaration(node) {
85073
- Debug.assert(!compilerOptions.verbatimModuleSyntax);
85015
+ Debug.assert(canCollectSymbolAliasAccessabilityData);
85074
85016
  switch (node.kind) {
85075
85017
  case 269 /* ImportEqualsDeclaration */:
85076
85018
  return isAliasResolvedToValue(getSymbolOfDeclaration(node));
@@ -85111,7 +85053,7 @@ function createTypeChecker(host) {
85111
85053
  return isConstEnumSymbol(s) || !!s.constEnumOnlyModule;
85112
85054
  }
85113
85055
  function isReferencedAliasDeclaration(node, checkChildren) {
85114
- Debug.assert(!compilerOptions.verbatimModuleSyntax);
85056
+ Debug.assert(canCollectSymbolAliasAccessabilityData);
85115
85057
  if (isAliasSymbolDeclaration2(node)) {
85116
85058
  const symbol = getSymbolOfDeclaration(node);
85117
85059
  const links = symbol && getSymbolLinks(symbol);
@@ -85449,12 +85391,12 @@ function createTypeChecker(host) {
85449
85391
  isDeclarationWithCollidingName,
85450
85392
  isValueAliasDeclaration: (nodeIn) => {
85451
85393
  const node = getParseTreeNode(nodeIn);
85452
- return node ? isValueAliasDeclaration(node) : true;
85394
+ return node && canCollectSymbolAliasAccessabilityData ? isValueAliasDeclaration(node) : true;
85453
85395
  },
85454
85396
  hasGlobalName,
85455
85397
  isReferencedAliasDeclaration: (nodeIn, checkChildren) => {
85456
85398
  const node = getParseTreeNode(nodeIn);
85457
- return node ? isReferencedAliasDeclaration(node, checkChildren) : true;
85399
+ return node && canCollectSymbolAliasAccessabilityData ? isReferencedAliasDeclaration(node, checkChildren) : true;
85458
85400
  },
85459
85401
  getNodeCheckFlags: (nodeIn) => {
85460
85402
  const node = getParseTreeNode(nodeIn);
@@ -86586,10 +86528,10 @@ function createTypeChecker(host) {
86586
86528
  currentKind = 2 /* SetAccessor */;
86587
86529
  break;
86588
86530
  default:
86589
- throw Debug.assertNever(prop, "Unexpected syntax kind:" + prop.kind);
86531
+ Debug.assertNever(prop, "Unexpected syntax kind:" + prop.kind);
86590
86532
  }
86591
86533
  if (!inDestructuring) {
86592
- const effectiveName = getPropertyNameForPropertyNameNode(name);
86534
+ const effectiveName = getEffectivePropertyNameForPropertyNameNode(name);
86593
86535
  if (effectiveName === void 0) {
86594
86536
  continue;
86595
86537
  }
@@ -87058,12 +87000,12 @@ function createTypeChecker(host) {
87058
87000
  switch (node.keywordToken) {
87059
87001
  case 104 /* NewKeyword */:
87060
87002
  if (escapedText !== "target") {
87061
- 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");
87003
+ 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");
87062
87004
  }
87063
87005
  break;
87064
87006
  case 101 /* ImportKeyword */:
87065
87007
  if (escapedText !== "meta") {
87066
- 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");
87008
+ 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");
87067
87009
  }
87068
87010
  break;
87069
87011
  }
@@ -87071,35 +87013,35 @@ function createTypeChecker(host) {
87071
87013
  function hasParseDiagnostics(sourceFile) {
87072
87014
  return sourceFile.parseDiagnostics.length > 0;
87073
87015
  }
87074
- function grammarErrorOnFirstToken(node, message, arg0, arg1, arg2) {
87016
+ function grammarErrorOnFirstToken(node, message, ...args) {
87075
87017
  const sourceFile = getSourceFileOfNode(node);
87076
87018
  if (!hasParseDiagnostics(sourceFile)) {
87077
87019
  const span = getSpanOfTokenAtPosition(sourceFile, node.pos);
87078
- diagnostics.add(createFileDiagnostic(sourceFile, span.start, span.length, message, arg0, arg1, arg2));
87020
+ diagnostics.add(createFileDiagnostic(sourceFile, span.start, span.length, message, ...args));
87079
87021
  return true;
87080
87022
  }
87081
87023
  return false;
87082
87024
  }
87083
- function grammarErrorAtPos(nodeForSourceFile, start2, length2, message, arg0, arg1, arg2) {
87025
+ function grammarErrorAtPos(nodeForSourceFile, start2, length2, message, ...args) {
87084
87026
  const sourceFile = getSourceFileOfNode(nodeForSourceFile);
87085
87027
  if (!hasParseDiagnostics(sourceFile)) {
87086
- diagnostics.add(createFileDiagnostic(sourceFile, start2, length2, message, arg0, arg1, arg2));
87028
+ diagnostics.add(createFileDiagnostic(sourceFile, start2, length2, message, ...args));
87087
87029
  return true;
87088
87030
  }
87089
87031
  return false;
87090
87032
  }
87091
- function grammarErrorOnNodeSkippedOn(key, node, message, arg0, arg1, arg2) {
87033
+ function grammarErrorOnNodeSkippedOn(key, node, message, ...args) {
87092
87034
  const sourceFile = getSourceFileOfNode(node);
87093
87035
  if (!hasParseDiagnostics(sourceFile)) {
87094
- errorSkippedOn(key, node, message, arg0, arg1, arg2);
87036
+ errorSkippedOn(key, node, message, ...args);
87095
87037
  return true;
87096
87038
  }
87097
87039
  return false;
87098
87040
  }
87099
- function grammarErrorOnNode(node, message, arg0, arg1, arg2) {
87041
+ function grammarErrorOnNode(node, message, ...args) {
87100
87042
  const sourceFile = getSourceFileOfNode(node);
87101
87043
  if (!hasParseDiagnostics(sourceFile)) {
87102
- diagnostics.add(createDiagnosticForNode(node, message, arg0, arg1, arg2));
87044
+ diagnostics.add(createDiagnosticForNode(node, message, ...args));
87103
87045
  return true;
87104
87046
  }
87105
87047
  return false;
@@ -87244,7 +87186,7 @@ function createTypeChecker(host) {
87244
87186
  }
87245
87187
  return false;
87246
87188
  }
87247
- function grammarErrorAfterFirstToken(node, message, arg0, arg1, arg2) {
87189
+ function grammarErrorAfterFirstToken(node, message, ...args) {
87248
87190
  const sourceFile = getSourceFileOfNode(node);
87249
87191
  if (!hasParseDiagnostics(sourceFile)) {
87250
87192
  const span = getSpanOfTokenAtPosition(sourceFile, node.pos);
@@ -87254,9 +87196,7 @@ function createTypeChecker(host) {
87254
87196
  /*length*/
87255
87197
  0,
87256
87198
  message,
87257
- arg0,
87258
- arg1,
87259
- arg2
87199
+ ...args
87260
87200
  ));
87261
87201
  return true;
87262
87202
  }
@@ -87402,6 +87342,10 @@ function createTypeChecker(host) {
87402
87342
  }
87403
87343
  return void 0;
87404
87344
  }
87345
+ function getEffectivePropertyNameForPropertyNameNode(node) {
87346
+ const name = getPropertyNameForPropertyNameNode(node);
87347
+ return name ? name : isComputedPropertyName(node) && isEntityNameExpression(node.expression) ? tryGetNameFromEntityNameExpression(node.expression) : void 0;
87348
+ }
87405
87349
  }
87406
87350
  function isNotAccessor(declaration) {
87407
87351
  return !isAccessor(declaration);
@@ -99466,10 +99410,13 @@ function transformJsx(context) {
99466
99410
  return Debug.failBadSyntaxKind(node);
99467
99411
  }
99468
99412
  }
99413
+ function hasProto(obj) {
99414
+ return obj.properties.some((p) => isPropertyAssignment(p) && (isIdentifier(p.name) && idText(p.name) === "__proto__" || isStringLiteral(p.name) && p.name.text === "__proto__"));
99415
+ }
99469
99416
  function hasKeyAfterPropsSpread(node) {
99470
99417
  let spread = false;
99471
99418
  for (const elem of node.attributes.properties) {
99472
- if (isJsxSpreadAttribute(elem)) {
99419
+ if (isJsxSpreadAttribute(elem) && (!isObjectLiteralExpression(elem.expression) || elem.expression.properties.some(isSpreadAssignment))) {
99473
99420
  spread = true;
99474
99421
  } else if (spread && isJsxAttribute(elem) && elem.name.escapedText === "key") {
99475
99422
  return true;
@@ -99635,7 +99582,10 @@ function transformJsx(context) {
99635
99582
  }
99636
99583
  return element;
99637
99584
  }
99638
- function transformJsxSpreadAttributeToSpreadAssignment(node) {
99585
+ function transformJsxSpreadAttributeToProps(node) {
99586
+ if (isObjectLiteralExpression(node.expression) && !hasProto(node.expression)) {
99587
+ return node.expression.properties;
99588
+ }
99639
99589
  return factory2.createSpreadAssignment(Debug.checkDefined(visitNode(node.expression, visitor, isExpression)));
99640
99590
  }
99641
99591
  function transformJsxAttributesToObjectProps(attrs, children) {
@@ -99643,30 +99593,48 @@ function transformJsx(context) {
99643
99593
  return target && target >= 5 /* ES2018 */ ? factory2.createObjectLiteralExpression(transformJsxAttributesToProps(attrs, children)) : transformJsxAttributesToExpression(attrs, children);
99644
99594
  }
99645
99595
  function transformJsxAttributesToProps(attrs, children) {
99646
- const props = flatten(spanMap(attrs, isJsxSpreadAttribute, (attrs2, isSpread) => map(attrs2, (attr) => isSpread ? transformJsxSpreadAttributeToSpreadAssignment(attr) : transformJsxAttributeToObjectLiteralElement(attr))));
99596
+ const props = flatten(spanMap(attrs, isJsxSpreadAttribute, (attrs2, isSpread) => flatten(map(attrs2, (attr) => isSpread ? transformJsxSpreadAttributeToProps(attr) : transformJsxAttributeToObjectLiteralElement(attr)))));
99647
99597
  if (children) {
99648
99598
  props.push(children);
99649
99599
  }
99650
99600
  return props;
99651
99601
  }
99652
99602
  function transformJsxAttributesToExpression(attrs, children) {
99653
- const expressions = flatten(
99654
- spanMap(
99655
- attrs,
99656
- isJsxSpreadAttribute,
99657
- (attrs2, isSpread) => isSpread ? map(attrs2, transformJsxSpreadAttributeToExpression) : factory2.createObjectLiteralExpression(map(attrs2, transformJsxAttributeToObjectLiteralElement))
99658
- )
99659
- );
99660
- if (isJsxSpreadAttribute(attrs[0])) {
99661
- expressions.unshift(factory2.createObjectLiteralExpression());
99603
+ const expressions = [];
99604
+ let properties = [];
99605
+ for (const attr of attrs) {
99606
+ if (isJsxSpreadAttribute(attr)) {
99607
+ if (isObjectLiteralExpression(attr.expression) && !hasProto(attr.expression)) {
99608
+ for (const prop of attr.expression.properties) {
99609
+ if (isSpreadAssignment(prop)) {
99610
+ finishObjectLiteralIfNeeded();
99611
+ expressions.push(prop.expression);
99612
+ continue;
99613
+ }
99614
+ properties.push(prop);
99615
+ }
99616
+ continue;
99617
+ }
99618
+ finishObjectLiteralIfNeeded();
99619
+ expressions.push(attr.expression);
99620
+ continue;
99621
+ }
99622
+ properties.push(transformJsxAttributeToObjectLiteralElement(attr));
99662
99623
  }
99663
99624
  if (children) {
99664
- expressions.push(factory2.createObjectLiteralExpression([children]));
99625
+ properties.push(children);
99626
+ }
99627
+ finishObjectLiteralIfNeeded();
99628
+ if (expressions.length && !isObjectLiteralExpression(expressions[0])) {
99629
+ expressions.unshift(factory2.createObjectLiteralExpression());
99665
99630
  }
99666
99631
  return singleOrUndefined(expressions) || emitHelpers().createAssignHelper(expressions);
99667
- }
99668
- function transformJsxSpreadAttributeToExpression(node) {
99669
- return Debug.checkDefined(visitNode(node.expression, visitor, isExpression));
99632
+ function finishObjectLiteralIfNeeded() {
99633
+ if (properties.length) {
99634
+ expressions.push(factory2.createObjectLiteralExpression(properties));
99635
+ properties = [];
99636
+ }
99637
+ }
99670
99638
  }
99671
99639
  function transformJsxAttributeToObjectLiteralElement(node) {
99672
99640
  const name = getAttributeName(node);
@@ -111754,8 +111722,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
111754
111722
  }
111755
111723
  }
111756
111724
  function createBuildInfo(program, bundle) {
111757
- const version2 = version;
111758
- return { bundle, program, version: version2 };
111725
+ return { bundle, program, version };
111759
111726
  }
111760
111727
  function getBuildInfoText(buildInfo) {
111761
111728
  return JSON.stringify(buildInfo);
@@ -111843,10 +111810,10 @@ function emitUsingBuildInfo(config, host, getCommandLine, customTransformers) {
111843
111810
  /*separateBeginAndEnd*/
111844
111811
  true
111845
111812
  );
111846
- ts_performance_exports.mark("beforeEmit");
111813
+ mark("beforeEmit");
111847
111814
  const result = emitUsingBuildInfoWorker(config, host, getCommandLine, customTransformers);
111848
- ts_performance_exports.mark("afterEmit");
111849
- ts_performance_exports.measure("Emit", "beforeEmit", "afterEmit");
111815
+ mark("afterEmit");
111816
+ measure("Emit", "beforeEmit", "afterEmit");
111850
111817
  (_b = tracing) == null ? void 0 : _b.pop();
111851
111818
  return result;
111852
111819
  }
@@ -115860,12 +115827,12 @@ function createPrinter(printerOptions = {}, handlers = {}) {
115860
115827
  return cache[nodeId] || (cache[nodeId] = generateNameForNode(node, privateName, flags != null ? flags : 0 /* None */, formatGeneratedNamePart(prefix, generateName), formatGeneratedNamePart(suffix)));
115861
115828
  }
115862
115829
  function isUniqueName(name, privateName) {
115863
- return isFileLevelUniqueName2(name, privateName) && !isReservedName(name, privateName) && !generatedNames.has(name);
115830
+ return isFileLevelUniqueNameInCurrentFile(name, privateName) && !isReservedName(name, privateName) && !generatedNames.has(name);
115864
115831
  }
115865
115832
  function isReservedName(name, privateName) {
115866
115833
  return privateName ? !!(reservedPrivateNames == null ? void 0 : reservedPrivateNames.has(name)) : !!(reservedNames == null ? void 0 : reservedNames.has(name));
115867
115834
  }
115868
- function isFileLevelUniqueName2(name, _isPrivate) {
115835
+ function isFileLevelUniqueNameInCurrentFile(name, _isPrivate) {
115869
115836
  return currentSourceFile ? isFileLevelUniqueName(currentSourceFile, name, hasGlobalName) : true;
115870
115837
  }
115871
115838
  function isUniqueLocalName(name, container) {
@@ -115984,7 +115951,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
115984
115951
  function makeFileLevelOptimisticUniqueName(name) {
115985
115952
  return makeUniqueName2(
115986
115953
  name,
115987
- isFileLevelUniqueName2,
115954
+ isFileLevelUniqueNameInCurrentFile,
115988
115955
  /*optimistic*/
115989
115956
  true,
115990
115957
  /*scoped*/
@@ -116164,7 +116131,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
116164
116131
  case 3 /* Unique */:
116165
116132
  return makeUniqueName2(
116166
116133
  idText(name),
116167
- autoGenerate.flags & 32 /* FileLevel */ ? isFileLevelUniqueName2 : isUniqueName,
116134
+ autoGenerate.flags & 32 /* FileLevel */ ? isFileLevelUniqueNameInCurrentFile : isUniqueName,
116168
116135
  !!(autoGenerate.flags & 16 /* Optimistic */),
116169
116136
  !!(autoGenerate.flags & 8 /* ReservedInNestedScopes */),
116170
116137
  isPrivateIdentifier(name),
@@ -119239,12 +119206,12 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
119239
119206
  }
119240
119207
  }
119241
119208
  }
119242
- function createDiagnosticForNodeArray2(nodes, message, arg0, arg1, arg2) {
119209
+ function createDiagnosticForNodeArray2(nodes, message, ...args) {
119243
119210
  const start2 = nodes.pos;
119244
- return createFileDiagnostic(sourceFile, start2, nodes.end - start2, message, arg0, arg1, arg2);
119211
+ return createFileDiagnostic(sourceFile, start2, nodes.end - start2, message, ...args);
119245
119212
  }
119246
- function createDiagnosticForNode2(node, message, arg0, arg1, arg2) {
119247
- return createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2);
119213
+ function createDiagnosticForNode2(node, message, ...args) {
119214
+ return createDiagnosticForNodeInSourceFile(sourceFile, node, message, ...args);
119248
119215
  }
119249
119216
  });
119250
119217
  }
@@ -119909,11 +119876,12 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
119909
119876
  const unqualifiedLibName = removeSuffix(removePrefix(libName, "lib."), ".d.ts");
119910
119877
  const suggestion = getSpellingSuggestion(unqualifiedLibName, libs, identity);
119911
119878
  const diagnostic = suggestion ? Diagnostics.Cannot_find_lib_definition_for_0_Did_you_mean_1 : Diagnostics.Cannot_find_lib_definition_for_0;
119879
+ const args = suggestion ? [libName, suggestion] : [libName];
119912
119880
  (fileProcessingDiagnostics || (fileProcessingDiagnostics = [])).push({
119913
119881
  kind: 0 /* FilePreprocessingReferencedDiagnostic */,
119914
119882
  reason: { kind: 7 /* LibReferenceDirective */, file: file.path, index },
119915
119883
  diagnostic,
119916
- args: [libName, suggestion]
119884
+ args
119917
119885
  });
119918
119886
  }
119919
119887
  });
@@ -120378,7 +120346,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120378
120346
  }
120379
120347
  }
120380
120348
  function verifyDeprecatedCompilerOptions() {
120381
- function createDiagnostic(name, value, useInstead, message, arg0, arg1, arg2, arg3) {
120349
+ function createDiagnostic(name, value, useInstead, message, ...args) {
120382
120350
  if (useInstead) {
120383
120351
  const details = chainDiagnosticMessages(
120384
120352
  /*details*/
@@ -120386,7 +120354,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120386
120354
  Diagnostics.Use_0_instead,
120387
120355
  useInstead
120388
120356
  );
120389
- const chain = chainDiagnosticMessages(details, message, arg0, arg1, arg2, arg3);
120357
+ const chain = chainDiagnosticMessages(details, message, ...args);
120390
120358
  createDiagnosticForOption(
120391
120359
  /*onKey*/
120392
120360
  !value,
@@ -120403,10 +120371,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120403
120371
  /*option2*/
120404
120372
  void 0,
120405
120373
  message,
120406
- arg0,
120407
- arg1,
120408
- arg2,
120409
- arg3
120374
+ ...args
120410
120375
  );
120411
120376
  }
120412
120377
  }
@@ -120459,8 +120424,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120459
120424
  });
120460
120425
  }
120461
120426
  function verifyDeprecatedProjectReference(ref, parentFile, index) {
120462
- function createDiagnostic(_name, _value, _useInstead, message, arg0, arg1, arg2, arg3) {
120463
- createDiagnosticForReference(parentFile, index, message, arg0, arg1, arg2, arg3);
120427
+ function createDiagnostic(_name, _value, _useInstead, message, ...args) {
120428
+ createDiagnosticForReference(parentFile, index, message, ...args);
120464
120429
  }
120465
120430
  checkDeprecations("5.0", "5.5", createDiagnostic, (createDeprecatedDiagnostic) => {
120466
120431
  if (ref.prepend) {
@@ -120572,8 +120537,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120572
120537
  if (!referenceInfo)
120573
120538
  return void 0;
120574
120539
  const { sourceFile, index } = referenceInfo;
120575
- const referencesSyntax = firstDefined(
120576
- getTsConfigPropArray(sourceFile, "references"),
120540
+ const referencesSyntax = forEachTsConfigPropArray(
120541
+ sourceFile,
120542
+ "references",
120577
120543
  (property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0
120578
120544
  );
120579
120545
  return referencesSyntax && referencesSyntax.elements.length > index ? createDiagnosticForNodeInSourceFile(
@@ -120642,28 +120608,26 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120642
120608
  }
120643
120609
  });
120644
120610
  }
120645
- function createDiagnosticForOptionPathKeyValue(key, valueIndex, message, arg0, arg1, arg2) {
120611
+ function createDiagnosticForOptionPathKeyValue(key, valueIndex, message, ...args) {
120646
120612
  let needCompilerDiagnostic = true;
120647
- const pathsSyntax = getOptionPathsSyntax();
120648
- for (const pathProp of pathsSyntax) {
120613
+ forEachOptionPathsSyntax((pathProp) => {
120649
120614
  if (isObjectLiteralExpression(pathProp.initializer)) {
120650
- for (const keyProps of getPropertyAssignment(pathProp.initializer, key)) {
120615
+ forEachPropertyAssignment(pathProp.initializer, key, (keyProps) => {
120651
120616
  const initializer = keyProps.initializer;
120652
120617
  if (isArrayLiteralExpression(initializer) && initializer.elements.length > valueIndex) {
120653
- programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, initializer.elements[valueIndex], message, arg0, arg1, arg2));
120618
+ programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, initializer.elements[valueIndex], message, ...args));
120654
120619
  needCompilerDiagnostic = false;
120655
120620
  }
120656
- }
120621
+ });
120657
120622
  }
120658
- }
120623
+ });
120659
120624
  if (needCompilerDiagnostic) {
120660
- programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1, arg2));
120625
+ programDiagnostics.add(createCompilerDiagnostic(message, ...args));
120661
120626
  }
120662
120627
  }
120663
- function createDiagnosticForOptionPaths(onKey, key, message, arg0) {
120628
+ function createDiagnosticForOptionPaths(onKey, key, message, ...args) {
120664
120629
  let needCompilerDiagnostic = true;
120665
- const pathsSyntax = getOptionPathsSyntax();
120666
- for (const pathProp of pathsSyntax) {
120630
+ forEachOptionPathsSyntax((pathProp) => {
120667
120631
  if (isObjectLiteralExpression(pathProp.initializer) && createOptionDiagnosticInObjectLiteralSyntax(
120668
120632
  pathProp.initializer,
120669
120633
  onKey,
@@ -120671,25 +120635,23 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120671
120635
  /*key2*/
120672
120636
  void 0,
120673
120637
  message,
120674
- arg0
120638
+ ...args
120675
120639
  )) {
120676
120640
  needCompilerDiagnostic = false;
120677
120641
  }
120678
- }
120642
+ });
120679
120643
  if (needCompilerDiagnostic) {
120680
- programDiagnostics.add(createCompilerDiagnostic(message, arg0));
120644
+ programDiagnostics.add(createCompilerDiagnostic(message, ...args));
120681
120645
  }
120682
120646
  }
120683
- function getOptionsSyntaxByName(name) {
120684
- const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax();
120685
- return compilerOptionsObjectLiteralSyntax && getPropertyAssignment(compilerOptionsObjectLiteralSyntax, name);
120647
+ function forEachOptionsSyntaxByName(name, callback) {
120648
+ return forEachPropertyAssignment(getCompilerOptionsObjectLiteralSyntax(), name, callback);
120686
120649
  }
120687
- function getOptionPathsSyntax() {
120688
- return getOptionsSyntaxByName("paths") || emptyArray;
120650
+ function forEachOptionPathsSyntax(callback) {
120651
+ return forEachOptionsSyntaxByName("paths", callback);
120689
120652
  }
120690
120653
  function getOptionsSyntaxByValue(name, value) {
120691
- const syntaxByName = getOptionsSyntaxByName(name);
120692
- return syntaxByName && firstDefined(syntaxByName, (property) => isStringLiteral(property.initializer) && property.initializer.text === value ? property.initializer : void 0);
120654
+ return forEachOptionsSyntaxByName(name, (property) => isStringLiteral(property.initializer) && property.initializer.text === value ? property.initializer : void 0);
120693
120655
  }
120694
120656
  function getOptionsSyntaxByArrayElementValue(name, value) {
120695
120657
  const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax();
@@ -120707,7 +120669,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120707
120669
  option3
120708
120670
  );
120709
120671
  }
120710
- function createOptionValueDiagnostic(option1, message, arg0, arg1) {
120672
+ function createOptionValueDiagnostic(option1, message, ...args) {
120711
120673
  createDiagnosticForOption(
120712
120674
  /*onKey*/
120713
120675
  false,
@@ -120715,57 +120677,53 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120715
120677
  /*option2*/
120716
120678
  void 0,
120717
120679
  message,
120718
- arg0,
120719
- arg1
120680
+ ...args
120720
120681
  );
120721
120682
  }
120722
- function createDiagnosticForReference(sourceFile, index, message, arg0, arg1, arg2, arg3) {
120723
- const referencesSyntax = firstDefined(
120724
- getTsConfigPropArray(sourceFile || options.configFile, "references"),
120683
+ function createDiagnosticForReference(sourceFile, index, message, ...args) {
120684
+ const referencesSyntax = forEachTsConfigPropArray(
120685
+ sourceFile || options.configFile,
120686
+ "references",
120725
120687
  (property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0
120726
120688
  );
120727
120689
  if (referencesSyntax && referencesSyntax.elements.length > index) {
120728
- programDiagnostics.add(createDiagnosticForNodeInSourceFile(sourceFile || options.configFile, referencesSyntax.elements[index], message, arg0, arg1, arg2, arg3));
120690
+ programDiagnostics.add(createDiagnosticForNodeInSourceFile(sourceFile || options.configFile, referencesSyntax.elements[index], message, ...args));
120729
120691
  } else {
120730
- programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1, arg2, arg3));
120692
+ programDiagnostics.add(createCompilerDiagnostic(message, ...args));
120731
120693
  }
120732
120694
  }
120733
- function createDiagnosticForOption(onKey, option1, option2, message, arg0, arg1, arg2, arg3) {
120695
+ function createDiagnosticForOption(onKey, option1, option2, message, ...args) {
120734
120696
  const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax();
120735
- const needCompilerDiagnostic = !compilerOptionsObjectLiteralSyntax || !createOptionDiagnosticInObjectLiteralSyntax(compilerOptionsObjectLiteralSyntax, onKey, option1, option2, message, arg0, arg1, arg2, arg3);
120697
+ const needCompilerDiagnostic = !compilerOptionsObjectLiteralSyntax || !createOptionDiagnosticInObjectLiteralSyntax(compilerOptionsObjectLiteralSyntax, onKey, option1, option2, message, ...args);
120736
120698
  if (needCompilerDiagnostic) {
120737
120699
  if ("messageText" in message) {
120738
120700
  programDiagnostics.add(createCompilerDiagnosticFromMessageChain(message));
120739
120701
  } else {
120740
- programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1, arg2, arg3));
120702
+ programDiagnostics.add(createCompilerDiagnostic(message, ...args));
120741
120703
  }
120742
120704
  }
120743
120705
  }
120744
120706
  function getCompilerOptionsObjectLiteralSyntax() {
120745
120707
  if (_compilerOptionsObjectLiteralSyntax === void 0) {
120746
- _compilerOptionsObjectLiteralSyntax = false;
120747
- const jsonObjectLiteral = getTsConfigObjectLiteralExpression(options.configFile);
120748
- if (jsonObjectLiteral) {
120749
- for (const prop of getPropertyAssignment(jsonObjectLiteral, "compilerOptions")) {
120750
- if (isObjectLiteralExpression(prop.initializer)) {
120751
- _compilerOptionsObjectLiteralSyntax = prop.initializer;
120752
- break;
120753
- }
120754
- }
120755
- }
120708
+ _compilerOptionsObjectLiteralSyntax = forEachPropertyAssignment(
120709
+ getTsConfigObjectLiteralExpression(options.configFile),
120710
+ "compilerOptions",
120711
+ (prop) => isObjectLiteralExpression(prop.initializer) ? prop.initializer : void 0
120712
+ ) || false;
120756
120713
  }
120757
120714
  return _compilerOptionsObjectLiteralSyntax || void 0;
120758
120715
  }
120759
- function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral, onKey, key1, key2, message, arg0, arg1, arg2, arg3) {
120760
- const props = getPropertyAssignment(objectLiteral, key1, key2);
120761
- for (const prop of props) {
120716
+ function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral, onKey, key1, key2, message, ...args) {
120717
+ let needsCompilerDiagnostic = false;
120718
+ forEachPropertyAssignment(objectLiteral, key1, (prop) => {
120762
120719
  if ("messageText" in message) {
120763
120720
  programDiagnostics.add(createDiagnosticForNodeFromMessageChain(options.configFile, onKey ? prop.name : prop.initializer, message));
120764
120721
  } else {
120765
- programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message, arg0, arg1, arg2, arg3));
120722
+ programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message, ...args));
120766
120723
  }
120767
- }
120768
- return !!props.length;
120724
+ needsCompilerDiagnostic = true;
120725
+ }, key2);
120726
+ return needsCompilerDiagnostic;
120769
120727
  }
120770
120728
  function createRedundantOptionDiagnostic(errorOnOption, redundantWithOption) {
120771
120729
  const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax();
@@ -121683,16 +121641,16 @@ function convertToDiagnostics(diagnostics, newProgram) {
121683
121641
  return emptyArray;
121684
121642
  let buildInfoDirectory;
121685
121643
  return diagnostics.map((diagnostic) => {
121686
- const result = convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPath3);
121644
+ const result = convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPathInBuildInfoDirectory);
121687
121645
  result.reportsUnnecessary = diagnostic.reportsUnnecessary;
121688
121646
  result.reportsDeprecated = diagnostic.reportDeprecated;
121689
121647
  result.source = diagnostic.source;
121690
121648
  result.skippedOn = diagnostic.skippedOn;
121691
121649
  const { relatedInformation } = diagnostic;
121692
- result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map((r) => convertToDiagnosticRelatedInformation(r, newProgram, toPath3)) : [] : void 0;
121650
+ result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map((r) => convertToDiagnosticRelatedInformation(r, newProgram, toPathInBuildInfoDirectory)) : [] : void 0;
121693
121651
  return result;
121694
121652
  });
121695
- function toPath3(path) {
121653
+ function toPathInBuildInfoDirectory(path) {
121696
121654
  buildInfoDirectory != null ? buildInfoDirectory : buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(getTsBuildInfoEmitOutputFilePath(newProgram.getCompilerOptions()), newProgram.getCurrentDirectory()));
121697
121655
  return toPath(path, buildInfoDirectory, newProgram.getCanonicalFileName);
121698
121656
  }
@@ -122600,7 +122558,7 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
122600
122558
  const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
122601
122559
  const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
122602
122560
  let state;
122603
- const filePaths = (_a2 = program.fileNames) == null ? void 0 : _a2.map(toPath3);
122561
+ const filePaths = (_a2 = program.fileNames) == null ? void 0 : _a2.map(toPathInBuildInfoDirectory);
122604
122562
  let filePathsSetList;
122605
122563
  const latestChangedDtsFile = program.latestChangedDtsFile ? toAbsolutePath(program.latestChangedDtsFile) : void 0;
122606
122564
  if (isProgramBundleEmitBuildInfo(program)) {
@@ -122681,7 +122639,7 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
122681
122639
  close: noop,
122682
122640
  hasChangedEmitSignature: returnFalse
122683
122641
  };
122684
- function toPath3(path) {
122642
+ function toPathInBuildInfoDirectory(path) {
122685
122643
  return toPath(path, buildInfoDirectory, getCanonicalFileName);
122686
122644
  }
122687
122645
  function toAbsolutePath(path) {
@@ -123727,15 +123685,13 @@ function getErrorSummaryText(errorCount, filesInError, newLine, host) {
123727
123685
  const nonNilFiles = filesInError.filter((fileInError) => fileInError !== void 0);
123728
123686
  const distinctFileNamesWithLines = nonNilFiles.map((fileInError) => `${fileInError.fileName}:${fileInError.line}`).filter((value, index, self) => self.indexOf(value) === index);
123729
123687
  const firstFileReference = nonNilFiles[0] && prettyPathForFileError(nonNilFiles[0], host.getCurrentDirectory());
123730
- const d = errorCount === 1 ? createCompilerDiagnostic(
123731
- filesInError[0] !== void 0 ? Diagnostics.Found_1_error_in_1 : Diagnostics.Found_1_error,
123732
- errorCount,
123733
- firstFileReference
123734
- ) : createCompilerDiagnostic(
123735
- 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,
123736
- errorCount,
123737
- distinctFileNamesWithLines.length === 1 ? firstFileReference : distinctFileNamesWithLines.length
123738
- );
123688
+ let messageAndArgs;
123689
+ if (errorCount === 1) {
123690
+ messageAndArgs = filesInError[0] !== void 0 ? [Diagnostics.Found_1_error_in_0, firstFileReference] : [Diagnostics.Found_1_error];
123691
+ } else {
123692
+ 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];
123693
+ }
123694
+ const d = createCompilerDiagnostic(...messageAndArgs);
123739
123695
  const suffix = distinctFileNamesWithLines.length > 1 ? createTabularErrorsDisplay(nonNilFiles, host) : "";
123740
123696
  return `${newLine}${flattenDiagnosticMessageText(d.messageText, newLine)}${newLine}${newLine}${suffix}`;
123741
123697
  }
@@ -123945,15 +123901,15 @@ function fileIncludeReasonToDiagnostics(program, reason, fileNameConvertor) {
123945
123901
  toFileName(referencedResolvedRef.sourceFile.fileName, fileNameConvertor),
123946
123902
  options.outFile ? "--outFile" : "--out"
123947
123903
  );
123948
- case 8 /* AutomaticTypeDirectiveFile */:
123904
+ case 8 /* AutomaticTypeDirectiveFile */: {
123905
+ 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];
123949
123906
  return chainDiagnosticMessages(
123950
123907
  /*details*/
123951
123908
  void 0,
123952
- 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,
123953
- reason.typeReference,
123954
- reason.packageId && packageIdToString(reason.packageId)
123909
+ ...messageAndArgs
123955
123910
  );
123956
- case 6 /* LibFile */:
123911
+ }
123912
+ case 6 /* LibFile */: {
123957
123913
  if (reason.index !== void 0)
123958
123914
  return chainDiagnosticMessages(
123959
123915
  /*details*/
@@ -123962,12 +123918,13 @@ function fileIncludeReasonToDiagnostics(program, reason, fileNameConvertor) {
123962
123918
  options.lib[reason.index]
123963
123919
  );
123964
123920
  const target = forEachEntry(targetOptionDeclaration.type, (value, key) => value === getEmitScriptTarget(options) ? key : void 0);
123921
+ const messageAndArgs = target ? [Diagnostics.Default_library_for_target_0, target] : [Diagnostics.Default_library];
123965
123922
  return chainDiagnosticMessages(
123966
123923
  /*details*/
123967
123924
  void 0,
123968
- target ? Diagnostics.Default_library_for_target_0 : Diagnostics.Default_library,
123969
- target
123925
+ ...messageAndArgs
123970
123926
  );
123927
+ }
123971
123928
  default:
123972
123929
  Debug.assertNever(reason);
123973
123930
  }
@@ -127320,7 +127277,7 @@ function renderPackageNameValidationFailureWorker(typing, result, name, isScopeN
127320
127277
  case 0 /* Ok */:
127321
127278
  return Debug.fail();
127322
127279
  default:
127323
- throw Debug.assertNever(result);
127280
+ Debug.assertNever(result);
127324
127281
  }
127325
127282
  }
127326
127283
 
@@ -128952,9 +128909,6 @@ function isStringAndEmptyAnonymousObjectIntersection(type) {
128952
128909
  const { types, checker } = type;
128953
128910
  return types.length === 2 && (areIntersectedTypesAvoidingStringReduction(checker, types[0], types[1]) || areIntersectedTypesAvoidingStringReduction(checker, types[1], types[0]));
128954
128911
  }
128955
- function isPunctuation(kind) {
128956
- return 18 /* FirstPunctuation */ <= kind && kind <= 78 /* LastPunctuation */;
128957
- }
128958
128912
  function isInsideTemplateLiteral(node, position, sourceFile) {
128959
128913
  return isTemplateLiteralKind(node.kind) && (node.getStart(sourceFile) < position && position < node.end) || !!node.isUnterminated && position === node.end;
128960
128914
  }
@@ -129060,6 +129014,7 @@ var typeKeywords = [
129060
129014
  147 /* ReadonlyKeyword */,
129061
129015
  153 /* StringKeyword */,
129062
129016
  154 /* SymbolKeyword */,
129017
+ 113 /* TypeOfKeyword */,
129063
129018
  111 /* TrueKeyword */,
129064
129019
  115 /* VoidKeyword */,
129065
129020
  156 /* UndefinedKeyword */,
@@ -134553,6 +134508,234 @@ function cleanText(text) {
134553
134508
  return text.replace(/\\?(\r?\n|\r|\u2028|\u2029)/g, "");
134554
134509
  }
134555
134510
 
134511
+ // src/services/classifier2020.ts
134512
+ var TokenEncodingConsts = /* @__PURE__ */ ((TokenEncodingConsts2) => {
134513
+ TokenEncodingConsts2[TokenEncodingConsts2["typeOffset"] = 8] = "typeOffset";
134514
+ TokenEncodingConsts2[TokenEncodingConsts2["modifierMask"] = 255] = "modifierMask";
134515
+ return TokenEncodingConsts2;
134516
+ })(TokenEncodingConsts || {});
134517
+ var TokenType = /* @__PURE__ */ ((TokenType2) => {
134518
+ TokenType2[TokenType2["class"] = 0] = "class";
134519
+ TokenType2[TokenType2["enum"] = 1] = "enum";
134520
+ TokenType2[TokenType2["interface"] = 2] = "interface";
134521
+ TokenType2[TokenType2["namespace"] = 3] = "namespace";
134522
+ TokenType2[TokenType2["typeParameter"] = 4] = "typeParameter";
134523
+ TokenType2[TokenType2["type"] = 5] = "type";
134524
+ TokenType2[TokenType2["parameter"] = 6] = "parameter";
134525
+ TokenType2[TokenType2["variable"] = 7] = "variable";
134526
+ TokenType2[TokenType2["enumMember"] = 8] = "enumMember";
134527
+ TokenType2[TokenType2["property"] = 9] = "property";
134528
+ TokenType2[TokenType2["function"] = 10] = "function";
134529
+ TokenType2[TokenType2["member"] = 11] = "member";
134530
+ return TokenType2;
134531
+ })(TokenType || {});
134532
+ var TokenModifier = /* @__PURE__ */ ((TokenModifier2) => {
134533
+ TokenModifier2[TokenModifier2["declaration"] = 0] = "declaration";
134534
+ TokenModifier2[TokenModifier2["static"] = 1] = "static";
134535
+ TokenModifier2[TokenModifier2["async"] = 2] = "async";
134536
+ TokenModifier2[TokenModifier2["readonly"] = 3] = "readonly";
134537
+ TokenModifier2[TokenModifier2["defaultLibrary"] = 4] = "defaultLibrary";
134538
+ TokenModifier2[TokenModifier2["local"] = 5] = "local";
134539
+ return TokenModifier2;
134540
+ })(TokenModifier || {});
134541
+ function getSemanticClassifications2(program, cancellationToken, sourceFile, span) {
134542
+ const classifications = getEncodedSemanticClassifications2(program, cancellationToken, sourceFile, span);
134543
+ Debug.assert(classifications.spans.length % 3 === 0);
134544
+ const dense = classifications.spans;
134545
+ const result = [];
134546
+ for (let i = 0; i < dense.length; i += 3) {
134547
+ result.push({
134548
+ textSpan: createTextSpan(dense[i], dense[i + 1]),
134549
+ classificationType: dense[i + 2]
134550
+ });
134551
+ }
134552
+ return result;
134553
+ }
134554
+ function getEncodedSemanticClassifications2(program, cancellationToken, sourceFile, span) {
134555
+ return {
134556
+ spans: getSemanticTokens(program, sourceFile, span, cancellationToken),
134557
+ endOfLineState: 0 /* None */
134558
+ };
134559
+ }
134560
+ function getSemanticTokens(program, sourceFile, span, cancellationToken) {
134561
+ const resultTokens = [];
134562
+ const collector = (node, typeIdx, modifierSet) => {
134563
+ resultTokens.push(node.getStart(sourceFile), node.getWidth(sourceFile), (typeIdx + 1 << 8 /* typeOffset */) + modifierSet);
134564
+ };
134565
+ if (program && sourceFile) {
134566
+ collectTokens(program, sourceFile, span, collector, cancellationToken);
134567
+ }
134568
+ return resultTokens;
134569
+ }
134570
+ function collectTokens(program, sourceFile, span, collector, cancellationToken) {
134571
+ const typeChecker = program.getTypeChecker();
134572
+ let inJSXElement = false;
134573
+ function visit(node) {
134574
+ switch (node.kind) {
134575
+ case 265 /* ModuleDeclaration */:
134576
+ case 261 /* ClassDeclaration */:
134577
+ case 262 /* InterfaceDeclaration */:
134578
+ case 260 /* FunctionDeclaration */:
134579
+ case 229 /* ClassExpression */:
134580
+ case 216 /* FunctionExpression */:
134581
+ case 217 /* ArrowFunction */:
134582
+ cancellationToken.throwIfCancellationRequested();
134583
+ }
134584
+ if (!node || !textSpanIntersectsWith(span, node.pos, node.getFullWidth()) || node.getFullWidth() === 0) {
134585
+ return;
134586
+ }
134587
+ const prevInJSXElement = inJSXElement;
134588
+ if (isJsxElement(node) || isJsxSelfClosingElement(node)) {
134589
+ inJSXElement = true;
134590
+ }
134591
+ if (isJsxExpression(node)) {
134592
+ inJSXElement = false;
134593
+ }
134594
+ if (isIdentifier(node) && !inJSXElement && !inImportClause(node) && !isInfinityOrNaNString(node.escapedText)) {
134595
+ let symbol = typeChecker.getSymbolAtLocation(node);
134596
+ if (symbol) {
134597
+ if (symbol.flags & 2097152 /* Alias */) {
134598
+ symbol = typeChecker.getAliasedSymbol(symbol);
134599
+ }
134600
+ let typeIdx = classifySymbol2(symbol, getMeaningFromLocation(node));
134601
+ if (typeIdx !== void 0) {
134602
+ let modifierSet = 0;
134603
+ if (node.parent) {
134604
+ const parentIsDeclaration = isBindingElement(node.parent) || tokenFromDeclarationMapping.get(node.parent.kind) === typeIdx;
134605
+ if (parentIsDeclaration && node.parent.name === node) {
134606
+ modifierSet = 1 << 0 /* declaration */;
134607
+ }
134608
+ }
134609
+ if (typeIdx === 6 /* parameter */ && isRightSideOfQualifiedNameOrPropertyAccess2(node)) {
134610
+ typeIdx = 9 /* property */;
134611
+ }
134612
+ typeIdx = reclassifyByType(typeChecker, node, typeIdx);
134613
+ const decl = symbol.valueDeclaration;
134614
+ if (decl) {
134615
+ const modifiers = getCombinedModifierFlags(decl);
134616
+ const nodeFlags = getCombinedNodeFlags(decl);
134617
+ if (modifiers & 32 /* Static */) {
134618
+ modifierSet |= 1 << 1 /* static */;
134619
+ }
134620
+ if (modifiers & 512 /* Async */) {
134621
+ modifierSet |= 1 << 2 /* async */;
134622
+ }
134623
+ if (typeIdx !== 0 /* class */ && typeIdx !== 2 /* interface */) {
134624
+ if (modifiers & 64 /* Readonly */ || nodeFlags & 2 /* Const */ || symbol.getFlags() & 8 /* EnumMember */) {
134625
+ modifierSet |= 1 << 3 /* readonly */;
134626
+ }
134627
+ }
134628
+ if ((typeIdx === 7 /* variable */ || typeIdx === 10 /* function */) && isLocalDeclaration(decl, sourceFile)) {
134629
+ modifierSet |= 1 << 5 /* local */;
134630
+ }
134631
+ if (program.isSourceFileDefaultLibrary(decl.getSourceFile())) {
134632
+ modifierSet |= 1 << 4 /* defaultLibrary */;
134633
+ }
134634
+ } else if (symbol.declarations && symbol.declarations.some((d) => program.isSourceFileDefaultLibrary(d.getSourceFile()))) {
134635
+ modifierSet |= 1 << 4 /* defaultLibrary */;
134636
+ }
134637
+ collector(node, typeIdx, modifierSet);
134638
+ }
134639
+ }
134640
+ }
134641
+ forEachChild(node, visit);
134642
+ inJSXElement = prevInJSXElement;
134643
+ }
134644
+ visit(sourceFile);
134645
+ }
134646
+ function classifySymbol2(symbol, meaning) {
134647
+ const flags = symbol.getFlags();
134648
+ if (flags & 32 /* Class */) {
134649
+ return 0 /* class */;
134650
+ } else if (flags & 384 /* Enum */) {
134651
+ return 1 /* enum */;
134652
+ } else if (flags & 524288 /* TypeAlias */) {
134653
+ return 5 /* type */;
134654
+ } else if (flags & 64 /* Interface */) {
134655
+ if (meaning & 2 /* Type */) {
134656
+ return 2 /* interface */;
134657
+ }
134658
+ } else if (flags & 262144 /* TypeParameter */) {
134659
+ return 4 /* typeParameter */;
134660
+ }
134661
+ let decl = symbol.valueDeclaration || symbol.declarations && symbol.declarations[0];
134662
+ if (decl && isBindingElement(decl)) {
134663
+ decl = getDeclarationForBindingElement(decl);
134664
+ }
134665
+ return decl && tokenFromDeclarationMapping.get(decl.kind);
134666
+ }
134667
+ function reclassifyByType(typeChecker, node, typeIdx) {
134668
+ if (typeIdx === 7 /* variable */ || typeIdx === 9 /* property */ || typeIdx === 6 /* parameter */) {
134669
+ const type = typeChecker.getTypeAtLocation(node);
134670
+ if (type) {
134671
+ const test = (condition) => {
134672
+ return condition(type) || type.isUnion() && type.types.some(condition);
134673
+ };
134674
+ if (typeIdx !== 6 /* parameter */ && test((t) => t.getConstructSignatures().length > 0)) {
134675
+ return 0 /* class */;
134676
+ }
134677
+ if (test((t) => t.getCallSignatures().length > 0) && !test((t) => t.getProperties().length > 0) || isExpressionInCallExpression(node)) {
134678
+ return typeIdx === 9 /* property */ ? 11 /* member */ : 10 /* function */;
134679
+ }
134680
+ }
134681
+ }
134682
+ return typeIdx;
134683
+ }
134684
+ function isLocalDeclaration(decl, sourceFile) {
134685
+ if (isBindingElement(decl)) {
134686
+ decl = getDeclarationForBindingElement(decl);
134687
+ }
134688
+ if (isVariableDeclaration(decl)) {
134689
+ return (!isSourceFile(decl.parent.parent.parent) || isCatchClause(decl.parent)) && decl.getSourceFile() === sourceFile;
134690
+ } else if (isFunctionDeclaration(decl)) {
134691
+ return !isSourceFile(decl.parent) && decl.getSourceFile() === sourceFile;
134692
+ }
134693
+ return false;
134694
+ }
134695
+ function getDeclarationForBindingElement(element) {
134696
+ while (true) {
134697
+ if (isBindingElement(element.parent.parent)) {
134698
+ element = element.parent.parent;
134699
+ } else {
134700
+ return element.parent.parent;
134701
+ }
134702
+ }
134703
+ }
134704
+ function inImportClause(node) {
134705
+ const parent2 = node.parent;
134706
+ return parent2 && (isImportClause(parent2) || isImportSpecifier(parent2) || isNamespaceImport(parent2));
134707
+ }
134708
+ function isExpressionInCallExpression(node) {
134709
+ while (isRightSideOfQualifiedNameOrPropertyAccess2(node)) {
134710
+ node = node.parent;
134711
+ }
134712
+ return isCallExpression(node.parent) && node.parent.expression === node;
134713
+ }
134714
+ function isRightSideOfQualifiedNameOrPropertyAccess2(node) {
134715
+ return isQualifiedName(node.parent) && node.parent.right === node || isPropertyAccessExpression(node.parent) && node.parent.name === node;
134716
+ }
134717
+ var tokenFromDeclarationMapping = /* @__PURE__ */ new Map([
134718
+ [258 /* VariableDeclaration */, 7 /* variable */],
134719
+ [167 /* Parameter */, 6 /* parameter */],
134720
+ [170 /* PropertyDeclaration */, 9 /* property */],
134721
+ [265 /* ModuleDeclaration */, 3 /* namespace */],
134722
+ [264 /* EnumDeclaration */, 1 /* enum */],
134723
+ [303 /* EnumMember */, 8 /* enumMember */],
134724
+ [261 /* ClassDeclaration */, 0 /* class */],
134725
+ [172 /* MethodDeclaration */, 11 /* member */],
134726
+ [260 /* FunctionDeclaration */, 10 /* function */],
134727
+ [216 /* FunctionExpression */, 10 /* function */],
134728
+ [171 /* MethodSignature */, 11 /* member */],
134729
+ [175 /* GetAccessor */, 9 /* property */],
134730
+ [176 /* SetAccessor */, 9 /* property */],
134731
+ [169 /* PropertySignature */, 9 /* property */],
134732
+ [262 /* InterfaceDeclaration */, 2 /* interface */],
134733
+ [263 /* TypeAliasDeclaration */, 5 /* type */],
134734
+ [166 /* TypeParameter */, 4 /* typeParameter */],
134735
+ [300 /* PropertyAssignment */, 9 /* property */],
134736
+ [301 /* ShorthandPropertyAssignment */, 9 /* property */]
134737
+ ]);
134738
+
134556
134739
  // src/services/services.ts
134557
134740
  var servicesVersion = "0.8";
134558
134741
  function createNode(kind, pos, end, parent2) {
@@ -135985,7 +136168,7 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
135985
136168
  synchronizeHostData();
135986
136169
  const responseFormat = format || "original" /* Original */;
135987
136170
  if (responseFormat === "2020" /* TwentyTwenty */) {
135988
- return ts_classifier_exports.v2020.getSemanticClassifications(program, cancellationToken, getValidSourceFile(fileName), span);
136171
+ return getSemanticClassifications2(program, cancellationToken, getValidSourceFile(fileName), span);
135989
136172
  } else {
135990
136173
  return getSemanticClassifications(program.getTypeChecker(), cancellationToken, getValidSourceFile(fileName), program.getClassifiableNames(), span);
135991
136174
  }
@@ -135996,7 +136179,7 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
135996
136179
  if (responseFormat === "original" /* Original */) {
135997
136180
  return getEncodedSemanticClassifications(program.getTypeChecker(), cancellationToken, getValidSourceFile(fileName), program.getClassifiableNames(), span);
135998
136181
  } else {
135999
- return ts_classifier_exports.v2020.getEncodedSemanticClassifications(program, cancellationToken, getValidSourceFile(fileName), span);
136182
+ return getEncodedSemanticClassifications2(program, cancellationToken, getValidSourceFile(fileName), span);
136000
136183
  }
136001
136184
  }
136002
136185
  function getSyntacticClassifications2(fileName, span) {
@@ -138563,234 +138746,6 @@ __export(ts_classifier_v2020_exports, {
138563
138746
  getSemanticClassifications: () => getSemanticClassifications2
138564
138747
  });
138565
138748
 
138566
- // src/services/classifier2020.ts
138567
- var TokenEncodingConsts = /* @__PURE__ */ ((TokenEncodingConsts2) => {
138568
- TokenEncodingConsts2[TokenEncodingConsts2["typeOffset"] = 8] = "typeOffset";
138569
- TokenEncodingConsts2[TokenEncodingConsts2["modifierMask"] = 255] = "modifierMask";
138570
- return TokenEncodingConsts2;
138571
- })(TokenEncodingConsts || {});
138572
- var TokenType = /* @__PURE__ */ ((TokenType2) => {
138573
- TokenType2[TokenType2["class"] = 0] = "class";
138574
- TokenType2[TokenType2["enum"] = 1] = "enum";
138575
- TokenType2[TokenType2["interface"] = 2] = "interface";
138576
- TokenType2[TokenType2["namespace"] = 3] = "namespace";
138577
- TokenType2[TokenType2["typeParameter"] = 4] = "typeParameter";
138578
- TokenType2[TokenType2["type"] = 5] = "type";
138579
- TokenType2[TokenType2["parameter"] = 6] = "parameter";
138580
- TokenType2[TokenType2["variable"] = 7] = "variable";
138581
- TokenType2[TokenType2["enumMember"] = 8] = "enumMember";
138582
- TokenType2[TokenType2["property"] = 9] = "property";
138583
- TokenType2[TokenType2["function"] = 10] = "function";
138584
- TokenType2[TokenType2["member"] = 11] = "member";
138585
- return TokenType2;
138586
- })(TokenType || {});
138587
- var TokenModifier = /* @__PURE__ */ ((TokenModifier2) => {
138588
- TokenModifier2[TokenModifier2["declaration"] = 0] = "declaration";
138589
- TokenModifier2[TokenModifier2["static"] = 1] = "static";
138590
- TokenModifier2[TokenModifier2["async"] = 2] = "async";
138591
- TokenModifier2[TokenModifier2["readonly"] = 3] = "readonly";
138592
- TokenModifier2[TokenModifier2["defaultLibrary"] = 4] = "defaultLibrary";
138593
- TokenModifier2[TokenModifier2["local"] = 5] = "local";
138594
- return TokenModifier2;
138595
- })(TokenModifier || {});
138596
- function getSemanticClassifications2(program, cancellationToken, sourceFile, span) {
138597
- const classifications = getEncodedSemanticClassifications2(program, cancellationToken, sourceFile, span);
138598
- Debug.assert(classifications.spans.length % 3 === 0);
138599
- const dense = classifications.spans;
138600
- const result = [];
138601
- for (let i = 0; i < dense.length; i += 3) {
138602
- result.push({
138603
- textSpan: createTextSpan(dense[i], dense[i + 1]),
138604
- classificationType: dense[i + 2]
138605
- });
138606
- }
138607
- return result;
138608
- }
138609
- function getEncodedSemanticClassifications2(program, cancellationToken, sourceFile, span) {
138610
- return {
138611
- spans: getSemanticTokens(program, sourceFile, span, cancellationToken),
138612
- endOfLineState: 0 /* None */
138613
- };
138614
- }
138615
- function getSemanticTokens(program, sourceFile, span, cancellationToken) {
138616
- const resultTokens = [];
138617
- const collector = (node, typeIdx, modifierSet) => {
138618
- resultTokens.push(node.getStart(sourceFile), node.getWidth(sourceFile), (typeIdx + 1 << 8 /* typeOffset */) + modifierSet);
138619
- };
138620
- if (program && sourceFile) {
138621
- collectTokens(program, sourceFile, span, collector, cancellationToken);
138622
- }
138623
- return resultTokens;
138624
- }
138625
- function collectTokens(program, sourceFile, span, collector, cancellationToken) {
138626
- const typeChecker = program.getTypeChecker();
138627
- let inJSXElement = false;
138628
- function visit(node) {
138629
- switch (node.kind) {
138630
- case 265 /* ModuleDeclaration */:
138631
- case 261 /* ClassDeclaration */:
138632
- case 262 /* InterfaceDeclaration */:
138633
- case 260 /* FunctionDeclaration */:
138634
- case 229 /* ClassExpression */:
138635
- case 216 /* FunctionExpression */:
138636
- case 217 /* ArrowFunction */:
138637
- cancellationToken.throwIfCancellationRequested();
138638
- }
138639
- if (!node || !textSpanIntersectsWith(span, node.pos, node.getFullWidth()) || node.getFullWidth() === 0) {
138640
- return;
138641
- }
138642
- const prevInJSXElement = inJSXElement;
138643
- if (isJsxElement(node) || isJsxSelfClosingElement(node)) {
138644
- inJSXElement = true;
138645
- }
138646
- if (isJsxExpression(node)) {
138647
- inJSXElement = false;
138648
- }
138649
- if (isIdentifier(node) && !inJSXElement && !inImportClause(node) && !isInfinityOrNaNString(node.escapedText)) {
138650
- let symbol = typeChecker.getSymbolAtLocation(node);
138651
- if (symbol) {
138652
- if (symbol.flags & 2097152 /* Alias */) {
138653
- symbol = typeChecker.getAliasedSymbol(symbol);
138654
- }
138655
- let typeIdx = classifySymbol2(symbol, getMeaningFromLocation(node));
138656
- if (typeIdx !== void 0) {
138657
- let modifierSet = 0;
138658
- if (node.parent) {
138659
- const parentIsDeclaration = isBindingElement(node.parent) || tokenFromDeclarationMapping.get(node.parent.kind) === typeIdx;
138660
- if (parentIsDeclaration && node.parent.name === node) {
138661
- modifierSet = 1 << 0 /* declaration */;
138662
- }
138663
- }
138664
- if (typeIdx === 6 /* parameter */ && isRightSideOfQualifiedNameOrPropertyAccess2(node)) {
138665
- typeIdx = 9 /* property */;
138666
- }
138667
- typeIdx = reclassifyByType(typeChecker, node, typeIdx);
138668
- const decl = symbol.valueDeclaration;
138669
- if (decl) {
138670
- const modifiers = getCombinedModifierFlags(decl);
138671
- const nodeFlags = getCombinedNodeFlags(decl);
138672
- if (modifiers & 32 /* Static */) {
138673
- modifierSet |= 1 << 1 /* static */;
138674
- }
138675
- if (modifiers & 512 /* Async */) {
138676
- modifierSet |= 1 << 2 /* async */;
138677
- }
138678
- if (typeIdx !== 0 /* class */ && typeIdx !== 2 /* interface */) {
138679
- if (modifiers & 64 /* Readonly */ || nodeFlags & 2 /* Const */ || symbol.getFlags() & 8 /* EnumMember */) {
138680
- modifierSet |= 1 << 3 /* readonly */;
138681
- }
138682
- }
138683
- if ((typeIdx === 7 /* variable */ || typeIdx === 10 /* function */) && isLocalDeclaration(decl, sourceFile)) {
138684
- modifierSet |= 1 << 5 /* local */;
138685
- }
138686
- if (program.isSourceFileDefaultLibrary(decl.getSourceFile())) {
138687
- modifierSet |= 1 << 4 /* defaultLibrary */;
138688
- }
138689
- } else if (symbol.declarations && symbol.declarations.some((d) => program.isSourceFileDefaultLibrary(d.getSourceFile()))) {
138690
- modifierSet |= 1 << 4 /* defaultLibrary */;
138691
- }
138692
- collector(node, typeIdx, modifierSet);
138693
- }
138694
- }
138695
- }
138696
- forEachChild(node, visit);
138697
- inJSXElement = prevInJSXElement;
138698
- }
138699
- visit(sourceFile);
138700
- }
138701
- function classifySymbol2(symbol, meaning) {
138702
- const flags = symbol.getFlags();
138703
- if (flags & 32 /* Class */) {
138704
- return 0 /* class */;
138705
- } else if (flags & 384 /* Enum */) {
138706
- return 1 /* enum */;
138707
- } else if (flags & 524288 /* TypeAlias */) {
138708
- return 5 /* type */;
138709
- } else if (flags & 64 /* Interface */) {
138710
- if (meaning & 2 /* Type */) {
138711
- return 2 /* interface */;
138712
- }
138713
- } else if (flags & 262144 /* TypeParameter */) {
138714
- return 4 /* typeParameter */;
138715
- }
138716
- let decl = symbol.valueDeclaration || symbol.declarations && symbol.declarations[0];
138717
- if (decl && isBindingElement(decl)) {
138718
- decl = getDeclarationForBindingElement(decl);
138719
- }
138720
- return decl && tokenFromDeclarationMapping.get(decl.kind);
138721
- }
138722
- function reclassifyByType(typeChecker, node, typeIdx) {
138723
- if (typeIdx === 7 /* variable */ || typeIdx === 9 /* property */ || typeIdx === 6 /* parameter */) {
138724
- const type = typeChecker.getTypeAtLocation(node);
138725
- if (type) {
138726
- const test = (condition) => {
138727
- return condition(type) || type.isUnion() && type.types.some(condition);
138728
- };
138729
- if (typeIdx !== 6 /* parameter */ && test((t) => t.getConstructSignatures().length > 0)) {
138730
- return 0 /* class */;
138731
- }
138732
- if (test((t) => t.getCallSignatures().length > 0) && !test((t) => t.getProperties().length > 0) || isExpressionInCallExpression(node)) {
138733
- return typeIdx === 9 /* property */ ? 11 /* member */ : 10 /* function */;
138734
- }
138735
- }
138736
- }
138737
- return typeIdx;
138738
- }
138739
- function isLocalDeclaration(decl, sourceFile) {
138740
- if (isBindingElement(decl)) {
138741
- decl = getDeclarationForBindingElement(decl);
138742
- }
138743
- if (isVariableDeclaration(decl)) {
138744
- return (!isSourceFile(decl.parent.parent.parent) || isCatchClause(decl.parent)) && decl.getSourceFile() === sourceFile;
138745
- } else if (isFunctionDeclaration(decl)) {
138746
- return !isSourceFile(decl.parent) && decl.getSourceFile() === sourceFile;
138747
- }
138748
- return false;
138749
- }
138750
- function getDeclarationForBindingElement(element) {
138751
- while (true) {
138752
- if (isBindingElement(element.parent.parent)) {
138753
- element = element.parent.parent;
138754
- } else {
138755
- return element.parent.parent;
138756
- }
138757
- }
138758
- }
138759
- function inImportClause(node) {
138760
- const parent2 = node.parent;
138761
- return parent2 && (isImportClause(parent2) || isImportSpecifier(parent2) || isNamespaceImport(parent2));
138762
- }
138763
- function isExpressionInCallExpression(node) {
138764
- while (isRightSideOfQualifiedNameOrPropertyAccess2(node)) {
138765
- node = node.parent;
138766
- }
138767
- return isCallExpression(node.parent) && node.parent.expression === node;
138768
- }
138769
- function isRightSideOfQualifiedNameOrPropertyAccess2(node) {
138770
- return isQualifiedName(node.parent) && node.parent.right === node || isPropertyAccessExpression(node.parent) && node.parent.name === node;
138771
- }
138772
- var tokenFromDeclarationMapping = /* @__PURE__ */ new Map([
138773
- [258 /* VariableDeclaration */, 7 /* variable */],
138774
- [167 /* Parameter */, 6 /* parameter */],
138775
- [170 /* PropertyDeclaration */, 9 /* property */],
138776
- [265 /* ModuleDeclaration */, 3 /* namespace */],
138777
- [264 /* EnumDeclaration */, 1 /* enum */],
138778
- [303 /* EnumMember */, 8 /* enumMember */],
138779
- [261 /* ClassDeclaration */, 0 /* class */],
138780
- [172 /* MethodDeclaration */, 11 /* member */],
138781
- [260 /* FunctionDeclaration */, 10 /* function */],
138782
- [216 /* FunctionExpression */, 10 /* function */],
138783
- [171 /* MethodSignature */, 11 /* member */],
138784
- [175 /* GetAccessor */, 9 /* property */],
138785
- [176 /* SetAccessor */, 9 /* property */],
138786
- [169 /* PropertySignature */, 9 /* property */],
138787
- [262 /* InterfaceDeclaration */, 2 /* interface */],
138788
- [263 /* TypeAliasDeclaration */, 5 /* type */],
138789
- [166 /* TypeParameter */, 4 /* typeParameter */],
138790
- [300 /* PropertyAssignment */, 9 /* property */],
138791
- [301 /* ShorthandPropertyAssignment */, 9 /* property */]
138792
- ]);
138793
-
138794
138749
  // src/services/_namespaces/ts.codefix.ts
138795
138750
  var ts_codefix_exports = {};
138796
138751
  __export(ts_codefix_exports, {
@@ -148143,7 +148098,7 @@ function getInfo14(sourceFile, program, pos) {
148143
148098
  /*checkArgumentIsStringLiteralLike*/
148144
148099
  true
148145
148100
  )) {
148146
- throw Debug.failBadSyntaxKind(parent2);
148101
+ Debug.failBadSyntaxKind(parent2);
148147
148102
  }
148148
148103
  const decl = cast(parent2.parent, isVariableDeclaration);
148149
148104
  const defaultImportName = tryCast(decl.name, isIdentifier);
@@ -151448,7 +151403,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
151448
151403
  return true;
151449
151404
  }
151450
151405
  }
151451
- return isDeclarationName(contextToken2) && !isShorthandPropertyAssignment(contextToken2.parent) && !isJsxAttribute(contextToken2.parent) && !(isClassLike(contextToken2.parent) && (contextToken2 !== previousToken || position > previousToken.end));
151406
+ return isDeclarationName(contextToken2) && !isShorthandPropertyAssignment(contextToken2.parent) && !isJsxAttribute(contextToken2.parent) && !((isClassLike(contextToken2.parent) || isInterfaceDeclaration(contextToken2.parent)) && (contextToken2 !== previousToken || position > previousToken.end));
151452
151407
  }
151453
151408
  function isPreviousPropertyDeclarationTerminated(contextToken2, position2) {
151454
151409
  return contextToken2.kind !== 63 /* EqualsToken */ && (contextToken2.kind === 26 /* SemicolonToken */ || !positionsAreOnSameLine(contextToken2.end, position2, sourceFile));
@@ -161373,7 +161328,7 @@ function getDescriptionForFunctionLikeDeclaration(scope) {
161373
161328
  case 176 /* SetAccessor */:
161374
161329
  return `'set ${scope.name.getText()}'`;
161375
161330
  default:
161376
- throw Debug.assertNever(scope, `Unexpected scope kind ${scope.kind}`);
161331
+ Debug.assertNever(scope, `Unexpected scope kind ${scope.kind}`);
161377
161332
  }
161378
161333
  }
161379
161334
  function getDescriptionForClassLikeDeclaration(scope) {
@@ -168092,8 +168047,8 @@ var SmartIndenter;
168092
168047
  })(SmartIndenter || (SmartIndenter = {}));
168093
168048
 
168094
168049
  // src/server/_namespaces/ts.ts
168095
- var ts_exports3 = {};
168096
- __export(ts_exports3, {
168050
+ var ts_exports2 = {};
168051
+ __export(ts_exports2, {
168097
168052
  ANONYMOUS: () => ANONYMOUS,
168098
168053
  AccessFlags: () => AccessFlags,
168099
168054
  AssertionLevel: () => AssertionLevel,
@@ -168396,8 +168351,8 @@ __export(ts_exports3, {
168396
168351
  convertCompilerOptionsFromJson: () => convertCompilerOptionsFromJson,
168397
168352
  convertJsonOption: () => convertJsonOption,
168398
168353
  convertToBase64: () => convertToBase64,
168354
+ convertToJson: () => convertToJson,
168399
168355
  convertToObject: () => convertToObject,
168400
- convertToObjectWorker: () => convertToObjectWorker,
168401
168356
  convertToOptionsWithAbsolutePaths: () => convertToOptionsWithAbsolutePaths,
168402
168357
  convertToRelativePath: () => convertToRelativePath,
168403
168358
  convertToTSConfig: () => convertToTSConfig,
@@ -168662,10 +168617,12 @@ __export(ts_exports3, {
168662
168617
  forEachKey: () => forEachKey,
168663
168618
  forEachLeadingCommentRange: () => forEachLeadingCommentRange,
168664
168619
  forEachNameInAccessChainWalkingLeft: () => forEachNameInAccessChainWalkingLeft,
168620
+ forEachPropertyAssignment: () => forEachPropertyAssignment,
168665
168621
  forEachResolvedProjectReference: () => forEachResolvedProjectReference,
168666
168622
  forEachReturnStatement: () => forEachReturnStatement,
168667
168623
  forEachRight: () => forEachRight,
168668
168624
  forEachTrailingCommentRange: () => forEachTrailingCommentRange,
168625
+ forEachTsConfigPropArray: () => forEachTsConfigPropArray,
168669
168626
  forEachUnique: () => forEachUnique,
168670
168627
  forEachYieldExpression: () => forEachYieldExpression,
168671
168628
  forSomeAncestorDirectory: () => forSomeAncestorDirectory,
@@ -168998,7 +168955,6 @@ __export(ts_exports3, {
168998
168955
  getProperties: () => getProperties,
168999
168956
  getProperty: () => getProperty,
169000
168957
  getPropertyArrayElementValue: () => getPropertyArrayElementValue,
169001
- getPropertyAssignment: () => getPropertyAssignment,
169002
168958
  getPropertyAssignmentAliasLikeExpression: () => getPropertyAssignmentAliasLikeExpression,
169003
168959
  getPropertyNameForPropertyNameNode: () => getPropertyNameForPropertyNameNode,
169004
168960
  getPropertyNameForUniqueESSymbol: () => getPropertyNameForUniqueESSymbol,
@@ -169103,7 +169059,6 @@ __export(ts_exports3, {
169103
169059
  getTransformers: () => getTransformers,
169104
169060
  getTsBuildInfoEmitOutputFilePath: () => getTsBuildInfoEmitOutputFilePath,
169105
169061
  getTsConfigObjectLiteralExpression: () => getTsConfigObjectLiteralExpression,
169106
- getTsConfigPropArray: () => getTsConfigPropArray,
169107
169062
  getTsConfigPropArrayElementValue: () => getTsConfigPropArrayElementValue,
169108
169063
  getTypeAnnotationNode: () => getTypeAnnotationNode,
169109
169064
  getTypeArgumentOrTypeParameterList: () => getTypeArgumentOrTypeParameterList,
@@ -169543,6 +169498,7 @@ __export(ts_exports3, {
169543
169498
  isJsxText: () => isJsxText,
169544
169499
  isJumpStatementTarget: () => isJumpStatementTarget,
169545
169500
  isKeyword: () => isKeyword,
169501
+ isKeywordOrPunctuation: () => isKeywordOrPunctuation,
169546
169502
  isKnownSymbol: () => isKnownSymbol,
169547
169503
  isLabelName: () => isLabelName,
169548
169504
  isLabelOfLabeledStatement: () => isLabelOfLabeledStatement,
@@ -173005,7 +172961,7 @@ var Project3 = class {
173005
172961
  serverHost: this.projectService.host,
173006
172962
  session: this.projectService.session
173007
172963
  };
173008
- const pluginModule = pluginModuleFactory({ typescript: ts_exports3 });
172964
+ const pluginModule = pluginModuleFactory({ typescript: ts_exports2 });
173009
172965
  const newLS = pluginModule.create(info);
173010
172966
  for (const k of Object.keys(this.languageService)) {
173011
172967
  if (!(k in newLS)) {
@@ -182361,8 +182317,8 @@ start(initializeNodeSystem(), require("os").platform());
182361
182317
  convertCompilerOptionsFromJson,
182362
182318
  convertJsonOption,
182363
182319
  convertToBase64,
182320
+ convertToJson,
182364
182321
  convertToObject,
182365
- convertToObjectWorker,
182366
182322
  convertToOptionsWithAbsolutePaths,
182367
182323
  convertToRelativePath,
182368
182324
  convertToTSConfig,
@@ -182627,10 +182583,12 @@ start(initializeNodeSystem(), require("os").platform());
182627
182583
  forEachKey,
182628
182584
  forEachLeadingCommentRange,
182629
182585
  forEachNameInAccessChainWalkingLeft,
182586
+ forEachPropertyAssignment,
182630
182587
  forEachResolvedProjectReference,
182631
182588
  forEachReturnStatement,
182632
182589
  forEachRight,
182633
182590
  forEachTrailingCommentRange,
182591
+ forEachTsConfigPropArray,
182634
182592
  forEachUnique,
182635
182593
  forEachYieldExpression,
182636
182594
  forSomeAncestorDirectory,
@@ -182963,7 +182921,6 @@ start(initializeNodeSystem(), require("os").platform());
182963
182921
  getProperties,
182964
182922
  getProperty,
182965
182923
  getPropertyArrayElementValue,
182966
- getPropertyAssignment,
182967
182924
  getPropertyAssignmentAliasLikeExpression,
182968
182925
  getPropertyNameForPropertyNameNode,
182969
182926
  getPropertyNameForUniqueESSymbol,
@@ -183068,7 +183025,6 @@ start(initializeNodeSystem(), require("os").platform());
183068
183025
  getTransformers,
183069
183026
  getTsBuildInfoEmitOutputFilePath,
183070
183027
  getTsConfigObjectLiteralExpression,
183071
- getTsConfigPropArray,
183072
183028
  getTsConfigPropArrayElementValue,
183073
183029
  getTypeAnnotationNode,
183074
183030
  getTypeArgumentOrTypeParameterList,
@@ -183508,6 +183464,7 @@ start(initializeNodeSystem(), require("os").platform());
183508
183464
  isJsxText,
183509
183465
  isJumpStatementTarget,
183510
183466
  isKeyword,
183467
+ isKeywordOrPunctuation,
183511
183468
  isKnownSymbol,
183512
183469
  isLabelName,
183513
183470
  isLabelOfLabeledStatement,