@typescript-deploys/pr-build 5.3.0-pr-55273-3 → 5.3.0-pr-54960-7

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.
Files changed (43) hide show
  1. package/lib/lib.decorators.d.ts +3 -6
  2. package/lib/lib.es2015.collection.d.ts +1 -2
  3. package/lib/lib.es2015.core.d.ts +1 -1
  4. package/lib/lib.es2015.iterable.d.ts +4 -5
  5. package/lib/lib.es2015.promise.d.ts +1 -1
  6. package/lib/lib.es2015.symbol.d.ts +1 -1
  7. package/lib/lib.es2016.array.include.d.ts +1 -1
  8. package/lib/lib.es2016.d.ts +1 -1
  9. package/lib/lib.es2016.full.d.ts +1 -1
  10. package/lib/lib.es2017.full.d.ts +1 -1
  11. package/lib/lib.es2017.intl.d.ts +11 -12
  12. package/lib/lib.es2017.object.d.ts +3 -3
  13. package/lib/lib.es2018.asynciterable.d.ts +1 -1
  14. package/lib/lib.es2018.full.d.ts +1 -1
  15. package/lib/lib.es2018.intl.d.ts +1 -2
  16. package/lib/lib.es2018.promise.d.ts +1 -1
  17. package/lib/lib.es2018.regexp.d.ts +5 -5
  18. package/lib/lib.es2019.array.d.ts +14 -18
  19. package/lib/lib.es2019.intl.d.ts +1 -1
  20. package/lib/lib.es2019.object.d.ts +1 -1
  21. package/lib/lib.es2020.bigint.d.ts +7 -7
  22. package/lib/lib.es2020.date.d.ts +1 -1
  23. package/lib/lib.es2020.intl.d.ts +11 -13
  24. package/lib/lib.es2020.promise.d.ts +1 -1
  25. package/lib/lib.es2021.intl.d.ts +5 -6
  26. package/lib/lib.es2021.promise.d.ts +3 -3
  27. package/lib/lib.es2021.weakref.d.ts +2 -2
  28. package/lib/lib.es2022.error.d.ts +2 -2
  29. package/lib/lib.es2022.intl.d.ts +1 -2
  30. package/lib/lib.es2022.sharedmemory.d.ts +2 -2
  31. package/lib/lib.es2023.array.d.ts +61 -61
  32. package/lib/lib.es5.d.ts +74 -88
  33. package/lib/lib.esnext.disposable.d.ts +10 -10
  34. package/lib/lib.esnext.full.d.ts +1 -1
  35. package/lib/lib.esnext.intl.d.ts +7 -7
  36. package/lib/lib.scripthost.d.ts +1 -4
  37. package/lib/lib.webworker.importscripts.d.ts +0 -1
  38. package/lib/tsc.js +1379 -1460
  39. package/lib/tsserver.js +1927 -2080
  40. package/lib/typescript.d.ts +339 -117
  41. package/lib/typescript.js +1925 -2080
  42. package/lib/typingsInstaller.js +143 -130
  43. package/package.json +4 -2
package/lib/tsc.js CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.3";
21
- var version = `${versionMajorMinor}.0-insiders.20230811`;
21
+ var version = `${versionMajorMinor}.0-insiders.20230817`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -1739,17 +1739,21 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
1739
1739
  return `${flowHeader}${remainingFlags ? ` (${formatFlowFlags(remainingFlags)})` : ""}`;
1740
1740
  }
1741
1741
  },
1742
- __debugFlowFlags: { get() {
1743
- return formatEnum(
1744
- this.flags,
1745
- FlowFlags,
1746
- /*isFlags*/
1747
- true
1748
- );
1749
- } },
1750
- __debugToString: { value() {
1751
- return formatControlFlowGraph(this);
1752
- } }
1742
+ __debugFlowFlags: {
1743
+ get() {
1744
+ return formatEnum(
1745
+ this.flags,
1746
+ FlowFlags,
1747
+ /*isFlags*/
1748
+ true
1749
+ );
1750
+ }
1751
+ },
1752
+ __debugToString: {
1753
+ value() {
1754
+ return formatControlFlowGraph(this);
1755
+ }
1756
+ }
1753
1757
  });
1754
1758
  }
1755
1759
  }
@@ -1808,9 +1812,11 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
1808
1812
  return `${symbolHeader} '${symbolName(this)}'${remainingSymbolFlags ? ` (${formatSymbolFlags(remainingSymbolFlags)})` : ""}`;
1809
1813
  }
1810
1814
  },
1811
- __debugFlags: { get() {
1812
- return formatSymbolFlags(this.flags);
1813
- } }
1815
+ __debugFlags: {
1816
+ get() {
1817
+ return formatSymbolFlags(this.flags);
1818
+ }
1819
+ }
1814
1820
  });
1815
1821
  Object.defineProperties(objectAllocator.getTypeConstructor().prototype, {
1816
1822
  // for use with vscode-js-debug's new customDescriptionGenerator in launch.json
@@ -1821,12 +1827,16 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
1821
1827
  return `${typeHeader}${this.symbol ? ` '${symbolName(this.symbol)}'` : ""}${remainingObjectFlags ? ` (${formatObjectFlags(remainingObjectFlags)})` : ""}`;
1822
1828
  }
1823
1829
  },
1824
- __debugFlags: { get() {
1825
- return formatTypeFlags(this.flags);
1826
- } },
1827
- __debugObjectFlags: { get() {
1828
- return this.flags & 524288 /* Object */ ? formatObjectFlags(this.objectFlags) : "";
1829
- } },
1830
+ __debugFlags: {
1831
+ get() {
1832
+ return formatTypeFlags(this.flags);
1833
+ }
1834
+ },
1835
+ __debugObjectFlags: {
1836
+ get() {
1837
+ return this.flags & 524288 /* Object */ ? formatObjectFlags(this.objectFlags) : "";
1838
+ }
1839
+ },
1830
1840
  __debugTypeToString: {
1831
1841
  value() {
1832
1842
  let text = weakTypeTextMap.get(this);
@@ -1839,13 +1849,17 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
1839
1849
  }
1840
1850
  });
1841
1851
  Object.defineProperties(objectAllocator.getSignatureConstructor().prototype, {
1842
- __debugFlags: { get() {
1843
- return formatSignatureFlags(this.flags);
1844
- } },
1845
- __debugSignatureToString: { value() {
1846
- var _a;
1847
- return (_a = this.checker) == null ? void 0 : _a.signatureToString(this);
1848
- } }
1852
+ __debugFlags: {
1853
+ get() {
1854
+ return formatSignatureFlags(this.flags);
1855
+ }
1856
+ },
1857
+ __debugSignatureToString: {
1858
+ value() {
1859
+ var _a;
1860
+ return (_a = this.checker) == null ? void 0 : _a.signatureToString(this);
1861
+ }
1862
+ }
1849
1863
  });
1850
1864
  const nodeConstructors = [
1851
1865
  objectAllocator.getNodeConstructor(),
@@ -1863,24 +1877,36 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
1863
1877
  return `${nodeHeader}${this.flags ? ` (${formatNodeFlags(this.flags)})` : ""}`;
1864
1878
  }
1865
1879
  },
1866
- __debugKind: { get() {
1867
- return formatSyntaxKind(this.kind);
1868
- } },
1869
- __debugNodeFlags: { get() {
1870
- return formatNodeFlags(this.flags);
1871
- } },
1872
- __debugModifierFlags: { get() {
1873
- return formatModifierFlags(getEffectiveModifierFlagsNoCache(this));
1874
- } },
1875
- __debugTransformFlags: { get() {
1876
- return formatTransformFlags(this.transformFlags);
1877
- } },
1878
- __debugIsParseTreeNode: { get() {
1879
- return isParseTreeNode(this);
1880
- } },
1881
- __debugEmitFlags: { get() {
1882
- return formatEmitFlags(getEmitFlags(this));
1883
- } },
1880
+ __debugKind: {
1881
+ get() {
1882
+ return formatSyntaxKind(this.kind);
1883
+ }
1884
+ },
1885
+ __debugNodeFlags: {
1886
+ get() {
1887
+ return formatNodeFlags(this.flags);
1888
+ }
1889
+ },
1890
+ __debugModifierFlags: {
1891
+ get() {
1892
+ return formatModifierFlags(getEffectiveModifierFlagsNoCache(this));
1893
+ }
1894
+ },
1895
+ __debugTransformFlags: {
1896
+ get() {
1897
+ return formatTransformFlags(this.transformFlags);
1898
+ }
1899
+ },
1900
+ __debugIsParseTreeNode: {
1901
+ get() {
1902
+ return isParseTreeNode(this);
1903
+ }
1904
+ },
1905
+ __debugEmitFlags: {
1906
+ get() {
1907
+ return formatEmitFlags(getEmitFlags(this));
1908
+ }
1909
+ },
1884
1910
  __debugGetText: {
1885
1911
  value(includeTrivia) {
1886
1912
  if (nodeIsSynthesized(this))
@@ -2520,15 +2546,21 @@ function parseComparator(operator, text, comparators) {
2520
2546
  switch (operator) {
2521
2547
  case "~":
2522
2548
  comparators.push(createComparator(">=", version2));
2523
- comparators.push(createComparator("<", version2.increment(
2524
- isWildcard(minor) ? "major" : "minor"
2525
- )));
2549
+ comparators.push(createComparator(
2550
+ "<",
2551
+ version2.increment(
2552
+ isWildcard(minor) ? "major" : "minor"
2553
+ )
2554
+ ));
2526
2555
  break;
2527
2556
  case "^":
2528
2557
  comparators.push(createComparator(">=", version2));
2529
- comparators.push(createComparator("<", version2.increment(
2530
- version2.major > 0 || isWildcard(minor) ? "major" : version2.minor > 0 || isWildcard(patch) ? "minor" : "patch"
2531
- )));
2558
+ comparators.push(createComparator(
2559
+ "<",
2560
+ version2.increment(
2561
+ version2.major > 0 || isWildcard(minor) ? "major" : version2.minor > 0 || isWildcard(patch) ? "minor" : "patch"
2562
+ )
2563
+ ));
2532
2564
  break;
2533
2565
  case "<":
2534
2566
  case ">=":
@@ -2807,11 +2839,7 @@ var tracingEnabled;
2807
2839
  const meta = { cat: "__metadata", ph: "M", ts: 1e3 * timestamp(), pid: 1, tid: 1 };
2808
2840
  fs.writeSync(
2809
2841
  traceFd,
2810
- "[\n" + [
2811
- { name: "process_name", args: { name: "tsc" }, ...meta },
2812
- { name: "thread_name", args: { name: "Main" }, ...meta },
2813
- { name: "TracingStartedInBrowser", ...meta, cat: "disabled-by-default-devtools.timeline" }
2814
- ].map((v) => JSON.stringify(v)).join(",\n")
2842
+ "[\n" + [{ name: "process_name", args: { name: "tsc" }, ...meta }, { name: "thread_name", args: { name: "Main" }, ...meta }, { name: "TracingStartedInBrowser", ...meta, cat: "disabled-by-default-devtools.timeline" }].map((v) => JSON.stringify(v)).join(",\n")
2815
2843
  );
2816
2844
  }
2817
2845
  tracingEnabled2.startTracing = startTracing2;
@@ -5297,7 +5325,9 @@ var sys = (() => {
5297
5325
  })();
5298
5326
  if (sys && sys.getEnvironmentVariable) {
5299
5327
  setCustomPollingValues(sys);
5300
- Debug.setAssertionLevel(/^development$/i.test(sys.getEnvironmentVariable("NODE_ENV")) ? 1 /* Normal */ : 0 /* None */);
5328
+ Debug.setAssertionLevel(
5329
+ /^development$/i.test(sys.getEnvironmentVariable("NODE_ENV")) ? 1 /* Normal */ : 0 /* None */
5330
+ );
5301
5331
  }
5302
5332
  if (sys && sys.debugMode) {
5303
5333
  Debug.isDebugging = true;
@@ -6650,9 +6680,9 @@ var Diagnostics = {
6650
6680
  Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext: diag(2821, 1 /* Error */, "Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext_2821", "Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'."),
6651
6681
  Import_assertions_cannot_be_used_with_type_only_imports_or_exports: diag(2822, 1 /* Error */, "Import_assertions_cannot_be_used_with_type_only_imports_or_exports_2822", "Import assertions cannot be used with type-only imports or exports."),
6652
6682
  Cannot_find_namespace_0_Did_you_mean_1: diag(2833, 1 /* Error */, "Cannot_find_namespace_0_Did_you_mean_1_2833", "Cannot find namespace '{0}'. Did you mean '{1}'?"),
6653
- Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Consider_adding_an_extension_to_the_import_path: diag(2834, 1 /* Error */, "Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2834", "Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path."),
6654
- Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0: diag(2835, 1 /* Error */, "Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2835", "Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean '{0}'?"),
6655
- Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls: diag(2836, 1 /* Error */, "Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls_2836", "Import assertions are not allowed on statements that transpile to commonjs 'require' calls."),
6683
+ Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Consider_adding_an_extension_to_the_import_path: diag(2834, 1 /* Error */, "Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_n_2834", "Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path."),
6684
+ Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0: diag(2835, 1 /* Error */, "Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_n_2835", "Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean '{0}'?"),
6685
+ Import_assertions_are_not_allowed_on_statements_that_transpile_to_CommonJS_require_calls: diag(2836, 1 /* Error */, "Import_assertions_are_not_allowed_on_statements_that_transpile_to_CommonJS_require_calls_2836", "Import assertions are not allowed on statements that transpile to CommonJS 'require' calls."),
6656
6686
  Import_assertion_values_must_be_string_literal_expressions: diag(2837, 1 /* Error */, "Import_assertion_values_must_be_string_literal_expressions_2837", "Import assertion values must be string literal expressions."),
6657
6687
  All_declarations_of_0_must_have_identical_constraints: diag(2838, 1 /* Error */, "All_declarations_of_0_must_have_identical_constraints_2838", "All declarations of '{0}' must have identical constraints."),
6658
6688
  This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value: diag(2839, 1 /* Error */, "This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value_2839", "This condition will always return '{0}' since JavaScript compares objects by reference, not value."),
@@ -12422,16 +12452,14 @@ function createDiagnosticForNodeArrayFromMessageChain(sourceFile, nodes, message
12422
12452
  const start = skipTrivia(sourceFile.text, nodes.pos);
12423
12453
  return createFileDiagnosticFromMessageChain(sourceFile, start, nodes.end - start, messageChain, relatedInformation);
12424
12454
  }
12425
- function assertDiagnosticLocation(file, start, length2) {
12455
+ function assertDiagnosticLocation(sourceText, start, length2) {
12426
12456
  Debug.assertGreaterThanOrEqual(start, 0);
12427
12457
  Debug.assertGreaterThanOrEqual(length2, 0);
12428
- if (file) {
12429
- Debug.assertLessThanOrEqual(start, file.text.length);
12430
- Debug.assertLessThanOrEqual(start + length2, file.text.length);
12431
- }
12458
+ Debug.assertLessThanOrEqual(start, sourceText.length);
12459
+ Debug.assertLessThanOrEqual(start + length2, sourceText.length);
12432
12460
  }
12433
12461
  function createFileDiagnosticFromMessageChain(file, start, length2, messageChain, relatedInformation) {
12434
- assertDiagnosticLocation(file, start, length2);
12462
+ assertDiagnosticLocation(file.text, start, length2);
12435
12463
  return {
12436
12464
  file,
12437
12465
  start,
@@ -12675,10 +12703,7 @@ function isPartOfTypeNode(node) {
12675
12703
  } else if (node.parent.kind === 211 /* PropertyAccessExpression */ && node.parent.name === node) {
12676
12704
  node = node.parent;
12677
12705
  }
12678
- Debug.assert(
12679
- node.kind === 80 /* Identifier */ || node.kind === 166 /* QualifiedName */ || node.kind === 211 /* PropertyAccessExpression */,
12680
- "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."
12681
- );
12706
+ Debug.assert(node.kind === 80 /* Identifier */ || node.kind === 166 /* QualifiedName */ || node.kind === 211 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'.");
12682
12707
  case 166 /* QualifiedName */:
12683
12708
  case 211 /* PropertyAccessExpression */:
12684
12709
  case 110 /* ThisKeyword */: {
@@ -12881,11 +12906,7 @@ function forEachPropertyAssignment(objectLiteral, key, callback, key2) {
12881
12906
  });
12882
12907
  }
12883
12908
  function getPropertyArrayElementValue(objectLiteral, propKey, elementValue) {
12884
- return forEachPropertyAssignment(
12885
- objectLiteral,
12886
- propKey,
12887
- (property) => isArrayLiteralExpression(property.initializer) ? find(property.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : void 0
12888
- );
12909
+ return forEachPropertyAssignment(objectLiteral, propKey, (property) => isArrayLiteralExpression(property.initializer) ? find(property.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : void 0);
12889
12910
  }
12890
12911
  function getTsConfigObjectLiteralExpression(tsConfigSourceFile) {
12891
12912
  if (tsConfigSourceFile && tsConfigSourceFile.statements.length) {
@@ -13288,8 +13309,8 @@ function isInExpressionContext(node) {
13288
13309
  return forStatement.initializer === node && forStatement.initializer.kind !== 261 /* VariableDeclarationList */ || forStatement.condition === node || forStatement.incrementor === node;
13289
13310
  case 249 /* ForInStatement */:
13290
13311
  case 250 /* ForOfStatement */:
13291
- const forInStatement = parent;
13292
- return forInStatement.initializer === node && forInStatement.initializer.kind !== 261 /* VariableDeclarationList */ || forInStatement.expression === node;
13312
+ const forInOrOfStatement = parent;
13313
+ return forInOrOfStatement.initializer === node && forInOrOfStatement.initializer.kind !== 261 /* VariableDeclarationList */ || forInOrOfStatement.expression === node;
13293
13314
  case 216 /* TypeAssertionExpression */:
13294
13315
  case 234 /* AsExpression */:
13295
13316
  return node === parent.expression;
@@ -13950,20 +13971,23 @@ function getTypeParameterFromJsDoc(node) {
13950
13971
  const { typeParameters } = node.parent.parent.parent;
13951
13972
  return typeParameters && find(typeParameters, (p) => p.name.escapedText === name);
13952
13973
  }
13953
- function getAssignmentTargetKind(node) {
13974
+ function getAssignmentTarget(node) {
13954
13975
  let parent = node.parent;
13955
13976
  while (true) {
13956
13977
  switch (parent.kind) {
13957
13978
  case 226 /* BinaryExpression */:
13958
- const binaryOperator = parent.operatorToken.kind;
13959
- return isAssignmentOperator(binaryOperator) && parent.left === node ? binaryOperator === 64 /* EqualsToken */ || isLogicalOrCoalescingAssignmentOperator(binaryOperator) ? 1 /* Definite */ : 2 /* Compound */ : 0 /* None */;
13979
+ const binaryExpression = parent;
13980
+ const binaryOperator = binaryExpression.operatorToken.kind;
13981
+ return isAssignmentOperator(binaryOperator) && binaryExpression.left === node ? binaryExpression : void 0;
13960
13982
  case 224 /* PrefixUnaryExpression */:
13961
13983
  case 225 /* PostfixUnaryExpression */:
13962
- const unaryOperator = parent.operator;
13963
- return unaryOperator === 46 /* PlusPlusToken */ || unaryOperator === 47 /* MinusMinusToken */ ? 2 /* Compound */ : 0 /* None */;
13984
+ const unaryExpression = parent;
13985
+ const unaryOperator = unaryExpression.operator;
13986
+ return unaryOperator === 46 /* PlusPlusToken */ || unaryOperator === 47 /* MinusMinusToken */ ? unaryExpression : void 0;
13964
13987
  case 249 /* ForInStatement */:
13965
13988
  case 250 /* ForOfStatement */:
13966
- return parent.initializer === node ? 1 /* Definite */ : 0 /* None */;
13989
+ const forInOrOfStatement = parent;
13990
+ return forInOrOfStatement.initializer === node ? forInOrOfStatement : void 0;
13967
13991
  case 217 /* ParenthesizedExpression */:
13968
13992
  case 209 /* ArrayLiteralExpression */:
13969
13993
  case 230 /* SpreadElement */:
@@ -13975,24 +13999,53 @@ function getAssignmentTargetKind(node) {
13975
13999
  break;
13976
14000
  case 304 /* ShorthandPropertyAssignment */:
13977
14001
  if (parent.name !== node) {
13978
- return 0 /* None */;
14002
+ return void 0;
13979
14003
  }
13980
14004
  node = parent.parent;
13981
14005
  break;
13982
14006
  case 303 /* PropertyAssignment */:
13983
14007
  if (parent.name === node) {
13984
- return 0 /* None */;
14008
+ return void 0;
13985
14009
  }
13986
14010
  node = parent.parent;
13987
14011
  break;
13988
14012
  default:
13989
- return 0 /* None */;
14013
+ return void 0;
13990
14014
  }
13991
14015
  parent = node.parent;
13992
14016
  }
13993
14017
  }
14018
+ function getAssignmentTargetKind(node) {
14019
+ const target = getAssignmentTarget(node);
14020
+ if (!target) {
14021
+ return 0 /* None */;
14022
+ }
14023
+ switch (target.kind) {
14024
+ case 226 /* BinaryExpression */:
14025
+ const binaryOperator = target.operatorToken.kind;
14026
+ return binaryOperator === 64 /* EqualsToken */ || isLogicalOrCoalescingAssignmentOperator(binaryOperator) ? 1 /* Definite */ : 2 /* Compound */;
14027
+ case 224 /* PrefixUnaryExpression */:
14028
+ case 225 /* PostfixUnaryExpression */:
14029
+ return 2 /* Compound */;
14030
+ case 249 /* ForInStatement */:
14031
+ case 250 /* ForOfStatement */:
14032
+ return 1 /* Definite */;
14033
+ }
14034
+ }
13994
14035
  function isAssignmentTarget(node) {
13995
- return getAssignmentTargetKind(node) !== 0 /* None */;
14036
+ return !!getAssignmentTarget(node);
14037
+ }
14038
+ function isCompoundLikeAssignment(assignment) {
14039
+ const right = skipParentheses(assignment.right);
14040
+ return right.kind === 226 /* BinaryExpression */ && isShiftOperatorOrHigher(right.operatorToken.kind);
14041
+ }
14042
+ function isInCompoundLikeAssignment(node) {
14043
+ const target = getAssignmentTarget(node);
14044
+ return !!target && isAssignmentExpression(
14045
+ target,
14046
+ /*excludeCompoundAssignment*/
14047
+ true
14048
+ ) && isCompoundLikeAssignment(target);
13996
14049
  }
13997
14050
  function isNodeWithPossibleHoistedDeclaration(node) {
13998
14051
  switch (node.kind) {
@@ -14642,8 +14695,11 @@ var templateSubstitutionRegExp = /\$\{/g;
14642
14695
  function escapeTemplateSubstitution(str) {
14643
14696
  return str.replace(templateSubstitutionRegExp, "\\${");
14644
14697
  }
14698
+ function containsInvalidEscapeFlag(node) {
14699
+ return !!((node.templateFlags || 0) & 2048 /* ContainsInvalidEscape */);
14700
+ }
14645
14701
  function hasInvalidEscape(template) {
14646
- return template && !!(isNoSubstitutionTemplateLiteral(template) ? template.templateFlags : template.head.templateFlags || some(template.templateSpans, (span) => !!span.literal.templateFlags));
14702
+ return template && !!(isNoSubstitutionTemplateLiteral(template) ? containsInvalidEscapeFlag(template) : containsInvalidEscapeFlag(template.head) || some(template.templateSpans, (span) => containsInvalidEscapeFlag(span.literal)));
14647
14703
  }
14648
14704
  var doubleQuoteEscapedCharsRegExp = /[\\"\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g;
14649
14705
  var singleQuoteEscapedCharsRegExp = /[\\'\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g;
@@ -15016,9 +15072,16 @@ function getSourceFilePathInNewDirWorker(fileName, newDirPath, currentDirectory,
15016
15072
  return combinePaths(newDirPath, sourceFilePath);
15017
15073
  }
15018
15074
  function writeFile(host, diagnostics, fileName, text, writeByteOrderMark, sourceFiles, data) {
15019
- host.writeFile(fileName, text, writeByteOrderMark, (hostErrorMessage) => {
15020
- diagnostics.add(createCompilerDiagnostic(Diagnostics.Could_not_write_file_0_Colon_1, fileName, hostErrorMessage));
15021
- }, sourceFiles, data);
15075
+ host.writeFile(
15076
+ fileName,
15077
+ text,
15078
+ writeByteOrderMark,
15079
+ (hostErrorMessage) => {
15080
+ diagnostics.add(createCompilerDiagnostic(Diagnostics.Could_not_write_file_0_Colon_1, fileName, hostErrorMessage));
15081
+ },
15082
+ sourceFiles,
15083
+ data
15084
+ );
15022
15085
  }
15023
15086
  function ensureDirectoriesExist(directoryPath, createDirectory, directoryExists) {
15024
15087
  if (directoryPath.length > getRootLength(directoryPath) && !directoryExists(directoryPath)) {
@@ -15888,21 +15951,17 @@ function isUMDExportSymbol(symbol) {
15888
15951
  }
15889
15952
  function getLastChild(node) {
15890
15953
  let lastChild;
15891
- forEachChild(
15892
- node,
15893
- (child) => {
15894
- if (nodeIsPresent(child))
15895
- lastChild = child;
15896
- },
15897
- (children) => {
15898
- for (let i = children.length - 1; i >= 0; i--) {
15899
- if (nodeIsPresent(children[i])) {
15900
- lastChild = children[i];
15901
- break;
15902
- }
15954
+ forEachChild(node, (child) => {
15955
+ if (nodeIsPresent(child))
15956
+ lastChild = child;
15957
+ }, (children) => {
15958
+ for (let i = children.length - 1; i >= 0; i--) {
15959
+ if (nodeIsPresent(children[i])) {
15960
+ lastChild = children[i];
15961
+ break;
15903
15962
  }
15904
15963
  }
15905
- );
15964
+ });
15906
15965
  return lastChild;
15907
15966
  }
15908
15967
  function isTypeNodeKind(kind) {
@@ -16044,13 +16103,11 @@ function setLocalizedDiagnosticMessages(messages) {
16044
16103
  function getLocaleSpecificMessage(message) {
16045
16104
  return localizedDiagnosticMessages && localizedDiagnosticMessages[message.key] || message.message;
16046
16105
  }
16047
- function createDetachedDiagnostic(fileName, start, length2, message, ...args) {
16048
- assertDiagnosticLocation(
16049
- /*file*/
16050
- void 0,
16051
- start,
16052
- length2
16053
- );
16106
+ function createDetachedDiagnostic(fileName, sourceText, start, length2, message, ...args) {
16107
+ if (start + length2 > sourceText.length) {
16108
+ length2 = sourceText.length - start;
16109
+ }
16110
+ assertDiagnosticLocation(sourceText, start, length2);
16054
16111
  let text = getLocaleSpecificMessage(message);
16055
16112
  if (some(args)) {
16056
16113
  text = formatStringFromArgs(text, args);
@@ -16106,7 +16163,7 @@ function attachFileToDiagnostics(diagnostics, file) {
16106
16163
  return diagnosticsWithLocation;
16107
16164
  }
16108
16165
  function createFileDiagnostic(file, start, length2, message, ...args) {
16109
- assertDiagnosticLocation(file, start, length2);
16166
+ assertDiagnosticLocation(file.text, start, length2);
16110
16167
  let text = getLocaleSpecificMessage(message);
16111
16168
  if (some(args)) {
16112
16169
  text = formatStringFromArgs(text, args);
@@ -25037,21 +25094,18 @@ function createExternalHelpersImportDeclarationIfNeeded(nodeFactory, helperFacto
25037
25094
  if (some(helperNames)) {
25038
25095
  helperNames.sort(compareStringsCaseSensitive);
25039
25096
  namedBindings = nodeFactory.createNamedImports(
25040
- map(
25041
- helperNames,
25042
- (name) => isFileLevelUniqueName(sourceFile, name) ? nodeFactory.createImportSpecifier(
25043
- /*isTypeOnly*/
25044
- false,
25045
- /*propertyName*/
25046
- void 0,
25047
- nodeFactory.createIdentifier(name)
25048
- ) : nodeFactory.createImportSpecifier(
25049
- /*isTypeOnly*/
25050
- false,
25051
- nodeFactory.createIdentifier(name),
25052
- helperFactory.getUnscopedHelperName(name)
25053
- )
25054
- )
25097
+ map(helperNames, (name) => isFileLevelUniqueName(sourceFile, name) ? nodeFactory.createImportSpecifier(
25098
+ /*isTypeOnly*/
25099
+ false,
25100
+ /*propertyName*/
25101
+ void 0,
25102
+ nodeFactory.createIdentifier(name)
25103
+ ) : nodeFactory.createImportSpecifier(
25104
+ /*isTypeOnly*/
25105
+ false,
25106
+ nodeFactory.createIdentifier(name),
25107
+ helperFactory.getUnscopedHelperName(name)
25108
+ ))
25055
25109
  );
25056
25110
  const parseNode = getOriginalNode(sourceFile, isSourceFile);
25057
25111
  const emitNode = getOrCreateEmitNode(parseNode);
@@ -26468,9 +26522,9 @@ var Parser;
26468
26522
  /*allowReservedWords*/
26469
26523
  true
26470
26524
  );
26471
- const isInvalid = token() === 1 /* EndOfFileToken */ && !parseDiagnostics.length;
26525
+ const isValid = token() === 1 /* EndOfFileToken */ && !parseDiagnostics.length;
26472
26526
  clearState();
26473
- return isInvalid ? entityName : void 0;
26527
+ return isValid ? entityName : void 0;
26474
26528
  }
26475
26529
  Parser2.parseIsolatedEntityName = parseIsolatedEntityName2;
26476
26530
  function parseJsonText2(fileName2, sourceText2, languageVersion2 = 2 /* ES2015 */, syntaxCursor2, setParentNodes = false) {
@@ -26636,7 +26690,7 @@ var Parser;
26636
26690
  }
26637
26691
  return sourceFile;
26638
26692
  function reportPragmaDiagnostic(pos, end, diagnostic) {
26639
- parseDiagnostics.push(createDetachedDiagnostic(fileName, pos, end, diagnostic));
26693
+ parseDiagnostics.push(createDetachedDiagnostic(fileName, sourceText, pos, end, diagnostic));
26640
26694
  }
26641
26695
  }
26642
26696
  let hasDeprecatedTag = false;
@@ -26876,7 +26930,7 @@ var Parser;
26876
26930
  const lastError = lastOrUndefined(parseDiagnostics);
26877
26931
  let result;
26878
26932
  if (!lastError || start !== lastError.start) {
26879
- result = createDetachedDiagnostic(fileName, start, length2, message, ...args);
26933
+ result = createDetachedDiagnostic(fileName, sourceText, start, length2, message, ...args);
26880
26934
  parseDiagnostics.push(result);
26881
26935
  }
26882
26936
  parseErrorBeforeNextFinishedNode = true;
@@ -27104,7 +27158,7 @@ var Parser;
27104
27158
  if (lastError) {
27105
27159
  addRelatedInfo(
27106
27160
  lastError,
27107
- createDetachedDiagnostic(fileName, openPosition, 1, Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, tokenToString(openKind), tokenToString(closeKind))
27161
+ createDetachedDiagnostic(fileName, sourceText, openPosition, 1, Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, tokenToString(openKind), tokenToString(closeKind))
27108
27162
  );
27109
27163
  }
27110
27164
  }
@@ -28703,7 +28757,7 @@ var Parser;
28703
28757
  if (lastError && lastError.code === Diagnostics._0_expected.code) {
28704
28758
  addRelatedInfo(
28705
28759
  lastError,
28706
- createDetachedDiagnostic(fileName, openBracePosition, 1, Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, "{", "}")
28760
+ createDetachedDiagnostic(fileName, sourceText, openBracePosition, 1, Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, "{", "}")
28707
28761
  );
28708
28762
  }
28709
28763
  }
@@ -31820,7 +31874,7 @@ var Parser;
31820
31874
  if (lastError && lastError.code === Diagnostics._0_expected.code) {
31821
31875
  addRelatedInfo(
31822
31876
  lastError,
31823
- createDetachedDiagnostic(fileName, openBracePosition, 1, Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, "{", "}")
31877
+ createDetachedDiagnostic(fileName, sourceText, openBracePosition, 1, Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, "{", "}")
31824
31878
  );
31825
31879
  }
31826
31880
  }
@@ -32799,7 +32853,7 @@ var Parser;
32799
32853
  if (childTypeTag) {
32800
32854
  const lastError = parseErrorAtCurrentToken(Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags);
32801
32855
  if (lastError) {
32802
- addRelatedInfo(lastError, createDetachedDiagnostic(fileName, 0, 0, Diagnostics.The_tag_was_first_specified_here));
32856
+ addRelatedInfo(lastError, createDetachedDiagnostic(fileName, sourceText, 0, 0, Diagnostics.The_tag_was_first_specified_here));
32803
32857
  }
32804
32858
  break;
32805
32859
  } else {
@@ -33094,16 +33148,7 @@ var IncrementalParser;
33094
33148
  Debug.assert(textSpanEnd(changeRange.span) === textSpanEnd(textChangeRange.span));
33095
33149
  Debug.assert(textSpanEnd(textChangeRangeNewSpan(changeRange)) === textSpanEnd(textChangeRangeNewSpan(textChangeRange)));
33096
33150
  const delta = textChangeRangeNewSpan(changeRange).length - changeRange.span.length;
33097
- updateTokenPositionsAndMarkElements(
33098
- incrementalSourceFile,
33099
- changeRange.span.start,
33100
- textSpanEnd(changeRange.span),
33101
- textSpanEnd(textChangeRangeNewSpan(changeRange)),
33102
- delta,
33103
- oldText,
33104
- newText,
33105
- aggressiveChecks
33106
- );
33151
+ updateTokenPositionsAndMarkElements(incrementalSourceFile, changeRange.span.start, textSpanEnd(changeRange.span), textSpanEnd(textChangeRangeNewSpan(changeRange)), delta, oldText, newText, aggressiveChecks);
33107
33152
  const result = Parser.parseSourceFile(
33108
33153
  sourceFile.fileName,
33109
33154
  newText,
@@ -36257,14 +36302,17 @@ function getExtendsConfigPathOrArray(value, host, basePath, configFileName, erro
36257
36302
  for (let index = 0; index < value.length; index++) {
36258
36303
  const fileName = value[index];
36259
36304
  if (isString(fileName)) {
36260
- extendedConfigPath = append(extendedConfigPath, getExtendsConfigPath(
36261
- fileName,
36262
- host,
36263
- newBase,
36264
- errors,
36265
- valueExpression == null ? void 0 : valueExpression.elements[index],
36266
- sourceFile
36267
- ));
36305
+ extendedConfigPath = append(
36306
+ extendedConfigPath,
36307
+ getExtendsConfigPath(
36308
+ fileName,
36309
+ host,
36310
+ newBase,
36311
+ errors,
36312
+ valueExpression == null ? void 0 : valueExpression.elements[index],
36313
+ sourceFile
36314
+ )
36315
+ );
36268
36316
  } else {
36269
36317
  convertJsonOption(extendsOptionDeclaration.element, value, basePath, errors, propertyAssignment, valueExpression == null ? void 0 : valueExpression.elements[index], sourceFile);
36270
36318
  }
@@ -37109,12 +37157,7 @@ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFil
37109
37157
  }
37110
37158
  }
37111
37159
  return resolvedTypeScriptOnly(
37112
- loadNodeModuleFromDirectory(
37113
- 4 /* Declaration */,
37114
- candidate,
37115
- !directoryExists,
37116
- moduleResolutionState
37117
- )
37160
+ loadNodeModuleFromDirectory(4 /* Declaration */, candidate, !directoryExists, moduleResolutionState)
37118
37161
  );
37119
37162
  });
37120
37163
  } else {
@@ -37247,9 +37290,8 @@ function compilerOptionValueToString(value) {
37247
37290
  function getKeyForCompilerOptions(options, affectingOptionDeclarations) {
37248
37291
  return affectingOptionDeclarations.map((option) => compilerOptionValueToString(getCompilerOptionValue(options, option))).join("|") + `|${options.pathsBasePath}`;
37249
37292
  }
37250
- function createCacheWithRedirects(ownOptions) {
37293
+ function createCacheWithRedirects(ownOptions, optionsToRedirectsKey) {
37251
37294
  const redirectsMap = /* @__PURE__ */ new Map();
37252
- const optionsToRedirectsKey = /* @__PURE__ */ new Map();
37253
37295
  const redirectsKeyToMap = /* @__PURE__ */ new Map();
37254
37296
  let ownMap = /* @__PURE__ */ new Map();
37255
37297
  if (ownOptions)
@@ -37359,8 +37401,8 @@ function getOrCreateCache(cacheWithRedirects, redirectedReference, key, create)
37359
37401
  }
37360
37402
  return result;
37361
37403
  }
37362
- function createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, options) {
37363
- const directoryToModuleNameMap = createCacheWithRedirects(options);
37404
+ function createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, options, optionsToRedirectsKey) {
37405
+ const directoryToModuleNameMap = createCacheWithRedirects(options, optionsToRedirectsKey);
37364
37406
  return {
37365
37407
  getFromDirectoryCache,
37366
37408
  getOrCreateCacheForDirectory,
@@ -37436,8 +37478,8 @@ function getOriginalOrResolvedModuleFileName(result) {
37436
37478
  function getOriginalOrResolvedTypeReferenceFileName(result) {
37437
37479
  return result.resolvedTypeReferenceDirective && (result.resolvedTypeReferenceDirective.originalPath || result.resolvedTypeReferenceDirective.resolvedFileName);
37438
37480
  }
37439
- function createNonRelativeNameResolutionCache(currentDirectory, getCanonicalFileName, options, getResolvedFileName) {
37440
- const moduleNameToDirectoryMap = createCacheWithRedirects(options);
37481
+ function createNonRelativeNameResolutionCache(currentDirectory, getCanonicalFileName, options, getResolvedFileName, optionsToRedirectsKey) {
37482
+ const moduleNameToDirectoryMap = createCacheWithRedirects(options, optionsToRedirectsKey);
37441
37483
  return {
37442
37484
  getFromNonRelativeNameCache,
37443
37485
  getOrCreateCacheForNonRelativeName,
@@ -37505,13 +37547,20 @@ function createNonRelativeNameResolutionCache(currentDirectory, getCanonicalFile
37505
37547
  }
37506
37548
  }
37507
37549
  }
37508
- function createModuleOrTypeReferenceResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache, getResolvedFileName) {
37509
- const perDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, options);
37550
+ function createModuleOrTypeReferenceResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache, getResolvedFileName, optionsToRedirectsKey) {
37551
+ optionsToRedirectsKey ?? (optionsToRedirectsKey = /* @__PURE__ */ new Map());
37552
+ const perDirectoryResolutionCache = createPerDirectoryResolutionCache(
37553
+ currentDirectory,
37554
+ getCanonicalFileName,
37555
+ options,
37556
+ optionsToRedirectsKey
37557
+ );
37510
37558
  const nonRelativeNameResolutionCache = createNonRelativeNameResolutionCache(
37511
37559
  currentDirectory,
37512
37560
  getCanonicalFileName,
37513
37561
  options,
37514
- getResolvedFileName
37562
+ getResolvedFileName,
37563
+ optionsToRedirectsKey
37515
37564
  );
37516
37565
  packageJsonInfoCache ?? (packageJsonInfoCache = createPackageJsonInfoCache(currentDirectory, getCanonicalFileName));
37517
37566
  return {
@@ -37521,7 +37570,8 @@ function createModuleOrTypeReferenceResolutionCache(currentDirectory, getCanonic
37521
37570
  clear: clear2,
37522
37571
  update,
37523
37572
  getPackageJsonInfoCache: () => packageJsonInfoCache,
37524
- clearAllExceptPackageJsonInfoCache
37573
+ clearAllExceptPackageJsonInfoCache,
37574
+ optionsToRedirectsKey
37525
37575
  };
37526
37576
  function clear2() {
37527
37577
  clearAllExceptPackageJsonInfoCache();
@@ -37536,24 +37586,26 @@ function createModuleOrTypeReferenceResolutionCache(currentDirectory, getCanonic
37536
37586
  nonRelativeNameResolutionCache.update(options2);
37537
37587
  }
37538
37588
  }
37539
- function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache) {
37589
+ function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache, optionsToRedirectsKey) {
37540
37590
  const result = createModuleOrTypeReferenceResolutionCache(
37541
37591
  currentDirectory,
37542
37592
  getCanonicalFileName,
37543
37593
  options,
37544
37594
  packageJsonInfoCache,
37545
- getOriginalOrResolvedModuleFileName
37595
+ getOriginalOrResolvedModuleFileName,
37596
+ optionsToRedirectsKey
37546
37597
  );
37547
37598
  result.getOrCreateCacheForModuleName = (nonRelativeName, mode, redirectedReference) => result.getOrCreateCacheForNonRelativeName(nonRelativeName, mode, redirectedReference);
37548
37599
  return result;
37549
37600
  }
37550
- function createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache) {
37601
+ function createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache, optionsToRedirectsKey) {
37551
37602
  return createModuleOrTypeReferenceResolutionCache(
37552
37603
  currentDirectory,
37553
37604
  getCanonicalFileName,
37554
37605
  options,
37555
37606
  packageJsonInfoCache,
37556
- getOriginalOrResolvedTypeReferenceFileName
37607
+ getOriginalOrResolvedTypeReferenceFileName,
37608
+ optionsToRedirectsKey
37557
37609
  );
37558
37610
  }
37559
37611
  function getOptionsForLibraryResolution(options) {
@@ -38581,13 +38633,15 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
38581
38633
  false,
38582
38634
  redirectedReference
38583
38635
  );
38584
- return toSearchResult(result.resolvedModule ? {
38585
- path: result.resolvedModule.resolvedFileName,
38586
- extension: result.resolvedModule.extension,
38587
- packageId: result.resolvedModule.packageId,
38588
- originalPath: result.resolvedModule.originalPath,
38589
- resolvedUsingTsExtension: result.resolvedModule.resolvedUsingTsExtension
38590
- } : void 0);
38636
+ return toSearchResult(
38637
+ result.resolvedModule ? {
38638
+ path: result.resolvedModule.resolvedFileName,
38639
+ extension: result.resolvedModule.extension,
38640
+ packageId: result.resolvedModule.packageId,
38641
+ originalPath: result.resolvedModule.originalPath,
38642
+ resolvedUsingTsExtension: result.resolvedModule.resolvedUsingTsExtension
38643
+ } : void 0
38644
+ );
38591
38645
  }
38592
38646
  if (state.traceEnabled) {
38593
38647
  trace(state.host, Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
@@ -38620,13 +38674,7 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
38620
38674
  );
38621
38675
  }
38622
38676
  if (state.traceEnabled) {
38623
- trace(
38624
- state.host,
38625
- Diagnostics.Using_0_subpath_1_with_target_2,
38626
- isImports ? "imports" : "exports",
38627
- key,
38628
- pattern ? target.replace(/\*/g, subpath) : target + subpath
38629
- );
38677
+ trace(state.host, Diagnostics.Using_0_subpath_1_with_target_2, isImports ? "imports" : "exports", key, pattern ? target.replace(/\*/g, subpath) : target + subpath);
38630
38678
  }
38631
38679
  const finalPath = toAbsolutePath(pattern ? resolvedTarget.replace(/\*/g, subpath) : resolvedTarget + subpath);
38632
38680
  const inputLink = tryLoadInputFileForPath(finalPath, subpath, combinePaths(scope.packageDirectory, "package.json"), isImports);
@@ -40849,31 +40897,15 @@ function createBinder() {
40849
40897
  return;
40850
40898
  }
40851
40899
  if (inStrictMode && originalKeywordKind >= 119 /* FirstFutureReservedWord */ && originalKeywordKind <= 127 /* LastFutureReservedWord */) {
40852
- file.bindDiagnostics.push(createDiagnosticForNode2(
40853
- node,
40854
- getStrictModeIdentifierMessage(node),
40855
- declarationNameToString(node)
40856
- ));
40900
+ file.bindDiagnostics.push(createDiagnosticForNode2(node, getStrictModeIdentifierMessage(node), declarationNameToString(node)));
40857
40901
  } else if (originalKeywordKind === 135 /* AwaitKeyword */) {
40858
40902
  if (isExternalModule(file) && isInTopLevelContext(node)) {
40859
- file.bindDiagnostics.push(createDiagnosticForNode2(
40860
- node,
40861
- Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module,
40862
- declarationNameToString(node)
40863
- ));
40903
+ file.bindDiagnostics.push(createDiagnosticForNode2(node, Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module, declarationNameToString(node)));
40864
40904
  } else if (node.flags & 65536 /* AwaitContext */) {
40865
- file.bindDiagnostics.push(createDiagnosticForNode2(
40866
- node,
40867
- Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here,
40868
- declarationNameToString(node)
40869
- ));
40905
+ file.bindDiagnostics.push(createDiagnosticForNode2(node, Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here, declarationNameToString(node)));
40870
40906
  }
40871
40907
  } else if (originalKeywordKind === 127 /* YieldKeyword */ && node.flags & 16384 /* YieldContext */) {
40872
- file.bindDiagnostics.push(createDiagnosticForNode2(
40873
- node,
40874
- Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here,
40875
- declarationNameToString(node)
40876
- ));
40908
+ file.bindDiagnostics.push(createDiagnosticForNode2(node, Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here, declarationNameToString(node)));
40877
40909
  }
40878
40910
  }
40879
40911
  }
@@ -40889,11 +40921,7 @@ function createBinder() {
40889
40921
  function checkPrivateIdentifier(node) {
40890
40922
  if (node.escapedText === "#constructor") {
40891
40923
  if (!file.parseDiagnostics.length) {
40892
- file.bindDiagnostics.push(createDiagnosticForNode2(
40893
- node,
40894
- Diagnostics.constructor_is_a_reserved_word,
40895
- declarationNameToString(node)
40896
- ));
40924
+ file.bindDiagnostics.push(createDiagnosticForNode2(node, Diagnostics.constructor_is_a_reserved_word, declarationNameToString(node)));
40897
40925
  }
40898
40926
  }
40899
40927
  }
@@ -40921,13 +40949,7 @@ function createBinder() {
40921
40949
  const identifier = name;
40922
40950
  if (isEvalOrArgumentsIdentifier(identifier)) {
40923
40951
  const span = getErrorSpanForNode(file, name);
40924
- file.bindDiagnostics.push(createFileDiagnostic(
40925
- file,
40926
- span.start,
40927
- span.length,
40928
- getStrictModeEvalOrArgumentsMessage(contextNode),
40929
- idText(identifier)
40930
- ));
40952
+ file.bindDiagnostics.push(createFileDiagnostic(file, span.start, span.length, getStrictModeEvalOrArgumentsMessage(contextNode), idText(identifier)));
40931
40953
  }
40932
40954
  }
40933
40955
  }
@@ -40958,12 +40980,7 @@ function createBinder() {
40958
40980
  if (languageVersion < 2 /* ES2015 */) {
40959
40981
  if (blockScopeContainer.kind !== 312 /* SourceFile */ && blockScopeContainer.kind !== 267 /* ModuleDeclaration */ && !isFunctionLikeOrClassStaticBlockDeclaration(blockScopeContainer)) {
40960
40982
  const errorSpan = getErrorSpanForNode(file, node);
40961
- file.bindDiagnostics.push(createFileDiagnostic(
40962
- file,
40963
- errorSpan.start,
40964
- errorSpan.length,
40965
- getStrictModeBlockScopeFunctionDeclarationMessage(node)
40966
- ));
40983
+ file.bindDiagnostics.push(createFileDiagnostic(file, errorSpan.start, errorSpan.length, getStrictModeBlockScopeFunctionDeclarationMessage(node)));
40967
40984
  }
40968
40985
  }
40969
40986
  }
@@ -41194,11 +41211,7 @@ function createBinder() {
41194
41211
  return declareSymbolAndAddToSymbolTable(node, 131072 /* Signature */, 0 /* None */);
41195
41212
  case 174 /* MethodDeclaration */:
41196
41213
  case 173 /* MethodSignature */:
41197
- return bindPropertyOrMethodOrAccessor(
41198
- node,
41199
- 8192 /* Method */ | (node.questionToken ? 16777216 /* Optional */ : 0 /* None */),
41200
- isObjectLiteralMethod(node) ? 0 /* PropertyExcludes */ : 103359 /* MethodExcludes */
41201
- );
41214
+ return bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 16777216 /* Optional */ : 0 /* None */), isObjectLiteralMethod(node) ? 0 /* PropertyExcludes */ : 103359 /* MethodExcludes */);
41202
41215
  case 262 /* FunctionDeclaration */:
41203
41216
  return bindFunctionDeclaration(node);
41204
41217
  case 176 /* Constructor */:
@@ -42535,32 +42548,29 @@ function tryGetModuleNameFromAmbientModule(moduleSymbol, checker) {
42535
42548
  if (decl) {
42536
42549
  return decl.name.text;
42537
42550
  }
42538
- const ambientModuleDeclareCandidates = mapDefined(
42539
- moduleSymbol.declarations,
42540
- (d) => {
42541
- var _a2, _b, _c, _d;
42542
- if (!isModuleDeclaration(d))
42543
- return;
42544
- const topNamespace = getTopNamespace(d);
42545
- if (!(((_a2 = topNamespace == null ? void 0 : topNamespace.parent) == null ? void 0 : _a2.parent) && isModuleBlock(topNamespace.parent) && isAmbientModule(topNamespace.parent.parent) && isSourceFile(topNamespace.parent.parent.parent)))
42546
- return;
42547
- const exportAssignment = (_d = (_c = (_b = topNamespace.parent.parent.symbol.exports) == null ? void 0 : _b.get("export=")) == null ? void 0 : _c.valueDeclaration) == null ? void 0 : _d.expression;
42548
- if (!exportAssignment)
42549
- return;
42550
- const exportSymbol = checker.getSymbolAtLocation(exportAssignment);
42551
- if (!exportSymbol)
42552
- return;
42553
- const originalExportSymbol = (exportSymbol == null ? void 0 : exportSymbol.flags) & 2097152 /* Alias */ ? checker.getAliasedSymbol(exportSymbol) : exportSymbol;
42554
- if (originalExportSymbol === d.symbol)
42555
- return topNamespace.parent.parent;
42556
- function getTopNamespace(namespaceDeclaration) {
42557
- while (namespaceDeclaration.flags & 8 /* NestedNamespace */) {
42558
- namespaceDeclaration = namespaceDeclaration.parent;
42559
- }
42560
- return namespaceDeclaration;
42551
+ const ambientModuleDeclareCandidates = mapDefined(moduleSymbol.declarations, (d) => {
42552
+ var _a2, _b, _c, _d;
42553
+ if (!isModuleDeclaration(d))
42554
+ return;
42555
+ const topNamespace = getTopNamespace(d);
42556
+ if (!(((_a2 = topNamespace == null ? void 0 : topNamespace.parent) == null ? void 0 : _a2.parent) && isModuleBlock(topNamespace.parent) && isAmbientModule(topNamespace.parent.parent) && isSourceFile(topNamespace.parent.parent.parent)))
42557
+ return;
42558
+ const exportAssignment = (_d = (_c = (_b = topNamespace.parent.parent.symbol.exports) == null ? void 0 : _b.get("export=")) == null ? void 0 : _c.valueDeclaration) == null ? void 0 : _d.expression;
42559
+ if (!exportAssignment)
42560
+ return;
42561
+ const exportSymbol = checker.getSymbolAtLocation(exportAssignment);
42562
+ if (!exportSymbol)
42563
+ return;
42564
+ const originalExportSymbol = (exportSymbol == null ? void 0 : exportSymbol.flags) & 2097152 /* Alias */ ? checker.getAliasedSymbol(exportSymbol) : exportSymbol;
42565
+ if (originalExportSymbol === d.symbol)
42566
+ return topNamespace.parent.parent;
42567
+ function getTopNamespace(namespaceDeclaration) {
42568
+ while (namespaceDeclaration.flags & 8 /* NestedNamespace */) {
42569
+ namespaceDeclaration = namespaceDeclaration.parent;
42561
42570
  }
42571
+ return namespaceDeclaration;
42562
42572
  }
42563
- );
42573
+ });
42564
42574
  const ambientModuleDeclare = ambientModuleDeclareCandidates[0];
42565
42575
  if (ambientModuleDeclare) {
42566
42576
  return ambientModuleDeclare.name.text;
@@ -45248,10 +45258,7 @@ function createTypeChecker(host) {
45248
45258
  diagnosticMessage = error(errorLocation, Diagnostics.Enum_0_used_before_its_declaration, declarationName);
45249
45259
  }
45250
45260
  if (diagnosticMessage) {
45251
- addRelatedInfo(
45252
- diagnosticMessage,
45253
- createDiagnosticForNode(declaration, Diagnostics._0_is_declared_here, declarationName)
45254
- );
45261
+ addRelatedInfo(diagnosticMessage, createDiagnosticForNode(declaration, Diagnostics._0_is_declared_here, declarationName));
45255
45262
  }
45256
45263
  }
45257
45264
  }
@@ -45427,11 +45434,14 @@ function createTypeChecker(host) {
45427
45434
  const exportAssignment = exportEqualsSymbol.valueDeclaration;
45428
45435
  const err = error(node.name, Diagnostics.Module_0_can_only_be_default_imported_using_the_1_flag, symbolToString(moduleSymbol), compilerOptionName);
45429
45436
  if (exportAssignment) {
45430
- addRelatedInfo(err, createDiagnosticForNode(
45431
- exportAssignment,
45432
- Diagnostics.This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag,
45433
- compilerOptionName
45434
- ));
45437
+ addRelatedInfo(
45438
+ err,
45439
+ createDiagnosticForNode(
45440
+ exportAssignment,
45441
+ Diagnostics.This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag,
45442
+ compilerOptionName
45443
+ )
45444
+ );
45435
45445
  }
45436
45446
  } else if (isImportClause(node)) {
45437
45447
  reportNonDefaultExport(moduleSymbol, node);
@@ -45488,10 +45498,12 @@ function createTypeChecker(host) {
45488
45498
  const diagnostic = error(node.name, Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol));
45489
45499
  const exportStar = (_b = moduleSymbol.exports) == null ? void 0 : _b.get("__export" /* ExportStar */);
45490
45500
  if (exportStar) {
45491
- const defaultExport = (_c = exportStar.declarations) == null ? void 0 : _c.find((decl) => {
45492
- var _a2, _b2;
45493
- return !!(isExportDeclaration(decl) && decl.moduleSpecifier && ((_b2 = (_a2 = resolveExternalModuleName(decl, decl.moduleSpecifier)) == null ? void 0 : _a2.exports) == null ? void 0 : _b2.has("default" /* Default */)));
45494
- });
45501
+ const defaultExport = (_c = exportStar.declarations) == null ? void 0 : _c.find(
45502
+ (decl) => {
45503
+ var _a2, _b2;
45504
+ return !!(isExportDeclaration(decl) && decl.moduleSpecifier && ((_b2 = (_a2 = resolveExternalModuleName(decl, decl.moduleSpecifier)) == null ? void 0 : _a2.exports) == null ? void 0 : _b2.has("default" /* Default */)));
45505
+ }
45506
+ );
45495
45507
  if (defaultExport) {
45496
45508
  addRelatedInfo(diagnostic, createDiagnosticForNode(defaultExport, Diagnostics.export_Asterisk_does_not_re_export_a_default));
45497
45509
  }
@@ -45638,10 +45650,7 @@ function createTypeChecker(host) {
45638
45650
  const suggestionName = symbolToString(suggestion);
45639
45651
  const diagnostic = error(name, Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, moduleName, declarationName, suggestionName);
45640
45652
  if (suggestion.valueDeclaration) {
45641
- addRelatedInfo(
45642
- diagnostic,
45643
- createDiagnosticForNode(suggestion.valueDeclaration, Diagnostics._0_is_declared_here, suggestionName)
45644
- );
45653
+ addRelatedInfo(diagnostic, createDiagnosticForNode(suggestion.valueDeclaration, Diagnostics._0_is_declared_here, suggestionName));
45645
45654
  }
45646
45655
  } else {
45647
45656
  if ((_a = moduleSymbol.exports) == null ? void 0 : _a.has("default" /* Default */)) {
@@ -45668,10 +45677,7 @@ function createTypeChecker(host) {
45668
45677
  const exportedSymbol = exports ? find(symbolsToArray(exports), (symbol) => !!getSymbolIfSameReference(symbol, localSymbol)) : void 0;
45669
45678
  const diagnostic = exportedSymbol ? error(name, Diagnostics.Module_0_declares_1_locally_but_it_is_exported_as_2, moduleName, declarationName, symbolToString(exportedSymbol)) : error(name, Diagnostics.Module_0_declares_1_locally_but_it_is_not_exported, moduleName, declarationName);
45670
45679
  if (localSymbol.declarations) {
45671
- addRelatedInfo(
45672
- diagnostic,
45673
- ...map(localSymbol.declarations, (decl, index) => createDiagnosticForNode(decl, index === 0 ? Diagnostics._0_is_declared_here : Diagnostics.and_here, declarationName))
45674
- );
45680
+ addRelatedInfo(diagnostic, ...map(localSymbol.declarations, (decl, index) => createDiagnosticForNode(decl, index === 0 ? Diagnostics._0_is_declared_here : Diagnostics.and_here, declarationName)));
45675
45681
  }
45676
45682
  }
45677
45683
  } else {
@@ -46336,11 +46342,15 @@ function createTypeChecker(host) {
46336
46342
  }
46337
46343
  }
46338
46344
  }
46339
- diagnostics.add(createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(errorNode), errorNode, chainDiagnosticMessages(
46340
- diagnosticDetails,
46341
- Diagnostics.The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_referenced_file_is_an_ECMAScript_module_and_cannot_be_imported_with_require_Consider_writing_a_dynamic_import_0_call_instead,
46342
- moduleReference
46343
- )));
46345
+ diagnostics.add(createDiagnosticForNodeFromMessageChain(
46346
+ getSourceFileOfNode(errorNode),
46347
+ errorNode,
46348
+ chainDiagnosticMessages(
46349
+ diagnosticDetails,
46350
+ Diagnostics.The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_referenced_file_is_an_ECMAScript_module_and_cannot_be_imported_with_require_Consider_writing_a_dynamic_import_0_call_instead,
46351
+ moduleReference
46352
+ )
46353
+ ));
46344
46354
  }
46345
46355
  }
46346
46356
  }
@@ -46397,13 +46407,9 @@ function createTypeChecker(host) {
46397
46407
  const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
46398
46408
  const suggestedExt = (_j = suggestedExtensions.find(([actualExt, _importExt]) => host.fileExists(absoluteRef + actualExt))) == null ? void 0 : _j[1];
46399
46409
  if (suggestedExt) {
46400
- error(
46401
- errorNode,
46402
- Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0,
46403
- moduleReference + suggestedExt
46404
- );
46410
+ error(errorNode, Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0, moduleReference + suggestedExt);
46405
46411
  } else {
46406
- error(errorNode, Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Consider_adding_an_extension_to_the_import_path);
46412
+ error(errorNode, Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Consider_adding_an_extension_to_the_import_path);
46407
46413
  }
46408
46414
  } else {
46409
46415
  error(errorNode, moduleNotFoundError, moduleReference);
@@ -46426,12 +46432,16 @@ function createTypeChecker(host) {
46426
46432
  if (!isExternalModuleNameRelative(moduleReference) && packageId) {
46427
46433
  errorInfo = createModuleNotFoundChain(sourceFile, host, moduleReference, mode, packageId.name);
46428
46434
  }
46429
- errorOrSuggestion(isError, errorNode, chainDiagnosticMessages(
46430
- errorInfo,
46431
- Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type,
46432
- moduleReference,
46433
- resolvedFileName
46434
- ));
46435
+ errorOrSuggestion(
46436
+ isError,
46437
+ errorNode,
46438
+ chainDiagnosticMessages(
46439
+ errorInfo,
46440
+ Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type,
46441
+ moduleReference,
46442
+ resolvedFileName
46443
+ )
46444
+ );
46435
46445
  }
46436
46446
  function resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) {
46437
46447
  if (moduleSymbol == null ? void 0 : moduleSymbol.exports) {
@@ -46668,10 +46678,12 @@ function createTypeChecker(host) {
46668
46678
  }
46669
46679
  if (exportStar == null ? void 0 : exportStar.isTypeOnly) {
46670
46680
  typeOnlyExportStarMap ?? (typeOnlyExportStarMap = /* @__PURE__ */ new Map());
46671
- symbols.forEach((_, escapedName) => typeOnlyExportStarMap.set(
46672
- escapedName,
46673
- exportStar
46674
- ));
46681
+ symbols.forEach(
46682
+ (_, escapedName) => typeOnlyExportStarMap.set(
46683
+ escapedName,
46684
+ exportStar
46685
+ )
46686
+ );
46675
46687
  }
46676
46688
  return symbols;
46677
46689
  }
@@ -46907,13 +46919,7 @@ function createTypeChecker(host) {
46907
46919
  return resolved;
46908
46920
  }
46909
46921
  function createAnonymousType(symbol, members, callSignatures, constructSignatures, indexInfos) {
46910
- return setStructuredTypeMembers(
46911
- createObjectType(16 /* Anonymous */, symbol),
46912
- members,
46913
- callSignatures,
46914
- constructSignatures,
46915
- indexInfos
46916
- );
46922
+ return setStructuredTypeMembers(createObjectType(16 /* Anonymous */, symbol), members, callSignatures, constructSignatures, indexInfos);
46917
46923
  }
46918
46924
  function getResolvedTypeWithoutAbstractConstructSignatures(type) {
46919
46925
  if (type.constructSignatures.length === 0)
@@ -48143,11 +48149,7 @@ function createTypeChecker(host) {
48143
48149
  }
48144
48150
  } else {
48145
48151
  if (typeArguments !== getIdentifierTypeArguments(qualifier.right)) {
48146
- qualifier = factory.updateQualifiedName(
48147
- qualifier,
48148
- qualifier.left,
48149
- setIdentifierTypeArguments(factory.cloneNode(qualifier.right), typeArguments)
48150
- );
48152
+ qualifier = factory.updateQualifiedName(qualifier, qualifier.left, setIdentifierTypeArguments(factory.cloneNode(qualifier.right), typeArguments));
48151
48153
  }
48152
48154
  }
48153
48155
  }
@@ -48173,11 +48175,7 @@ function createTypeChecker(host) {
48173
48175
  }
48174
48176
  } else {
48175
48177
  if (typeArguments !== getIdentifierTypeArguments(typeName.right)) {
48176
- typeName = factory.updateQualifiedName(
48177
- typeName,
48178
- typeName.left,
48179
- setIdentifierTypeArguments(factory.cloneNode(typeName.right), typeArguments)
48180
- );
48178
+ typeName = factory.updateQualifiedName(typeName, typeName.left, setIdentifierTypeArguments(factory.cloneNode(typeName.right), typeArguments));
48181
48179
  }
48182
48180
  }
48183
48181
  typeArguments = ref.typeArguments;
@@ -48734,7 +48732,9 @@ function createTypeChecker(host) {
48734
48732
  if (!accessibleSymbolChain || needsQualification(accessibleSymbolChain[0], context.enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning2 : getQualifiedLeftMeaning(meaning2))) {
48735
48733
  const parents = getContainersOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol2, context.enclosingDeclaration, meaning2);
48736
48734
  if (length(parents)) {
48737
- parentSpecifiers = parents.map((symbol3) => some(symbol3.declarations, hasNonGlobalAugmentationExternalModuleSymbol) ? getSpecifierForModuleSymbol(symbol3, context) : void 0);
48735
+ parentSpecifiers = parents.map(
48736
+ (symbol3) => some(symbol3.declarations, hasNonGlobalAugmentationExternalModuleSymbol) ? getSpecifierForModuleSymbol(symbol3, context) : void 0
48737
+ );
48738
48738
  const indices = parents.map((_, i) => i);
48739
48739
  indices.sort(sortByBestName);
48740
48740
  const sortedParents = indices.map((i) => parents[i]);
@@ -49151,7 +49151,14 @@ function createTypeChecker(host) {
49151
49151
  }
49152
49152
  function isStringNamed(d) {
49153
49153
  const name = getNameOfDeclaration(d);
49154
- return !!name && isStringLiteral(name);
49154
+ if (!name) {
49155
+ return false;
49156
+ }
49157
+ if (isComputedPropertyName(name)) {
49158
+ const type = checkExpression(name.expression);
49159
+ return !!(type.flags & 402653316 /* StringLike */);
49160
+ }
49161
+ return isStringLiteral(name);
49155
49162
  }
49156
49163
  function isSingleQuotedStringNamed(d) {
49157
49164
  const name = getNameOfDeclaration(d);
@@ -49508,7 +49515,11 @@ function createTypeChecker(host) {
49508
49515
  if (accessibleResult.accessibility === 0 /* Accessible */) {
49509
49516
  const chain = lookupSymbolChainWorker(sym, context, meaning);
49510
49517
  if (!(sym.flags & 4 /* Property */)) {
49511
- includePrivateSymbol(chain[0]);
49518
+ const root = chain[0];
49519
+ const contextFile = getSourceFileOfNode(oldcontext.enclosingDeclaration);
49520
+ if (some(root.declarations, (d) => getSourceFileOfNode(d) === contextFile)) {
49521
+ includePrivateSymbol(root);
49522
+ }
49512
49523
  }
49513
49524
  } else if ((_a = oldcontext.tracker.inner) == null ? void 0 : _a.trackSymbol) {
49514
49525
  return oldcontext.tracker.inner.trackSymbol(sym, decl, meaning);
@@ -49553,21 +49564,24 @@ function createTypeChecker(host) {
49553
49564
  ns.name,
49554
49565
  body = factory.updateModuleBlock(
49555
49566
  body,
49556
- factory.createNodeArray([...ns.body.statements, factory.createExportDeclaration(
49557
- /*modifiers*/
49558
- void 0,
49559
- /*isTypeOnly*/
49560
- false,
49561
- factory.createNamedExports(map(flatMap(excessExports, (e) => getNamesOfDeclaration(e)), (id) => factory.createExportSpecifier(
49567
+ factory.createNodeArray([
49568
+ ...ns.body.statements,
49569
+ factory.createExportDeclaration(
49570
+ /*modifiers*/
49571
+ void 0,
49562
49572
  /*isTypeOnly*/
49563
49573
  false,
49564
- /*propertyName*/
49565
- void 0,
49566
- id
49567
- ))),
49568
- /*moduleSpecifier*/
49569
- void 0
49570
- )])
49574
+ factory.createNamedExports(map(flatMap(excessExports, (e) => getNamesOfDeclaration(e)), (id) => factory.createExportSpecifier(
49575
+ /*isTypeOnly*/
49576
+ false,
49577
+ /*propertyName*/
49578
+ void 0,
49579
+ id
49580
+ ))),
49581
+ /*moduleSpecifier*/
49582
+ void 0
49583
+ )
49584
+ ])
49571
49585
  )
49572
49586
  );
49573
49587
  statements = [...statements.slice(0, nsIndex), ns, ...statements.slice(nsIndex + 1)];
@@ -49587,15 +49601,18 @@ function createTypeChecker(host) {
49587
49601
  const exports = filter(statements, (d) => isExportDeclaration(d) && !d.moduleSpecifier && !!d.exportClause && isNamedExports(d.exportClause));
49588
49602
  if (length(exports) > 1) {
49589
49603
  const nonExports = filter(statements, (d) => !isExportDeclaration(d) || !!d.moduleSpecifier || !d.exportClause);
49590
- statements = [...nonExports, factory.createExportDeclaration(
49591
- /*modifiers*/
49592
- void 0,
49593
- /*isTypeOnly*/
49594
- false,
49595
- factory.createNamedExports(flatMap(exports, (e) => cast(e.exportClause, isNamedExports).elements)),
49596
- /*moduleSpecifier*/
49597
- void 0
49598
- )];
49604
+ statements = [
49605
+ ...nonExports,
49606
+ factory.createExportDeclaration(
49607
+ /*modifiers*/
49608
+ void 0,
49609
+ /*isTypeOnly*/
49610
+ false,
49611
+ factory.createNamedExports(flatMap(exports, (e) => cast(e.exportClause, isNamedExports).elements)),
49612
+ /*moduleSpecifier*/
49613
+ void 0
49614
+ )
49615
+ ];
49599
49616
  }
49600
49617
  const reexports = filter(statements, (d) => isExportDeclaration(d) && !!d.moduleSpecifier && !!d.exportClause && isNamedExports(d.exportClause));
49601
49618
  if (length(reexports) > 1) {
@@ -49774,18 +49791,21 @@ function createTypeChecker(host) {
49774
49791
  );
49775
49792
  context.tracker.trackSymbol(type.symbol, context.enclosingDeclaration, 111551 /* Value */);
49776
49793
  } else {
49777
- const statement = setTextRange(factory.createVariableStatement(
49778
- /*modifiers*/
49779
- void 0,
49780
- factory.createVariableDeclarationList([
49781
- factory.createVariableDeclaration(
49782
- name,
49783
- /*exclamationToken*/
49784
- void 0,
49785
- serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled)
49786
- )
49787
- ], flags)
49788
- ), textRange);
49794
+ const statement = setTextRange(
49795
+ factory.createVariableStatement(
49796
+ /*modifiers*/
49797
+ void 0,
49798
+ factory.createVariableDeclarationList([
49799
+ factory.createVariableDeclaration(
49800
+ name,
49801
+ /*exclamationToken*/
49802
+ void 0,
49803
+ serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled)
49804
+ )
49805
+ ], flags)
49806
+ ),
49807
+ textRange
49808
+ );
49789
49809
  addResult(statement, name !== localName ? modifierFlags & ~1 /* Export */ : modifierFlags);
49790
49810
  if (name !== localName && !isPrivate) {
49791
49811
  addResult(
@@ -49859,18 +49879,21 @@ function createTypeChecker(host) {
49859
49879
  factory.createIdentifier(getInternalSymbolName(symbol, symbolName2))
49860
49880
  ), 0 /* None */);
49861
49881
  } else if (needsExportDeclaration) {
49862
- addResult(factory.createExportDeclaration(
49863
- /*modifiers*/
49864
- void 0,
49865
- /*isTypeOnly*/
49866
- false,
49867
- factory.createNamedExports([factory.createExportSpecifier(
49882
+ addResult(
49883
+ factory.createExportDeclaration(
49884
+ /*modifiers*/
49885
+ void 0,
49868
49886
  /*isTypeOnly*/
49869
49887
  false,
49870
- getInternalSymbolName(symbol, symbolName2),
49871
- symbolName2
49872
- )])
49873
- ), 0 /* None */);
49888
+ factory.createNamedExports([factory.createExportSpecifier(
49889
+ /*isTypeOnly*/
49890
+ false,
49891
+ getInternalSymbolName(symbol, symbolName2),
49892
+ symbolName2
49893
+ )])
49894
+ ),
49895
+ 0 /* None */
49896
+ );
49874
49897
  }
49875
49898
  }
49876
49899
  function includePrivateSymbol(symbol) {
@@ -49878,10 +49901,7 @@ function createTypeChecker(host) {
49878
49901
  return;
49879
49902
  Debug.assertIsDefined(deferredPrivatesStack[deferredPrivatesStack.length - 1]);
49880
49903
  getUnusedName(unescapeLeadingUnderscores(symbol.escapedName), symbol);
49881
- const isExternalImportAlias = !!(symbol.flags & 2097152 /* Alias */) && !some(
49882
- symbol.declarations,
49883
- (d) => !!findAncestor(d, isExportDeclaration) || isNamespaceExport(d) || isImportEqualsDeclaration(d) && !isExternalModuleReference(d.moduleReference)
49884
- );
49904
+ const isExternalImportAlias = !!(symbol.flags & 2097152 /* Alias */) && !some(symbol.declarations, (d) => !!findAncestor(d, isExportDeclaration) || isNamespaceExport(d) || isImportEqualsDeclaration(d) && !isExternalModuleReference(d.moduleReference));
49885
49905
  deferredPrivatesStack[isExternalImportAlias ? 0 : deferredPrivatesStack.length - 1].set(getSymbolId(symbol), symbol);
49886
49906
  }
49887
49907
  function isExportingScope(enclosingDeclaration2) {
@@ -49918,16 +49938,19 @@ function createTypeChecker(host) {
49918
49938
  const oldEnclosingDecl = context.enclosingDeclaration;
49919
49939
  context.enclosingDeclaration = jsdocAliasDecl;
49920
49940
  const typeNode = jsdocAliasDecl && jsdocAliasDecl.typeExpression && isJSDocTypeExpression(jsdocAliasDecl.typeExpression) && serializeExistingTypeNode(context, jsdocAliasDecl.typeExpression.type, includePrivateSymbol, bundled) || typeToTypeNodeHelper(aliasType, context);
49921
- addResult(setSyntheticLeadingComments(
49922
- factory.createTypeAliasDeclaration(
49923
- /*modifiers*/
49924
- void 0,
49925
- getInternalSymbolName(symbol, symbolName2),
49926
- typeParamDecls,
49927
- typeNode
49941
+ addResult(
49942
+ setSyntheticLeadingComments(
49943
+ factory.createTypeAliasDeclaration(
49944
+ /*modifiers*/
49945
+ void 0,
49946
+ getInternalSymbolName(symbol, symbolName2),
49947
+ typeParamDecls,
49948
+ typeNode
49949
+ ),
49950
+ !commentText ? [] : [{ kind: 3 /* MultiLineCommentTrivia */, text: "*\n * " + commentText.replace(/\n/g, "\n * ") + "\n ", pos: -1, end: -1, hasTrailingNewLine: true }]
49928
49951
  ),
49929
- !commentText ? [] : [{ kind: 3 /* MultiLineCommentTrivia */, text: "*\n * " + commentText.replace(/\n/g, "\n * ") + "\n ", pos: -1, end: -1, hasTrailingNewLine: true }]
49930
- ), modifierFlags);
49952
+ modifierFlags
49953
+ );
49931
49954
  context.flags = oldFlags;
49932
49955
  context.enclosingDeclaration = oldEnclosingDecl;
49933
49956
  }
@@ -49942,14 +49965,17 @@ function createTypeChecker(host) {
49942
49965
  const constructSignatures = serializeSignatures(1 /* Construct */, interfaceType, baseType, 180 /* ConstructSignature */);
49943
49966
  const indexSignatures = serializeIndexSignatures(interfaceType, baseType);
49944
49967
  const heritageClauses = !length(baseTypes) ? void 0 : [factory.createHeritageClause(96 /* ExtendsKeyword */, mapDefined(baseTypes, (b) => trySerializeAsTypeReference(b, 111551 /* Value */)))];
49945
- addResult(factory.createInterfaceDeclaration(
49946
- /*modifiers*/
49947
- void 0,
49948
- getInternalSymbolName(symbol, symbolName2),
49949
- typeParamDecls,
49950
- heritageClauses,
49951
- [...indexSignatures, ...constructSignatures, ...callSignatures, ...members]
49952
- ), modifierFlags);
49968
+ addResult(
49969
+ factory.createInterfaceDeclaration(
49970
+ /*modifiers*/
49971
+ void 0,
49972
+ getInternalSymbolName(symbol, symbolName2),
49973
+ typeParamDecls,
49974
+ heritageClauses,
49975
+ [...indexSignatures, ...constructSignatures, ...callSignatures, ...members]
49976
+ ),
49977
+ modifierFlags
49978
+ );
49953
49979
  }
49954
49980
  function getNamespaceMembersForSerialization(symbol) {
49955
49981
  const exports = getExportsOfSymbol(symbol);
@@ -49999,24 +50025,33 @@ function createTypeChecker(host) {
49999
50025
  );
50000
50026
  }))
50001
50027
  )]);
50002
- addResult(factory.createModuleDeclaration(
50003
- /*modifiers*/
50004
- void 0,
50005
- factory.createIdentifier(localName),
50006
- nsBody,
50007
- 32 /* Namespace */
50008
- ), 0 /* None */);
50028
+ addResult(
50029
+ factory.createModuleDeclaration(
50030
+ /*modifiers*/
50031
+ void 0,
50032
+ factory.createIdentifier(localName),
50033
+ nsBody,
50034
+ 32 /* Namespace */
50035
+ ),
50036
+ 0 /* None */
50037
+ );
50009
50038
  }
50010
50039
  }
50011
50040
  function serializeEnum(symbol, symbolName2, modifierFlags) {
50012
- addResult(factory.createEnumDeclaration(
50013
- factory.createModifiersFromModifierFlags(isConstEnumSymbol(symbol) ? 2048 /* Const */ : 0),
50014
- getInternalSymbolName(symbol, symbolName2),
50015
- map(filter(getPropertiesOfType(getTypeOfSymbol(symbol)), (p) => !!(p.flags & 8 /* EnumMember */)), (p) => {
50016
- const initializedValue = p.declarations && p.declarations[0] && isEnumMember(p.declarations[0]) ? getConstantValue2(p.declarations[0]) : void 0;
50017
- return factory.createEnumMember(unescapeLeadingUnderscores(p.escapedName), initializedValue === void 0 ? void 0 : typeof initializedValue === "string" ? factory.createStringLiteral(initializedValue) : factory.createNumericLiteral(initializedValue));
50018
- })
50019
- ), modifierFlags);
50041
+ addResult(
50042
+ factory.createEnumDeclaration(
50043
+ factory.createModifiersFromModifierFlags(isConstEnumSymbol(symbol) ? 2048 /* Const */ : 0),
50044
+ getInternalSymbolName(symbol, symbolName2),
50045
+ map(filter(getPropertiesOfType(getTypeOfSymbol(symbol)), (p) => !!(p.flags & 8 /* EnumMember */)), (p) => {
50046
+ const initializedValue = p.declarations && p.declarations[0] && isEnumMember(p.declarations[0]) ? getConstantValue2(p.declarations[0]) : void 0;
50047
+ return factory.createEnumMember(
50048
+ unescapeLeadingUnderscores(p.escapedName),
50049
+ initializedValue === void 0 ? void 0 : typeof initializedValue === "string" ? factory.createStringLiteral(initializedValue) : factory.createNumericLiteral(initializedValue)
50050
+ );
50051
+ })
50052
+ ),
50053
+ modifierFlags
50054
+ );
50020
50055
  }
50021
50056
  function serializeAsFunctionNamespaceMerge(type, symbol, localName, modifierFlags) {
50022
50057
  const signatures = getSignaturesOfType(type, 0 /* Call */);
@@ -50048,13 +50083,7 @@ function createTypeChecker(host) {
50048
50083
  }
50049
50084
  function serializeAsNamespaceDeclaration(props, localName, modifierFlags, suppressNewPrivateContext) {
50050
50085
  if (length(props)) {
50051
- const localVsRemoteMap = arrayToMultiMap(
50052
- props,
50053
- (p) => !length(p.declarations) || some(
50054
- p.declarations,
50055
- (d) => getSourceFileOfNode(d) === getSourceFileOfNode(context.enclosingDeclaration)
50056
- ) ? "local" : "remote"
50057
- );
50086
+ const localVsRemoteMap = arrayToMultiMap(props, (p) => !length(p.declarations) || some(p.declarations, (d) => getSourceFileOfNode(d) === getSourceFileOfNode(context.enclosingDeclaration)) ? "local" : "remote");
50058
50087
  const localProps = localVsRemoteMap.get("local") || emptyArray;
50059
50088
  let fakespace = parseNodeFactory.createModuleDeclaration(
50060
50089
  /*modifiers*/
@@ -50131,10 +50160,7 @@ function createTypeChecker(host) {
50131
50160
  }
50132
50161
  return cleanup(factory.createExpressionWithTypeArguments(
50133
50162
  expr,
50134
- map(
50135
- e.typeArguments,
50136
- (a) => serializeExistingTypeNode(context, a, includePrivateSymbol, bundled) || typeToTypeNodeHelper(getTypeFromTypeNode(a), context)
50137
- )
50163
+ map(e.typeArguments, (a) => serializeExistingTypeNode(context, a, includePrivateSymbol, bundled) || typeToTypeNodeHelper(getTypeFromTypeNode(a), context))
50138
50164
  ));
50139
50165
  function cleanup(result2) {
50140
50166
  context.enclosingDeclaration = oldEnclosing;
@@ -50208,14 +50234,20 @@ function createTypeChecker(host) {
50208
50234
  )] : serializeSignatures(1 /* Construct */, staticType, staticBaseType, 176 /* Constructor */);
50209
50235
  const indexSignatures = serializeIndexSignatures(classType, baseTypes[0]);
50210
50236
  context.enclosingDeclaration = oldEnclosing;
50211
- addResult(setTextRange(factory.createClassDeclaration(
50212
- /*modifiers*/
50213
- void 0,
50214
- localName,
50215
- typeParamDecls,
50216
- heritageClauses,
50217
- [...indexSignatures, ...staticMembers, ...constructors, ...publicProperties, ...privateProperties]
50218
- ), symbol.declarations && filter(symbol.declarations, (d) => isClassDeclaration(d) || isClassExpression(d))[0]), modifierFlags);
50237
+ addResult(
50238
+ setTextRange(
50239
+ factory.createClassDeclaration(
50240
+ /*modifiers*/
50241
+ void 0,
50242
+ localName,
50243
+ typeParamDecls,
50244
+ heritageClauses,
50245
+ [...indexSignatures, ...staticMembers, ...constructors, ...publicProperties, ...privateProperties]
50246
+ ),
50247
+ symbol.declarations && filter(symbol.declarations, (d) => isClassDeclaration(d) || isClassExpression(d))[0]
50248
+ ),
50249
+ modifierFlags
50250
+ );
50219
50251
  }
50220
50252
  function getSomeTargetNameFromDeclarations(declarations) {
50221
50253
  return firstDefined(declarations, (d) => {
@@ -50261,25 +50293,28 @@ function createTypeChecker(host) {
50261
50293
  if (((_b = (_a = node.parent) == null ? void 0 : _a.parent) == null ? void 0 : _b.kind) === 260 /* VariableDeclaration */) {
50262
50294
  const specifier2 = getSpecifierForModuleSymbol(target.parent || target, context);
50263
50295
  const { propertyName } = node;
50264
- addResult(factory.createImportDeclaration(
50265
- /*modifiers*/
50266
- void 0,
50267
- factory.createImportClause(
50268
- /*isTypeOnly*/
50269
- false,
50270
- /*name*/
50296
+ addResult(
50297
+ factory.createImportDeclaration(
50298
+ /*modifiers*/
50271
50299
  void 0,
50272
- factory.createNamedImports([factory.createImportSpecifier(
50300
+ factory.createImportClause(
50273
50301
  /*isTypeOnly*/
50274
50302
  false,
50275
- propertyName && isIdentifier(propertyName) ? factory.createIdentifier(idText(propertyName)) : void 0,
50276
- factory.createIdentifier(localName)
50277
- )])
50303
+ /*name*/
50304
+ void 0,
50305
+ factory.createNamedImports([factory.createImportSpecifier(
50306
+ /*isTypeOnly*/
50307
+ false,
50308
+ propertyName && isIdentifier(propertyName) ? factory.createIdentifier(idText(propertyName)) : void 0,
50309
+ factory.createIdentifier(localName)
50310
+ )])
50311
+ ),
50312
+ factory.createStringLiteral(specifier2),
50313
+ /*assertClause*/
50314
+ void 0
50278
50315
  ),
50279
- factory.createStringLiteral(specifier2),
50280
- /*assertClause*/
50281
- void 0
50282
- ), 0 /* None */);
50316
+ 0 /* None */
50317
+ );
50283
50318
  break;
50284
50319
  }
50285
50320
  Debug.failBadSyntaxKind(((_c = node.parent) == null ? void 0 : _c.parent) || node, "Unhandled binding element grandparent kind in declaration serialization");
@@ -50297,22 +50332,28 @@ function createTypeChecker(host) {
50297
50332
  const initializer = node.initializer;
50298
50333
  const uniqueName = factory.createUniqueName(localName);
50299
50334
  const specifier2 = getSpecifierForModuleSymbol(target.parent || target, context);
50300
- addResult(factory.createImportEqualsDeclaration(
50301
- /*modifiers*/
50302
- void 0,
50303
- /*isTypeOnly*/
50304
- false,
50305
- uniqueName,
50306
- factory.createExternalModuleReference(factory.createStringLiteral(specifier2))
50307
- ), 0 /* None */);
50308
- addResult(factory.createImportEqualsDeclaration(
50309
- /*modifiers*/
50310
- void 0,
50311
- /*isTypeOnly*/
50312
- false,
50313
- factory.createIdentifier(localName),
50314
- factory.createQualifiedName(uniqueName, initializer.name)
50315
- ), modifierFlags);
50335
+ addResult(
50336
+ factory.createImportEqualsDeclaration(
50337
+ /*modifiers*/
50338
+ void 0,
50339
+ /*isTypeOnly*/
50340
+ false,
50341
+ uniqueName,
50342
+ factory.createExternalModuleReference(factory.createStringLiteral(specifier2))
50343
+ ),
50344
+ 0 /* None */
50345
+ );
50346
+ addResult(
50347
+ factory.createImportEqualsDeclaration(
50348
+ /*modifiers*/
50349
+ void 0,
50350
+ /*isTypeOnly*/
50351
+ false,
50352
+ factory.createIdentifier(localName),
50353
+ factory.createQualifiedName(uniqueName, initializer.name)
50354
+ ),
50355
+ modifierFlags
50356
+ );
50316
50357
  break;
50317
50358
  }
50318
50359
  case 271 /* ImportEqualsDeclaration */:
@@ -50321,20 +50362,23 @@ function createTypeChecker(host) {
50321
50362
  break;
50322
50363
  }
50323
50364
  const isLocalImport = !(target.flags & 512 /* ValueModule */) && !isVariableDeclaration(node);
50324
- addResult(factory.createImportEqualsDeclaration(
50325
- /*modifiers*/
50326
- void 0,
50327
- /*isTypeOnly*/
50328
- false,
50329
- factory.createIdentifier(localName),
50330
- isLocalImport ? symbolToName(
50331
- target,
50332
- context,
50333
- 67108863 /* All */,
50334
- /*expectsIdentifier*/
50335
- false
50336
- ) : factory.createExternalModuleReference(factory.createStringLiteral(getSpecifierForModuleSymbol(target, context)))
50337
- ), isLocalImport ? modifierFlags : 0 /* None */);
50365
+ addResult(
50366
+ factory.createImportEqualsDeclaration(
50367
+ /*modifiers*/
50368
+ void 0,
50369
+ /*isTypeOnly*/
50370
+ false,
50371
+ factory.createIdentifier(localName),
50372
+ isLocalImport ? symbolToName(
50373
+ target,
50374
+ context,
50375
+ 67108863 /* All */,
50376
+ /*expectsIdentifier*/
50377
+ false
50378
+ ) : factory.createExternalModuleReference(factory.createStringLiteral(getSpecifierForModuleSymbol(target, context)))
50379
+ ),
50380
+ isLocalImport ? modifierFlags : 0 /* None */
50381
+ );
50338
50382
  break;
50339
50383
  case 270 /* NamespaceExportDeclaration */:
50340
50384
  addResult(factory.createNamespaceExportDeclaration(idText(node.name)), 0 /* None */);
@@ -50342,72 +50386,84 @@ function createTypeChecker(host) {
50342
50386
  case 273 /* ImportClause */: {
50343
50387
  const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
50344
50388
  const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.moduleSpecifier;
50345
- addResult(factory.createImportDeclaration(
50346
- /*modifiers*/
50347
- void 0,
50348
- factory.createImportClause(
50349
- /*isTypeOnly*/
50350
- false,
50351
- factory.createIdentifier(localName),
50352
- /*namedBindings*/
50353
- void 0
50389
+ addResult(
50390
+ factory.createImportDeclaration(
50391
+ /*modifiers*/
50392
+ void 0,
50393
+ factory.createImportClause(
50394
+ /*isTypeOnly*/
50395
+ false,
50396
+ factory.createIdentifier(localName),
50397
+ /*namedBindings*/
50398
+ void 0
50399
+ ),
50400
+ specifier2,
50401
+ node.parent.assertClause
50354
50402
  ),
50355
- specifier2,
50356
- node.parent.assertClause
50357
- ), 0 /* None */);
50403
+ 0 /* None */
50404
+ );
50358
50405
  break;
50359
50406
  }
50360
50407
  case 274 /* NamespaceImport */: {
50361
50408
  const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
50362
50409
  const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.moduleSpecifier;
50363
- addResult(factory.createImportDeclaration(
50364
- /*modifiers*/
50365
- void 0,
50366
- factory.createImportClause(
50367
- /*isTypeOnly*/
50368
- false,
50369
- /*name*/
50410
+ addResult(
50411
+ factory.createImportDeclaration(
50412
+ /*modifiers*/
50370
50413
  void 0,
50371
- factory.createNamespaceImport(factory.createIdentifier(localName))
50414
+ factory.createImportClause(
50415
+ /*isTypeOnly*/
50416
+ false,
50417
+ /*name*/
50418
+ void 0,
50419
+ factory.createNamespaceImport(factory.createIdentifier(localName))
50420
+ ),
50421
+ specifier2,
50422
+ node.parent.parent.assertClause
50372
50423
  ),
50373
- specifier2,
50374
- node.parent.parent.assertClause
50375
- ), 0 /* None */);
50424
+ 0 /* None */
50425
+ );
50376
50426
  break;
50377
50427
  }
50378
50428
  case 280 /* NamespaceExport */:
50379
- addResult(factory.createExportDeclaration(
50380
- /*modifiers*/
50381
- void 0,
50382
- /*isTypeOnly*/
50383
- false,
50384
- factory.createNamespaceExport(factory.createIdentifier(localName)),
50385
- factory.createStringLiteral(getSpecifierForModuleSymbol(target, context))
50386
- ), 0 /* None */);
50429
+ addResult(
50430
+ factory.createExportDeclaration(
50431
+ /*modifiers*/
50432
+ void 0,
50433
+ /*isTypeOnly*/
50434
+ false,
50435
+ factory.createNamespaceExport(factory.createIdentifier(localName)),
50436
+ factory.createStringLiteral(getSpecifierForModuleSymbol(target, context))
50437
+ ),
50438
+ 0 /* None */
50439
+ );
50387
50440
  break;
50388
50441
  case 276 /* ImportSpecifier */: {
50389
50442
  const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
50390
50443
  const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.parent.moduleSpecifier;
50391
- addResult(factory.createImportDeclaration(
50392
- /*modifiers*/
50393
- void 0,
50394
- factory.createImportClause(
50395
- /*isTypeOnly*/
50396
- false,
50397
- /*name*/
50444
+ addResult(
50445
+ factory.createImportDeclaration(
50446
+ /*modifiers*/
50398
50447
  void 0,
50399
- factory.createNamedImports([
50400
- factory.createImportSpecifier(
50401
- /*isTypeOnly*/
50402
- false,
50403
- localName !== verbatimTargetName ? factory.createIdentifier(verbatimTargetName) : void 0,
50404
- factory.createIdentifier(localName)
50405
- )
50406
- ])
50448
+ factory.createImportClause(
50449
+ /*isTypeOnly*/
50450
+ false,
50451
+ /*name*/
50452
+ void 0,
50453
+ factory.createNamedImports([
50454
+ factory.createImportSpecifier(
50455
+ /*isTypeOnly*/
50456
+ false,
50457
+ localName !== verbatimTargetName ? factory.createIdentifier(verbatimTargetName) : void 0,
50458
+ factory.createIdentifier(localName)
50459
+ )
50460
+ ])
50461
+ ),
50462
+ specifier2,
50463
+ node.parent.parent.parent.assertClause
50407
50464
  ),
50408
- specifier2,
50409
- node.parent.parent.parent.assertClause
50410
- ), 0 /* None */);
50465
+ 0 /* None */
50466
+ );
50411
50467
  break;
50412
50468
  }
50413
50469
  case 281 /* ExportSpecifier */:
@@ -50435,19 +50491,22 @@ function createTypeChecker(host) {
50435
50491
  }
50436
50492
  }
50437
50493
  function serializeExportSpecifier(localName, targetName, specifier) {
50438
- addResult(factory.createExportDeclaration(
50439
- /*modifiers*/
50440
- void 0,
50441
- /*isTypeOnly*/
50442
- false,
50443
- factory.createNamedExports([factory.createExportSpecifier(
50494
+ addResult(
50495
+ factory.createExportDeclaration(
50496
+ /*modifiers*/
50497
+ void 0,
50444
50498
  /*isTypeOnly*/
50445
50499
  false,
50446
- localName !== targetName ? targetName : void 0,
50447
- localName
50448
- )]),
50449
- specifier
50450
- ), 0 /* None */);
50500
+ factory.createNamedExports([factory.createExportSpecifier(
50501
+ /*isTypeOnly*/
50502
+ false,
50503
+ localName !== targetName ? targetName : void 0,
50504
+ localName
50505
+ )]),
50506
+ specifier
50507
+ ),
50508
+ 0 /* None */
50509
+ );
50451
50510
  }
50452
50511
  function serializeMaybeAliasAssignment(symbol) {
50453
50512
  var _a;
@@ -50495,20 +50554,23 @@ function createTypeChecker(host) {
50495
50554
  serializeExportSpecifier(name, getInternalSymbolName(target, symbolName(target)));
50496
50555
  } else {
50497
50556
  const varName = getUnusedName(name, symbol);
50498
- addResult(factory.createImportEqualsDeclaration(
50499
- /*modifiers*/
50500
- void 0,
50501
- /*isTypeOnly*/
50502
- false,
50503
- factory.createIdentifier(varName),
50504
- symbolToName(
50505
- target,
50506
- context,
50507
- 67108863 /* All */,
50508
- /*expectsIdentifier*/
50509
- false
50510
- )
50511
- ), 0 /* None */);
50557
+ addResult(
50558
+ factory.createImportEqualsDeclaration(
50559
+ /*modifiers*/
50560
+ void 0,
50561
+ /*isTypeOnly*/
50562
+ false,
50563
+ factory.createIdentifier(varName),
50564
+ symbolToName(
50565
+ target,
50566
+ context,
50567
+ 67108863 /* All */,
50568
+ /*expectsIdentifier*/
50569
+ false
50570
+ )
50571
+ ),
50572
+ 0 /* None */
50573
+ );
50512
50574
  serializeExportSpecifier(name, varName);
50513
50575
  }
50514
50576
  }
@@ -50575,60 +50637,72 @@ function createTypeChecker(host) {
50575
50637
  if (p.flags & 98304 /* Accessor */ && useAccessors) {
50576
50638
  const result = [];
50577
50639
  if (p.flags & 65536 /* SetAccessor */) {
50578
- result.push(setTextRange(factory.createSetAccessorDeclaration(
50579
- factory.createModifiersFromModifierFlags(flag),
50580
- name,
50581
- [factory.createParameterDeclaration(
50582
- /*modifiers*/
50583
- void 0,
50584
- /*dotDotDotToken*/
50585
- void 0,
50586
- "arg",
50587
- /*questionToken*/
50588
- void 0,
50589
- isPrivate ? void 0 : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled)
50590
- )],
50591
- /*body*/
50592
- void 0
50593
- ), ((_b = p.declarations) == null ? void 0 : _b.find(isSetAccessor)) || firstPropertyLikeDecl));
50640
+ result.push(setTextRange(
50641
+ factory.createSetAccessorDeclaration(
50642
+ factory.createModifiersFromModifierFlags(flag),
50643
+ name,
50644
+ [factory.createParameterDeclaration(
50645
+ /*modifiers*/
50646
+ void 0,
50647
+ /*dotDotDotToken*/
50648
+ void 0,
50649
+ "arg",
50650
+ /*questionToken*/
50651
+ void 0,
50652
+ isPrivate ? void 0 : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled)
50653
+ )],
50654
+ /*body*/
50655
+ void 0
50656
+ ),
50657
+ ((_b = p.declarations) == null ? void 0 : _b.find(isSetAccessor)) || firstPropertyLikeDecl
50658
+ ));
50594
50659
  }
50595
50660
  if (p.flags & 32768 /* GetAccessor */) {
50596
50661
  const isPrivate2 = modifierFlags & 8 /* Private */;
50597
- result.push(setTextRange(factory.createGetAccessorDeclaration(
50598
- factory.createModifiersFromModifierFlags(flag),
50599
- name,
50600
- [],
50601
- isPrivate2 ? void 0 : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled),
50602
- /*body*/
50603
- void 0
50604
- ), ((_c = p.declarations) == null ? void 0 : _c.find(isGetAccessor)) || firstPropertyLikeDecl));
50662
+ result.push(setTextRange(
50663
+ factory.createGetAccessorDeclaration(
50664
+ factory.createModifiersFromModifierFlags(flag),
50665
+ name,
50666
+ [],
50667
+ isPrivate2 ? void 0 : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled),
50668
+ /*body*/
50669
+ void 0
50670
+ ),
50671
+ ((_c = p.declarations) == null ? void 0 : _c.find(isGetAccessor)) || firstPropertyLikeDecl
50672
+ ));
50605
50673
  }
50606
50674
  return result;
50607
50675
  } else if (p.flags & (4 /* Property */ | 3 /* Variable */ | 98304 /* Accessor */)) {
50608
- return setTextRange(createProperty2(
50609
- factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 64 /* Readonly */ : 0) | flag),
50610
- name,
50611
- p.flags & 16777216 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0,
50612
- isPrivate ? void 0 : serializeTypeForDeclaration(context, getWriteTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled),
50613
- // TODO: https://github.com/microsoft/TypeScript/pull/32372#discussion_r328386357
50614
- // interface members can't have initializers, however class members _can_
50615
- /*initializer*/
50616
- void 0
50617
- ), ((_d = p.declarations) == null ? void 0 : _d.find(or(isPropertyDeclaration, isVariableDeclaration))) || firstPropertyLikeDecl);
50618
- }
50619
- if (p.flags & (8192 /* Method */ | 16 /* Function */)) {
50620
- const type = getTypeOfSymbol(p);
50621
- const signatures = getSignaturesOfType(type, 0 /* Call */);
50622
- if (flag & 8 /* Private */) {
50623
- return setTextRange(createProperty2(
50676
+ return setTextRange(
50677
+ createProperty2(
50624
50678
  factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 64 /* Readonly */ : 0) | flag),
50625
50679
  name,
50626
50680
  p.flags & 16777216 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0,
50627
- /*type*/
50628
- void 0,
50681
+ isPrivate ? void 0 : serializeTypeForDeclaration(context, getWriteTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled),
50682
+ // TODO: https://github.com/microsoft/TypeScript/pull/32372#discussion_r328386357
50683
+ // interface members can't have initializers, however class members _can_
50629
50684
  /*initializer*/
50630
50685
  void 0
50631
- ), ((_e = p.declarations) == null ? void 0 : _e.find(isFunctionLikeDeclaration)) || signatures[0] && signatures[0].declaration || p.declarations && p.declarations[0]);
50686
+ ),
50687
+ ((_d = p.declarations) == null ? void 0 : _d.find(or(isPropertyDeclaration, isVariableDeclaration))) || firstPropertyLikeDecl
50688
+ );
50689
+ }
50690
+ if (p.flags & (8192 /* Method */ | 16 /* Function */)) {
50691
+ const type = getTypeOfSymbol(p);
50692
+ const signatures = getSignaturesOfType(type, 0 /* Call */);
50693
+ if (flag & 8 /* Private */) {
50694
+ return setTextRange(
50695
+ createProperty2(
50696
+ factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 64 /* Readonly */ : 0) | flag),
50697
+ name,
50698
+ p.flags & 16777216 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0,
50699
+ /*type*/
50700
+ void 0,
50701
+ /*initializer*/
50702
+ void 0
50703
+ ),
50704
+ ((_e = p.declarations) == null ? void 0 : _e.find(isFunctionLikeDeclaration)) || signatures[0] && signatures[0].declaration || p.declarations && p.declarations[0]
50705
+ );
50632
50706
  }
50633
50707
  const results2 = [];
50634
50708
  for (const sig of signatures) {
@@ -50699,13 +50773,16 @@ function createTypeChecker(host) {
50699
50773
  }
50700
50774
  }
50701
50775
  if (privateProtected) {
50702
- return [setTextRange(factory.createConstructorDeclaration(
50703
- factory.createModifiersFromModifierFlags(privateProtected),
50704
- /*parameters*/
50705
- [],
50706
- /*body*/
50707
- void 0
50708
- ), signatures[0].declaration)];
50776
+ return [setTextRange(
50777
+ factory.createConstructorDeclaration(
50778
+ factory.createModifiersFromModifierFlags(privateProtected),
50779
+ /*parameters*/
50780
+ [],
50781
+ /*body*/
50782
+ void 0
50783
+ ),
50784
+ signatures[0].declaration
50785
+ )];
50709
50786
  }
50710
50787
  }
50711
50788
  const results2 = [];
@@ -52243,19 +52320,11 @@ function createTypeChecker(host) {
52243
52320
  function reportCircularityError(symbol) {
52244
52321
  const declaration = symbol.valueDeclaration;
52245
52322
  if (getEffectiveTypeAnnotationNode(declaration)) {
52246
- error(
52247
- symbol.valueDeclaration,
52248
- Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation,
52249
- symbolToString(symbol)
52250
- );
52323
+ error(symbol.valueDeclaration, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));
52251
52324
  return errorType;
52252
52325
  }
52253
52326
  if (noImplicitAny && (declaration.kind !== 169 /* Parameter */ || declaration.initializer)) {
52254
- error(
52255
- symbol.valueDeclaration,
52256
- Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer,
52257
- symbolToString(symbol)
52258
- );
52327
+ error(symbol.valueDeclaration, Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol));
52259
52328
  }
52260
52329
  return anyType;
52261
52330
  }
@@ -52283,7 +52352,7 @@ function createTypeChecker(host) {
52283
52352
  return checkFlags & 2 /* SyntheticProperty */ ? checkFlags & 65536 /* DeferredType */ ? getWriteTypeOfSymbolWithDeferredType(symbol) || getTypeOfSymbolWithDeferredType(symbol) : (
52284
52353
  // NOTE: cast to TransientSymbol should be safe because only TransientSymbols can have CheckFlags.SyntheticProperty
52285
52354
  symbol.links.writeType || symbol.links.type
52286
- ) : getTypeOfSymbol(symbol);
52355
+ ) : removeMissingType(getTypeOfSymbol(symbol), !!(symbol.flags & 16777216 /* Optional */));
52287
52356
  }
52288
52357
  if (symbol.flags & 98304 /* Accessor */) {
52289
52358
  return checkFlags & 1 /* Instantiated */ ? getWriteTypeOfInstantiatedSymbol(symbol) : getWriteTypeOfAccessors(symbol);
@@ -52466,10 +52535,7 @@ function createTypeChecker(host) {
52466
52535
  function getConstructorsForTypeArguments(type, typeArgumentNodes, location) {
52467
52536
  const typeArgCount = length(typeArgumentNodes);
52468
52537
  const isJavascript = isInJSFile(location);
52469
- return filter(
52470
- getSignaturesOfType(type, 1 /* Construct */),
52471
- (sig) => (isJavascript || typeArgCount >= getMinTypeArgumentCount(sig.typeParameters)) && typeArgCount <= length(sig.typeParameters)
52472
- );
52538
+ return filter(getSignaturesOfType(type, 1 /* Construct */), (sig) => (isJavascript || typeArgCount >= getMinTypeArgumentCount(sig.typeParameters)) && typeArgCount <= length(sig.typeParameters));
52473
52539
  }
52474
52540
  function getInstantiatedConstructorsForTypeArguments(type, typeArgumentNodes, location) {
52475
52541
  const signatures = getConstructorsForTypeArguments(type, typeArgumentNodes, location);
@@ -52616,16 +52682,12 @@ function createTypeChecker(host) {
52616
52682
  return type.resolvedBaseTypes = emptyArray;
52617
52683
  }
52618
52684
  if (type === reducedBaseType || hasBaseType(reducedBaseType, type)) {
52619
- error(
52620
- type.symbol.valueDeclaration,
52621
- Diagnostics.Type_0_recursively_references_itself_as_a_base_type,
52622
- typeToString(
52623
- type,
52624
- /*enclosingDeclaration*/
52625
- void 0,
52626
- 2 /* WriteArrayAsGenericType */
52627
- )
52628
- );
52685
+ error(type.symbol.valueDeclaration, Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(
52686
+ type,
52687
+ /*enclosingDeclaration*/
52688
+ void 0,
52689
+ 2 /* WriteArrayAsGenericType */
52690
+ ));
52629
52691
  return type.resolvedBaseTypes = emptyArray;
52630
52692
  }
52631
52693
  if (type.resolvedBaseTypes === resolvingEmptyArray) {
@@ -52779,7 +52841,9 @@ function createTypeChecker(host) {
52779
52841
  if (hasBindableName(member)) {
52780
52842
  const memberSymbol = getSymbolOfDeclaration(member);
52781
52843
  const value = getEnumMemberValue(member);
52782
- const memberType = getFreshTypeOfLiteralType(value !== void 0 ? getEnumLiteralType(value, getSymbolId(symbol), memberSymbol) : createComputedEnumType(memberSymbol));
52844
+ const memberType = getFreshTypeOfLiteralType(
52845
+ value !== void 0 ? getEnumLiteralType(value, getSymbolId(symbol), memberSymbol) : createComputedEnumType(memberSymbol)
52846
+ );
52783
52847
  getSymbolLinks(memberSymbol).declaredType = memberType;
52784
52848
  memberTypeList.push(getRegularTypeOfLiteralType(memberType));
52785
52849
  }
@@ -53187,10 +53251,7 @@ function createTypeChecker(host) {
53187
53251
  return signature.optionalCallSignatureCache[key] || (signature.optionalCallSignatureCache[key] = createOptionalCallSignature(signature, callChainFlags));
53188
53252
  }
53189
53253
  function createOptionalCallSignature(signature, callChainFlags) {
53190
- Debug.assert(
53191
- callChainFlags === 8 /* IsInnerCallChain */ || callChainFlags === 16 /* IsOuterCallChain */,
53192
- "An optional call signature can either be for an inner call chain or an outer call chain, but not both."
53193
- );
53254
+ Debug.assert(callChainFlags === 8 /* IsInnerCallChain */ || callChainFlags === 16 /* IsOuterCallChain */, "An optional call signature can either be for an inner call chain or an outer call chain, but not both.");
53194
53255
  const result = cloneSignature(signature);
53195
53256
  result.flags |= callChainFlags;
53196
53257
  return result;
@@ -53477,11 +53538,7 @@ function createTypeChecker(host) {
53477
53538
  for (const info of sourceInfos) {
53478
53539
  const indexType = info.keyType;
53479
53540
  if (every(types, (t) => !!getIndexInfoOfType(t, indexType))) {
53480
- result.push(createIndexInfo(
53481
- indexType,
53482
- getUnionType(map(types, (t) => getIndexTypeOfType(t, indexType))),
53483
- some(types, (t) => getIndexInfoOfType(t, indexType).isReadonly)
53484
- ));
53541
+ result.push(createIndexInfo(indexType, getUnionType(map(types, (t) => getIndexTypeOfType(t, indexType))), some(types, (t) => getIndexInfoOfType(t, indexType).isReadonly)));
53485
53542
  }
53486
53543
  }
53487
53544
  return result;
@@ -53573,11 +53630,7 @@ function createTypeChecker(host) {
53573
53630
  for (let i = 0; i < indexInfos.length; i++) {
53574
53631
  const info = indexInfos[i];
53575
53632
  if (info.keyType === newInfo.keyType) {
53576
- indexInfos[i] = createIndexInfo(
53577
- info.keyType,
53578
- union ? getUnionType([info.type, newInfo.type]) : getIntersectionType([info.type, newInfo.type]),
53579
- union ? info.isReadonly || newInfo.isReadonly : info.isReadonly && newInfo.isReadonly
53580
- );
53633
+ indexInfos[i] = createIndexInfo(info.keyType, union ? getUnionType([info.type, newInfo.type]) : getIntersectionType([info.type, newInfo.type]), union ? info.isReadonly || newInfo.isReadonly : info.isReadonly && newInfo.isReadonly);
53581
53634
  return indexInfos;
53582
53635
  }
53583
53636
  }
@@ -53657,20 +53710,23 @@ function createTypeChecker(host) {
53657
53710
  const classType = getDeclaredTypeOfClassOrInterface(symbol);
53658
53711
  let constructSignatures = symbol.members ? getSignaturesOfSymbol(symbol.members.get("__constructor" /* Constructor */)) : emptyArray;
53659
53712
  if (symbol.flags & 16 /* Function */) {
53660
- constructSignatures = addRange(constructSignatures.slice(), mapDefined(
53661
- type.callSignatures,
53662
- (sig) => isJSConstructor(sig.declaration) ? createSignature(
53663
- sig.declaration,
53664
- sig.typeParameters,
53665
- sig.thisParameter,
53666
- sig.parameters,
53667
- classType,
53668
- /*resolvedTypePredicate*/
53669
- void 0,
53670
- sig.minArgumentCount,
53671
- sig.flags & 167 /* PropagatingFlags */
53672
- ) : void 0
53673
- ));
53713
+ constructSignatures = addRange(
53714
+ constructSignatures.slice(),
53715
+ mapDefined(
53716
+ type.callSignatures,
53717
+ (sig) => isJSConstructor(sig.declaration) ? createSignature(
53718
+ sig.declaration,
53719
+ sig.typeParameters,
53720
+ sig.thisParameter,
53721
+ sig.parameters,
53722
+ classType,
53723
+ /*resolvedTypePredicate*/
53724
+ void 0,
53725
+ sig.minArgumentCount,
53726
+ sig.flags & 167 /* PropagatingFlags */
53727
+ ) : void 0
53728
+ )
53729
+ );
53674
53730
  }
53675
53731
  if (!constructSignatures.length) {
53676
53732
  constructSignatures = getDefaultConstructSignatures(classType);
@@ -53792,11 +53848,7 @@ function createTypeChecker(host) {
53792
53848
  const isReadonly = !!(templateModifiers & 1 /* IncludeReadonly */ || !(templateModifiers & 2 /* ExcludeReadonly */) && modifiersProp && isReadonlySymbol(modifiersProp));
53793
53849
  const stripOptional = strictNullChecks && !isOptional && modifiersProp && modifiersProp.flags & 16777216 /* Optional */;
53794
53850
  const lateFlag = modifiersProp ? getIsLateCheckFlag(modifiersProp) : 0;
53795
- const prop = createSymbol(
53796
- 4 /* Property */ | (isOptional ? 16777216 /* Optional */ : 0),
53797
- propName,
53798
- lateFlag | 262144 /* Mapped */ | (isReadonly ? 8 /* Readonly */ : 0) | (stripOptional ? 524288 /* StripOptional */ : 0)
53799
- );
53851
+ const prop = createSymbol(4 /* Property */ | (isOptional ? 16777216 /* Optional */ : 0), propName, lateFlag | 262144 /* Mapped */ | (isReadonly ? 8 /* Readonly */ : 0) | (stripOptional ? 524288 /* StripOptional */ : 0));
53800
53852
  prop.links.mappedType = type;
53801
53853
  prop.links.nameType = propNameType;
53802
53854
  prop.links.keyType = keyType;
@@ -54517,31 +54569,21 @@ function createTypeChecker(host) {
54517
54569
  if (type.flags & 2097152 /* Intersection */ && getObjectFlags(type) & 33554432 /* IsNeverIntersection */) {
54518
54570
  const neverProp = find(getPropertiesOfUnionOrIntersectionType(type), isDiscriminantWithNeverType);
54519
54571
  if (neverProp) {
54520
- return chainDiagnosticMessages(
54521
- errorInfo,
54522
- Diagnostics.The_intersection_0_was_reduced_to_never_because_property_1_has_conflicting_types_in_some_constituents,
54523
- typeToString(
54524
- type,
54525
- /*enclosingDeclaration*/
54526
- void 0,
54527
- 536870912 /* NoTypeReduction */
54528
- ),
54529
- symbolToString(neverProp)
54530
- );
54572
+ return chainDiagnosticMessages(errorInfo, Diagnostics.The_intersection_0_was_reduced_to_never_because_property_1_has_conflicting_types_in_some_constituents, typeToString(
54573
+ type,
54574
+ /*enclosingDeclaration*/
54575
+ void 0,
54576
+ 536870912 /* NoTypeReduction */
54577
+ ), symbolToString(neverProp));
54531
54578
  }
54532
54579
  const privateProp = find(getPropertiesOfUnionOrIntersectionType(type), isConflictingPrivateProperty);
54533
54580
  if (privateProp) {
54534
- return chainDiagnosticMessages(
54535
- errorInfo,
54536
- Diagnostics.The_intersection_0_was_reduced_to_never_because_property_1_exists_in_multiple_constituents_and_is_private_in_some,
54537
- typeToString(
54538
- type,
54539
- /*enclosingDeclaration*/
54540
- void 0,
54541
- 536870912 /* NoTypeReduction */
54542
- ),
54543
- symbolToString(privateProp)
54544
- );
54581
+ return chainDiagnosticMessages(errorInfo, Diagnostics.The_intersection_0_was_reduced_to_never_because_property_1_exists_in_multiple_constituents_and_is_private_in_some, typeToString(
54582
+ type,
54583
+ /*enclosingDeclaration*/
54584
+ void 0,
54585
+ 536870912 /* NoTypeReduction */
54586
+ ), symbolToString(privateProp));
54545
54587
  }
54546
54588
  }
54547
54589
  return errorInfo;
@@ -54626,16 +54668,12 @@ function createTypeChecker(host) {
54626
54668
  }
54627
54669
  }
54628
54670
  }
54629
- return applicableInfos ? createIndexInfo(
54630
- unknownType,
54631
- getIntersectionType(map(applicableInfos, (info) => info.type)),
54632
- reduceLeft(
54633
- applicableInfos,
54634
- (isReadonly, info) => isReadonly && info.isReadonly,
54635
- /*initial*/
54636
- true
54637
- )
54638
- ) : applicableInfo ? applicableInfo : stringIndexInfo && isApplicableIndexType(keyType, stringType) ? stringIndexInfo : void 0;
54671
+ return applicableInfos ? createIndexInfo(unknownType, getIntersectionType(map(applicableInfos, (info) => info.type)), reduceLeft(
54672
+ applicableInfos,
54673
+ (isReadonly, info) => isReadonly && info.isReadonly,
54674
+ /*initial*/
54675
+ true
54676
+ )) : applicableInfo ? applicableInfo : stringIndexInfo && isApplicableIndexType(keyType, stringType) ? stringIndexInfo : void 0;
54639
54677
  }
54640
54678
  function isApplicableIndexType(source, target) {
54641
54679
  return isTypeAssignableTo(source, target) || target === stringType && isTypeAssignableTo(source, numberType) || target === numberType && (source === numericStringType || !!(source.flags & 128 /* StringLiteral */) && isNumericLiteralName(source.value));
@@ -54987,12 +55025,7 @@ function createTypeChecker(host) {
54987
55025
  /*parameterIndex*/
54988
55026
  void 0,
54989
55027
  type
54990
- ) : createTypePredicate(
54991
- node.assertsModifier ? 3 /* AssertsIdentifier */ : 1 /* Identifier */,
54992
- parameterName.escapedText,
54993
- findIndex(signature.parameters, (p) => p.escapedName === parameterName.escapedText),
54994
- type
54995
- );
55028
+ ) : createTypePredicate(node.assertsModifier ? 3 /* AssertsIdentifier */ : 1 /* Identifier */, parameterName.escapedText, findIndex(signature.parameters, (p) => p.escapedName === parameterName.escapedText), type);
54996
55029
  }
54997
55030
  function getUnionOrIntersectionType(types, kind, unionReduction) {
54998
55031
  return kind !== 2097152 /* Intersection */ ? getUnionType(types, unionReduction) : getIntersectionType(types);
@@ -55187,12 +55220,7 @@ function createTypeChecker(host) {
55187
55220
  if (parameter.type) {
55188
55221
  forEachType(getTypeFromTypeNode(parameter.type), (keyType) => {
55189
55222
  if (isValidIndexKeyType(keyType) && !findIndexInfo(indexInfos, keyType)) {
55190
- indexInfos.push(createIndexInfo(
55191
- keyType,
55192
- declaration.type ? getTypeFromTypeNode(declaration.type) : anyType,
55193
- hasEffectiveModifier(declaration, 64 /* Readonly */),
55194
- declaration
55195
- ));
55223
+ indexInfos.push(createIndexInfo(keyType, declaration.type ? getTypeFromTypeNode(declaration.type) : anyType, hasEffectiveModifier(declaration, 64 /* Readonly */), declaration));
55196
55224
  }
55197
55225
  });
55198
55226
  }
@@ -55223,9 +55251,12 @@ function createTypeChecker(host) {
55223
55251
  if (index < typeParameters.length) {
55224
55252
  const declaredConstraint = getConstraintOfTypeParameter(typeParameters[index]);
55225
55253
  if (declaredConstraint) {
55226
- const mapper = makeDeferredTypeMapper(typeParameters, typeParameters.map((_, index2) => () => {
55227
- return getEffectiveTypeArgumentAtIndex(typeReference, typeParameters, index2);
55228
- }));
55254
+ const mapper = makeDeferredTypeMapper(
55255
+ typeParameters,
55256
+ typeParameters.map((_, index2) => () => {
55257
+ return getEffectiveTypeArgumentAtIndex(typeReference, typeParameters, index2);
55258
+ })
55259
+ );
55229
55260
  const constraint = instantiateType(declaredConstraint, mapper);
55230
55261
  if (constraint !== typeParameter) {
55231
55262
  inferences = append(inferences, constraint);
@@ -55242,10 +55273,7 @@ function createTypeChecker(host) {
55242
55273
  } else if (grandParent.kind === 200 /* MappedType */ && grandParent.type && skipParentheses(grandParent.type) === declaration.parent && grandParent.parent.kind === 194 /* ConditionalType */ && grandParent.parent.extendsType === grandParent && grandParent.parent.checkType.kind === 200 /* MappedType */ && grandParent.parent.checkType.type) {
55243
55274
  const checkMappedType2 = grandParent.parent.checkType;
55244
55275
  const nodeType = getTypeFromTypeNode(checkMappedType2.type);
55245
- inferences = append(inferences, instantiateType(
55246
- nodeType,
55247
- makeUnaryTypeMapper(getDeclaredTypeOfTypeParameter(getSymbolOfDeclaration(checkMappedType2.typeParameter)), checkMappedType2.typeParameter.constraint ? getTypeFromTypeNode(checkMappedType2.typeParameter.constraint) : keyofConstraintType)
55248
- ));
55276
+ inferences = append(inferences, instantiateType(nodeType, makeUnaryTypeMapper(getDeclaredTypeOfTypeParameter(getSymbolOfDeclaration(checkMappedType2.typeParameter)), checkMappedType2.typeParameter.constraint ? getTypeFromTypeNode(checkMappedType2.typeParameter.constraint) : keyofConstraintType)));
55249
55277
  }
55250
55278
  }
55251
55279
  }
@@ -55420,12 +55448,7 @@ function createTypeChecker(host) {
55420
55448
  const id = getTypeListId(typeArguments) + getAliasId(aliasSymbol, aliasTypeArguments);
55421
55449
  let instantiation = links.instantiations.get(id);
55422
55450
  if (!instantiation) {
55423
- links.instantiations.set(id, instantiation = instantiateTypeWithAlias(
55424
- type,
55425
- createTypeMapper(typeParameters, fillMissingTypeArguments(typeArguments, typeParameters, getMinTypeArgumentCount(typeParameters), isInJSFile(symbol.valueDeclaration))),
55426
- aliasSymbol,
55427
- aliasTypeArguments
55428
- ));
55451
+ links.instantiations.set(id, instantiation = instantiateTypeWithAlias(type, createTypeMapper(typeParameters, fillMissingTypeArguments(typeArguments, typeParameters, getMinTypeArgumentCount(typeParameters), isInJSFile(symbol.valueDeclaration))), aliasSymbol, aliasTypeArguments));
55429
55452
  }
55430
55453
  return instantiation;
55431
55454
  }
@@ -56261,11 +56284,7 @@ function createTypeChecker(host) {
56261
56284
  const flags = elementFlags[i];
56262
56285
  combinedFlags |= flags;
56263
56286
  if (!(combinedFlags & 12 /* Variable */)) {
56264
- const property = createSymbol(
56265
- 4 /* Property */ | (flags & 2 /* Optional */ ? 16777216 /* Optional */ : 0),
56266
- "" + i,
56267
- readonly ? 8 /* Readonly */ : 0
56268
- );
56287
+ const property = createSymbol(4 /* Property */ | (flags & 2 /* Optional */ ? 16777216 /* Optional */ : 0), "" + i, readonly ? 8 /* Readonly */ : 0);
56269
56288
  property.links.tupleLabelDeclaration = namedMemberDeclarations == null ? void 0 : namedMemberDeclarations[i];
56270
56289
  property.links.type = typeParameter;
56271
56290
  properties.push(property);
@@ -56336,7 +56355,10 @@ function createTypeChecker(host) {
56336
56355
  } else if (isTupleType(type)) {
56337
56356
  const elements = getElementTypes(type);
56338
56357
  if (elements.length + expandedTypes.length >= 1e4) {
56339
- error(currentNode, isPartOfTypeNode(currentNode) ? Diagnostics.Type_produces_a_tuple_type_that_is_too_large_to_represent : Diagnostics.Expression_produces_a_tuple_type_that_is_too_large_to_represent);
56358
+ error(
56359
+ currentNode,
56360
+ isPartOfTypeNode(currentNode) ? Diagnostics.Type_produces_a_tuple_type_that_is_too_large_to_represent : Diagnostics.Expression_produces_a_tuple_type_that_is_too_large_to_represent
56361
+ );
56340
56362
  return errorType;
56341
56363
  }
56342
56364
  forEach(elements, (t, n) => {
@@ -56355,10 +56377,7 @@ function createTypeChecker(host) {
56355
56377
  expandedFlags[i] = 1 /* Required */;
56356
56378
  }
56357
56379
  if (firstRestIndex >= 0 && firstRestIndex < lastOptionalOrRestIndex) {
56358
- expandedTypes[firstRestIndex] = getUnionType(sameMap(
56359
- expandedTypes.slice(firstRestIndex, lastOptionalOrRestIndex + 1),
56360
- (t, i) => expandedFlags[firstRestIndex + i] & 8 /* Variadic */ ? getIndexedAccessType(t, numberType) : t
56361
- ));
56380
+ expandedTypes[firstRestIndex] = getUnionType(sameMap(expandedTypes.slice(firstRestIndex, lastOptionalOrRestIndex + 1), (t, i) => expandedFlags[firstRestIndex + i] & 8 /* Variadic */ ? getIndexedAccessType(t, numberType) : t));
56362
56381
  expandedTypes.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
56363
56382
  expandedFlags.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
56364
56383
  expandedDeclarations.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
@@ -56396,10 +56415,7 @@ function createTypeChecker(host) {
56396
56415
  );
56397
56416
  }
56398
56417
  function getKnownKeysOfTupleType(type) {
56399
- return getUnionType(append(
56400
- arrayOf(type.target.fixedLength, (i) => getStringLiteralType("" + i)),
56401
- getIndexType(type.target.readonly ? globalReadonlyArrayType : globalArrayType)
56402
- ));
56418
+ return getUnionType(append(arrayOf(type.target.fixedLength, (i) => getStringLiteralType("" + i)), getIndexType(type.target.readonly ? globalReadonlyArrayType : globalArrayType)));
56403
56419
  }
56404
56420
  function getStartElementCount(type, flags) {
56405
56421
  const index = findIndex(type.elementFlags, (f) => !(f & flags));
@@ -56535,10 +56551,7 @@ function createTypeChecker(host) {
56535
56551
  }
56536
56552
  }
56537
56553
  function removeStringLiteralsMatchedByTemplateLiterals(types) {
56538
- const templates = filter(
56539
- types,
56540
- (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t) && t.types.every((t2) => !(t2.flags & 2097152 /* Intersection */) || !areIntersectedTypesAvoidingPrimitiveReduction(t2.types))
56541
- );
56554
+ const templates = filter(types, (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t) && t.types.every((t2) => !(t2.flags & 2097152 /* Intersection */) || !areIntersectedTypesAvoidingPrimitiveReduction(t2.types)));
56542
56555
  if (templates.length) {
56543
56556
  let i = types.length;
56544
56557
  while (i > 0) {
@@ -56708,12 +56721,7 @@ function createTypeChecker(host) {
56708
56721
  const links = getNodeLinks(node);
56709
56722
  if (!links.resolvedType) {
56710
56723
  const aliasSymbol = getAliasSymbolForTypeNode(node);
56711
- links.resolvedType = getUnionType(
56712
- map(node.types, getTypeFromTypeNode),
56713
- 1 /* Literal */,
56714
- aliasSymbol,
56715
- getTypeArgumentsForAliasSymbol(aliasSymbol)
56716
- );
56724
+ links.resolvedType = getUnionType(map(node.types, getTypeFromTypeNode), 1 /* Literal */, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol));
56717
56725
  }
56718
56726
  return links.resolvedType;
56719
56727
  }
@@ -57066,11 +57074,7 @@ function createTypeChecker(host) {
57066
57074
  }
57067
57075
  function getIndexType(type, indexFlags = defaultIndexFlags) {
57068
57076
  type = getReducedType(type);
57069
- return shouldDeferIndexType(type, indexFlags) ? getIndexTypeForGenericType(type, indexFlags) : type.flags & 1048576 /* Union */ ? getIntersectionType(map(type.types, (t) => getIndexType(t, indexFlags))) : type.flags & 2097152 /* Intersection */ ? getUnionType(map(type.types, (t) => getIndexType(t, indexFlags))) : getObjectFlags(type) & 32 /* Mapped */ ? getIndexTypeForMappedType(type, indexFlags) : type === wildcardType ? wildcardType : type.flags & 2 /* Unknown */ ? neverType : type.flags & (1 /* Any */ | 131072 /* Never */) ? keyofConstraintType : getLiteralTypeFromProperties(
57070
- type,
57071
- (indexFlags & 2 /* NoIndexSignatures */ ? 128 /* StringLiteral */ : 402653316 /* StringLike */) | (indexFlags & 1 /* StringsOnly */ ? 0 : 296 /* NumberLike */ | 12288 /* ESSymbolLike */),
57072
- indexFlags === defaultIndexFlags
57073
- );
57077
+ return shouldDeferIndexType(type, indexFlags) ? getIndexTypeForGenericType(type, indexFlags) : type.flags & 1048576 /* Union */ ? getIntersectionType(map(type.types, (t) => getIndexType(t, indexFlags))) : type.flags & 2097152 /* Intersection */ ? getUnionType(map(type.types, (t) => getIndexType(t, indexFlags))) : getObjectFlags(type) & 32 /* Mapped */ ? getIndexTypeForMappedType(type, indexFlags) : type === wildcardType ? wildcardType : type.flags & 2 /* Unknown */ ? neverType : type.flags & (1 /* Any */ | 131072 /* Never */) ? keyofConstraintType : getLiteralTypeFromProperties(type, (indexFlags & 2 /* NoIndexSignatures */ ? 128 /* StringLiteral */ : 402653316 /* StringLike */) | (indexFlags & 1 /* StringsOnly */ ? 0 : 296 /* NumberLike */ | 12288 /* ESSymbolLike */), indexFlags === defaultIndexFlags);
57074
57078
  }
57075
57079
  function getExtractStringType(type) {
57076
57080
  if (keyofStringsOnly) {
@@ -57310,13 +57314,7 @@ function createTypeChecker(host) {
57310
57314
  error(indexNode, Diagnostics.A_tuple_type_cannot_be_indexed_with_a_negative_value);
57311
57315
  return undefinedType;
57312
57316
  }
57313
- error(
57314
- indexNode,
57315
- Diagnostics.Tuple_type_0_of_length_1_has_no_element_at_index_2,
57316
- typeToString(objectType),
57317
- getTypeReferenceArity(objectType),
57318
- unescapeLeadingUnderscores(propName)
57319
- );
57317
+ error(indexNode, Diagnostics.Tuple_type_0_of_length_1_has_no_element_at_index_2, typeToString(objectType), getTypeReferenceArity(objectType), unescapeLeadingUnderscores(propName));
57320
57318
  } else {
57321
57319
  error(indexNode, Diagnostics.Property_0_does_not_exist_on_type_1, unescapeLeadingUnderscores(propName), typeToString(objectType));
57322
57320
  }
@@ -58597,24 +58595,29 @@ function createTypeChecker(host) {
58597
58595
  if (typeVariable) {
58598
58596
  const mappedTypeVariable = instantiateType(typeVariable, mapper);
58599
58597
  if (typeVariable !== mappedTypeVariable) {
58600
- return mapTypeWithAlias(getReducedType(mappedTypeVariable), (t) => {
58601
- if (t.flags & (3 /* AnyOrUnknown */ | 58982400 /* InstantiableNonPrimitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && t !== wildcardType && !isErrorType(t)) {
58602
- if (!type.declaration.nameType) {
58603
- let constraint;
58604
- if (isArrayType(t) || t.flags & 1 /* Any */ && findResolutionCycleStartIndex(typeVariable, 4 /* ImmediateBaseConstraint */) < 0 && (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, isArrayOrTupleType)) {
58605
- return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
58606
- }
58607
- if (isGenericTupleType(t)) {
58608
- return instantiateMappedGenericTupleType(t, type, typeVariable, mapper);
58609
- }
58610
- if (isTupleType(t)) {
58611
- return instantiateMappedTupleType(t, type, prependTypeMapping(typeVariable, t, mapper));
58598
+ return mapTypeWithAlias(
58599
+ getReducedType(mappedTypeVariable),
58600
+ (t) => {
58601
+ if (t.flags & (3 /* AnyOrUnknown */ | 58982400 /* InstantiableNonPrimitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && t !== wildcardType && !isErrorType(t)) {
58602
+ if (!type.declaration.nameType) {
58603
+ let constraint;
58604
+ if (isArrayType(t) || t.flags & 1 /* Any */ && findResolutionCycleStartIndex(typeVariable, 4 /* ImmediateBaseConstraint */) < 0 && (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, isArrayOrTupleType)) {
58605
+ return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
58606
+ }
58607
+ if (isGenericTupleType(t)) {
58608
+ return instantiateMappedGenericTupleType(t, type, typeVariable, mapper);
58609
+ }
58610
+ if (isTupleType(t)) {
58611
+ return instantiateMappedTupleType(t, type, prependTypeMapping(typeVariable, t, mapper));
58612
+ }
58612
58613
  }
58614
+ return instantiateAnonymousType(type, prependTypeMapping(typeVariable, t, mapper));
58613
58615
  }
58614
- return instantiateAnonymousType(type, prependTypeMapping(typeVariable, t, mapper));
58615
- }
58616
- return t;
58617
- }, aliasSymbol, aliasTypeArguments);
58616
+ return t;
58617
+ },
58618
+ aliasSymbol,
58619
+ aliasTypeArguments
58620
+ );
58618
58621
  }
58619
58622
  }
58620
58623
  return instantiateType(getConstraintTypeFromMappedType(type), mapper) === wildcardType ? wildcardType : instantiateAnonymousType(type, mapper, aliasSymbol, aliasTypeArguments);
@@ -59008,10 +59011,13 @@ function createTypeChecker(host) {
59008
59011
  const resultObj = errorOutputContainer || {};
59009
59012
  checkTypeAssignableTo(source, target, node, headMessage, containingMessageChain, resultObj);
59010
59013
  const diagnostic = resultObj.errors[resultObj.errors.length - 1];
59011
- addRelatedInfo(diagnostic, createDiagnosticForNode(
59012
- node,
59013
- signatures === constructSignatures ? Diagnostics.Did_you_mean_to_use_new_with_this_expression : Diagnostics.Did_you_mean_to_call_this_expression
59014
- ));
59014
+ addRelatedInfo(
59015
+ diagnostic,
59016
+ createDiagnosticForNode(
59017
+ node,
59018
+ signatures === constructSignatures ? Diagnostics.Did_you_mean_to_use_new_with_this_expression : Diagnostics.Did_you_mean_to_call_this_expression
59019
+ )
59020
+ );
59015
59021
  return true;
59016
59022
  }
59017
59023
  }
@@ -59068,10 +59074,13 @@ function createTypeChecker(host) {
59068
59074
  );
59069
59075
  if (resultObj.errors) {
59070
59076
  if (target.symbol && length(target.symbol.declarations)) {
59071
- addRelatedInfo(resultObj.errors[resultObj.errors.length - 1], createDiagnosticForNode(
59072
- target.symbol.declarations[0],
59073
- Diagnostics.The_expected_type_comes_from_the_return_type_of_this_signature
59074
- ));
59077
+ addRelatedInfo(
59078
+ resultObj.errors[resultObj.errors.length - 1],
59079
+ createDiagnosticForNode(
59080
+ target.symbol.declarations[0],
59081
+ Diagnostics.The_expected_type_comes_from_the_return_type_of_this_signature
59082
+ )
59083
+ );
59075
59084
  }
59076
59085
  if ((getFunctionFlags(node) & 2 /* Async */) === 0 && !getTypeOfPropertyOfType(sourceReturn, "then") && checkTypeRelatedTo(
59077
59086
  createPromiseType(sourceReturn),
@@ -59080,10 +59089,13 @@ function createTypeChecker(host) {
59080
59089
  /*errorNode*/
59081
59090
  void 0
59082
59091
  )) {
59083
- addRelatedInfo(resultObj.errors[resultObj.errors.length - 1], createDiagnosticForNode(
59084
- node,
59085
- Diagnostics.Did_you_mean_to_mark_this_function_as_async
59086
- ));
59092
+ addRelatedInfo(
59093
+ resultObj.errors[resultObj.errors.length - 1],
59094
+ createDiagnosticForNode(
59095
+ node,
59096
+ Diagnostics.Did_you_mean_to_mark_this_function_as_async
59097
+ )
59098
+ );
59087
59099
  }
59088
59100
  return true;
59089
59101
  }
@@ -59178,12 +59190,15 @@ function createTypeChecker(host) {
59178
59190
  if (!issuedElaboration && (targetProp && length(targetProp.declarations) || target.symbol && length(target.symbol.declarations))) {
59179
59191
  const targetNode = targetProp && length(targetProp.declarations) ? targetProp.declarations[0] : target.symbol.declarations[0];
59180
59192
  if (!getSourceFileOfNode(targetNode).hasNoDefaultLib) {
59181
- addRelatedInfo(reportedDiag, createDiagnosticForNode(
59182
- targetNode,
59183
- Diagnostics.The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1,
59184
- propertyName && !(nameType.flags & 8192 /* UniqueESSymbol */) ? unescapeLeadingUnderscores(propertyName) : typeToString(nameType),
59185
- typeToString(target)
59186
- ));
59193
+ addRelatedInfo(
59194
+ reportedDiag,
59195
+ createDiagnosticForNode(
59196
+ targetNode,
59197
+ Diagnostics.The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1,
59198
+ propertyName && !(nameType.flags & 8192 /* UniqueESSymbol */) ? unescapeLeadingUnderscores(propertyName) : typeToString(nameType),
59199
+ typeToString(target)
59200
+ )
59201
+ );
59187
59202
  }
59188
59203
  }
59189
59204
  }
@@ -59565,11 +59580,7 @@ function createTypeChecker(host) {
59565
59580
  }
59566
59581
  if (!related) {
59567
59582
  if (reportErrors2) {
59568
- errorReporter(
59569
- Diagnostics.Types_of_parameters_0_and_1_are_incompatible,
59570
- unescapeLeadingUnderscores(getParameterNameAtPosition(source, i)),
59571
- unescapeLeadingUnderscores(getParameterNameAtPosition(target, i))
59572
- );
59583
+ errorReporter(Diagnostics.Types_of_parameters_0_and_1_are_incompatible, unescapeLeadingUnderscores(getParameterNameAtPosition(source, i)), unescapeLeadingUnderscores(getParameterNameAtPosition(target, i)));
59573
59584
  }
59574
59585
  return 0 /* False */;
59575
59586
  }
@@ -59690,16 +59701,12 @@ function createTypeChecker(host) {
59690
59701
  const targetProperty = getPropertyOfType(targetEnumType, property.escapedName);
59691
59702
  if (!targetProperty || !(targetProperty.flags & 8 /* EnumMember */)) {
59692
59703
  if (errorReporter) {
59693
- errorReporter(
59694
- Diagnostics.Property_0_is_missing_in_type_1,
59695
- symbolName(property),
59696
- typeToString(
59697
- getDeclaredTypeOfSymbol(targetSymbol),
59698
- /*enclosingDeclaration*/
59699
- void 0,
59700
- 64 /* UseFullyQualifiedType */
59701
- )
59702
- );
59704
+ errorReporter(Diagnostics.Property_0_is_missing_in_type_1, symbolName(property), typeToString(
59705
+ getDeclaredTypeOfSymbol(targetSymbol),
59706
+ /*enclosingDeclaration*/
59707
+ void 0,
59708
+ 64 /* UseFullyQualifiedType */
59709
+ ));
59703
59710
  enumRelation.set(id, 2 /* Failed */ | 4 /* Reported */);
59704
59711
  } else {
59705
59712
  enumRelation.set(id, 2 /* Failed */);
@@ -60372,18 +60379,9 @@ function createTypeChecker(host) {
60372
60379
  }
60373
60380
  }
60374
60381
  if (suggestion !== void 0) {
60375
- reportParentSkippedError(
60376
- Diagnostics.Object_literal_may_only_specify_known_properties_but_0_does_not_exist_in_type_1_Did_you_mean_to_write_2,
60377
- symbolToString(prop),
60378
- typeToString(errorTarget),
60379
- suggestion
60380
- );
60382
+ reportParentSkippedError(Diagnostics.Object_literal_may_only_specify_known_properties_but_0_does_not_exist_in_type_1_Did_you_mean_to_write_2, symbolToString(prop), typeToString(errorTarget), suggestion);
60381
60383
  } else {
60382
- reportParentSkippedError(
60383
- Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1,
60384
- symbolToString(prop),
60385
- typeToString(errorTarget)
60386
- );
60384
+ reportParentSkippedError(Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(prop), typeToString(errorTarget));
60387
60385
  }
60388
60386
  }
60389
60387
  }
@@ -61585,12 +61583,7 @@ function createTypeChecker(host) {
61585
61583
  if (sourcePropFlags & 8 /* Private */ && targetPropFlags & 8 /* Private */) {
61586
61584
  reportError(Diagnostics.Types_have_separate_declarations_of_a_private_property_0, symbolToString(targetProp));
61587
61585
  } else {
61588
- reportError(
61589
- Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2,
61590
- symbolToString(targetProp),
61591
- typeToString(sourcePropFlags & 8 /* Private */ ? source2 : target2),
61592
- typeToString(sourcePropFlags & 8 /* Private */ ? target2 : source2)
61593
- );
61586
+ reportError(Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2, symbolToString(targetProp), typeToString(sourcePropFlags & 8 /* Private */ ? source2 : target2), typeToString(sourcePropFlags & 8 /* Private */ ? target2 : source2));
61594
61587
  }
61595
61588
  }
61596
61589
  return 0 /* False */;
@@ -61598,23 +61591,13 @@ function createTypeChecker(host) {
61598
61591
  } else if (targetPropFlags & 16 /* Protected */) {
61599
61592
  if (!isValidOverrideOf(sourceProp, targetProp)) {
61600
61593
  if (reportErrors2) {
61601
- reportError(
61602
- Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2,
61603
- symbolToString(targetProp),
61604
- typeToString(getDeclaringClass(sourceProp) || source2),
61605
- typeToString(getDeclaringClass(targetProp) || target2)
61606
- );
61594
+ reportError(Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2, symbolToString(targetProp), typeToString(getDeclaringClass(sourceProp) || source2), typeToString(getDeclaringClass(targetProp) || target2));
61607
61595
  }
61608
61596
  return 0 /* False */;
61609
61597
  }
61610
61598
  } else if (sourcePropFlags & 16 /* Protected */) {
61611
61599
  if (reportErrors2) {
61612
- reportError(
61613
- Diagnostics.Property_0_is_protected_in_type_1_but_public_in_type_2,
61614
- symbolToString(targetProp),
61615
- typeToString(source2),
61616
- typeToString(target2)
61617
- );
61600
+ reportError(Diagnostics.Property_0_is_protected_in_type_1_but_public_in_type_2, symbolToString(targetProp), typeToString(source2), typeToString(target2));
61618
61601
  }
61619
61602
  return 0 /* False */;
61620
61603
  }
@@ -61630,12 +61613,7 @@ function createTypeChecker(host) {
61630
61613
  }
61631
61614
  if (!skipOptional && sourceProp.flags & 16777216 /* Optional */ && targetProp.flags & 106500 /* ClassMember */ && !(targetProp.flags & 16777216 /* Optional */)) {
61632
61615
  if (reportErrors2) {
61633
- reportError(
61634
- Diagnostics.Property_0_is_optional_in_type_1_but_required_in_type_2,
61635
- symbolToString(targetProp),
61636
- typeToString(source2),
61637
- typeToString(target2)
61638
- );
61616
+ reportError(Diagnostics.Property_0_is_optional_in_type_1_but_required_in_type_2, symbolToString(targetProp), typeToString(source2), typeToString(target2));
61639
61617
  }
61640
61618
  return 0 /* False */;
61641
61619
  }
@@ -61881,8 +61859,14 @@ function createTypeChecker(host) {
61881
61859
  }
61882
61860
  const sourceIsJSConstructor = source2.symbol && isJSConstructor(source2.symbol.valueDeclaration);
61883
61861
  const targetIsJSConstructor = target2.symbol && isJSConstructor(target2.symbol.valueDeclaration);
61884
- const sourceSignatures = getSignaturesOfType(source2, sourceIsJSConstructor && kind === 1 /* Construct */ ? 0 /* Call */ : kind);
61885
- const targetSignatures = getSignaturesOfType(target2, targetIsJSConstructor && kind === 1 /* Construct */ ? 0 /* Call */ : kind);
61862
+ const sourceSignatures = getSignaturesOfType(
61863
+ source2,
61864
+ sourceIsJSConstructor && kind === 1 /* Construct */ ? 0 /* Call */ : kind
61865
+ );
61866
+ const targetSignatures = getSignaturesOfType(
61867
+ target2,
61868
+ targetIsJSConstructor && kind === 1 /* Construct */ ? 0 /* Call */ : kind
61869
+ );
61886
61870
  if (kind === 1 /* Construct */ && sourceSignatures.length && targetSignatures.length) {
61887
61871
  const sourceIsAbstract = !!(sourceSignatures[0].flags & 4 /* Abstract */);
61888
61872
  const targetIsAbstract = !!(targetSignatures[0].flags & 4 /* Abstract */);
@@ -61956,18 +61940,14 @@ function createTypeChecker(host) {
61956
61940
  shouldElaborateErrors = false;
61957
61941
  }
61958
61942
  if (shouldElaborateErrors) {
61959
- reportError(
61960
- Diagnostics.Type_0_provides_no_match_for_the_signature_1,
61961
- typeToString(source2),
61962
- signatureToString(
61963
- t,
61964
- /*enclosingDeclaration*/
61965
- void 0,
61966
- /*flags*/
61967
- void 0,
61968
- kind
61969
- )
61970
- );
61943
+ reportError(Diagnostics.Type_0_provides_no_match_for_the_signature_1, typeToString(source2), signatureToString(
61944
+ t,
61945
+ /*enclosingDeclaration*/
61946
+ void 0,
61947
+ /*flags*/
61948
+ void 0,
61949
+ kind
61950
+ ));
61971
61951
  }
61972
61952
  return 0 /* False */;
61973
61953
  }
@@ -62000,16 +61980,7 @@ function createTypeChecker(host) {
62000
61980
  }
62001
61981
  function signatureRelatedTo(source2, target2, erase, reportErrors2, intersectionState, incompatibleReporter) {
62002
61982
  const checkMode = relation === subtypeRelation ? 16 /* StrictTopSignature */ : relation === strictSubtypeRelation ? 16 /* StrictTopSignature */ | 8 /* StrictArity */ : 0 /* None */;
62003
- return compareSignaturesRelated(
62004
- erase ? getErasedSignature(source2) : source2,
62005
- erase ? getErasedSignature(target2) : target2,
62006
- checkMode,
62007
- reportErrors2,
62008
- reportError,
62009
- incompatibleReporter,
62010
- isRelatedToWorker2,
62011
- reportUnreliableMapper
62012
- );
61983
+ return compareSignaturesRelated(erase ? getErasedSignature(source2) : source2, erase ? getErasedSignature(target2) : target2, checkMode, reportErrors2, reportError, incompatibleReporter, isRelatedToWorker2, reportUnreliableMapper);
62013
61984
  function isRelatedToWorker2(source3, target3, reportErrors3) {
62014
61985
  return isRelatedTo(
62015
61986
  source3,
@@ -62918,13 +62889,7 @@ function createTypeChecker(host) {
62918
62889
  }
62919
62890
  }
62920
62891
  }
62921
- const result = createAnonymousType(
62922
- type.symbol,
62923
- members,
62924
- emptyArray,
62925
- emptyArray,
62926
- sameMap(getIndexInfosOfType(type), (info) => createIndexInfo(info.keyType, getWidenedType(info.type), info.isReadonly))
62927
- );
62892
+ const result = createAnonymousType(type.symbol, members, emptyArray, emptyArray, sameMap(getIndexInfosOfType(type), (info) => createIndexInfo(info.keyType, getWidenedType(info.type), info.isReadonly)));
62928
62893
  result.objectFlags |= getObjectFlags(type) & (4096 /* JSLiteral */ | 262144 /* NonInferrableType */);
62929
62894
  return result;
62930
62895
  }
@@ -63137,19 +63102,25 @@ function createTypeChecker(host) {
63137
63102
  return context;
63138
63103
  }
63139
63104
  function makeFixingMapperForContext(context) {
63140
- return makeDeferredTypeMapper(map(context.inferences, (i) => i.typeParameter), map(context.inferences, (inference, i) => () => {
63141
- if (!inference.isFixed) {
63142
- inferFromIntraExpressionSites(context);
63143
- clearCachedInferences(context.inferences);
63144
- inference.isFixed = true;
63145
- }
63146
- return getInferredType(context, i);
63147
- }));
63105
+ return makeDeferredTypeMapper(
63106
+ map(context.inferences, (i) => i.typeParameter),
63107
+ map(context.inferences, (inference, i) => () => {
63108
+ if (!inference.isFixed) {
63109
+ inferFromIntraExpressionSites(context);
63110
+ clearCachedInferences(context.inferences);
63111
+ inference.isFixed = true;
63112
+ }
63113
+ return getInferredType(context, i);
63114
+ })
63115
+ );
63148
63116
  }
63149
63117
  function makeNonFixingMapperForContext(context) {
63150
- return makeDeferredTypeMapper(map(context.inferences, (i) => i.typeParameter), map(context.inferences, (_, i) => () => {
63151
- return getInferredType(context, i);
63152
- }));
63118
+ return makeDeferredTypeMapper(
63119
+ map(context.inferences, (i) => i.typeParameter),
63120
+ map(context.inferences, (_, i) => () => {
63121
+ return getInferredType(context, i);
63122
+ })
63123
+ );
63153
63124
  }
63154
63125
  function clearCachedInferences(inferences) {
63155
63126
  for (const inference of inferences) {
@@ -63494,7 +63465,6 @@ function createTypeChecker(host) {
63494
63465
  let bivariant = false;
63495
63466
  let propagationType;
63496
63467
  let inferencePriority = 2048 /* MaxValue */;
63497
- let allowComplexConstraintInference = true;
63498
63468
  let visited;
63499
63469
  let sourceStack;
63500
63470
  let targetStack;
@@ -63649,8 +63619,7 @@ function createTypeChecker(host) {
63649
63619
  source = getReducedType(source);
63650
63620
  if (!(priority & 512 /* NoConstraints */ && source.flags & (2097152 /* Intersection */ | 465829888 /* Instantiable */))) {
63651
63621
  const apparentSource = getApparentType(source);
63652
- if (apparentSource !== source && allowComplexConstraintInference && !(apparentSource.flags & (524288 /* Object */ | 2097152 /* Intersection */))) {
63653
- allowComplexConstraintInference = false;
63622
+ if (apparentSource !== source && !(apparentSource.flags & (524288 /* Object */ | 2097152 /* Intersection */))) {
63654
63623
  return inferFromTypes(apparentSource, target);
63655
63624
  }
63656
63625
  source = apparentSource;
@@ -63899,11 +63868,7 @@ function createTypeChecker(host) {
63899
63868
  )) {
63900
63869
  allTypeFlags &= ~2112 /* BigIntLike */;
63901
63870
  }
63902
- const matchingType = reduceLeft(
63903
- constraintTypes,
63904
- (left, right) => !(right.flags & allTypeFlags) ? left : left.flags & 4 /* String */ ? left : right.flags & 4 /* String */ ? source2 : left.flags & 134217728 /* TemplateLiteral */ ? left : right.flags & 134217728 /* TemplateLiteral */ && isTypeMatchedByTemplateLiteralType(source2, right) ? source2 : left.flags & 268435456 /* StringMapping */ ? left : right.flags & 268435456 /* StringMapping */ && str === applyStringMapping(right.symbol, str) ? source2 : left.flags & 128 /* StringLiteral */ ? left : right.flags & 128 /* StringLiteral */ && right.value === str ? right : left.flags & 8 /* Number */ ? left : right.flags & 8 /* Number */ ? getNumberLiteralType(+str) : left.flags & 32 /* Enum */ ? left : right.flags & 32 /* Enum */ ? getNumberLiteralType(+str) : left.flags & 256 /* NumberLiteral */ ? left : right.flags & 256 /* NumberLiteral */ && right.value === +str ? right : left.flags & 64 /* BigInt */ ? left : right.flags & 64 /* BigInt */ ? parseBigIntLiteralType(str) : left.flags & 2048 /* BigIntLiteral */ ? left : right.flags & 2048 /* BigIntLiteral */ && pseudoBigIntToString(right.value) === str ? right : left.flags & 16 /* Boolean */ ? left : right.flags & 16 /* Boolean */ ? str === "true" ? trueType : str === "false" ? falseType : booleanType : left.flags & 512 /* BooleanLiteral */ ? left : right.flags & 512 /* BooleanLiteral */ && right.intrinsicName === str ? right : left.flags & 32768 /* Undefined */ ? left : right.flags & 32768 /* Undefined */ && right.intrinsicName === str ? right : left.flags & 65536 /* Null */ ? left : right.flags & 65536 /* Null */ && right.intrinsicName === str ? right : left,
63905
- neverType
63906
- );
63871
+ const matchingType = reduceLeft(constraintTypes, (left, right) => !(right.flags & allTypeFlags) ? left : left.flags & 4 /* String */ ? left : right.flags & 4 /* String */ ? source2 : left.flags & 134217728 /* TemplateLiteral */ ? left : right.flags & 134217728 /* TemplateLiteral */ && isTypeMatchedByTemplateLiteralType(source2, right) ? source2 : left.flags & 268435456 /* StringMapping */ ? left : right.flags & 268435456 /* StringMapping */ && str === applyStringMapping(right.symbol, str) ? source2 : left.flags & 128 /* StringLiteral */ ? left : right.flags & 128 /* StringLiteral */ && right.value === str ? right : left.flags & 8 /* Number */ ? left : right.flags & 8 /* Number */ ? getNumberLiteralType(+str) : left.flags & 32 /* Enum */ ? left : right.flags & 32 /* Enum */ ? getNumberLiteralType(+str) : left.flags & 256 /* NumberLiteral */ ? left : right.flags & 256 /* NumberLiteral */ && right.value === +str ? right : left.flags & 64 /* BigInt */ ? left : right.flags & 64 /* BigInt */ ? parseBigIntLiteralType(str) : left.flags & 2048 /* BigIntLiteral */ ? left : right.flags & 2048 /* BigIntLiteral */ && pseudoBigIntToString(right.value) === str ? right : left.flags & 16 /* Boolean */ ? left : right.flags & 16 /* Boolean */ ? str === "true" ? trueType : str === "false" ? falseType : booleanType : left.flags & 512 /* BooleanLiteral */ ? left : right.flags & 512 /* BooleanLiteral */ && right.intrinsicName === str ? right : left.flags & 32768 /* Undefined */ ? left : right.flags & 32768 /* Undefined */ && right.intrinsicName === str ? right : left.flags & 65536 /* Null */ ? left : right.flags & 65536 /* Null */ && right.intrinsicName === str ? right : left, neverType);
63907
63872
  if (!(matchingType.flags & 131072 /* Never */)) {
63908
63873
  inferFromTypes(matchingType, target2);
63909
63874
  continue;
@@ -63949,10 +63914,7 @@ function createTypeChecker(host) {
63949
63914
  return;
63950
63915
  }
63951
63916
  const startLength = isTupleType(source) ? Math.min(source.target.fixedLength, target.target.fixedLength) : 0;
63952
- const endLength = Math.min(
63953
- isTupleType(source) ? getEndElementCount(source.target, 3 /* Fixed */) : 0,
63954
- target.target.hasRestElement ? getEndElementCount(target.target, 3 /* Fixed */) : 0
63955
- );
63917
+ const endLength = Math.min(isTupleType(source) ? getEndElementCount(source.target, 3 /* Fixed */) : 0, target.target.hasRestElement ? getEndElementCount(target.target, 3 /* Fixed */) : 0);
63956
63918
  for (let i = 0; i < startLength; i++) {
63957
63919
  inferFromTypes(getTypeArguments(source)[i], elementTypes[i]);
63958
63920
  }
@@ -64874,7 +64836,9 @@ function createTypeChecker(host) {
64874
64836
  return isTypeSubsetOf(elementType, evolvingArrayType.elementType) ? evolvingArrayType : getEvolvingArrayType(getUnionType([evolvingArrayType.elementType, elementType]));
64875
64837
  }
64876
64838
  function createFinalArrayType(elementType) {
64877
- return elementType.flags & 131072 /* Never */ ? autoArrayType : createArrayType(elementType.flags & 1048576 /* Union */ ? getUnionType(elementType.types, 2 /* Subtype */) : elementType);
64839
+ return elementType.flags & 131072 /* Never */ ? autoArrayType : createArrayType(
64840
+ elementType.flags & 1048576 /* Union */ ? getUnionType(elementType.types, 2 /* Subtype */) : elementType
64841
+ );
64878
64842
  }
64879
64843
  function getFinalArrayType(evolvingArrayType) {
64880
64844
  return evolvingArrayType.finalArrayType || (evolvingArrayType.finalArrayType = createFinalArrayType(evolvingArrayType.elementType));
@@ -65275,7 +65239,10 @@ function createTypeChecker(host) {
65275
65239
  }
65276
65240
  function getInitialOrAssignedType(flow) {
65277
65241
  const node = flow.node;
65278
- return getNarrowableTypeForReference(node.kind === 260 /* VariableDeclaration */ || node.kind === 208 /* BindingElement */ ? getInitialType(node) : getAssignedType(node), reference);
65242
+ return getNarrowableTypeForReference(
65243
+ node.kind === 260 /* VariableDeclaration */ || node.kind === 208 /* BindingElement */ ? getInitialType(node) : getAssignedType(node),
65244
+ reference
65245
+ );
65279
65246
  }
65280
65247
  function getTypeAtFlowAssignment(flow) {
65281
65248
  const node = flow.node;
@@ -65294,10 +65261,11 @@ function createTypeChecker(host) {
65294
65261
  const assignedType = getWidenedLiteralType(getInitialOrAssignedType(flow));
65295
65262
  return isTypeAssignableTo(assignedType, declaredType) ? assignedType : anyArrayType;
65296
65263
  }
65297
- if (declaredType.flags & 1048576 /* Union */) {
65298
- return getAssignmentReducedType(declaredType, getInitialOrAssignedType(flow));
65264
+ const t = isInCompoundLikeAssignment(node) ? getBaseTypeOfLiteralType(declaredType) : declaredType;
65265
+ if (t.flags & 1048576 /* Union */) {
65266
+ return getAssignmentReducedType(t, getInitialOrAssignedType(flow));
65299
65267
  }
65300
- return declaredType;
65268
+ return t;
65301
65269
  }
65302
65270
  if (containsMatchingReference(reference, node)) {
65303
65271
  if (!isReachableFlowNode(flow)) {
@@ -65413,21 +65381,9 @@ function createTypeChecker(host) {
65413
65381
  } else {
65414
65382
  if (strictNullChecks) {
65415
65383
  if (optionalChainContainsReference(expr, reference)) {
65416
- type = narrowTypeBySwitchOptionalChainContainment(
65417
- type,
65418
- flow.switchStatement,
65419
- flow.clauseStart,
65420
- flow.clauseEnd,
65421
- (t) => !(t.flags & (32768 /* Undefined */ | 131072 /* Never */))
65422
- );
65384
+ type = narrowTypeBySwitchOptionalChainContainment(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd, (t) => !(t.flags & (32768 /* Undefined */ | 131072 /* Never */)));
65423
65385
  } else if (expr.kind === 221 /* TypeOfExpression */ && optionalChainContainsReference(expr.expression, reference)) {
65424
- type = narrowTypeBySwitchOptionalChainContainment(
65425
- type,
65426
- flow.switchStatement,
65427
- flow.clauseStart,
65428
- flow.clauseEnd,
65429
- (t) => !(t.flags & 131072 /* Never */ || t.flags & 128 /* StringLiteral */ && t.value === "undefined")
65430
- );
65386
+ type = narrowTypeBySwitchOptionalChainContainment(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd, (t) => !(t.flags & 131072 /* Never */ || t.flags & 128 /* StringLiteral */ && t.value === "undefined"));
65431
65387
  }
65432
65388
  }
65433
65389
  const access = getDiscriminantPropertyAccess(expr, type);
@@ -66050,7 +66006,10 @@ function createTypeChecker(host) {
66050
66006
  const narrowedType = mapType(candidate, (c) => {
66051
66007
  const discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
66052
66008
  const matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
66053
- const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeStrictSubtypeOf(t, c) ? t : isTypeStrictSubtypeOf(c, t) ? c : isTypeSubtypeOf(t, c) ? t : isTypeSubtypeOf(c, t) ? c : neverType);
66009
+ const directlyRelated = mapType(
66010
+ matching || type,
66011
+ checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeStrictSubtypeOf(t, c) ? t : isTypeStrictSubtypeOf(c, t) ? c : isTypeSubtypeOf(t, c) ? t : isTypeSubtypeOf(c, t) ? c : neverType
66012
+ );
66054
66013
  return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated;
66055
66014
  });
66056
66015
  return !(narrowedType.flags & 131072 /* Never */) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]);
@@ -66160,7 +66119,15 @@ function createTypeChecker(host) {
66160
66119
  location = location.parent;
66161
66120
  }
66162
66121
  if (isExpressionNode(location) && (!isAssignmentTarget(location) || isWriteAccess(location))) {
66163
- const type = removeOptionalTypeMarker(getTypeOfExpression(location));
66122
+ const type = removeOptionalTypeMarker(
66123
+ isWriteAccess(location) && location.kind === 211 /* PropertyAccessExpression */ ? checkPropertyAccessExpression(
66124
+ location,
66125
+ /*checkMode*/
66126
+ void 0,
66127
+ /*writeOnly*/
66128
+ true
66129
+ ) : getTypeOfExpression(location)
66130
+ );
66164
66131
  if (getExportSymbolOfValueSymbolIfExported(getNodeLinks(location).resolvedSymbol) === symbol) {
66165
66132
  return type;
66166
66133
  }
@@ -66421,7 +66388,7 @@ function createTypeChecker(host) {
66421
66388
  const isAlias = localOrExportSymbol.flags & 2097152 /* Alias */;
66422
66389
  if (localOrExportSymbol.flags & 3 /* Variable */) {
66423
66390
  if (assignmentKind === 1 /* Definite */) {
66424
- return type;
66391
+ return isInCompoundLikeAssignment(node) ? getBaseTypeOfLiteralType(type) : type;
66425
66392
  }
66426
66393
  } else if (isAlias) {
66427
66394
  declaration = getDeclarationOfAliasSymbol(symbol);
@@ -67516,8 +67483,19 @@ function createTypeChecker(host) {
67516
67483
  contextualType,
67517
67484
  concatenate(
67518
67485
  map(
67519
- filter(node.properties, (p) => !!p.symbol && p.kind === 303 /* PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName)),
67520
- (prop) => [() => getContextFreeTypeOfExpression(prop.initializer), prop.symbol.escapedName]
67486
+ filter(node.properties, (p) => {
67487
+ if (!p.symbol) {
67488
+ return false;
67489
+ }
67490
+ if (p.kind === 303 /* PropertyAssignment */) {
67491
+ return isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName);
67492
+ }
67493
+ if (p.kind === 304 /* ShorthandPropertyAssignment */) {
67494
+ return isDiscriminantProperty(contextualType, p.symbol.escapedName);
67495
+ }
67496
+ return false;
67497
+ }),
67498
+ (prop) => [() => getContextFreeTypeOfExpression(prop.kind === 303 /* PropertyAssignment */ ? prop.initializer : prop.name), prop.symbol.escapedName]
67521
67499
  ),
67522
67500
  map(
67523
67501
  filter(getPropertiesOfType(contextualType), (s) => {
@@ -68068,7 +68046,10 @@ function createTypeChecker(host) {
68068
68046
  inConstContext
68069
68047
  ));
68070
68048
  }
68071
- return createArrayLiteralType(createArrayType(elementTypes.length ? getUnionType(sameMap(elementTypes, (t, i) => elementFlags[i] & 8 /* Variadic */ ? getIndexedAccessTypeOrUndefined(t, numberType) || anyType : t), 2 /* Subtype */) : strictNullChecks ? implicitNeverType : undefinedWideningType, inConstContext));
68049
+ return createArrayLiteralType(createArrayType(
68050
+ elementTypes.length ? getUnionType(sameMap(elementTypes, (t, i) => elementFlags[i] & 8 /* Variadic */ ? getIndexedAccessTypeOrUndefined(t, numberType) || anyType : t), 2 /* Subtype */) : strictNullChecks ? implicitNeverType : undefinedWideningType,
68051
+ inConstContext
68052
+ ));
68072
68053
  }
68073
68054
  function createArrayLiteralType(type) {
68074
68055
  if (!(getObjectFlags(type) & 4 /* Reference */)) {
@@ -68221,12 +68202,7 @@ function createTypeChecker(host) {
68221
68202
  if (impliedProp) {
68222
68203
  prop.flags |= impliedProp.flags & 16777216 /* Optional */;
68223
68204
  } else if (!compilerOptions.suppressExcessPropertyErrors && !getIndexInfoOfType(contextualType, stringType)) {
68224
- error(
68225
- memberDecl.name,
68226
- Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1,
68227
- symbolToString(member),
68228
- typeToString(contextualType)
68229
- );
68205
+ error(memberDecl.name, Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(member), typeToString(contextualType));
68230
68206
  }
68231
68207
  }
68232
68208
  prop.declarations = member.declarations;
@@ -68296,22 +68272,13 @@ function createTypeChecker(host) {
68296
68272
  }
68297
68273
  popContextualType();
68298
68274
  if (contextualTypeHasPattern) {
68299
- const rootPatternParent = findAncestor(
68300
- contextualType.pattern.parent,
68301
- (n) => n.kind === 260 /* VariableDeclaration */ || n.kind === 226 /* BinaryExpression */ || n.kind === 169 /* Parameter */
68302
- );
68303
- const spreadOrOutsideRootObject = findAncestor(
68304
- node,
68305
- (n) => n === rootPatternParent || n.kind === 305 /* SpreadAssignment */
68306
- );
68275
+ const rootPatternParent = findAncestor(contextualType.pattern.parent, (n) => n.kind === 260 /* VariableDeclaration */ || n.kind === 226 /* BinaryExpression */ || n.kind === 169 /* Parameter */);
68276
+ const spreadOrOutsideRootObject = findAncestor(node, (n) => n === rootPatternParent || n.kind === 305 /* SpreadAssignment */);
68307
68277
  if (spreadOrOutsideRootObject.kind !== 305 /* SpreadAssignment */) {
68308
68278
  for (const prop of getPropertiesOfType(contextualType)) {
68309
68279
  if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) {
68310
68280
  if (!(prop.flags & 16777216 /* Optional */)) {
68311
- error(
68312
- prop.valueDeclaration || ((_a = tryCast(prop, isTransientSymbol)) == null ? void 0 : _a.links.bindingElement),
68313
- Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value
68314
- );
68281
+ error(prop.valueDeclaration || ((_a = tryCast(prop, isTransientSymbol)) == null ? void 0 : _a.links.bindingElement), Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value);
68315
68282
  }
68316
68283
  propertiesTable.set(prop.escapedName, prop);
68317
68284
  propertiesArray.push(prop);
@@ -68383,7 +68350,10 @@ function createTypeChecker(host) {
68383
68350
  checkJsxOpeningLikeElementOrOpeningFragment(node.openingFragment);
68384
68351
  const nodeSourceFile = getSourceFileOfNode(node);
68385
68352
  if (getJSXTransformEnabled(compilerOptions) && (compilerOptions.jsxFactory || nodeSourceFile.pragmas.has("jsx")) && !compilerOptions.jsxFragmentFactory && !nodeSourceFile.pragmas.has("jsxfrag")) {
68386
- error(node, compilerOptions.jsxFactory ? Diagnostics.The_jsxFragmentFactory_compiler_option_must_be_provided_to_use_JSX_fragments_with_the_jsxFactory_compiler_option : Diagnostics.An_jsxFrag_pragma_is_required_when_using_an_jsx_pragma_with_JSX_fragments);
68353
+ error(
68354
+ node,
68355
+ compilerOptions.jsxFactory ? Diagnostics.The_jsxFragmentFactory_compiler_option_must_be_provided_to_use_JSX_fragments_with_the_jsxFactory_compiler_option : Diagnostics.An_jsxFrag_pragma_is_required_when_using_an_jsx_pragma_with_JSX_fragments
68356
+ );
68387
68357
  }
68388
68358
  checkJsxChildren(node);
68389
68359
  return getJsxElementTypeAt(node) || anyType;
@@ -68964,12 +68934,7 @@ function createTypeChecker(host) {
68964
68934
  }
68965
68935
  if (flags & 256 /* Abstract */) {
68966
68936
  if (errorNode) {
68967
- error(
68968
- errorNode,
68969
- Diagnostics.Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression,
68970
- symbolToString(prop),
68971
- typeToString(getDeclaringClass(prop))
68972
- );
68937
+ error(errorNode, Diagnostics.Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression, symbolToString(prop), typeToString(getDeclaringClass(prop)));
68973
68938
  }
68974
68939
  return false;
68975
68940
  }
@@ -68978,12 +68943,7 @@ function createTypeChecker(host) {
68978
68943
  const declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop));
68979
68944
  if (declaringClassDeclaration && isNodeUsedDuringClassInitialization(location)) {
68980
68945
  if (errorNode) {
68981
- error(
68982
- errorNode,
68983
- Diagnostics.Abstract_property_0_in_class_1_cannot_be_accessed_in_the_constructor,
68984
- symbolToString(prop),
68985
- getTextOfIdentifierOrLiteral(declaringClassDeclaration.name)
68986
- );
68946
+ error(errorNode, Diagnostics.Abstract_property_0_in_class_1_cannot_be_accessed_in_the_constructor, symbolToString(prop), getTextOfIdentifierOrLiteral(declaringClassDeclaration.name));
68987
68947
  }
68988
68948
  return false;
68989
68949
  }
@@ -68995,12 +68955,7 @@ function createTypeChecker(host) {
68995
68955
  const declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop));
68996
68956
  if (!isNodeWithinClass(location, declaringClassDeclaration)) {
68997
68957
  if (errorNode) {
68998
- error(
68999
- errorNode,
69000
- Diagnostics.Property_0_is_private_and_only_accessible_within_class_1,
69001
- symbolToString(prop),
69002
- typeToString(getDeclaringClass(prop))
69003
- );
68958
+ error(errorNode, Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(getDeclaringClass(prop)));
69004
68959
  }
69005
68960
  return false;
69006
68961
  }
@@ -69018,12 +68973,7 @@ function createTypeChecker(host) {
69018
68973
  enclosingClass = enclosingClass && isClassDerivedFromDeclaringClasses(enclosingClass, prop, writing);
69019
68974
  if (flags & 32 /* Static */ || !enclosingClass) {
69020
68975
  if (errorNode) {
69021
- error(
69022
- errorNode,
69023
- Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses,
69024
- symbolToString(prop),
69025
- typeToString(getDeclaringClass(prop) || containingType)
69026
- );
68976
+ error(errorNode, Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(getDeclaringClass(prop) || containingType));
69027
68977
  }
69028
68978
  return false;
69029
68979
  }
@@ -69036,13 +68986,7 @@ function createTypeChecker(host) {
69036
68986
  }
69037
68987
  if (!containingType || !hasBaseType(containingType, enclosingClass)) {
69038
68988
  if (errorNode) {
69039
- error(
69040
- errorNode,
69041
- Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_This_is_an_instance_of_class_2,
69042
- symbolToString(prop),
69043
- typeToString(enclosingClass),
69044
- typeToString(containingType)
69045
- );
68989
+ error(errorNode, Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_This_is_an_instance_of_class_2, symbolToString(prop), typeToString(enclosingClass), typeToString(containingType));
69046
68990
  }
69047
68991
  return false;
69048
68992
  }
@@ -69454,10 +69398,7 @@ function createTypeChecker(host) {
69454
69398
  diagnosticMessage = error(right, Diagnostics.Class_0_used_before_its_declaration, declarationName);
69455
69399
  }
69456
69400
  if (diagnosticMessage) {
69457
- addRelatedInfo(
69458
- diagnosticMessage,
69459
- createDiagnosticForNode(valueDeclaration, Diagnostics._0_is_declared_here, declarationName)
69460
- );
69401
+ addRelatedInfo(diagnosticMessage, createDiagnosticForNode(valueDeclaration, Diagnostics._0_is_declared_here, declarationName));
69461
69402
  }
69462
69403
  }
69463
69404
  function isInPropertyInitializerOrClassStaticBlock(node) {
@@ -70397,12 +70338,7 @@ function createTypeChecker(host) {
70397
70338
  forEach(getElementTypes(spreadType), (t, i2) => {
70398
70339
  var _a;
70399
70340
  const flags = spreadType.target.elementFlags[i2];
70400
- const syntheticArg = createSyntheticExpression(
70401
- arg,
70402
- flags & 4 /* Rest */ ? createArrayType(t) : t,
70403
- !!(flags & 12 /* Variable */),
70404
- (_a = spreadType.target.labeledElementDeclarations) == null ? void 0 : _a[i2]
70405
- );
70341
+ const syntheticArg = createSyntheticExpression(arg, flags & 4 /* Rest */ ? createArrayType(t) : t, !!(flags & 12 /* Variable */), (_a = spreadType.target.labeledElementDeclarations) == null ? void 0 : _a[i2]);
70406
70342
  effectiveArgs.push(syntheticArg);
70407
70343
  });
70408
70344
  } else {
@@ -71320,10 +71256,7 @@ function createTypeChecker(host) {
71320
71256
  const sigs = getSignaturesOfType(getTypeOfSymbol(getSymbolLinks(apparentType.symbol).target), kind);
71321
71257
  if (!sigs || !sigs.length)
71322
71258
  return;
71323
- addRelatedInfo(
71324
- diagnostic,
71325
- createDiagnosticForNode(importNode, Diagnostics.Type_originates_at_this_import_A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_Consider_using_a_default_import_or_import_require_here_instead)
71326
- );
71259
+ addRelatedInfo(diagnostic, createDiagnosticForNode(importNode, Diagnostics.Type_originates_at_this_import_A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_Consider_using_a_default_import_or_import_require_here_instead));
71327
71260
  }
71328
71261
  }
71329
71262
  function resolveTaggedTemplateExpression(node, candidatesOutArray, checkMode) {
@@ -71950,12 +71883,7 @@ function createTypeChecker(host) {
71950
71883
  addLazyDiagnostic(() => {
71951
71884
  const widenedType = getWidenedType(exprType);
71952
71885
  if (!isTypeComparableTo(targetType, widenedType)) {
71953
- checkTypeComparableTo(
71954
- exprType,
71955
- targetType,
71956
- errNode,
71957
- Diagnostics.Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the_other_If_this_was_intentional_convert_the_expression_to_unknown_first
71958
- );
71886
+ checkTypeComparableTo(exprType, targetType, errNode, Diagnostics.Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the_other_If_this_was_intentional_convert_the_expression_to_unknown_first);
71959
71887
  }
71960
71888
  });
71961
71889
  }
@@ -72115,7 +72043,7 @@ function createTypeChecker(host) {
72115
72043
  const type = getTypeOfSymbol(symbol);
72116
72044
  if (strictNullChecks) {
72117
72045
  const declaration = symbol.valueDeclaration;
72118
- if (declaration && hasInitializer(declaration)) {
72046
+ if (declaration && (hasInitializer(declaration) || isOptionalDeclaration(declaration))) {
72119
72047
  return getOptionalType(type);
72120
72048
  }
72121
72049
  }
@@ -72329,7 +72257,14 @@ function createTypeChecker(host) {
72329
72257
  if (declaration.type) {
72330
72258
  const typeNode = getEffectiveTypeAnnotationNode(declaration);
72331
72259
  if (typeNode) {
72332
- inferTypes(inferenceContext.inferences, getTypeFromTypeNode(typeNode), getTypeAtPosition(context, i));
72260
+ const source = addOptionality(
72261
+ getTypeFromTypeNode(typeNode),
72262
+ /*isProperty*/
72263
+ false,
72264
+ isOptionalDeclaration(declaration)
72265
+ );
72266
+ const target = getTypeAtPosition(context, i);
72267
+ inferTypes(inferenceContext.inferences, source, target);
72333
72268
  }
72334
72269
  }
72335
72270
  }
@@ -72672,13 +72607,19 @@ function createTypeChecker(host) {
72672
72607
  function createPromiseReturnType(func, promisedType) {
72673
72608
  const promiseType = createPromiseType(promisedType);
72674
72609
  if (promiseType === unknownType) {
72675
- error(func, isImportCall(func) ? Diagnostics.A_dynamic_import_call_returns_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option : Diagnostics.An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option);
72610
+ error(
72611
+ func,
72612
+ isImportCall(func) ? Diagnostics.A_dynamic_import_call_returns_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option : Diagnostics.An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option
72613
+ );
72676
72614
  return errorType;
72677
72615
  } else if (!getGlobalPromiseConstructorSymbol(
72678
72616
  /*reportErrors*/
72679
72617
  true
72680
72618
  )) {
72681
- error(func, isImportCall(func) ? Diagnostics.A_dynamic_import_call_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option : Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option);
72619
+ error(
72620
+ func,
72621
+ isImportCall(func) ? Diagnostics.A_dynamic_import_call_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option : Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option
72622
+ );
72682
72623
  }
72683
72624
  return promiseType;
72684
72625
  }
@@ -72861,7 +72802,11 @@ function createTypeChecker(host) {
72861
72802
  function getYieldedTypeOfYieldExpression(node, expressionType, sentType, isAsync) {
72862
72803
  const errorNode = node.expression || node;
72863
72804
  const yieldedType = node.asteriskToken ? checkIteratedTypeOrElementType(isAsync ? 19 /* AsyncYieldStar */ : 17 /* YieldStar */, expressionType, sentType, errorNode) : expressionType;
72864
- return !isAsync ? yieldedType : getAwaitedType(yieldedType, errorNode, node.asteriskToken ? Diagnostics.Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member : Diagnostics.Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member);
72805
+ return !isAsync ? yieldedType : getAwaitedType(
72806
+ yieldedType,
72807
+ errorNode,
72808
+ node.asteriskToken ? Diagnostics.Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member : Diagnostics.Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member
72809
+ );
72865
72810
  }
72866
72811
  function getNotEqualFactsFromTypeofSwitch(start, end, witnesses) {
72867
72812
  let facts = 0 /* None */;
@@ -73359,11 +73304,7 @@ function createTypeChecker(host) {
73359
73304
  return facts === 4194304 /* Truthy */ ? falseType : facts === 8388608 /* Falsy */ ? trueType : booleanType;
73360
73305
  case 46 /* PlusPlusToken */:
73361
73306
  case 47 /* MinusMinusToken */:
73362
- const ok = checkArithmeticOperandType(
73363
- node.operand,
73364
- checkNonNullType(operandType, node.operand),
73365
- Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_bigint_or_an_enum_type
73366
- );
73307
+ const ok = checkArithmeticOperandType(node.operand, checkNonNullType(operandType, node.operand), Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_bigint_or_an_enum_type);
73367
73308
  if (ok) {
73368
73309
  checkReferenceExpression(
73369
73310
  node.operand,
@@ -73956,7 +73897,9 @@ function createTypeChecker(host) {
73956
73897
  }
73957
73898
  if (!resultType) {
73958
73899
  const closeEnoughKind = 296 /* NumberLike */ | 2112 /* BigIntLike */ | 402653316 /* StringLike */ | 3 /* AnyOrUnknown */;
73959
- reportOperatorError((left2, right2) => isTypeAssignableToKind(left2, closeEnoughKind) && isTypeAssignableToKind(right2, closeEnoughKind));
73900
+ reportOperatorError(
73901
+ (left2, right2) => isTypeAssignableToKind(left2, closeEnoughKind) && isTypeAssignableToKind(right2, closeEnoughKind)
73902
+ );
73960
73903
  return anyType;
73961
73904
  }
73962
73905
  if (operator === 65 /* PlusEqualsToken */) {
@@ -74120,11 +74063,7 @@ function createTypeChecker(host) {
74120
74063
  true
74121
74064
  );
74122
74065
  }
74123
- if (checkReferenceExpression(
74124
- left,
74125
- Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access,
74126
- Diagnostics.The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access
74127
- )) {
74066
+ if (checkReferenceExpression(left, Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access, Diagnostics.The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access)) {
74128
74067
  let headMessage;
74129
74068
  if (exactOptionalPropertyTypes && isPropertyAccessExpression(left) && maybeTypeOfKind(valueType, 32768 /* Undefined */)) {
74130
74069
  const target = getTypeOfPropertyOfType(getTypeOfExpression(left.expression), left.name.escapedText);
@@ -74206,21 +74145,13 @@ function createTypeChecker(host) {
74206
74145
  const isLeftNaN = isGlobalNaN(skipParentheses(left2));
74207
74146
  const isRightNaN = isGlobalNaN(skipParentheses(right2));
74208
74147
  if (isLeftNaN || isRightNaN) {
74209
- const err = error(
74210
- errorNode2,
74211
- Diagnostics.This_condition_will_always_return_0,
74212
- tokenToString(operator2 === 37 /* EqualsEqualsEqualsToken */ || operator2 === 35 /* EqualsEqualsToken */ ? 97 /* FalseKeyword */ : 112 /* TrueKeyword */)
74213
- );
74148
+ const err = error(errorNode2, Diagnostics.This_condition_will_always_return_0, tokenToString(operator2 === 37 /* EqualsEqualsEqualsToken */ || operator2 === 35 /* EqualsEqualsToken */ ? 97 /* FalseKeyword */ : 112 /* TrueKeyword */));
74214
74149
  if (isLeftNaN && isRightNaN)
74215
74150
  return;
74216
74151
  const operatorString = operator2 === 38 /* ExclamationEqualsEqualsToken */ || operator2 === 36 /* ExclamationEqualsToken */ ? tokenToString(54 /* ExclamationToken */) : "";
74217
74152
  const location = isLeftNaN ? right2 : left2;
74218
74153
  const expression = skipParentheses(location);
74219
- addRelatedInfo(err, createDiagnosticForNode(
74220
- location,
74221
- Diagnostics.Did_you_mean_0,
74222
- `${operatorString}Number.isNaN(${isEntityNameExpression(expression) ? entityNameToString(expression) : "..."})`
74223
- ));
74154
+ addRelatedInfo(err, createDiagnosticForNode(location, Diagnostics.Did_you_mean_0, `${operatorString}Number.isNaN(${isEntityNameExpression(expression) ? entityNameToString(expression) : "..."})`));
74224
74155
  }
74225
74156
  }
74226
74157
  function isGlobalNaN(expr) {
@@ -75004,11 +74935,7 @@ function createTypeChecker(host) {
75004
74935
  }
75005
74936
  const name = element.name;
75006
74937
  if (name.kind === 80 /* Identifier */ && name.escapedText === predicateVariableName) {
75007
- error(
75008
- predicateVariableNode,
75009
- Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern,
75010
- predicateVariableName
75011
- );
74938
+ error(predicateVariableNode, Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName);
75012
74939
  return true;
75013
74940
  } else if (name.kind === 207 /* ArrayBindingPattern */ || name.kind === 206 /* ObjectBindingPattern */) {
75014
74941
  if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(
@@ -75408,12 +75335,7 @@ function createTypeChecker(host) {
75408
75335
  return getEffectiveTypeArguments(node, typeParameters)[index];
75409
75336
  }
75410
75337
  function getEffectiveTypeArguments(node, typeParameters) {
75411
- return fillMissingTypeArguments(
75412
- map(node.typeArguments, getTypeFromTypeNode),
75413
- typeParameters,
75414
- getMinTypeArgumentCount(typeParameters),
75415
- isInJSFile(node)
75416
- );
75338
+ return fillMissingTypeArguments(map(node.typeArguments, getTypeFromTypeNode), typeParameters, getMinTypeArgumentCount(typeParameters), isInJSFile(node));
75417
75339
  }
75418
75340
  function checkTypeArgumentConstraints(node, typeParameters) {
75419
75341
  let typeArguments;
@@ -76228,12 +76150,7 @@ function createTypeChecker(host) {
76228
76150
  const rootName = promiseConstructorName && getFirstIdentifier(promiseConstructorName);
76229
76151
  const collidingSymbol = getSymbol(node.locals, rootName.escapedText, 111551 /* Value */);
76230
76152
  if (collidingSymbol) {
76231
- error(
76232
- collidingSymbol.valueDeclaration,
76233
- Diagnostics.Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions,
76234
- idText(rootName),
76235
- entityNameToString(promiseConstructorName)
76236
- );
76153
+ error(collidingSymbol.valueDeclaration, Diagnostics.Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions, idText(rootName), entityNameToString(promiseConstructorName));
76237
76154
  return;
76238
76155
  }
76239
76156
  }
@@ -76836,7 +76753,11 @@ function createTypeChecker(host) {
76836
76753
  const importDecl = importClause.parent;
76837
76754
  const nDeclarations = (importClause.name ? 1 : 0) + (importClause.namedBindings ? importClause.namedBindings.kind === 274 /* NamespaceImport */ ? 1 : importClause.namedBindings.elements.length : 0);
76838
76755
  if (nDeclarations === unuseds.length) {
76839
- addDiagnostic(importDecl, 0 /* Local */, unuseds.length === 1 ? createDiagnosticForNode(importDecl, Diagnostics._0_is_declared_but_its_value_is_never_read, idText(first(unuseds).name)) : createDiagnosticForNode(importDecl, Diagnostics.All_imports_in_import_declaration_are_unused));
76756
+ addDiagnostic(
76757
+ importDecl,
76758
+ 0 /* Local */,
76759
+ unuseds.length === 1 ? createDiagnosticForNode(importDecl, Diagnostics._0_is_declared_but_its_value_is_never_read, idText(first(unuseds).name)) : createDiagnosticForNode(importDecl, Diagnostics.All_imports_in_import_declaration_are_unused)
76760
+ );
76840
76761
  } else {
76841
76762
  for (const unused of unuseds)
76842
76763
  errorUnusedLocal(unused, idText(unused.name), addDiagnostic);
@@ -76848,7 +76769,11 @@ function createTypeChecker(host) {
76848
76769
  if (bindingElements.length === 1 && bindingPattern.parent.kind === 260 /* VariableDeclaration */ && bindingPattern.parent.parent.kind === 261 /* VariableDeclarationList */) {
76849
76770
  addToGroup(unusedVariables, bindingPattern.parent.parent, bindingPattern.parent, getNodeId);
76850
76771
  } else {
76851
- addDiagnostic(bindingPattern, kind, bindingElements.length === 1 ? createDiagnosticForNode(bindingPattern, Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(first(bindingElements).name)) : createDiagnosticForNode(bindingPattern, Diagnostics.All_destructured_elements_are_unused));
76772
+ addDiagnostic(
76773
+ bindingPattern,
76774
+ kind,
76775
+ bindingElements.length === 1 ? createDiagnosticForNode(bindingPattern, Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(first(bindingElements).name)) : createDiagnosticForNode(bindingPattern, Diagnostics.All_destructured_elements_are_unused)
76776
+ );
76852
76777
  }
76853
76778
  } else {
76854
76779
  for (const e of bindingElements) {
@@ -76858,7 +76783,11 @@ function createTypeChecker(host) {
76858
76783
  });
76859
76784
  unusedVariables.forEach(([declarationList, declarations]) => {
76860
76785
  if (declarationList.declarations.length === declarations.length) {
76861
- addDiagnostic(declarationList, 0 /* Local */, declarations.length === 1 ? createDiagnosticForNode(first(declarations).name, Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(first(declarations).name)) : createDiagnosticForNode(declarationList.parent.kind === 243 /* VariableStatement */ ? declarationList.parent : declarationList, Diagnostics.All_variables_are_unused));
76786
+ addDiagnostic(
76787
+ declarationList,
76788
+ 0 /* Local */,
76789
+ declarations.length === 1 ? createDiagnosticForNode(first(declarations).name, Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(first(declarations).name)) : createDiagnosticForNode(declarationList.parent.kind === 243 /* VariableStatement */ ? declarationList.parent : declarationList, Diagnostics.All_variables_are_unused)
76790
+ );
76862
76791
  } else {
76863
76792
  for (const decl of declarations) {
76864
76793
  addDiagnostic(decl, 0 /* Local */, createDiagnosticForNode(decl, Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(decl.name)));
@@ -76986,13 +76915,7 @@ function createTypeChecker(host) {
76986
76915
  }
76987
76916
  const parent = getDeclarationContainer(node);
76988
76917
  if (parent.kind === 312 /* SourceFile */ && isExternalOrCommonJsModule(parent)) {
76989
- errorSkippedOn(
76990
- "noEmit",
76991
- name,
76992
- Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module,
76993
- declarationNameToString(name),
76994
- declarationNameToString(name)
76995
- );
76918
+ errorSkippedOn("noEmit", name, Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, declarationNameToString(name), declarationNameToString(name));
76996
76919
  }
76997
76920
  }
76998
76921
  function checkCollisionWithGlobalPromiseInGeneratedCode(node, name) {
@@ -77004,13 +76927,7 @@ function createTypeChecker(host) {
77004
76927
  }
77005
76928
  const parent = getDeclarationContainer(node);
77006
76929
  if (parent.kind === 312 /* SourceFile */ && isExternalOrCommonJsModule(parent) && parent.flags & 4096 /* HasAsyncFunctions */) {
77007
- errorSkippedOn(
77008
- "noEmit",
77009
- name,
77010
- Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions,
77011
- declarationNameToString(name),
77012
- declarationNameToString(name)
77013
- );
76930
+ errorSkippedOn("noEmit", name, Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, declarationNameToString(name), declarationNameToString(name));
77014
76931
  }
77015
76932
  }
77016
76933
  function recordPotentialCollisionWithWeakMapSetInGeneratedCode(node, name) {
@@ -77051,13 +76968,7 @@ function createTypeChecker(host) {
77051
76968
  }
77052
76969
  if (hasCollision) {
77053
76970
  Debug.assert(isNamedDeclaration(node) && isIdentifier(node.name), "The target of a Reflect collision check should be an identifier");
77054
- errorSkippedOn(
77055
- "noEmit",
77056
- node,
77057
- Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_when_emitting_super_references_in_static_initializers,
77058
- declarationNameToString(node.name),
77059
- "Reflect"
77060
- );
76971
+ errorSkippedOn("noEmit", node, Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_when_emitting_super_references_in_static_initializers, declarationNameToString(node.name), "Reflect");
77061
76972
  }
77062
76973
  }
77063
76974
  function checkCollisionsForDeclarationName(node, name) {
@@ -77292,10 +77203,7 @@ function createTypeChecker(host) {
77292
77203
  typeToString(nextType)
77293
77204
  );
77294
77205
  if (firstDeclaration) {
77295
- addRelatedInfo(
77296
- err,
77297
- createDiagnosticForNode(firstDeclaration, Diagnostics._0_was_also_declared_here, declName)
77298
- );
77206
+ addRelatedInfo(err, createDiagnosticForNode(firstDeclaration, Diagnostics._0_was_also_declared_here, declName));
77299
77207
  }
77300
77208
  }
77301
77209
  function areDeclarationFlagsIdentical(left, right) {
@@ -77932,13 +77840,10 @@ function createTypeChecker(host) {
77932
77840
  !!getAwaitedTypeOfPromise(type) || !allowAsyncIterables && isForOfStatement(errorNode.parent) && errorNode.parent.expression === errorNode && getGlobalAsyncIterableType(
77933
77841
  /*reportErrors*/
77934
77842
  false
77935
- ) !== emptyGenericType && isTypeAssignableTo(
77936
- type,
77937
- getGlobalAsyncIterableType(
77938
- /*reportErrors*/
77939
- false
77940
- )
77941
- )
77843
+ ) !== emptyGenericType && isTypeAssignableTo(type, getGlobalAsyncIterableType(
77844
+ /*reportErrors*/
77845
+ false
77846
+ ))
77942
77847
  );
77943
77848
  return errorAndMaybeSuggestAwait(errorNode, suggestAwait, message, typeToString(type));
77944
77849
  }
@@ -78395,14 +78300,7 @@ function createTypeChecker(host) {
78395
78300
  const localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfDeclaration(info.declaration)) === type.symbol ? info.declaration : void 0;
78396
78301
  const errorNode = localPropDeclaration || localIndexDeclaration || (interfaceDeclaration && !some(getBaseTypes(type), (base) => !!getPropertyOfObjectType(base, prop.escapedName) && !!getIndexTypeOfType(base, info.keyType)) ? interfaceDeclaration : void 0);
78397
78302
  if (errorNode && !isTypeAssignableTo(propType, info.type)) {
78398
- const diagnostic = createError(
78399
- errorNode,
78400
- Diagnostics.Property_0_of_type_1_is_not_assignable_to_2_index_type_3,
78401
- symbolToString(prop),
78402
- typeToString(propType),
78403
- typeToString(info.keyType),
78404
- typeToString(info.type)
78405
- );
78303
+ const diagnostic = createError(errorNode, Diagnostics.Property_0_of_type_1_is_not_assignable_to_2_index_type_3, symbolToString(prop), typeToString(propType), typeToString(info.keyType), typeToString(info.type));
78406
78304
  if (propDeclaration && errorNode !== propDeclaration) {
78407
78305
  addRelatedInfo(diagnostic, createDiagnosticForNode(propDeclaration, Diagnostics._0_is_declared_here, symbolToString(prop)));
78408
78306
  }
@@ -78421,14 +78319,7 @@ function createTypeChecker(host) {
78421
78319
  const localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfDeclaration(info.declaration)) === type.symbol ? info.declaration : void 0;
78422
78320
  const errorNode = localCheckDeclaration || localIndexDeclaration || (interfaceDeclaration && !some(getBaseTypes(type), (base) => !!getIndexInfoOfType(base, checkInfo.keyType) && !!getIndexTypeOfType(base, info.keyType)) ? interfaceDeclaration : void 0);
78423
78321
  if (errorNode && !isTypeAssignableTo(checkInfo.type, info.type)) {
78424
- error(
78425
- errorNode,
78426
- Diagnostics._0_index_type_1_is_not_assignable_to_2_index_type_3,
78427
- typeToString(checkInfo.keyType),
78428
- typeToString(checkInfo.type),
78429
- typeToString(info.keyType),
78430
- typeToString(info.type)
78431
- );
78322
+ error(errorNode, Diagnostics._0_index_type_1_is_not_assignable_to_2_index_type_3, typeToString(checkInfo.keyType), typeToString(checkInfo.type), typeToString(info.keyType), typeToString(info.type));
78432
78323
  }
78433
78324
  }
78434
78325
  }
@@ -78709,12 +78600,7 @@ function createTypeChecker(host) {
78709
78600
  )) {
78710
78601
  issueMemberSpecificError(node, typeWithThis, baseWithThis, Diagnostics.Class_0_incorrectly_extends_base_class_1);
78711
78602
  } else {
78712
- checkTypeAssignableTo(
78713
- staticType,
78714
- getTypeWithoutSignatures(staticBaseType),
78715
- node.name || node,
78716
- Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1
78717
- );
78603
+ checkTypeAssignableTo(staticType, getTypeWithoutSignatures(staticBaseType), node.name || node, Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1);
78718
78604
  }
78719
78605
  if (baseConstructorType.flags & 8650752 /* TypeVariable */) {
78720
78606
  if (!isMixinConstructorType(staticType)) {
@@ -79277,7 +79163,10 @@ function createTypeChecker(host) {
79277
79163
  const value = evaluate(initializer, member);
79278
79164
  if (value !== void 0) {
79279
79165
  if (isConstEnum && typeof value === "number" && !isFinite(value)) {
79280
- error(initializer, isNaN(value) ? Diagnostics.const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN : Diagnostics.const_enum_member_initializer_was_evaluated_to_a_non_finite_value);
79166
+ error(
79167
+ initializer,
79168
+ isNaN(value) ? Diagnostics.const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN : Diagnostics.const_enum_member_initializer_was_evaluated_to_a_non_finite_value
79169
+ );
79281
79170
  }
79282
79171
  } else if (isConstEnum) {
79283
79172
  error(initializer, Diagnostics.const_enum_member_initializers_must_be_constant_expressions);
@@ -79644,7 +79533,10 @@ function createTypeChecker(host) {
79644
79533
  }
79645
79534
  const inAmbientExternalModule = node.parent.kind === 268 /* ModuleBlock */ && isAmbientModule(node.parent.parent);
79646
79535
  if (node.parent.kind !== 312 /* SourceFile */ && !inAmbientExternalModule) {
79647
- error(moduleName, node.kind === 278 /* ExportDeclaration */ ? Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module);
79536
+ error(
79537
+ moduleName,
79538
+ node.kind === 278 /* ExportDeclaration */ ? Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module
79539
+ );
79648
79540
  return false;
79649
79541
  }
79650
79542
  if (inAmbientExternalModule && isExternalModuleNameRelative(moduleName.text)) {
@@ -79680,11 +79572,14 @@ function createTypeChecker(host) {
79680
79572
  if (alreadyExportedSymbol === target) {
79681
79573
  const exportingDeclaration = (_c = alreadyExportedSymbol.declarations) == null ? void 0 : _c.find(isJSDocNode);
79682
79574
  if (exportingDeclaration) {
79683
- addRelatedInfo(diag2, createDiagnosticForNode(
79684
- exportingDeclaration,
79685
- Diagnostics._0_is_automatically_exported_here,
79686
- unescapeLeadingUnderscores(alreadyExportedSymbol.escapedName)
79687
- ));
79575
+ addRelatedInfo(
79576
+ diag2,
79577
+ createDiagnosticForNode(
79578
+ exportingDeclaration,
79579
+ Diagnostics._0_is_automatically_exported_here,
79580
+ unescapeLeadingUnderscores(alreadyExportedSymbol.escapedName)
79581
+ )
79582
+ );
79688
79583
  }
79689
79584
  }
79690
79585
  } else {
@@ -79805,7 +79700,7 @@ function createTypeChecker(host) {
79805
79700
  if (mode !== 99 /* ESNext */ && moduleKind !== 99 /* ESNext */) {
79806
79701
  return grammarErrorOnNode(
79807
79702
  declaration.assertClause,
79808
- moduleKind === 199 /* NodeNext */ ? Diagnostics.Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls : Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext
79703
+ moduleKind === 199 /* NodeNext */ ? Diagnostics.Import_assertions_are_not_allowed_on_statements_that_transpile_to_CommonJS_require_calls : Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext
79809
79704
  );
79810
79705
  }
79811
79706
  if (isImportDeclaration(declaration) ? (_a = declaration.importClause) == null ? void 0 : _a.isTypeOnly : declaration.isTypeOnly) {
@@ -80351,9 +80246,14 @@ function createTypeChecker(host) {
80351
80246
  const diagnostic = node.postfix ? Diagnostics._0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1 : Diagnostics._0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1;
80352
80247
  const typeNode = node.type;
80353
80248
  const type = getTypeFromTypeNode(typeNode);
80354
- grammarErrorOnNode(node, diagnostic, token, typeToString(
80355
- isJSDocNullableType(node) && !(type === neverType || type === voidType) ? getUnionType(append([type, undefinedType], node.postfix ? void 0 : nullType)) : type
80356
- ));
80249
+ grammarErrorOnNode(
80250
+ node,
80251
+ diagnostic,
80252
+ token,
80253
+ typeToString(
80254
+ isJSDocNullableType(node) && !(type === neverType || type === voidType) ? getUnionType(append([type, undefinedType], node.postfix ? void 0 : nullType)) : type
80255
+ )
80256
+ );
80357
80257
  } else {
80358
80258
  grammarErrorOnNode(node, Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments);
80359
80259
  }
@@ -83067,10 +82967,7 @@ function createTypeChecker(host) {
83067
82967
  if (isInTopLevelContext(forInOrOfStatement)) {
83068
82968
  if (!hasParseDiagnostics(sourceFile)) {
83069
82969
  if (!isEffectiveExternalModule(sourceFile, compilerOptions)) {
83070
- diagnostics.add(createDiagnosticForNode(
83071
- forInOrOfStatement.awaitModifier,
83072
- Diagnostics.for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module
83073
- ));
82970
+ diagnostics.add(createDiagnosticForNode(forInOrOfStatement.awaitModifier, Diagnostics.for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module));
83074
82971
  }
83075
82972
  switch (moduleKind) {
83076
82973
  case 100 /* Node16 */:
@@ -83089,10 +82986,7 @@ function createTypeChecker(host) {
83089
82986
  }
83090
82987
  default:
83091
82988
  diagnostics.add(
83092
- createDiagnosticForNode(
83093
- forInOrOfStatement.awaitModifier,
83094
- Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher
83095
- )
82989
+ createDiagnosticForNode(forInOrOfStatement.awaitModifier, Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher)
83096
82990
  );
83097
82991
  break;
83098
82992
  }
@@ -86950,10 +86844,7 @@ function createTemplateCooked(factory2, template) {
86950
86844
  function getRawLiteral(factory2, node, currentSourceFile) {
86951
86845
  let text = node.rawText;
86952
86846
  if (text === void 0) {
86953
- Debug.assertIsDefined(
86954
- currentSourceFile,
86955
- "Template literal node is missing 'rawText' and does not have a source file. Possibly bad transform."
86956
- );
86847
+ Debug.assertIsDefined(currentSourceFile, "Template literal node is missing 'rawText' and does not have a source file. Possibly bad transform.");
86957
86848
  text = getSourceTextOfNodeFromSourceFile(currentSourceFile, node);
86958
86849
  const isLast = node.kind === 15 /* NoSubstitutionTemplateLiteral */ || node.kind === 18 /* TemplateTail */;
86959
86850
  text = text.substring(1, text.length - (isLast ? 1 : 2));
@@ -87001,12 +86892,15 @@ function transformTypeScript(context) {
87001
86892
  return transformSourceFile(node);
87002
86893
  }
87003
86894
  function transformBundle(node) {
87004
- return factory2.createBundle(node.sourceFiles.map(transformSourceFile), mapDefined(node.prepends, (prepend) => {
87005
- if (prepend.kind === 315 /* InputFiles */) {
87006
- return createUnparsedSourceFile(prepend, "js");
87007
- }
87008
- return prepend;
87009
- }));
86895
+ return factory2.createBundle(
86896
+ node.sourceFiles.map(transformSourceFile),
86897
+ mapDefined(node.prepends, (prepend) => {
86898
+ if (prepend.kind === 315 /* InputFiles */) {
86899
+ return createUnparsedSourceFile(prepend, "js");
86900
+ }
86901
+ return prepend;
86902
+ })
86903
+ );
87010
86904
  }
87011
86905
  function transformSourceFile(node) {
87012
86906
  if (node.isDeclarationFile) {
@@ -91454,16 +91348,19 @@ function transformLegacyDecorators(context) {
91454
91348
  true
91455
91349
  );
91456
91350
  if (hasClassElementWithDecoratorContainingPrivateIdentifierInExpression(node)) {
91457
- members = setTextRange(factory2.createNodeArray([
91458
- ...members,
91459
- factory2.createClassStaticBlockDeclaration(
91460
- factory2.createBlock(
91461
- decorationStatements,
91462
- /*multiLine*/
91463
- true
91351
+ members = setTextRange(
91352
+ factory2.createNodeArray([
91353
+ ...members,
91354
+ factory2.createClassStaticBlockDeclaration(
91355
+ factory2.createBlock(
91356
+ decorationStatements,
91357
+ /*multiLine*/
91358
+ true
91359
+ )
91464
91360
  )
91465
- )
91466
- ]), members);
91361
+ ]),
91362
+ members
91363
+ );
91467
91364
  decorationStatements = void 0;
91468
91365
  }
91469
91366
  return { decorationStatements, members };
@@ -91510,16 +91407,19 @@ function transformLegacyDecorators(context) {
91510
91407
  ({ members, decorationStatements } = transformDecoratorsOfClassElements(node, members));
91511
91408
  const assignClassAliasInStaticBlock = languageVersion >= 9 /* ES2022 */ && !!classAlias && some(members, (member) => isPropertyDeclaration(member) && hasSyntacticModifier(member, 32 /* Static */) || isClassStaticBlockDeclaration(member));
91512
91409
  if (assignClassAliasInStaticBlock) {
91513
- members = setTextRange(factory2.createNodeArray([
91514
- factory2.createClassStaticBlockDeclaration(
91515
- factory2.createBlock([
91516
- factory2.createExpressionStatement(
91517
- factory2.createAssignment(classAlias, factory2.createThis())
91518
- )
91519
- ])
91520
- ),
91521
- ...members
91522
- ]), members);
91410
+ members = setTextRange(
91411
+ factory2.createNodeArray([
91412
+ factory2.createClassStaticBlockDeclaration(
91413
+ factory2.createBlock([
91414
+ factory2.createExpressionStatement(
91415
+ factory2.createAssignment(classAlias, factory2.createThis())
91416
+ )
91417
+ ])
91418
+ ),
91419
+ ...members
91420
+ ]),
91421
+ members
91422
+ );
91523
91423
  }
91524
91424
  const classExpression = factory2.createClassExpression(
91525
91425
  modifiers,
@@ -91591,55 +91491,67 @@ function transformLegacyDecorators(context) {
91591
91491
  return updated;
91592
91492
  }
91593
91493
  function visitMethodDeclaration(node) {
91594
- return finishClassElement(factory2.updateMethodDeclaration(
91595
- node,
91596
- visitNodes2(node.modifiers, modifierVisitor, isModifier),
91597
- node.asteriskToken,
91598
- Debug.checkDefined(visitNode(node.name, visitor, isPropertyName)),
91599
- /*questionToken*/
91600
- void 0,
91601
- /*typeParameters*/
91602
- void 0,
91603
- visitNodes2(node.parameters, visitor, isParameter),
91604
- /*type*/
91605
- void 0,
91606
- visitNode(node.body, visitor, isBlock)
91607
- ), node);
91494
+ return finishClassElement(
91495
+ factory2.updateMethodDeclaration(
91496
+ node,
91497
+ visitNodes2(node.modifiers, modifierVisitor, isModifier),
91498
+ node.asteriskToken,
91499
+ Debug.checkDefined(visitNode(node.name, visitor, isPropertyName)),
91500
+ /*questionToken*/
91501
+ void 0,
91502
+ /*typeParameters*/
91503
+ void 0,
91504
+ visitNodes2(node.parameters, visitor, isParameter),
91505
+ /*type*/
91506
+ void 0,
91507
+ visitNode(node.body, visitor, isBlock)
91508
+ ),
91509
+ node
91510
+ );
91608
91511
  }
91609
91512
  function visitGetAccessorDeclaration(node) {
91610
- return finishClassElement(factory2.updateGetAccessorDeclaration(
91611
- node,
91612
- visitNodes2(node.modifiers, modifierVisitor, isModifier),
91613
- Debug.checkDefined(visitNode(node.name, visitor, isPropertyName)),
91614
- visitNodes2(node.parameters, visitor, isParameter),
91615
- /*type*/
91616
- void 0,
91617
- visitNode(node.body, visitor, isBlock)
91618
- ), node);
91513
+ return finishClassElement(
91514
+ factory2.updateGetAccessorDeclaration(
91515
+ node,
91516
+ visitNodes2(node.modifiers, modifierVisitor, isModifier),
91517
+ Debug.checkDefined(visitNode(node.name, visitor, isPropertyName)),
91518
+ visitNodes2(node.parameters, visitor, isParameter),
91519
+ /*type*/
91520
+ void 0,
91521
+ visitNode(node.body, visitor, isBlock)
91522
+ ),
91523
+ node
91524
+ );
91619
91525
  }
91620
91526
  function visitSetAccessorDeclaration(node) {
91621
- return finishClassElement(factory2.updateSetAccessorDeclaration(
91622
- node,
91623
- visitNodes2(node.modifiers, modifierVisitor, isModifier),
91624
- Debug.checkDefined(visitNode(node.name, visitor, isPropertyName)),
91625
- visitNodes2(node.parameters, visitor, isParameter),
91626
- visitNode(node.body, visitor, isBlock)
91627
- ), node);
91527
+ return finishClassElement(
91528
+ factory2.updateSetAccessorDeclaration(
91529
+ node,
91530
+ visitNodes2(node.modifiers, modifierVisitor, isModifier),
91531
+ Debug.checkDefined(visitNode(node.name, visitor, isPropertyName)),
91532
+ visitNodes2(node.parameters, visitor, isParameter),
91533
+ visitNode(node.body, visitor, isBlock)
91534
+ ),
91535
+ node
91536
+ );
91628
91537
  }
91629
91538
  function visitPropertyDeclaration(node) {
91630
91539
  if (node.flags & 33554432 /* Ambient */ || hasSyntacticModifier(node, 2 /* Ambient */)) {
91631
91540
  return void 0;
91632
91541
  }
91633
- return finishClassElement(factory2.updatePropertyDeclaration(
91634
- node,
91635
- visitNodes2(node.modifiers, modifierVisitor, isModifier),
91636
- Debug.checkDefined(visitNode(node.name, visitor, isPropertyName)),
91637
- /*questionOrExclamationToken*/
91638
- void 0,
91639
- /*type*/
91640
- void 0,
91641
- visitNode(node.initializer, visitor, isExpression)
91642
- ), node);
91542
+ return finishClassElement(
91543
+ factory2.updatePropertyDeclaration(
91544
+ node,
91545
+ visitNodes2(node.modifiers, modifierVisitor, isModifier),
91546
+ Debug.checkDefined(visitNode(node.name, visitor, isPropertyName)),
91547
+ /*questionOrExclamationToken*/
91548
+ void 0,
91549
+ /*type*/
91550
+ void 0,
91551
+ visitNode(node.initializer, visitor, isExpression)
91552
+ ),
91553
+ node
91554
+ );
91643
91555
  }
91644
91556
  function visitParameterDeclaration(node) {
91645
91557
  const updated = factory2.updateParameterDeclaration(
@@ -92222,7 +92134,10 @@ function transformESDecorators(context) {
92222
92134
  classInfo2.classDescriptorName = factory2.createUniqueName("_classDescriptor", 16 /* Optimistic */ | 32 /* FileLevel */);
92223
92135
  classInfo2.classExtraInitializersName = factory2.createUniqueName("_classExtraInitializers", 16 /* Optimistic */ | 32 /* FileLevel */);
92224
92136
  const needsUniqueClassThis = some(node.members, (member) => (isPrivateIdentifierClassElementDeclaration(member) || isAutoAccessorPropertyDeclaration(member)) && hasStaticModifier(member));
92225
- classInfo2.classThis = factory2.createUniqueName("_classThis", needsUniqueClassThis ? 16 /* Optimistic */ | 8 /* ReservedInNestedScopes */ : 16 /* Optimistic */ | 32 /* FileLevel */);
92137
+ classInfo2.classThis = factory2.createUniqueName(
92138
+ "_classThis",
92139
+ needsUniqueClassThis ? 16 /* Optimistic */ | 8 /* ReservedInNestedScopes */ : 16 /* Optimistic */ | 32 /* FileLevel */
92140
+ );
92226
92141
  classDefinitionStatements.push(
92227
92142
  createLet(classInfo2.classDecoratorsName, factory2.createArrayLiteralExpression(classDecorators)),
92228
92143
  createLet(classInfo2.classDescriptorName),
@@ -94629,9 +94544,12 @@ function transformES2018(context) {
94629
94544
  }
94630
94545
  function visitReturnStatement(node) {
94631
94546
  if (enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */) {
94632
- return factory2.updateReturnStatement(node, createDownlevelAwait(
94633
- node.expression ? visitNode(node.expression, visitor, isExpression) : factory2.createVoidZero()
94634
- ));
94547
+ return factory2.updateReturnStatement(
94548
+ node,
94549
+ createDownlevelAwait(
94550
+ node.expression ? visitNode(node.expression, visitor, isExpression) : factory2.createVoidZero()
94551
+ )
94552
+ );
94635
94553
  }
94636
94554
  return visitEachChild(node, visitor, context);
94637
94555
  }
@@ -94657,7 +94575,10 @@ function transformES2018(context) {
94657
94575
  const target = e.expression;
94658
94576
  objects.push(visitNode(target, visitor, isExpression));
94659
94577
  } else {
94660
- chunkObject = append(chunkObject, e.kind === 303 /* PropertyAssignment */ ? factory2.createPropertyAssignment(e.name, visitNode(e.initializer, visitor, isExpression)) : visitNode(e, visitor, isObjectLiteralElementLike));
94578
+ chunkObject = append(
94579
+ chunkObject,
94580
+ e.kind === 303 /* PropertyAssignment */ ? factory2.createPropertyAssignment(e.name, visitNode(e.initializer, visitor, isExpression)) : visitNode(e, visitor, isObjectLiteralElementLike)
94581
+ );
94661
94582
  }
94662
94583
  }
94663
94584
  if (chunkObject) {
@@ -94696,13 +94617,16 @@ function transformES2018(context) {
94696
94617
  );
94697
94618
  exportedVariableStatement = false;
94698
94619
  const visited = visitEachChild(node, visitor, context);
94699
- const statement = concatenate(visited.statements, taggedTemplateStringDeclarations && [
94700
- factory2.createVariableStatement(
94701
- /*modifiers*/
94702
- void 0,
94703
- factory2.createVariableDeclarationList(taggedTemplateStringDeclarations)
94704
- )
94705
- ]);
94620
+ const statement = concatenate(
94621
+ visited.statements,
94622
+ taggedTemplateStringDeclarations && [
94623
+ factory2.createVariableStatement(
94624
+ /*modifiers*/
94625
+ void 0,
94626
+ factory2.createVariableDeclarationList(taggedTemplateStringDeclarations)
94627
+ )
94628
+ ]
94629
+ );
94706
94630
  const result = factory2.updateSourceFile(visited, setTextRange(factory2.createNodeArray(statement), node.statements));
94707
94631
  exitSubtree(ancestorFacts);
94708
94632
  return result;
@@ -95828,15 +95752,18 @@ function transformES2020(context) {
95828
95752
  right = factory2.createTempVariable(hoistVariableDeclaration);
95829
95753
  left = factory2.createAssignment(right, left);
95830
95754
  }
95831
- return setTextRange(factory2.createConditionalExpression(
95832
- createNotNullCondition(left, right),
95833
- /*questionToken*/
95834
- void 0,
95835
- right,
95836
- /*colonToken*/
95837
- void 0,
95838
- visitNode(node.right, visitor, isExpression)
95839
- ), node);
95755
+ return setTextRange(
95756
+ factory2.createConditionalExpression(
95757
+ createNotNullCondition(left, right),
95758
+ /*questionToken*/
95759
+ void 0,
95760
+ right,
95761
+ /*colonToken*/
95762
+ void 0,
95763
+ visitNode(node.right, visitor, isExpression)
95764
+ ),
95765
+ node
95766
+ );
95840
95767
  }
95841
95768
  function visitDeleteExpression(node) {
95842
95769
  return isOptionalChain(skipParentheses(node.expression)) ? setOriginalNode(visitNonOptionalExpression(
@@ -95990,13 +95917,16 @@ function transformESNext(context) {
95990
95917
  const envBinding = createEnvBinding();
95991
95918
  const bodyStatements = transformUsingDeclarations(node.statements, pos, node.statements.length, envBinding, topLevelStatements);
95992
95919
  if (exportBindings.size) {
95993
- append(topLevelStatements, factory2.createExportDeclaration(
95994
- /*modifiers*/
95995
- void 0,
95996
- /*isTypeOnly*/
95997
- false,
95998
- factory2.createNamedExports(arrayFrom(exportBindings.values()))
95999
- ));
95920
+ append(
95921
+ topLevelStatements,
95922
+ factory2.createExportDeclaration(
95923
+ /*modifiers*/
95924
+ void 0,
95925
+ /*isTypeOnly*/
95926
+ false,
95927
+ factory2.createNamedExports(arrayFrom(exportBindings.values()))
95928
+ )
95929
+ );
96000
95930
  }
96001
95931
  addRange(topLevelStatements, endLexicalEnvironment());
96002
95932
  if (exportVars.length) {
@@ -96760,7 +96690,9 @@ function transformJsx(context) {
96760
96690
  }
96761
96691
  }
96762
96692
  function hasProto(obj) {
96763
- return obj.properties.some((p) => isPropertyAssignment(p) && (isIdentifier(p.name) && idText(p.name) === "__proto__" || isStringLiteral(p.name) && p.name.text === "__proto__"));
96693
+ return obj.properties.some(
96694
+ (p) => isPropertyAssignment(p) && (isIdentifier(p.name) && idText(p.name) === "__proto__" || isStringLiteral(p.name) && p.name.text === "__proto__")
96695
+ );
96764
96696
  }
96765
96697
  function hasKeyAfterPropsSpread(node) {
96766
96698
  let spread = false;
@@ -97782,10 +97714,13 @@ function transformES2015(context) {
97782
97714
  }
97783
97715
  }
97784
97716
  if (node.flags & 256 /* IdentifierHasExtendedUnicodeEscape */) {
97785
- return setOriginalNode(setTextRange(
97786
- factory2.createIdentifier(unescapeLeadingUnderscores(node.escapedText)),
97717
+ return setOriginalNode(
97718
+ setTextRange(
97719
+ factory2.createIdentifier(unescapeLeadingUnderscores(node.escapedText)),
97720
+ node
97721
+ ),
97787
97722
  node
97788
- ), node);
97723
+ );
97789
97724
  }
97790
97725
  return node;
97791
97726
  }
@@ -98964,7 +98899,11 @@ function transformES2015(context) {
98964
98899
  if (node.flags & 7 /* BlockScoped */) {
98965
98900
  enableSubstitutionsForBlockScopedBindings();
98966
98901
  }
98967
- const declarations = visitNodes2(node.declarations, node.flags & 1 /* Let */ ? visitVariableDeclarationInLetDeclarationList : visitVariableDeclaration, isVariableDeclaration);
98902
+ const declarations = visitNodes2(
98903
+ node.declarations,
98904
+ node.flags & 1 /* Let */ ? visitVariableDeclarationInLetDeclarationList : visitVariableDeclaration,
98905
+ isVariableDeclaration
98906
+ );
98968
98907
  const declarationList = factory2.createVariableDeclarationList(declarations);
98969
98908
  setOriginalNode(declarationList, node);
98970
98909
  setTextRange(declarationList, node);
@@ -100407,11 +100346,7 @@ function transformES2015(context) {
100407
100346
  // As we visit each element, we return one of two functions to use as the "key":
100408
100347
  // - `visitSpanOfSpreads` for one or more contiguous `...` spread expressions, i.e. `...a, ...b` in `[1, 2, ...a, ...b]`
100409
100348
  // - `visitSpanOfNonSpreads` for one or more contiguous non-spread elements, i.e. `1, 2`, in `[1, 2, ...a, ...b]`
100410
- spanMap(
100411
- elements,
100412
- partitionSpread,
100413
- (partition, visitPartition, _start, end) => visitPartition(partition, multiLine, hasTrailingComma && end === numElements)
100414
- )
100349
+ spanMap(elements, partitionSpread, (partition, visitPartition, _start, end) => visitPartition(partition, multiLine, hasTrailingComma && end === numElements))
100415
100350
  );
100416
100351
  if (segments.length === 1) {
100417
100352
  const firstSegment = segments[0];
@@ -101063,11 +100998,7 @@ function transformGenerators(context) {
101063
100998
  );
101064
100999
  break;
101065
101000
  case 212 /* ElementAccessExpression */:
101066
- target = factory2.updateElementAccessExpression(
101067
- left,
101068
- cacheExpression(Debug.checkDefined(visitNode(left.expression, visitor, isLeftHandSideExpression))),
101069
- cacheExpression(Debug.checkDefined(visitNode(left.argumentExpression, visitor, isExpression)))
101070
- );
101001
+ target = factory2.updateElementAccessExpression(left, cacheExpression(Debug.checkDefined(visitNode(left.expression, visitor, isLeftHandSideExpression))), cacheExpression(Debug.checkDefined(visitNode(left.argumentExpression, visitor, isExpression))));
101071
101002
  break;
101072
101003
  default:
101073
101004
  target = Debug.checkDefined(visitNode(left, visitor, isExpression));
@@ -101102,12 +101033,7 @@ function transformGenerators(context) {
101102
101033
  } else if (node.operatorToken.kind === 28 /* CommaToken */) {
101103
101034
  return visitCommaExpression(node);
101104
101035
  }
101105
- return factory2.updateBinaryExpression(
101106
- node,
101107
- cacheExpression(Debug.checkDefined(visitNode(node.left, visitor, isExpression))),
101108
- node.operatorToken,
101109
- Debug.checkDefined(visitNode(node.right, visitor, isExpression))
101110
- );
101036
+ return factory2.updateBinaryExpression(node, cacheExpression(Debug.checkDefined(visitNode(node.left, visitor, isExpression))), node.operatorToken, Debug.checkDefined(visitNode(node.right, visitor, isExpression)));
101111
101037
  }
101112
101038
  return visitEachChild(node, visitor, context);
101113
101039
  }
@@ -101315,11 +101241,7 @@ function transformGenerators(context) {
101315
101241
  }
101316
101242
  function visitElementAccessExpression(node) {
101317
101243
  if (containsYield(node.argumentExpression)) {
101318
- return factory2.updateElementAccessExpression(
101319
- node,
101320
- cacheExpression(Debug.checkDefined(visitNode(node.expression, visitor, isLeftHandSideExpression))),
101321
- Debug.checkDefined(visitNode(node.argumentExpression, visitor, isExpression))
101322
- );
101244
+ return factory2.updateElementAccessExpression(node, cacheExpression(Debug.checkDefined(visitNode(node.expression, visitor, isLeftHandSideExpression))), Debug.checkDefined(visitNode(node.argumentExpression, visitor, isExpression)));
101323
101245
  }
101324
101246
  return visitEachChild(node, visitor, context);
101325
101247
  }
@@ -101677,12 +101599,7 @@ function transformGenerators(context) {
101677
101599
  for (const variable of initializer.declarations) {
101678
101600
  hoistVariableDeclaration(variable.name);
101679
101601
  }
101680
- node = factory2.updateForInStatement(
101681
- node,
101682
- initializer.declarations[0].name,
101683
- Debug.checkDefined(visitNode(node.expression, visitor, isExpression)),
101684
- Debug.checkDefined(visitNode(node.statement, visitor, isStatement, factory2.liftToBlock))
101685
- );
101602
+ node = factory2.updateForInStatement(node, initializer.declarations[0].name, Debug.checkDefined(visitNode(node.expression, visitor, isExpression)), Debug.checkDefined(visitNode(node.statement, visitor, isStatement, factory2.liftToBlock)));
101686
101603
  } else {
101687
101604
  node = visitEachChild(node, visitor, context);
101688
101605
  }
@@ -102843,12 +102760,14 @@ function transformModule(context) {
102843
102760
  // Add the dependency array argument:
102844
102761
  //
102845
102762
  // ["require", "exports", module1", "module2", ...]
102846
- factory2.createArrayLiteralExpression(jsonSourceFile ? emptyArray : [
102847
- factory2.createStringLiteral("require"),
102848
- factory2.createStringLiteral("exports"),
102849
- ...aliasedModuleNames,
102850
- ...unaliasedModuleNames
102851
- ]),
102763
+ factory2.createArrayLiteralExpression(
102764
+ jsonSourceFile ? emptyArray : [
102765
+ factory2.createStringLiteral("require"),
102766
+ factory2.createStringLiteral("exports"),
102767
+ ...aliasedModuleNames,
102768
+ ...unaliasedModuleNames
102769
+ ]
102770
+ ),
102852
102771
  // Add the module body function argument:
102853
102772
  //
102854
102773
  // function (require, exports, module1, module2) ...
@@ -103574,22 +103493,25 @@ function transformModule(context) {
103574
103493
  );
103575
103494
  } else {
103576
103495
  const temp = factory2.createTempVariable(hoistVariableDeclaration);
103577
- return factory2.createComma(factory2.createAssignment(temp, arg), factory2.createConditionalExpression(
103578
- /*condition*/
103579
- factory2.createIdentifier("__syncRequire"),
103580
- /*questionToken*/
103581
- void 0,
103582
- /*whenTrue*/
103583
- createImportCallExpressionCommonJS(
103584
- temp,
103585
- /*isInlineable*/
103586
- true
103587
- ),
103588
- /*colonToken*/
103589
- void 0,
103590
- /*whenFalse*/
103591
- createImportCallExpressionAMD(temp, containsLexicalThis)
103592
- ));
103496
+ return factory2.createComma(
103497
+ factory2.createAssignment(temp, arg),
103498
+ factory2.createConditionalExpression(
103499
+ /*condition*/
103500
+ factory2.createIdentifier("__syncRequire"),
103501
+ /*questionToken*/
103502
+ void 0,
103503
+ /*whenTrue*/
103504
+ createImportCallExpressionCommonJS(
103505
+ temp,
103506
+ /*isInlineable*/
103507
+ true
103508
+ ),
103509
+ /*colonToken*/
103510
+ void 0,
103511
+ /*whenFalse*/
103512
+ createImportCallExpressionAMD(temp, containsLexicalThis)
103513
+ )
103514
+ );
103593
103515
  }
103594
103516
  }
103595
103517
  function createImportCallExpressionAMD(arg, containsLexicalThis) {
@@ -104030,7 +103952,10 @@ function transformModule(context) {
104030
103952
  factory2.createExpressionStatement(
104031
103953
  createExportExpression(
104032
103954
  factory2.cloneNode(node.exportClause.name),
104033
- getHelperExpressionForExport(node, moduleKind !== 2 /* AMD */ ? createRequireCall(node) : isExportNamespaceAsDefaultDeclaration(node) ? generatedName : factory2.createIdentifier(idText(node.exportClause.name)))
103955
+ getHelperExpressionForExport(
103956
+ node,
103957
+ moduleKind !== 2 /* AMD */ ? createRequireCall(node) : isExportNamespaceAsDefaultDeclaration(node) ? generatedName : factory2.createIdentifier(idText(node.exportClause.name))
103958
+ )
104034
103959
  )
104035
103960
  ),
104036
103961
  node
@@ -104422,21 +104347,24 @@ function transformModule(context) {
104422
104347
  factory2.createStringLiteralFromNode(name),
104423
104348
  factory2.createObjectLiteralExpression([
104424
104349
  factory2.createPropertyAssignment("enumerable", factory2.createTrue()),
104425
- factory2.createPropertyAssignment("get", factory2.createFunctionExpression(
104426
- /*modifiers*/
104427
- void 0,
104428
- /*asteriskToken*/
104429
- void 0,
104430
- /*name*/
104431
- void 0,
104432
- /*typeParameters*/
104433
- void 0,
104434
- /*parameters*/
104435
- [],
104436
- /*type*/
104437
- void 0,
104438
- factory2.createBlock([factory2.createReturnStatement(value)])
104439
- ))
104350
+ factory2.createPropertyAssignment(
104351
+ "get",
104352
+ factory2.createFunctionExpression(
104353
+ /*modifiers*/
104354
+ void 0,
104355
+ /*asteriskToken*/
104356
+ void 0,
104357
+ /*name*/
104358
+ void 0,
104359
+ /*typeParameters*/
104360
+ void 0,
104361
+ /*parameters*/
104362
+ [],
104363
+ /*type*/
104364
+ void 0,
104365
+ factory2.createBlock([factory2.createReturnStatement(value)])
104366
+ )
104367
+ )
104440
104368
  ])
104441
104369
  ]
104442
104370
  ) : factory2.createAssignment(
@@ -104811,10 +104739,7 @@ function transformSystemModule(context) {
104811
104739
  const modifiers = node.transformFlags & 2097152 /* ContainsAwait */ ? factory2.createModifiersFromModifierFlags(512 /* Async */) : void 0;
104812
104740
  const moduleObject = factory2.createObjectLiteralExpression(
104813
104741
  [
104814
- factory2.createPropertyAssignment(
104815
- "setters",
104816
- createSettersArray(exportStarFunction, dependencyGroups)
104817
- ),
104742
+ factory2.createPropertyAssignment("setters", createSettersArray(exportStarFunction, dependencyGroups)),
104818
104743
  factory2.createPropertyAssignment(
104819
104744
  "execute",
104820
104745
  factory2.createFunctionExpression(
@@ -106134,18 +106059,21 @@ function transformECMAScriptModule(context) {
106134
106059
  }
106135
106060
  function appendExportsOfImportEqualsDeclaration(statements, node) {
106136
106061
  if (hasSyntacticModifier(node, 1 /* Export */)) {
106137
- statements = append(statements, factory2.createExportDeclaration(
106138
- /*modifiers*/
106139
- void 0,
106140
- node.isTypeOnly,
106141
- factory2.createNamedExports([factory2.createExportSpecifier(
106142
- /*isTypeOnly*/
106143
- false,
106144
- /*propertyName*/
106062
+ statements = append(
106063
+ statements,
106064
+ factory2.createExportDeclaration(
106065
+ /*modifiers*/
106145
106066
  void 0,
106146
- idText(node.name)
106147
- )])
106148
- ));
106067
+ node.isTypeOnly,
106068
+ factory2.createNamedExports([factory2.createExportSpecifier(
106069
+ /*isTypeOnly*/
106070
+ false,
106071
+ /*propertyName*/
106072
+ void 0,
106073
+ idText(node.name)
106074
+ )])
106075
+ )
106076
+ );
106149
106077
  }
106150
106078
  return statements;
106151
106079
  }
@@ -106672,20 +106600,9 @@ function transformDeclarations(context) {
106672
106600
  const errorInfo = getSymbolAccessibilityDiagnostic(symbolAccessibilityResult);
106673
106601
  if (errorInfo) {
106674
106602
  if (errorInfo.typeName) {
106675
- context.addDiagnostic(createDiagnosticForNode(
106676
- symbolAccessibilityResult.errorNode || errorInfo.errorNode,
106677
- errorInfo.diagnosticMessage,
106678
- getTextOfNode(errorInfo.typeName),
106679
- symbolAccessibilityResult.errorSymbolName,
106680
- symbolAccessibilityResult.errorModuleName
106681
- ));
106603
+ context.addDiagnostic(createDiagnosticForNode(symbolAccessibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, getTextOfNode(errorInfo.typeName), symbolAccessibilityResult.errorSymbolName, symbolAccessibilityResult.errorModuleName));
106682
106604
  } else {
106683
- context.addDiagnostic(createDiagnosticForNode(
106684
- symbolAccessibilityResult.errorNode || errorInfo.errorNode,
106685
- errorInfo.diagnosticMessage,
106686
- symbolAccessibilityResult.errorSymbolName,
106687
- symbolAccessibilityResult.errorModuleName
106688
- ));
106605
+ context.addDiagnostic(createDiagnosticForNode(symbolAccessibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, symbolAccessibilityResult.errorSymbolName, symbolAccessibilityResult.errorModuleName));
106689
106606
  }
106690
106607
  return true;
106691
106608
  }
@@ -106722,41 +106639,22 @@ function transformDeclarations(context) {
106722
106639
  }
106723
106640
  function reportInaccessibleUniqueSymbolError() {
106724
106641
  if (errorNameNode || errorFallbackNode) {
106725
- context.addDiagnostic(createDiagnosticForNode(
106726
- errorNameNode || errorFallbackNode,
106727
- Diagnostics.The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary,
106728
- errorDeclarationNameWithFallback(),
106729
- "unique symbol"
106730
- ));
106642
+ context.addDiagnostic(createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary, errorDeclarationNameWithFallback(), "unique symbol"));
106731
106643
  }
106732
106644
  }
106733
106645
  function reportCyclicStructureError() {
106734
106646
  if (errorNameNode || errorFallbackNode) {
106735
- context.addDiagnostic(createDiagnosticForNode(
106736
- errorNameNode || errorFallbackNode,
106737
- Diagnostics.The_inferred_type_of_0_references_a_type_with_a_cyclic_structure_which_cannot_be_trivially_serialized_A_type_annotation_is_necessary,
106738
- errorDeclarationNameWithFallback()
106739
- ));
106647
+ context.addDiagnostic(createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.The_inferred_type_of_0_references_a_type_with_a_cyclic_structure_which_cannot_be_trivially_serialized_A_type_annotation_is_necessary, errorDeclarationNameWithFallback()));
106740
106648
  }
106741
106649
  }
106742
106650
  function reportInaccessibleThisError() {
106743
106651
  if (errorNameNode || errorFallbackNode) {
106744
- context.addDiagnostic(createDiagnosticForNode(
106745
- errorNameNode || errorFallbackNode,
106746
- Diagnostics.The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary,
106747
- errorDeclarationNameWithFallback(),
106748
- "this"
106749
- ));
106652
+ context.addDiagnostic(createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary, errorDeclarationNameWithFallback(), "this"));
106750
106653
  }
106751
106654
  }
106752
106655
  function reportLikelyUnsafeImportRequiredError(specifier) {
106753
106656
  if (errorNameNode || errorFallbackNode) {
106754
- context.addDiagnostic(createDiagnosticForNode(
106755
- errorNameNode || errorFallbackNode,
106756
- Diagnostics.The_inferred_type_of_0_cannot_be_named_without_a_reference_to_1_This_is_likely_not_portable_A_type_annotation_is_necessary,
106757
- errorDeclarationNameWithFallback(),
106758
- specifier
106759
- ));
106657
+ context.addDiagnostic(createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.The_inferred_type_of_0_cannot_be_named_without_a_reference_to_1_This_is_likely_not_portable_A_type_annotation_is_necessary, errorDeclarationNameWithFallback(), specifier));
106760
106658
  }
106761
106659
  }
106762
106660
  function reportTruncationError() {
@@ -106806,9 +106704,8 @@ function transformDeclarations(context) {
106806
106704
  refs = /* @__PURE__ */ new Map();
106807
106705
  libs2 = /* @__PURE__ */ new Map();
106808
106706
  let hasNoDefaultLib = false;
106809
- const bundle = factory2.createBundle(map(
106810
- node.sourceFiles,
106811
- (sourceFile) => {
106707
+ const bundle = factory2.createBundle(
106708
+ map(node.sourceFiles, (sourceFile) => {
106812
106709
  if (sourceFile.isDeclarationFile)
106813
106710
  return void 0;
106814
106711
  hasNoDefaultLib = hasNoDefaultLib || sourceFile.hasNoDefaultLib;
@@ -106866,18 +106763,19 @@ function transformDeclarations(context) {
106866
106763
  /*libReferences*/
106867
106764
  []
106868
106765
  );
106869
- }
106870
- ), mapDefined(node.prepends, (prepend) => {
106871
- if (prepend.kind === 315 /* InputFiles */) {
106872
- const sourceFile = createUnparsedSourceFile(prepend, "dts", stripInternal);
106873
- hasNoDefaultLib = hasNoDefaultLib || !!sourceFile.hasNoDefaultLib;
106874
- collectReferences(sourceFile, refs);
106875
- recordTypeReferenceDirectivesIfNecessary(map(sourceFile.typeReferenceDirectives, (ref) => [ref.fileName, ref.resolutionMode]));
106876
- collectLibs(sourceFile, libs2);
106877
- return sourceFile;
106878
- }
106879
- return prepend;
106880
- }));
106766
+ }),
106767
+ mapDefined(node.prepends, (prepend) => {
106768
+ if (prepend.kind === 315 /* InputFiles */) {
106769
+ const sourceFile = createUnparsedSourceFile(prepend, "dts", stripInternal);
106770
+ hasNoDefaultLib = hasNoDefaultLib || !!sourceFile.hasNoDefaultLib;
106771
+ collectReferences(sourceFile, refs);
106772
+ recordTypeReferenceDirectivesIfNecessary(map(sourceFile.typeReferenceDirectives, (ref) => [ref.fileName, ref.resolutionMode]));
106773
+ collectLibs(sourceFile, libs2);
106774
+ return sourceFile;
106775
+ }
106776
+ return prepend;
106777
+ })
106778
+ );
106881
106779
  bundle.syntheticFileReferences = [];
106882
106780
  bundle.syntheticTypeReferences = getFileReferencesForUsedTypeReferences();
106883
106781
  bundle.syntheticLibReferences = getLibReferences();
@@ -107293,25 +107191,37 @@ function transformDeclarations(context) {
107293
107191
  }
107294
107192
  const visibleDefaultBinding = decl.importClause && decl.importClause.name && resolver.isDeclarationVisible(decl.importClause) ? decl.importClause.name : void 0;
107295
107193
  if (!decl.importClause.namedBindings) {
107296
- return visibleDefaultBinding && factory2.updateImportDeclaration(decl, decl.modifiers, factory2.updateImportClause(
107297
- decl.importClause,
107298
- decl.importClause.isTypeOnly,
107299
- visibleDefaultBinding,
107300
- /*namedBindings*/
107301
- void 0
107302
- ), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause));
107194
+ return visibleDefaultBinding && factory2.updateImportDeclaration(
107195
+ decl,
107196
+ decl.modifiers,
107197
+ factory2.updateImportClause(
107198
+ decl.importClause,
107199
+ decl.importClause.isTypeOnly,
107200
+ visibleDefaultBinding,
107201
+ /*namedBindings*/
107202
+ void 0
107203
+ ),
107204
+ rewriteModuleSpecifier(decl, decl.moduleSpecifier),
107205
+ getResolutionModeOverrideForClauseInNightly(decl.assertClause)
107206
+ );
107303
107207
  }
107304
107208
  if (decl.importClause.namedBindings.kind === 274 /* NamespaceImport */) {
107305
107209
  const namedBindings = resolver.isDeclarationVisible(decl.importClause.namedBindings) ? decl.importClause.namedBindings : (
107306
107210
  /*namedBindings*/
107307
107211
  void 0
107308
107212
  );
107309
- return visibleDefaultBinding || namedBindings ? factory2.updateImportDeclaration(decl, decl.modifiers, factory2.updateImportClause(
107310
- decl.importClause,
107311
- decl.importClause.isTypeOnly,
107312
- visibleDefaultBinding,
107313
- namedBindings
107314
- ), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause)) : void 0;
107213
+ return visibleDefaultBinding || namedBindings ? factory2.updateImportDeclaration(
107214
+ decl,
107215
+ decl.modifiers,
107216
+ factory2.updateImportClause(
107217
+ decl.importClause,
107218
+ decl.importClause.isTypeOnly,
107219
+ visibleDefaultBinding,
107220
+ namedBindings
107221
+ ),
107222
+ rewriteModuleSpecifier(decl, decl.moduleSpecifier),
107223
+ getResolutionModeOverrideForClauseInNightly(decl.assertClause)
107224
+ ) : void 0;
107315
107225
  }
107316
107226
  const bindingList = mapDefined(decl.importClause.namedBindings.elements, (b) => resolver.isDeclarationVisible(b) ? b : void 0);
107317
107227
  if (bindingList && bindingList.length || visibleDefaultBinding) {
@@ -107969,13 +107879,16 @@ function transformDeclarations(context) {
107969
107879
  return;
107970
107880
  getSymbolAccessibilityDiagnostic = createGetSymbolAccessibilityDiagnosticForNode(param);
107971
107881
  if (param.name.kind === 80 /* Identifier */) {
107972
- return preserveJsDoc(factory2.createPropertyDeclaration(
107973
- ensureModifiers(param),
107974
- param.name,
107975
- param.questionToken,
107976
- ensureType(param, param.type),
107977
- ensureNoInitializer(param)
107978
- ), param);
107882
+ return preserveJsDoc(
107883
+ factory2.createPropertyDeclaration(
107884
+ ensureModifiers(param),
107885
+ param.name,
107886
+ param.questionToken,
107887
+ ensureType(param, param.type),
107888
+ ensureNoInitializer(param)
107889
+ ),
107890
+ param
107891
+ );
107979
107892
  } else {
107980
107893
  return walkBindingPattern(param.name);
107981
107894
  }
@@ -108051,14 +107964,17 @@ function transformDeclarations(context) {
108051
107964
  }
108052
107965
  return factory2.updateHeritageClause(clause, visitNodes2(factory2.createNodeArray(filter(clause.types, (t) => isEntityNameExpression(t.expression) || t.expression.kind === 106 /* NullKeyword */)), visitDeclarationSubtree, isExpressionWithTypeArguments));
108053
107966
  }));
108054
- return [statement, cleanup(factory2.updateClassDeclaration(
108055
- input,
108056
- modifiers,
108057
- input.name,
108058
- typeParameters,
108059
- heritageClauses,
108060
- members
108061
- ))];
107967
+ return [
107968
+ statement,
107969
+ cleanup(factory2.updateClassDeclaration(
107970
+ input,
107971
+ modifiers,
107972
+ input.name,
107973
+ typeParameters,
107974
+ heritageClauses,
107975
+ members
107976
+ ))
107977
+ ];
108062
107978
  } else {
108063
107979
  const heritageClauses = transformHeritageClauses(input.heritageClauses);
108064
107980
  return cleanup(factory2.updateClassDeclaration(
@@ -108075,13 +107991,18 @@ function transformDeclarations(context) {
108075
107991
  return cleanup(transformVariableStatement(input));
108076
107992
  }
108077
107993
  case 266 /* EnumDeclaration */: {
108078
- return cleanup(factory2.updateEnumDeclaration(input, factory2.createNodeArray(ensureModifiers(input)), input.name, factory2.createNodeArray(mapDefined(input.members, (m) => {
108079
- if (shouldStripInternal(m))
108080
- return;
108081
- const constValue = resolver.getConstantValue(m);
108082
- const newInitializer = constValue === void 0 ? void 0 : typeof constValue === "string" ? factory2.createStringLiteral(constValue) : constValue < 0 ? factory2.createPrefixUnaryExpression(41 /* MinusToken */, factory2.createNumericLiteral(Math.abs(constValue))) : factory2.createNumericLiteral(constValue);
108083
- return preserveJsDoc(factory2.updateEnumMember(m, m.name, newInitializer), m);
108084
- }))));
107994
+ return cleanup(factory2.updateEnumDeclaration(
107995
+ input,
107996
+ factory2.createNodeArray(ensureModifiers(input)),
107997
+ input.name,
107998
+ factory2.createNodeArray(mapDefined(input.members, (m) => {
107999
+ if (shouldStripInternal(m))
108000
+ return;
108001
+ const constValue = resolver.getConstantValue(m);
108002
+ const newInitializer = constValue === void 0 ? void 0 : typeof constValue === "string" ? factory2.createStringLiteral(constValue) : constValue < 0 ? factory2.createPrefixUnaryExpression(41 /* MinusToken */, factory2.createNumericLiteral(Math.abs(constValue))) : factory2.createNumericLiteral(constValue);
108003
+ return preserveJsDoc(factory2.updateEnumMember(m, m.name, newInitializer), m);
108004
+ }))
108005
+ ));
108085
108006
  }
108086
108007
  }
108087
108008
  return Debug.assertNever(input, `Unhandled top-level node in declaration emit: ${Debug.formatSyntaxKind(input.kind)}`);
@@ -108205,9 +108126,19 @@ function transformDeclarations(context) {
108205
108126
  return accessorType;
108206
108127
  }
108207
108128
  function transformHeritageClauses(nodes) {
108208
- return factory2.createNodeArray(filter(map(nodes, (clause) => factory2.updateHeritageClause(clause, visitNodes2(factory2.createNodeArray(filter(clause.types, (t) => {
108209
- return isEntityNameExpression(t.expression) || clause.token === 96 /* ExtendsKeyword */ && t.expression.kind === 106 /* NullKeyword */;
108210
- })), visitDeclarationSubtree, isExpressionWithTypeArguments))), (clause) => clause.types && !!clause.types.length));
108129
+ return factory2.createNodeArray(filter(
108130
+ map(nodes, (clause) => factory2.updateHeritageClause(
108131
+ clause,
108132
+ visitNodes2(
108133
+ factory2.createNodeArray(filter(clause.types, (t) => {
108134
+ return isEntityNameExpression(t.expression) || clause.token === 96 /* ExtendsKeyword */ && t.expression.kind === 106 /* NullKeyword */;
108135
+ })),
108136
+ visitDeclarationSubtree,
108137
+ isExpressionWithTypeArguments
108138
+ )
108139
+ )),
108140
+ (clause) => clause.types && !!clause.types.length
108141
+ ));
108211
108142
  }
108212
108143
  }
108213
108144
  function isAlwaysType(node) {
@@ -110544,14 +110475,8 @@ function createPrinter(printerOptions = {}, handlers = {}) {
110544
110475
  nonEscapingWrite(`}`);
110545
110476
  }
110546
110477
  function emitTabStop(hint, node, snippet) {
110547
- Debug.assert(
110548
- node.kind === 242 /* EmptyStatement */,
110549
- `A tab stop cannot be attached to a node of kind ${Debug.formatSyntaxKind(node.kind)}.`
110550
- );
110551
- Debug.assert(
110552
- hint !== 5 /* EmbeddedStatement */,
110553
- `A tab stop cannot be attached to an embedded statement.`
110554
- );
110478
+ Debug.assert(node.kind === 242 /* EmptyStatement */, `A tab stop cannot be attached to a node of kind ${Debug.formatSyntaxKind(node.kind)}.`);
110479
+ Debug.assert(hint !== 5 /* EmbeddedStatement */, `A tab stop cannot be attached to an embedded statement.`);
110555
110480
  nonEscapingWrite(`$${snippet.order}`);
110556
110481
  }
110557
110482
  function emitIdentifier(node) {
@@ -111976,7 +111901,10 @@ function createPrinter(printerOptions = {}, handlers = {}) {
111976
111901
  emitTokenWithComment(90 /* DefaultKeyword */, nextPos, writeKeyword, node);
111977
111902
  }
111978
111903
  writeSpace();
111979
- emitExpression(node.expression, node.isExportEquals ? parenthesizer.getParenthesizeRightSideOfBinaryForOperator(64 /* EqualsToken */) : parenthesizer.parenthesizeExpressionOfExportDefault);
111904
+ emitExpression(
111905
+ node.expression,
111906
+ node.isExportEquals ? parenthesizer.getParenthesizeRightSideOfBinaryForOperator(64 /* EqualsToken */) : parenthesizer.parenthesizeExpressionOfExportDefault
111907
+ );
111980
111908
  writeTrailingSemicolon();
111981
111909
  }
111982
111910
  function emitExportDeclaration(node) {
@@ -115523,7 +115451,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
115523
115451
  getCanonicalFileName,
115524
115452
  /*options*/
115525
115453
  void 0,
115526
- moduleResolutionCache == null ? void 0 : moduleResolutionCache.getPackageJsonInfoCache()
115454
+ moduleResolutionCache == null ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(),
115455
+ moduleResolutionCache == null ? void 0 : moduleResolutionCache.optionsToRedirectsKey
115527
115456
  );
115528
115457
  actualResolveTypeReferenceDirectiveNamesWorker = (typeDirectiveNames, containingFile, redirectedReference, options2, containingSourceFile) => loadWithModeAwareCache(
115529
115458
  typeDirectiveNames,
@@ -118160,19 +118089,11 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118160
118089
  case 1 /* SourceFromProjectReference */:
118161
118090
  case 2 /* OutputFromProjectReference */:
118162
118091
  const referencedResolvedRef = Debug.checkDefined(resolvedProjectReferences == null ? void 0 : resolvedProjectReferences[reason.index]);
118163
- const referenceInfo = forEachProjectReference(
118164
- projectReferences,
118165
- resolvedProjectReferences,
118166
- (resolvedRef, parent, index2) => resolvedRef === referencedResolvedRef ? { sourceFile: (parent == null ? void 0 : parent.sourceFile) || options.configFile, index: index2 } : void 0
118167
- );
118092
+ const referenceInfo = forEachProjectReference(projectReferences, resolvedProjectReferences, (resolvedRef, parent, index2) => resolvedRef === referencedResolvedRef ? { sourceFile: (parent == null ? void 0 : parent.sourceFile) || options.configFile, index: index2 } : void 0);
118168
118093
  if (!referenceInfo)
118169
118094
  return void 0;
118170
118095
  const { sourceFile, index } = referenceInfo;
118171
- const referencesSyntax = forEachTsConfigPropArray(
118172
- sourceFile,
118173
- "references",
118174
- (property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0
118175
- );
118096
+ const referencesSyntax = forEachTsConfigPropArray(sourceFile, "references", (property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0);
118176
118097
  return referencesSyntax && referencesSyntax.elements.length > index ? createDiagnosticForNodeInSourceFile(
118177
118098
  sourceFile,
118178
118099
  referencesSyntax.elements[index],
@@ -118312,11 +118233,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118312
118233
  );
118313
118234
  }
118314
118235
  function createDiagnosticForReference(sourceFile, index, message, ...args) {
118315
- const referencesSyntax = forEachTsConfigPropArray(
118316
- sourceFile || options.configFile,
118317
- "references",
118318
- (property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0
118319
- );
118236
+ const referencesSyntax = forEachTsConfigPropArray(sourceFile || options.configFile, "references", (property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0);
118320
118237
  if (referencesSyntax && referencesSyntax.elements.length > index) {
118321
118238
  programDiagnostics.add(createDiagnosticForNodeInSourceFile(sourceFile || options.configFile, referencesSyntax.elements[index], message, ...args));
118322
118239
  } else {
@@ -118910,13 +118827,16 @@ var BuilderState;
118910
118827
  sourceFile,
118911
118828
  (fileName, text, _writeByteOrderMark, _onError, sourceFiles, data) => {
118912
118829
  Debug.assert(isDeclarationFileName(fileName), `File extension for signature expected to be dts: Got:: ${fileName}`);
118913
- onNewSignature(computeSignatureWithDiagnostics(
118914
- programOfThisState,
118915
- sourceFile,
118916
- text,
118917
- host,
118918
- data
118919
- ), sourceFiles);
118830
+ onNewSignature(
118831
+ computeSignatureWithDiagnostics(
118832
+ programOfThisState,
118833
+ sourceFile,
118834
+ text,
118835
+ host,
118836
+ data
118837
+ ),
118838
+ sourceFiles
118839
+ );
118920
118840
  },
118921
118841
  cancellationToken,
118922
118842
  /*emitOnly*/
@@ -119428,10 +119348,7 @@ function removeDiagnosticsOfLibraryFiles(state) {
119428
119348
  state.cleanedDiagnosticsOfLibFiles = true;
119429
119349
  const program = Debug.checkDefined(state.program);
119430
119350
  const options = program.getCompilerOptions();
119431
- forEach(
119432
- program.getSourceFiles(),
119433
- (f) => program.isSourceFileDefaultLibrary(f) && !skipTypeChecking(f, options, program) && removeSemanticDiagnosticsOf(state, f.resolvedPath)
119434
- );
119351
+ forEach(program.getSourceFiles(), (f) => program.isSourceFileDefaultLibrary(f) && !skipTypeChecking(f, options, program) && removeSemanticDiagnosticsOf(state, f.resolvedPath));
119435
119352
  }
119436
119353
  }
119437
119354
  function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, host) {
@@ -119499,12 +119416,14 @@ function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, hos
119499
119416
  state.program,
119500
119417
  /*firstSourceFile*/
119501
119418
  void 0
119502
- ).forEach((file) => handleDtsMayChangeOf(
119503
- state,
119504
- file.resolvedPath,
119505
- cancellationToken,
119506
- host
119507
- ));
119419
+ ).forEach(
119420
+ (file) => handleDtsMayChangeOf(
119421
+ state,
119422
+ file.resolvedPath,
119423
+ cancellationToken,
119424
+ host
119425
+ )
119426
+ );
119508
119427
  removeDiagnosticsOfLibraryFiles(state);
119509
119428
  return true;
119510
119429
  }
@@ -119537,16 +119456,13 @@ function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile
119537
119456
  if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, host))
119538
119457
  return true;
119539
119458
  const references = state.referencedMap.getKeys(exportedFromPath);
119540
- return references && forEachKey(
119541
- references,
119542
- (filePath) => handleDtsMayChangeOfFileAndExportsOfFile(
119543
- state,
119544
- filePath,
119545
- seenFileAndExportsOfFile,
119546
- cancellationToken,
119547
- host
119548
- )
119549
- );
119459
+ return references && forEachKey(references, (filePath) => handleDtsMayChangeOfFileAndExportsOfFile(
119460
+ state,
119461
+ filePath,
119462
+ seenFileAndExportsOfFile,
119463
+ cancellationToken,
119464
+ host
119465
+ ));
119550
119466
  });
119551
119467
  }
119552
119468
  function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, host) {
@@ -119654,11 +119570,13 @@ function getBuildInfo2(state, bundle) {
119654
119570
  if (!isJsonSourceFile(file) && sourceFileMayBeEmitted(file, state.program)) {
119655
119571
  const emitSignature = (_b2 = state.emitSignatures) == null ? void 0 : _b2.get(key);
119656
119572
  if (emitSignature !== actualSignature) {
119657
- (emitSignatures || (emitSignatures = [])).push(emitSignature === void 0 ? fileId : (
119658
- // There is no emit, encode as false
119659
- // fileId, signature: emptyArray if signature only differs in dtsMap option than our own compilerOptions otherwise EmitSignature
119660
- [fileId, !isString(emitSignature) && emitSignature[0] === actualSignature ? emptyArray : emitSignature]
119661
- ));
119573
+ (emitSignatures || (emitSignatures = [])).push(
119574
+ emitSignature === void 0 ? fileId : (
119575
+ // There is no emit, encode as false
119576
+ // fileId, signature: emptyArray if signature only differs in dtsMap option than our own compilerOptions otherwise EmitSignature
119577
+ [fileId, !isString(emitSignature) && emitSignature[0] === actualSignature ? emptyArray : emitSignature]
119578
+ )
119579
+ );
119662
119580
  }
119663
119581
  }
119664
119582
  }
@@ -119912,9 +119830,7 @@ function computeSignatureWithDiagnostics(program, sourceFile, text, host, data)
119912
119830
  text = getTextHandlingSourceMapForSignature(text, data);
119913
119831
  let sourceFileDirectory;
119914
119832
  if ((_a = data == null ? void 0 : data.diagnostics) == null ? void 0 : _a.length) {
119915
- text += data.diagnostics.map(
119916
- (diagnostic) => `${locationInfo(diagnostic)}${DiagnosticCategory[diagnostic.category]}${diagnostic.code}: ${flattenDiagnosticMessageText2(diagnostic.messageText)}`
119917
- ).join("\n");
119833
+ text += data.diagnostics.map((diagnostic) => `${locationInfo(diagnostic)}${DiagnosticCategory[diagnostic.category]}${diagnostic.code}: ${flattenDiagnosticMessageText2(diagnostic.messageText)}`).join("\n");
119918
119834
  }
119919
119835
  return (host.createHash ?? generateDjb2Hash)(text);
119920
119836
  function flattenDiagnosticMessageText2(diagnostic) {
@@ -120321,9 +120237,7 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
120321
120237
  return void 0;
120322
120238
  }
120323
120239
  const map2 = BuilderState.createManyToManyPathMap();
120324
- referenceMap.forEach(
120325
- ([fileId, fileIdListId]) => map2.set(toFilePath(fileId), toFilePathsSet(fileIdListId))
120326
- );
120240
+ referenceMap.forEach(([fileId, fileIdListId]) => map2.set(toFilePath(fileId), toFilePathsSet(fileIdListId)));
120327
120241
  return map2;
120328
120242
  }
120329
120243
  }
@@ -120538,7 +120452,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
120538
120452
  getCurrentDirectory(),
120539
120453
  resolutionHost.getCanonicalFileName,
120540
120454
  resolutionHost.getCompilationSettings(),
120541
- moduleResolutionCache.getPackageJsonInfoCache()
120455
+ moduleResolutionCache.getPackageJsonInfoCache(),
120456
+ moduleResolutionCache.optionsToRedirectsKey
120542
120457
  );
120543
120458
  const resolvedLibraries = /* @__PURE__ */ new Map();
120544
120459
  const libraryResolutionCache = createModuleResolutionCache(
@@ -120812,11 +120727,13 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
120812
120727
  seenNamesInFile.set(name, mode, true);
120813
120728
  resolvedModules.push(resolution);
120814
120729
  }
120815
- reusedNames == null ? void 0 : reusedNames.forEach((entry) => seenNamesInFile.set(
120816
- loader.nameAndMode.getName(entry),
120817
- loader.nameAndMode.getMode(entry, containingSourceFile),
120818
- true
120819
- ));
120730
+ reusedNames == null ? void 0 : reusedNames.forEach(
120731
+ (entry) => seenNamesInFile.set(
120732
+ loader.nameAndMode.getName(entry),
120733
+ loader.nameAndMode.getMode(entry, containingSourceFile),
120734
+ true
120735
+ )
120736
+ );
120820
120737
  if (resolutionsInFile.size() !== seenNamesInFile.size()) {
120821
120738
  resolutionsInFile.forEach((resolution, name, mode) => {
120822
120739
  if (!seenNamesInFile.has(name, mode)) {
@@ -121445,10 +121362,7 @@ function getFilesInErrorForSummary(diagnostics) {
121445
121362
  if (fileName === void 0) {
121446
121363
  return void 0;
121447
121364
  }
121448
- const diagnosticForFileName = find(
121449
- diagnostics,
121450
- (diagnostic) => diagnostic.file !== void 0 && diagnostic.file.fileName === fileName
121451
- );
121365
+ const diagnosticForFileName = find(diagnostics, (diagnostic) => diagnostic.file !== void 0 && diagnostic.file.fileName === fileName);
121452
121366
  if (diagnosticForFileName !== void 0) {
121453
121367
  const { line } = getLineAndCharacterOfPosition(diagnosticForFileName.file, diagnosticForFileName.start);
121454
121368
  return {
@@ -122467,14 +122381,16 @@ function createWatchProgram(host) {
122467
122381
  }
122468
122382
  function parseConfigFile2() {
122469
122383
  Debug.assert(configFileName);
122470
- setConfigFileParsingResult(getParsedCommandLineOfConfigFile(
122471
- configFileName,
122472
- optionsToExtendForConfigFile,
122473
- parseConfigFileHost,
122474
- extendedConfigCache || (extendedConfigCache = /* @__PURE__ */ new Map()),
122475
- watchOptionsToExtend,
122476
- extraFileExtensions
122477
- ));
122384
+ setConfigFileParsingResult(
122385
+ getParsedCommandLineOfConfigFile(
122386
+ configFileName,
122387
+ optionsToExtendForConfigFile,
122388
+ parseConfigFileHost,
122389
+ extendedConfigCache || (extendedConfigCache = /* @__PURE__ */ new Map()),
122390
+ watchOptionsToExtend,
122391
+ extraFileExtensions
122392
+ )
122393
+ );
122478
122394
  }
122479
122395
  function setConfigFileParsingResult(configFileParseResult) {
122480
122396
  rootFileNames = configFileParseResult.fileNames;
@@ -122842,7 +122758,8 @@ function createSolutionBuilderState(watch, hostOrHostWithWatch, rootNames, optio
122842
122758
  compilerHost.getCanonicalFileName,
122843
122759
  /*options*/
122844
122760
  void 0,
122845
- moduleResolutionCache == null ? void 0 : moduleResolutionCache.getPackageJsonInfoCache()
122761
+ moduleResolutionCache == null ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(),
122762
+ moduleResolutionCache == null ? void 0 : moduleResolutionCache.optionsToRedirectsKey
122846
122763
  );
122847
122764
  compilerHost.resolveTypeReferenceDirectiveReferences = (typeDirectiveNames, containingFile, redirectedReference, options2, containingSourceFile) => loadWithModeAwareCache(
122848
122765
  typeDirectiveNames,
@@ -123311,10 +123228,13 @@ function createBuildOrUpdateInvalidedProject(kind, state, project, projectPath,
123311
123228
  config.projectReferences
123312
123229
  );
123313
123230
  if (state.watch) {
123314
- state.lastCachedPackageJsonLookups.set(projectPath, state.moduleResolutionCache && map(
123315
- state.moduleResolutionCache.getPackageJsonInfoCache().entries(),
123316
- ([path, data]) => [state.host.realpath && data ? toPath2(state, state.host.realpath(path)) : path, data]
123317
- ));
123231
+ state.lastCachedPackageJsonLookups.set(
123232
+ projectPath,
123233
+ state.moduleResolutionCache && map(
123234
+ state.moduleResolutionCache.getPackageJsonInfoCache().entries(),
123235
+ ([path, data]) => [state.host.realpath && data ? toPath2(state, state.host.realpath(path)) : path, data]
123236
+ )
123237
+ );
123318
123238
  state.builderPrograms.set(projectPath, program);
123319
123239
  }
123320
123240
  step++;
@@ -124368,15 +124288,18 @@ function buildNextInvalidatedProjectWorker(state, changeDetected) {
124368
124288
  function watchConfigFile(state, resolved, resolvedPath, parsed) {
124369
124289
  if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath))
124370
124290
  return;
124371
- state.allWatchedConfigFiles.set(resolvedPath, watchFile(
124372
- state,
124373
- resolved,
124374
- () => invalidateProjectAndScheduleBuilds(state, resolvedPath, 2 /* Full */),
124375
- 2e3 /* High */,
124376
- parsed == null ? void 0 : parsed.watchOptions,
124377
- WatchType.ConfigFile,
124378
- resolved
124379
- ));
124291
+ state.allWatchedConfigFiles.set(
124292
+ resolvedPath,
124293
+ watchFile(
124294
+ state,
124295
+ resolved,
124296
+ () => invalidateProjectAndScheduleBuilds(state, resolvedPath, 2 /* Full */),
124297
+ 2e3 /* High */,
124298
+ parsed == null ? void 0 : parsed.watchOptions,
124299
+ WatchType.ConfigFile,
124300
+ resolved
124301
+ )
124302
+ );
124380
124303
  }
124381
124304
  function watchExtendedConfigFiles(state, resolvedPath, parsed) {
124382
124305
  updateSharedExtendedConfigFileWatcher(
@@ -125656,11 +125579,7 @@ function enableStatisticsAndTracing(system, compilerOptions, isBuildMode) {
125656
125579
  enable(system);
125657
125580
  }
125658
125581
  if (canTrace(system, compilerOptions)) {
125659
- startTracing(
125660
- isBuildMode ? "build" : "project",
125661
- compilerOptions.generateTrace,
125662
- compilerOptions.configFilePath
125663
- );
125582
+ startTracing(isBuildMode ? "build" : "project", compilerOptions.generateTrace, compilerOptions.configFilePath);
125664
125583
  }
125665
125584
  }
125666
125585
  function isSolutionMarkOrMeasure(name) {