typescript 4.7.0-dev.20220309 → 4.7.0-dev.20220312

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -89,7 +89,7 @@ var ts;
89
89
  // The following is baselined as a literal template type without intervention
90
90
  /** The version of the TypeScript compiler release */
91
91
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
92
- ts.version = ts.versionMajorMinor + ".0-dev.20220309";
92
+ ts.version = ts.versionMajorMinor + ".0-dev.20220312";
93
93
  /* @internal */
94
94
  var Comparison;
95
95
  (function (Comparison) {
@@ -1457,6 +1457,159 @@ var ts;
1457
1457
  return createMultiMap();
1458
1458
  }
1459
1459
  ts.createUnderscoreEscapedMultiMap = createUnderscoreEscapedMultiMap;
1460
+ /**
1461
+ * Creates a Set with custom equality and hash code functionality. This is useful when you
1462
+ * want to use something looser than object identity - e.g. "has the same span".
1463
+ *
1464
+ * If `equals(a, b)`, it must be the case that `getHashCode(a) === getHashCode(b)`.
1465
+ * The converse is not required.
1466
+ *
1467
+ * To facilitate a perf optimization (lazy allocation of bucket arrays), `TElement` is
1468
+ * assumed not to be an array type.
1469
+ */
1470
+ function createSet(getHashCode, equals) {
1471
+ var multiMap = new ts.Map();
1472
+ var size = 0;
1473
+ function getElementIterator() {
1474
+ var valueIt = multiMap.values();
1475
+ var arrayIt;
1476
+ return {
1477
+ next: function () {
1478
+ while (true) {
1479
+ if (arrayIt) {
1480
+ var n = arrayIt.next();
1481
+ if (!n.done) {
1482
+ return { value: n.value };
1483
+ }
1484
+ arrayIt = undefined;
1485
+ }
1486
+ else {
1487
+ var n = valueIt.next();
1488
+ if (n.done) {
1489
+ return { value: undefined, done: true };
1490
+ }
1491
+ if (!isArray(n.value)) {
1492
+ return { value: n.value };
1493
+ }
1494
+ arrayIt = arrayIterator(n.value);
1495
+ }
1496
+ }
1497
+ }
1498
+ };
1499
+ }
1500
+ var set = {
1501
+ has: function (element) {
1502
+ var hash = getHashCode(element);
1503
+ if (!multiMap.has(hash))
1504
+ return false;
1505
+ var candidates = multiMap.get(hash);
1506
+ if (!isArray(candidates))
1507
+ return equals(candidates, element);
1508
+ for (var _i = 0, candidates_1 = candidates; _i < candidates_1.length; _i++) {
1509
+ var candidate = candidates_1[_i];
1510
+ if (equals(candidate, element)) {
1511
+ return true;
1512
+ }
1513
+ }
1514
+ return false;
1515
+ },
1516
+ add: function (element) {
1517
+ var hash = getHashCode(element);
1518
+ if (multiMap.has(hash)) {
1519
+ var values = multiMap.get(hash);
1520
+ if (isArray(values)) {
1521
+ if (!contains(values, element, equals)) {
1522
+ values.push(element);
1523
+ size++;
1524
+ }
1525
+ }
1526
+ else {
1527
+ var value = values;
1528
+ if (!equals(value, element)) {
1529
+ multiMap.set(hash, [value, element]);
1530
+ size++;
1531
+ }
1532
+ }
1533
+ }
1534
+ else {
1535
+ multiMap.set(hash, element);
1536
+ size++;
1537
+ }
1538
+ return this;
1539
+ },
1540
+ delete: function (element) {
1541
+ var hash = getHashCode(element);
1542
+ if (!multiMap.has(hash))
1543
+ return false;
1544
+ var candidates = multiMap.get(hash);
1545
+ if (isArray(candidates)) {
1546
+ for (var i = 0; i < candidates.length; i++) {
1547
+ if (equals(candidates[i], element)) {
1548
+ if (candidates.length === 1) {
1549
+ multiMap.delete(hash);
1550
+ }
1551
+ else if (candidates.length === 2) {
1552
+ multiMap.set(hash, candidates[1 - i]);
1553
+ }
1554
+ else {
1555
+ unorderedRemoveItemAt(candidates, i);
1556
+ }
1557
+ size--;
1558
+ return true;
1559
+ }
1560
+ }
1561
+ }
1562
+ else {
1563
+ var candidate = candidates;
1564
+ if (equals(candidate, element)) {
1565
+ multiMap.delete(hash);
1566
+ size--;
1567
+ return true;
1568
+ }
1569
+ }
1570
+ return false;
1571
+ },
1572
+ clear: function () {
1573
+ multiMap.clear();
1574
+ size = 0;
1575
+ },
1576
+ get size() {
1577
+ return size;
1578
+ },
1579
+ forEach: function (action) {
1580
+ for (var _i = 0, _a = arrayFrom(multiMap.values()); _i < _a.length; _i++) {
1581
+ var elements = _a[_i];
1582
+ if (isArray(elements)) {
1583
+ for (var _b = 0, elements_1 = elements; _b < elements_1.length; _b++) {
1584
+ var element = elements_1[_b];
1585
+ action(element, element);
1586
+ }
1587
+ }
1588
+ else {
1589
+ var element = elements;
1590
+ action(element, element);
1591
+ }
1592
+ }
1593
+ },
1594
+ keys: function () {
1595
+ return getElementIterator();
1596
+ },
1597
+ values: function () {
1598
+ return getElementIterator();
1599
+ },
1600
+ entries: function () {
1601
+ var it = getElementIterator();
1602
+ return {
1603
+ next: function () {
1604
+ var n = it.next();
1605
+ return n.done ? n : { value: [n.value, n.value] };
1606
+ }
1607
+ };
1608
+ },
1609
+ };
1610
+ return set;
1611
+ }
1612
+ ts.createSet = createSet;
1460
1613
  /**
1461
1614
  * Tests whether a value is an array.
1462
1615
  */
@@ -1850,8 +2003,8 @@ var ts;
1850
2003
  var maximumLengthDifference = Math.min(2, Math.floor(name.length * 0.34));
1851
2004
  var bestDistance = Math.floor(name.length * 0.4) + 1; // If the best result is worse than this, don't bother.
1852
2005
  var bestCandidate;
1853
- for (var _i = 0, candidates_1 = candidates; _i < candidates_1.length; _i++) {
1854
- var candidate = candidates_1[_i];
2006
+ for (var _i = 0, candidates_2 = candidates; _i < candidates_2.length; _i++) {
2007
+ var candidate = candidates_2[_i];
1855
2008
  var candidateName = getName(candidate);
1856
2009
  if (candidateName !== undefined && Math.abs(candidateName.length - name.length) <= maximumLengthDifference) {
1857
2010
  if (candidateName === name) {
@@ -2088,13 +2241,15 @@ var ts;
2088
2241
  for (var _i = 0; _i < arguments.length; _i++) {
2089
2242
  args[_i] = arguments[_i];
2090
2243
  }
2244
+ var lastResult;
2091
2245
  for (var _a = 0, fs_1 = fs; _a < fs_1.length; _a++) {
2092
2246
  var f = fs_1[_a];
2093
- if (f.apply(void 0, args)) {
2094
- return true;
2247
+ lastResult = f.apply(void 0, args);
2248
+ if (lastResult) {
2249
+ return lastResult;
2095
2250
  }
2096
2251
  }
2097
- return false;
2252
+ return lastResult;
2098
2253
  };
2099
2254
  }
2100
2255
  ts.or = or;
@@ -4153,6 +4308,7 @@ var ts;
4153
4308
  SyntaxKind[SyntaxKind["JSDocFunctionType"] = 316] = "JSDocFunctionType";
4154
4309
  SyntaxKind[SyntaxKind["JSDocVariadicType"] = 317] = "JSDocVariadicType";
4155
4310
  SyntaxKind[SyntaxKind["JSDocNamepathType"] = 318] = "JSDocNamepathType";
4311
+ /** @deprecated Use SyntaxKind.JSDoc */
4156
4312
  SyntaxKind[SyntaxKind["JSDocComment"] = 319] = "JSDocComment";
4157
4313
  SyntaxKind[SyntaxKind["JSDocText"] = 320] = "JSDocText";
4158
4314
  SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 321] = "JSDocTypeLiteral";
@@ -4226,6 +4382,7 @@ var ts;
4226
4382
  SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 346] = "LastJSDocTagNode";
4227
4383
  /* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 126] = "FirstContextualKeyword";
4228
4384
  /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 159] = "LastContextualKeyword";
4385
+ SyntaxKind[SyntaxKind["JSDoc"] = 319] = "JSDoc";
4229
4386
  })(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {}));
4230
4387
  var NodeFlags;
4231
4388
  (function (NodeFlags) {
@@ -5112,6 +5269,21 @@ var ts;
5112
5269
  ModuleResolutionKind[ModuleResolutionKind["Node12"] = 3] = "Node12";
5113
5270
  ModuleResolutionKind[ModuleResolutionKind["NodeNext"] = 99] = "NodeNext";
5114
5271
  })(ModuleResolutionKind = ts.ModuleResolutionKind || (ts.ModuleResolutionKind = {}));
5272
+ var ModuleDetectionKind;
5273
+ (function (ModuleDetectionKind) {
5274
+ /**
5275
+ * Files with imports, exports and/or import.meta are considered modules
5276
+ */
5277
+ ModuleDetectionKind[ModuleDetectionKind["Legacy"] = 1] = "Legacy";
5278
+ /**
5279
+ * Legacy, but also files with jsx under react-jsx or react-jsxdev and esm mode files under moduleResolution: node12+
5280
+ */
5281
+ ModuleDetectionKind[ModuleDetectionKind["Auto"] = 2] = "Auto";
5282
+ /**
5283
+ * Consider all non-declaration files modules, regardless of present syntax
5284
+ */
5285
+ ModuleDetectionKind[ModuleDetectionKind["Force"] = 3] = "Force";
5286
+ })(ModuleDetectionKind = ts.ModuleDetectionKind || (ts.ModuleDetectionKind = {}));
5115
5287
  var WatchFileKind;
5116
5288
  (function (WatchFileKind) {
5117
5289
  WatchFileKind[WatchFileKind["FixedPollingInterval"] = 0] = "FixedPollingInterval";
@@ -8209,6 +8381,8 @@ var ts;
8209
8381
  catch_or_finally_expected: diag(1472, ts.DiagnosticCategory.Error, "catch_or_finally_expected_1472", "'catch' or 'finally' expected."),
8210
8382
  An_import_declaration_can_only_be_used_at_the_top_level_of_a_module: diag(1473, ts.DiagnosticCategory.Error, "An_import_declaration_can_only_be_used_at_the_top_level_of_a_module_1473", "An import declaration can only be used at the top level of a module."),
8211
8383
  An_export_declaration_can_only_be_used_at_the_top_level_of_a_module: diag(1474, ts.DiagnosticCategory.Error, "An_export_declaration_can_only_be_used_at_the_top_level_of_a_module_1474", "An export declaration can only be used at the top level of a module."),
8384
+ Control_what_method_is_used_to_detect_module_format_JS_files: diag(1475, ts.DiagnosticCategory.Message, "Control_what_method_is_used_to_detect_module_format_JS_files_1475", "Control what method is used to detect module-format JS files."),
8385
+ auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_with_module_Colon_node12_as_modules: diag(1476, ts.DiagnosticCategory.Message, "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476", "\"auto\": Treat files with imports, exports, import.meta, jsx (with jsx: react-jsx), or esm format (with module: node12+) as modules."),
8212
8386
  The_types_of_0_are_incompatible_between_these_types: diag(2200, ts.DiagnosticCategory.Error, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
8213
8387
  The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, ts.DiagnosticCategory.Error, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
8214
8388
  Call_signature_return_types_0_and_1_are_incompatible: diag(2202, ts.DiagnosticCategory.Error, "Call_signature_return_types_0_and_1_are_incompatible_2202", "Call signature return types '{0}' and '{1}' are incompatible.", /*reportsUnnecessary*/ undefined, /*elidedInCompatabilityPyramid*/ true),
@@ -12822,7 +12996,7 @@ var ts;
12822
12996
  return ts.emptyArray;
12823
12997
  }
12824
12998
  if (ts.isJSDocTypeAlias(node)) {
12825
- ts.Debug.assert(node.parent.kind === 319 /* JSDocComment */);
12999
+ ts.Debug.assert(node.parent.kind === 319 /* JSDoc */);
12826
13000
  return ts.flatMap(node.parent.tags, function (tag) { return ts.isJSDocTemplateTag(tag) ? tag.typeParameters : undefined; });
12827
13001
  }
12828
13002
  if (node.typeParameters) {
@@ -13769,7 +13943,7 @@ var ts;
13769
13943
  ts.isJSDocNode = isJSDocNode;
13770
13944
  /** True if node is of a kind that may contain comment text. */
13771
13945
  function isJSDocCommentContainingNode(node) {
13772
- return node.kind === 319 /* JSDocComment */
13946
+ return node.kind === 319 /* JSDoc */
13773
13947
  || node.kind === 318 /* JSDocNamepathType */
13774
13948
  || node.kind === 320 /* JSDocText */
13775
13949
  || isJSDocLinkLike(node)
@@ -15334,10 +15508,23 @@ var ts;
15334
15508
  && node.parent.parent.kind === 236 /* VariableStatement */;
15335
15509
  }
15336
15510
  ts.isVariableDeclarationInVariableStatement = isVariableDeclarationInVariableStatement;
15511
+ function isCommonJsExportedExpression(node) {
15512
+ if (!isInJSFile(node))
15513
+ return false;
15514
+ return (ts.isObjectLiteralExpression(node.parent) && ts.isBinaryExpression(node.parent.parent) && getAssignmentDeclarationKind(node.parent.parent) === 2 /* ModuleExports */) ||
15515
+ isCommonJsExportPropertyAssignment(node.parent);
15516
+ }
15517
+ ts.isCommonJsExportedExpression = isCommonJsExportedExpression;
15518
+ function isCommonJsExportPropertyAssignment(node) {
15519
+ if (!isInJSFile(node))
15520
+ return false;
15521
+ return (ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 1 /* ExportsProperty */);
15522
+ }
15523
+ ts.isCommonJsExportPropertyAssignment = isCommonJsExportPropertyAssignment;
15337
15524
  function isValidESSymbolDeclaration(node) {
15338
- return ts.isVariableDeclaration(node) ? isVarConst(node) && ts.isIdentifier(node.name) && isVariableDeclarationInVariableStatement(node) :
15525
+ return (ts.isVariableDeclaration(node) ? isVarConst(node) && ts.isIdentifier(node.name) && isVariableDeclarationInVariableStatement(node) :
15339
15526
  ts.isPropertyDeclaration(node) ? hasEffectiveReadonlyModifier(node) && hasStaticModifier(node) :
15340
- ts.isPropertySignature(node) && hasEffectiveReadonlyModifier(node);
15527
+ ts.isPropertySignature(node) && hasEffectiveReadonlyModifier(node)) || isCommonJsExportPropertyAssignment(node);
15341
15528
  }
15342
15529
  ts.isValidESSymbolDeclaration = isValidESSymbolDeclaration;
15343
15530
  function introducesArgumentsExoticObject(node) {
@@ -18231,7 +18418,7 @@ var ts;
18231
18418
  ts.getJSDocTypeParameterDeclarations = getJSDocTypeParameterDeclarations;
18232
18419
  /** template tags are only available when a typedef isn't already using them */
18233
18420
  function isNonTypeAliasTemplate(tag) {
18234
- return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 319 /* JSDocComment */ && tag.parent.tags.some(isJSDocTypeAlias));
18421
+ return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 319 /* JSDoc */ && tag.parent.tags.some(isJSDocTypeAlias));
18235
18422
  }
18236
18423
  /**
18237
18424
  * Gets the effective type annotation of the value parameter of a set accessor. If the node
@@ -19705,6 +19892,61 @@ var ts;
19705
19892
  return scriptKind === 4 /* TSX */ || scriptKind === 2 /* JSX */ || scriptKind === 1 /* JS */ || scriptKind === 6 /* JSON */ ? 1 /* JSX */ : 0 /* Standard */;
19706
19893
  }
19707
19894
  ts.getLanguageVariant = getLanguageVariant;
19895
+ /**
19896
+ * This is a somewhat unavoidable full tree walk to locate a JSX tag - `import.meta` requires the same,
19897
+ * but we avoid that walk (or parts of it) if at all possible using the `PossiblyContainsImportMeta` node flag.
19898
+ * Unfortunately, there's no `NodeFlag` space to do the same for JSX.
19899
+ */
19900
+ function walkTreeForJSXTags(node) {
19901
+ if (!(node.transformFlags & 2 /* ContainsJsx */))
19902
+ return undefined;
19903
+ return ts.isJsxOpeningLikeElement(node) || ts.isJsxFragment(node) ? node : ts.forEachChild(node, walkTreeForJSXTags);
19904
+ }
19905
+ function isFileModuleFromUsingJSXTag(file) {
19906
+ // Excludes declaration files - they still require an explicit `export {}` or the like
19907
+ // for back compat purposes. (not that declaration files should contain JSX tags!)
19908
+ return !file.isDeclarationFile ? walkTreeForJSXTags(file) : undefined;
19909
+ }
19910
+ /**
19911
+ * Note that this requires file.impliedNodeFormat be set already; meaning it must be set very early on
19912
+ * in SourceFile construction.
19913
+ */
19914
+ function isFileForcedToBeModuleByFormat(file) {
19915
+ // Excludes declaration files - they still require an explicit `export {}` or the like
19916
+ // for back compat purposes.
19917
+ return file.impliedNodeFormat === ts.ModuleKind.ESNext && !file.isDeclarationFile ? true : undefined;
19918
+ }
19919
+ function getSetExternalModuleIndicator(options) {
19920
+ // TODO: Should this callback be cached?
19921
+ switch (getEmitModuleDetectionKind(options)) {
19922
+ case ts.ModuleDetectionKind.Force:
19923
+ // All non-declaration files are modules, declaration files still do the usual isFileProbablyExternalModule
19924
+ return function (file) {
19925
+ file.externalModuleIndicator = !file.isDeclarationFile || ts.isFileProbablyExternalModule(file);
19926
+ };
19927
+ case ts.ModuleDetectionKind.Legacy:
19928
+ // Files are modules if they have imports, exports, or import.meta
19929
+ return function (file) {
19930
+ file.externalModuleIndicator = ts.isFileProbablyExternalModule(file);
19931
+ };
19932
+ case ts.ModuleDetectionKind.Auto:
19933
+ // If module is nodenext or node12, all esm format files are modules
19934
+ // If jsx is react-jsx or react-jsxdev then jsx tags force module-ness
19935
+ // otherwise, the presence of import or export statments (or import.meta) implies module-ness
19936
+ var checks = [ts.isFileProbablyExternalModule];
19937
+ if (options.jsx === 4 /* ReactJSX */ || options.jsx === 5 /* ReactJSXDev */) {
19938
+ checks.push(isFileModuleFromUsingJSXTag);
19939
+ }
19940
+ var moduleKind = getEmitModuleKind(options);
19941
+ if (moduleKind === ts.ModuleKind.Node12 || moduleKind === ts.ModuleKind.NodeNext) {
19942
+ checks.push(isFileForcedToBeModuleByFormat);
19943
+ }
19944
+ var combined_1 = ts.or.apply(void 0, checks);
19945
+ var callback = function (file) { return void (file.externalModuleIndicator = combined_1(file)); };
19946
+ return callback;
19947
+ }
19948
+ }
19949
+ ts.getSetExternalModuleIndicator = getSetExternalModuleIndicator;
19708
19950
  function getEmitScriptTarget(compilerOptions) {
19709
19951
  return compilerOptions.target ||
19710
19952
  (compilerOptions.module === ts.ModuleKind.Node12 && 7 /* ES2020 */) ||
@@ -19739,6 +19981,10 @@ var ts;
19739
19981
  return moduleResolution;
19740
19982
  }
19741
19983
  ts.getEmitModuleResolutionKind = getEmitModuleResolutionKind;
19984
+ function getEmitModuleDetectionKind(options) {
19985
+ return options.moduleDetection || ts.ModuleDetectionKind.Auto;
19986
+ }
19987
+ ts.getEmitModuleDetectionKind = getEmitModuleDetectionKind;
19742
19988
  function hasJsonModuleEmitEnabled(options) {
19743
19989
  switch (getEmitModuleKind(options)) {
19744
19990
  case ts.ModuleKind.CommonJS:
@@ -25208,7 +25454,7 @@ var ts;
25208
25454
  }
25209
25455
  // @api
25210
25456
  function createJSDocComment(comment, tags) {
25211
- var node = createBaseNode(319 /* JSDocComment */);
25457
+ var node = createBaseNode(319 /* JSDoc */);
25212
25458
  node.comment = comment;
25213
25459
  node.tags = asNodeArray(tags);
25214
25460
  return node;
@@ -28717,7 +28963,7 @@ var ts;
28717
28963
  }
28718
28964
  ts.isJSDocNamepathType = isJSDocNamepathType;
28719
28965
  function isJSDoc(node) {
28720
- return node.kind === 319 /* JSDocComment */;
28966
+ return node.kind === 319 /* JSDoc */;
28721
28967
  }
28722
28968
  ts.isJSDoc = isJSDoc;
28723
28969
  function isJSDocTypeLiteral(node) {
@@ -29909,6 +30155,36 @@ var ts;
29909
30155
  text.charCodeAt(start + 3) !== 47 /* slash */;
29910
30156
  }
29911
30157
  ts.isJSDocLikeText = isJSDocLikeText;
30158
+ /*@internal*/
30159
+ function isFileProbablyExternalModule(sourceFile) {
30160
+ // Try to use the first top-level import/export when available, then
30161
+ // fall back to looking for an 'import.meta' somewhere in the tree if necessary.
30162
+ return ts.forEach(sourceFile.statements, isAnExternalModuleIndicatorNode) ||
30163
+ getImportMetaIfNecessary(sourceFile);
30164
+ }
30165
+ ts.isFileProbablyExternalModule = isFileProbablyExternalModule;
30166
+ function isAnExternalModuleIndicatorNode(node) {
30167
+ return hasModifierOfKind(node, 93 /* ExportKeyword */)
30168
+ || ts.isImportEqualsDeclaration(node) && ts.isExternalModuleReference(node.moduleReference)
30169
+ || ts.isImportDeclaration(node)
30170
+ || ts.isExportAssignment(node)
30171
+ || ts.isExportDeclaration(node) ? node : undefined;
30172
+ }
30173
+ function getImportMetaIfNecessary(sourceFile) {
30174
+ return sourceFile.flags & 2097152 /* PossiblyContainsImportMeta */ ?
30175
+ walkTreeForImportMeta(sourceFile) :
30176
+ undefined;
30177
+ }
30178
+ function walkTreeForImportMeta(node) {
30179
+ return isImportMeta(node) ? node : forEachChild(node, walkTreeForImportMeta);
30180
+ }
30181
+ /** Do not use hasModifier inside the parser; it relies on parent pointers. Use this instead. */
30182
+ function hasModifierOfKind(node, kind) {
30183
+ return ts.some(node.modifiers, function (m) { return m.kind === kind; });
30184
+ }
30185
+ function isImportMeta(node) {
30186
+ return ts.isMetaProperty(node) && node.keywordToken === 100 /* ImportKeyword */ && node.name.escapedText === "meta";
30187
+ }
29912
30188
  /**
29913
30189
  * Invokes a callback for each child of the given node. The 'cbNode' callback is invoked for all child nodes
29914
30190
  * stored in properties. If a 'cbNodes' callback is specified, it is invoked for embedded arrays; otherwise,
@@ -30342,7 +30618,7 @@ var ts;
30342
30618
  case 316 /* JSDocFunctionType */:
30343
30619
  return visitNodes(cbNode, cbNodes, node.parameters) ||
30344
30620
  visitNode(cbNode, node.type);
30345
- case 319 /* JSDocComment */:
30621
+ case 319 /* JSDoc */:
30346
30622
  return (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))
30347
30623
  || visitNodes(cbNode, cbNodes, node.tags);
30348
30624
  case 345 /* JSDocSeeTag */:
@@ -30490,17 +30766,25 @@ var ts;
30490
30766
  children.unshift(n);
30491
30767
  }
30492
30768
  }
30493
- function createSourceFile(fileName, sourceText, languageVersion, setParentNodes, scriptKind) {
30769
+ function setExternalModuleIndicator(sourceFile) {
30770
+ sourceFile.externalModuleIndicator = isFileProbablyExternalModule(sourceFile);
30771
+ }
30772
+ function createSourceFile(fileName, sourceText, languageVersionOrOptions, setParentNodes, scriptKind) {
30494
30773
  if (setParentNodes === void 0) { setParentNodes = false; }
30495
30774
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("parse" /* Parse */, "createSourceFile", { path: fileName }, /*separateBeginAndEnd*/ true);
30496
30775
  ts.performance.mark("beforeParse");
30497
30776
  var result;
30498
30777
  ts.perfLogger.logStartParseSourceFile(fileName);
30778
+ var _a = typeof languageVersionOrOptions === "object" ? languageVersionOrOptions : { languageVersion: languageVersionOrOptions }, languageVersion = _a.languageVersion, overrideSetExternalModuleIndicator = _a.setExternalModuleIndicator, format = _a.impliedNodeFormat;
30499
30779
  if (languageVersion === 100 /* JSON */) {
30500
- result = Parser.parseSourceFile(fileName, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes, 6 /* JSON */);
30780
+ result = Parser.parseSourceFile(fileName, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes, 6 /* JSON */, ts.noop);
30501
30781
  }
30502
30782
  else {
30503
- result = Parser.parseSourceFile(fileName, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes, scriptKind);
30783
+ var setIndicator = format === undefined ? overrideSetExternalModuleIndicator : function (file) {
30784
+ file.impliedNodeFormat = format;
30785
+ return (overrideSetExternalModuleIndicator || setExternalModuleIndicator)(file);
30786
+ };
30787
+ result = Parser.parseSourceFile(fileName, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes, scriptKind, setIndicator);
30504
30788
  }
30505
30789
  ts.perfLogger.logStopParseSourceFile();
30506
30790
  ts.performance.mark("afterParse");
@@ -30686,7 +30970,7 @@ var ts;
30686
30970
  // Note: any errors at the end of the file that do not precede a regular node, should get
30687
30971
  // attached to the EOF token.
30688
30972
  var parseErrorBeforeNextFinishedNode = false;
30689
- function parseSourceFile(fileName, sourceText, languageVersion, syntaxCursor, setParentNodes, scriptKind) {
30973
+ function parseSourceFile(fileName, sourceText, languageVersion, syntaxCursor, setParentNodes, scriptKind, setExternalModuleIndicatorOverride) {
30690
30974
  var _a;
30691
30975
  if (setParentNodes === void 0) { setParentNodes = false; }
30692
30976
  scriptKind = ts.ensureScriptKind(fileName, scriptKind);
@@ -30702,7 +30986,7 @@ var ts;
30702
30986
  return result_3;
30703
30987
  }
30704
30988
  initializeState(fileName, sourceText, languageVersion, syntaxCursor, scriptKind);
30705
- var result = parseSourceFileWorker(languageVersion, setParentNodes, scriptKind);
30989
+ var result = parseSourceFileWorker(languageVersion, setParentNodes, scriptKind, setExternalModuleIndicatorOverride || setExternalModuleIndicator);
30706
30990
  clearState();
30707
30991
  return result;
30708
30992
  }
@@ -30786,7 +31070,7 @@ var ts;
30786
31070
  endOfFileToken = parseExpectedToken(1 /* EndOfFileToken */, ts.Diagnostics.Unexpected_token);
30787
31071
  }
30788
31072
  // Set source file so that errors will be reported with this file name
30789
- var sourceFile = createSourceFile(fileName, 2 /* ES2015 */, 6 /* JSON */, /*isDeclaration*/ false, statements, endOfFileToken, sourceFlags);
31073
+ var sourceFile = createSourceFile(fileName, 2 /* ES2015 */, 6 /* JSON */, /*isDeclaration*/ false, statements, endOfFileToken, sourceFlags, ts.noop);
30790
31074
  if (setParentNodes) {
30791
31075
  fixupParentReferences(sourceFile);
30792
31076
  }
@@ -30860,7 +31144,7 @@ var ts;
30860
31144
  notParenthesizedArrow = undefined;
30861
31145
  topLevel = true;
30862
31146
  }
30863
- function parseSourceFileWorker(languageVersion, setParentNodes, scriptKind) {
31147
+ function parseSourceFileWorker(languageVersion, setParentNodes, scriptKind, setExternalModuleIndicator) {
30864
31148
  var isDeclarationFile = isDeclarationFileName(fileName);
30865
31149
  if (isDeclarationFile) {
30866
31150
  contextFlags |= 8388608 /* Ambient */;
@@ -30871,7 +31155,7 @@ var ts;
30871
31155
  var statements = parseList(0 /* SourceElements */, parseStatement);
30872
31156
  ts.Debug.assert(token() === 1 /* EndOfFileToken */);
30873
31157
  var endOfFileToken = addJSDocComment(parseTokenNode());
30874
- var sourceFile = createSourceFile(fileName, languageVersion, scriptKind, isDeclarationFile, statements, endOfFileToken, sourceFlags);
31158
+ var sourceFile = createSourceFile(fileName, languageVersion, scriptKind, isDeclarationFile, statements, endOfFileToken, sourceFlags, setExternalModuleIndicator);
30875
31159
  // A member of ReadonlyArray<T> isn't assignable to a member of T[] (and prevents a direct cast) - but this is where we set up those members so they can be readonly in the future
30876
31160
  processCommentPragmas(sourceFile, sourceText);
30877
31161
  processPragmasIntoFields(sourceFile, reportPragmaDiagnostic);
@@ -31008,25 +31292,30 @@ var ts;
31008
31292
  ts.setParentRecursive(rootNode, /*incremental*/ true);
31009
31293
  }
31010
31294
  Parser.fixupParentReferences = fixupParentReferences;
31011
- function createSourceFile(fileName, languageVersion, scriptKind, isDeclarationFile, statements, endOfFileToken, flags) {
31295
+ function createSourceFile(fileName, languageVersion, scriptKind, isDeclarationFile, statements, endOfFileToken, flags, setExternalModuleIndicator) {
31012
31296
  // code from createNode is inlined here so createNode won't have to deal with special case of creating source files
31013
31297
  // this is quite rare comparing to other nodes and createNode should be as fast as possible
31014
31298
  var sourceFile = factory.createSourceFile(statements, endOfFileToken, flags);
31015
31299
  ts.setTextRangePosWidth(sourceFile, 0, sourceText.length);
31016
- setExternalModuleIndicator(sourceFile);
31300
+ setFields(sourceFile);
31017
31301
  // If we parsed this as an external module, it may contain top-level await
31018
31302
  if (!isDeclarationFile && isExternalModule(sourceFile) && sourceFile.transformFlags & 16777216 /* ContainsPossibleTopLevelAwait */) {
31019
31303
  sourceFile = reparseTopLevelAwait(sourceFile);
31304
+ setFields(sourceFile);
31020
31305
  }
31021
- sourceFile.text = sourceText;
31022
- sourceFile.bindDiagnostics = [];
31023
- sourceFile.bindSuggestionDiagnostics = undefined;
31024
- sourceFile.languageVersion = languageVersion;
31025
- sourceFile.fileName = fileName;
31026
- sourceFile.languageVariant = ts.getLanguageVariant(scriptKind);
31027
- sourceFile.isDeclarationFile = isDeclarationFile;
31028
- sourceFile.scriptKind = scriptKind;
31029
31306
  return sourceFile;
31307
+ function setFields(sourceFile) {
31308
+ sourceFile.text = sourceText;
31309
+ sourceFile.bindDiagnostics = [];
31310
+ sourceFile.bindSuggestionDiagnostics = undefined;
31311
+ sourceFile.languageVersion = languageVersion;
31312
+ sourceFile.fileName = fileName;
31313
+ sourceFile.languageVariant = ts.getLanguageVariant(scriptKind);
31314
+ sourceFile.isDeclarationFile = isDeclarationFile;
31315
+ sourceFile.scriptKind = scriptKind;
31316
+ setExternalModuleIndicator(sourceFile);
31317
+ sourceFile.setExternalModuleIndicator = setExternalModuleIndicator;
31318
+ }
31030
31319
  }
31031
31320
  function setContextFlag(val, flag) {
31032
31321
  if (val) {
@@ -36509,35 +36798,6 @@ var ts;
36509
36798
  var node = factory.createExportAssignment(decorators, modifiers, isExportEquals, expression);
36510
36799
  return withJSDoc(finishNode(node, pos), hasJSDoc);
36511
36800
  }
36512
- function setExternalModuleIndicator(sourceFile) {
36513
- // Try to use the first top-level import/export when available, then
36514
- // fall back to looking for an 'import.meta' somewhere in the tree if necessary.
36515
- sourceFile.externalModuleIndicator =
36516
- ts.forEach(sourceFile.statements, isAnExternalModuleIndicatorNode) ||
36517
- getImportMetaIfNecessary(sourceFile);
36518
- }
36519
- function isAnExternalModuleIndicatorNode(node) {
36520
- return hasModifierOfKind(node, 93 /* ExportKeyword */)
36521
- || ts.isImportEqualsDeclaration(node) && ts.isExternalModuleReference(node.moduleReference)
36522
- || ts.isImportDeclaration(node)
36523
- || ts.isExportAssignment(node)
36524
- || ts.isExportDeclaration(node) ? node : undefined;
36525
- }
36526
- function getImportMetaIfNecessary(sourceFile) {
36527
- return sourceFile.flags & 2097152 /* PossiblyContainsImportMeta */ ?
36528
- walkTreeForExternalModuleIndicators(sourceFile) :
36529
- undefined;
36530
- }
36531
- function walkTreeForExternalModuleIndicators(node) {
36532
- return isImportMeta(node) ? node : forEachChild(node, walkTreeForExternalModuleIndicators);
36533
- }
36534
- /** Do not use hasModifier inside the parser; it relies on parent pointers. Use this instead. */
36535
- function hasModifierOfKind(node, kind) {
36536
- return ts.some(node.modifiers, function (m) { return m.kind === kind; });
36537
- }
36538
- function isImportMeta(node) {
36539
- return ts.isMetaProperty(node) && node.keywordToken === 100 /* ImportKeyword */ && node.name.escapedText === "meta";
36540
- }
36541
36801
  var ParsingContext;
36542
36802
  (function (ParsingContext) {
36543
36803
  ParsingContext[ParsingContext["SourceElements"] = 0] = "SourceElements";
@@ -36580,7 +36840,7 @@ var ts;
36580
36840
  scanner.setText(content, start, length);
36581
36841
  currentToken = scanner.scan();
36582
36842
  var jsDocTypeExpression = parseJSDocTypeExpression();
36583
- var sourceFile = createSourceFile("file.js", 99 /* Latest */, 1 /* JS */, /*isDeclarationFile*/ false, [], factory.createToken(1 /* EndOfFileToken */), 0 /* None */);
36843
+ var sourceFile = createSourceFile("file.js", 99 /* Latest */, 1 /* JS */, /*isDeclarationFile*/ false, [], factory.createToken(1 /* EndOfFileToken */), 0 /* None */, ts.noop);
36584
36844
  var diagnostics = ts.attachFileToDiagnostics(parseDiagnostics, sourceFile);
36585
36845
  if (jsDocDiagnostics) {
36586
36846
  sourceFile.jsDocDiagnostics = ts.attachFileToDiagnostics(jsDocDiagnostics, sourceFile);
@@ -37541,7 +37801,7 @@ var ts;
37541
37801
  if (sourceFile.statements.length === 0) {
37542
37802
  // If we don't have any statements in the current source file, then there's no real
37543
37803
  // way to incrementally parse. So just do a full parse instead.
37544
- return Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, /*syntaxCursor*/ undefined, /*setParentNodes*/ true, sourceFile.scriptKind);
37804
+ return Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, /*syntaxCursor*/ undefined, /*setParentNodes*/ true, sourceFile.scriptKind, sourceFile.setExternalModuleIndicator);
37545
37805
  }
37546
37806
  // Make sure we're not trying to incrementally update a source file more than once. Once
37547
37807
  // we do an update the original source file is considered unusable from that point onwards.
@@ -37598,7 +37858,7 @@ var ts;
37598
37858
  // inconsistent tree. Setting the parents on the new tree should be very fast. We
37599
37859
  // will immediately bail out of walking any subtrees when we can see that their parents
37600
37860
  // are already correct.
37601
- var result = Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, syntaxCursor, /*setParentNodes*/ true, sourceFile.scriptKind);
37861
+ var result = Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, syntaxCursor, /*setParentNodes*/ true, sourceFile.scriptKind, sourceFile.setExternalModuleIndicator);
37602
37862
  result.commentDirectives = getNewCommentDirectives(sourceFile.commentDirectives, result.commentDirectives, changeRange.span.start, ts.textSpanEnd(changeRange.span), delta, oldText, newText, aggressiveChecks);
37603
37863
  result.impliedNodeFormat = sourceFile.impliedNodeFormat;
37604
37864
  return result;
@@ -39514,6 +39774,18 @@ var ts;
39514
39774
  description: ts.Diagnostics.Specify_a_list_of_language_service_plugins_to_include,
39515
39775
  category: ts.Diagnostics.Editor_Support,
39516
39776
  },
39777
+ {
39778
+ name: "moduleDetection",
39779
+ type: new ts.Map(ts.getEntries({
39780
+ auto: ts.ModuleDetectionKind.Auto,
39781
+ legacy: ts.ModuleDetectionKind.Legacy,
39782
+ force: ts.ModuleDetectionKind.Force,
39783
+ })),
39784
+ affectsModuleResolution: true,
39785
+ description: ts.Diagnostics.Control_what_method_is_used_to_detect_module_format_JS_files,
39786
+ category: ts.Diagnostics.Language_and_Environment,
39787
+ defaultValueDescription: ts.Diagnostics.auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_with_module_Colon_node12_as_modules,
39788
+ }
39517
39789
  ];
39518
39790
  /* @internal */
39519
39791
  ts.optionDeclarations = __spreadArray(__spreadArray([], ts.commonOptionsWithBuild, true), commandOptionsWithoutBuild, true);
@@ -47656,6 +47928,8 @@ var ts;
47656
47928
  var templateConstraintType = getUnionType([stringType, numberType, booleanType, bigintType, nullType, undefinedType]);
47657
47929
  var restrictiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? getRestrictiveTypeParameter(t) : t; });
47658
47930
  var permissiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? wildcardType : t; });
47931
+ var uniqueLiteralType = createIntrinsicType(131072 /* Never */, "never"); // `uniqueLiteralType` is a special `never` flagged by union reduction to behave as a literal
47932
+ var uniqueLiteralMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? uniqueLiteralType : t; }); // replace all type parameters with the unique literal type (disregarding constraints)
47659
47933
  var emptyObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
47660
47934
  var emptyJsxObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
47661
47935
  emptyJsxObjectType.objectFlags |= 2048 /* JsxAttributes */;
@@ -48594,7 +48868,7 @@ var ts;
48594
48868
  // - parameters are only in the scope of function body
48595
48869
  // This restriction does not apply to JSDoc comment types because they are parented
48596
48870
  // at a higher level than type parameters would normally be
48597
- if (meaning & result.flags & 788968 /* Type */ && lastLocation.kind !== 319 /* JSDocComment */) {
48871
+ if (meaning & result.flags & 788968 /* Type */ && lastLocation.kind !== 319 /* JSDoc */) {
48598
48872
  useResult = result.flags & 262144 /* TypeParameter */
48599
48873
  // type parameters are visible in parameter list, return type and type parameter list
48600
48874
  ? lastLocation === location.type ||
@@ -51560,10 +51834,16 @@ var ts;
51560
51834
  var readonlyToken = type.declaration.readonlyToken ? ts.factory.createToken(type.declaration.readonlyToken.kind) : undefined;
51561
51835
  var questionToken = type.declaration.questionToken ? ts.factory.createToken(type.declaration.questionToken.kind) : undefined;
51562
51836
  var appropriateConstraintTypeNode;
51837
+ var newTypeVariable;
51563
51838
  if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
51564
51839
  // We have a { [P in keyof T]: X }
51565
51840
  // We do this to ensure we retain the toplevel keyof-ness of the type which may be lost due to keyof distribution during `getConstraintTypeFromMappedType`
51566
- appropriateConstraintTypeNode = ts.factory.createTypeOperatorNode(140 /* KeyOfKeyword */, typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context));
51841
+ if (!(getModifiersTypeFromMappedType(type).flags & 262144 /* TypeParameter */) && context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
51842
+ var newParam = createTypeParameter(createSymbol(262144 /* TypeParameter */, "T"));
51843
+ var name = typeParameterToName(newParam, context);
51844
+ newTypeVariable = ts.factory.createTypeReferenceNode(name);
51845
+ }
51846
+ appropriateConstraintTypeNode = ts.factory.createTypeOperatorNode(140 /* KeyOfKeyword */, newTypeVariable || typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context));
51567
51847
  }
51568
51848
  else {
51569
51849
  appropriateConstraintTypeNode = typeToTypeNodeHelper(getConstraintTypeFromMappedType(type), context);
@@ -51573,7 +51853,14 @@ var ts;
51573
51853
  var templateTypeNode = typeToTypeNodeHelper(removeMissingType(getTemplateTypeFromMappedType(type), !!(getMappedTypeModifiers(type) & 4 /* IncludeOptional */)), context);
51574
51854
  var mappedTypeNode = ts.factory.createMappedTypeNode(readonlyToken, typeParameterNode, nameTypeNode, questionToken, templateTypeNode, /*members*/ undefined);
51575
51855
  context.approximateLength += 10;
51576
- return ts.setEmitFlags(mappedTypeNode, 1 /* SingleLine */);
51856
+ var result = ts.setEmitFlags(mappedTypeNode, 1 /* SingleLine */);
51857
+ if (isMappedTypeWithKeyofConstraintDeclaration(type) && !(getModifiersTypeFromMappedType(type).flags & 262144 /* TypeParameter */) && context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
51858
+ // homomorphic mapped type with a non-homomorphic naive inlining
51859
+ // wrap it with a conditional like `SomeModifiersType extends infer U ? {..the mapped type...} : never` to ensure the resulting
51860
+ // type stays homomorphic
51861
+ return ts.factory.createConditionalTypeNode(typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context), ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(ts.factory.cloneNode(newTypeVariable.typeName))), result, ts.factory.createKeywordTypeNode(143 /* NeverKeyword */));
51862
+ }
51863
+ return result;
51577
51864
  }
51578
51865
  function createAnonymousTypeNode(type) {
51579
51866
  var _a;
@@ -53194,7 +53481,7 @@ var ts;
53194
53481
  // If it's a class/interface/function: emit a class/interface/function with a `default` modifier
53195
53482
  // These forms can merge, eg (`export default 12; export default interface A {}`)
53196
53483
  function serializeSymbolWorker(symbol, isPrivate, propertyAsAlias) {
53197
- var _a, _b;
53484
+ var _a, _b, _c, _d;
53198
53485
  var symbolName = ts.unescapeLeadingUnderscores(symbol.escapedName);
53199
53486
  var isDefault = symbol.escapedName === "default" /* Default */;
53200
53487
  if (isPrivate && !(context.flags & 131072 /* AllowAnonymousIdentifier */) && ts.isStringANonContextualKeyword(symbolName) && !isDefault) {
@@ -53245,17 +53532,21 @@ var ts;
53245
53532
  else {
53246
53533
  // A Class + Property merge is made for a `module.exports.Member = class {}`, and it doesn't serialize well as either a class _or_ a property symbol - in fact, _it behaves like an alias!_
53247
53534
  // `var` is `FunctionScopedVariable`, `const` and `let` are `BlockScopedVariable`, and `module.exports.thing =` is `Property`
53248
- var flags = !(symbol.flags & 2 /* BlockScopedVariable */) ? undefined
53249
- : isConstVariable(symbol) ? 2 /* Const */
53535
+ var flags = !(symbol.flags & 2 /* BlockScopedVariable */)
53536
+ ? ((_a = symbol.parent) === null || _a === void 0 ? void 0 : _a.valueDeclaration) && ts.isSourceFile((_b = symbol.parent) === null || _b === void 0 ? void 0 : _b.valueDeclaration)
53537
+ ? 2 /* Const */
53538
+ : undefined
53539
+ : isConstVariable(symbol)
53540
+ ? 2 /* Const */
53250
53541
  : 1 /* Let */;
53251
53542
  var name = (needsPostExportDefault || !(symbol.flags & 4 /* Property */)) ? localName : getUnusedName(localName, symbol);
53252
53543
  var textRange = symbol.declarations && ts.find(symbol.declarations, function (d) { return ts.isVariableDeclaration(d); });
53253
53544
  if (textRange && ts.isVariableDeclarationList(textRange.parent) && textRange.parent.declarations.length === 1) {
53254
53545
  textRange = textRange.parent.parent;
53255
53546
  }
53256
- var propertyAccessRequire = (_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isPropertyAccessExpression);
53547
+ var propertyAccessRequire = (_c = symbol.declarations) === null || _c === void 0 ? void 0 : _c.find(ts.isPropertyAccessExpression);
53257
53548
  if (propertyAccessRequire && ts.isBinaryExpression(propertyAccessRequire.parent) && ts.isIdentifier(propertyAccessRequire.parent.right)
53258
- && ((_b = type.symbol) === null || _b === void 0 ? void 0 : _b.valueDeclaration) && ts.isSourceFile(type.symbol.valueDeclaration)) {
53549
+ && ((_d = type.symbol) === null || _d === void 0 ? void 0 : _d.valueDeclaration) && ts.isSourceFile(type.symbol.valueDeclaration)) {
53259
53550
  var alias = localName === propertyAccessRequire.parent.right.escapedText ? undefined : propertyAccessRequire.parent.right;
53260
53551
  addResult(ts.factory.createExportDeclaration(
53261
53552
  /*decorators*/ undefined,
@@ -53335,8 +53626,8 @@ var ts;
53335
53626
  // synthesize export * from "moduleReference"
53336
53627
  // Straightforward - only one thing to do - make an export declaration
53337
53628
  if (symbol.declarations) {
53338
- for (var _i = 0, _c = symbol.declarations; _i < _c.length; _i++) {
53339
- var node = _c[_i];
53629
+ for (var _i = 0, _e = symbol.declarations; _i < _e.length; _i++) {
53630
+ var node = _e[_i];
53340
53631
  var resolvedModule = resolveExternalModuleName(node, node.moduleSpecifier);
53341
53632
  if (!resolvedModule)
53342
53633
  continue;
@@ -55142,7 +55433,10 @@ var ts;
55142
55433
  if (containsSameNamedThisProperty(expression.left, expression.right)) {
55143
55434
  return anyType;
55144
55435
  }
55145
- var type = resolvedSymbol ? getTypeOfSymbol(resolvedSymbol) : getWidenedLiteralType(checkExpressionCached(expression.right));
55436
+ var isDirectExport = kind === 1 /* ExportsProperty */ && (ts.isPropertyAccessExpression(expression.left) || ts.isElementAccessExpression(expression.left)) && (ts.isModuleExportsAccessExpression(expression.left.expression) || (ts.isIdentifier(expression.left.expression) && ts.isExportsIdentifier(expression.left.expression)));
55437
+ var type = resolvedSymbol ? getTypeOfSymbol(resolvedSymbol)
55438
+ : isDirectExport ? getRegularTypeOfLiteralType(checkExpressionCached(expression.right))
55439
+ : getWidenedLiteralType(checkExpressionCached(expression.right));
55146
55440
  if (type.flags & 524288 /* Object */ &&
55147
55441
  kind === 2 /* ModuleExports */ &&
55148
55442
  symbol.escapedName === "export=" /* ExportEquals */) {
@@ -55886,7 +56180,7 @@ var ts;
55886
56180
  node = paramSymbol.valueDeclaration;
55887
56181
  }
55888
56182
  break;
55889
- case 319 /* JSDocComment */: {
56183
+ case 319 /* JSDoc */: {
55890
56184
  var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes);
55891
56185
  return node.tags
55892
56186
  ? appendTypeParameters(outerTypeParameters, ts.flatMap(node.tags, function (t) { return ts.isJSDocTemplateTag(t) ? t.typeParameters : undefined; }))
@@ -58147,10 +58441,10 @@ var ts;
58147
58441
  else if (type !== firstType) {
58148
58442
  checkFlags |= 64 /* HasNonUniformType */;
58149
58443
  }
58150
- if (isLiteralType(type) || isPatternLiteralType(type)) {
58444
+ if (isLiteralType(type) || isPatternLiteralType(type) || type === uniqueLiteralType) {
58151
58445
  checkFlags |= 128 /* HasLiteralType */;
58152
58446
  }
58153
- if (type.flags & 131072 /* Never */) {
58447
+ if (type.flags & 131072 /* Never */ && type !== uniqueLiteralType) {
58154
58448
  checkFlags |= 131072 /* HasNeverType */;
58155
58449
  }
58156
58450
  propTypes.push(type);
@@ -59335,7 +59629,7 @@ var ts;
59335
59629
  function getConditionalFlowTypeOfType(type, node) {
59336
59630
  var constraints;
59337
59631
  var covariant = true;
59338
- while (node && !ts.isStatement(node) && node.kind !== 319 /* JSDocComment */) {
59632
+ while (node && !ts.isStatement(node) && node.kind !== 319 /* JSDoc */) {
59339
59633
  var parent = node.parent;
59340
59634
  // only consider variance flipped by parameter locations - `keyof` types would usually be considered variance inverting, but
59341
59635
  // often get used in indexed accesses where they behave sortof invariantly, but our checking is lax
@@ -60691,10 +60985,24 @@ var ts;
60691
60985
  return getUnionType(ts.concatenate(propertyTypes, indexKeyTypes), 1 /* Literal */,
60692
60986
  /*aliasSymbol*/ undefined, /*aliasTypeArguments*/ undefined, origin);
60693
60987
  }
60988
+ /**
60989
+ * A union type which is reducible upon instantiation (meaning some members are removed under certain instantiations)
60990
+ * must be kept generic, as that instantiation information needs to flow through the type system. By replacing all
60991
+ * type parameters in the union with a special never type that is treated as a literal in `getReducedType`, we can cause the `getReducedType` logic
60992
+ * to reduce the resulting type if possible (since only intersections with conflicting literal-typed properties are reducible).
60993
+ */
60994
+ function isPossiblyReducibleByInstantiation(type) {
60995
+ return ts.some(type.types, function (t) {
60996
+ var uniqueFilled = getUniqueLiteralFilledInstantiation(t);
60997
+ return getReducedType(uniqueFilled) !== uniqueFilled;
60998
+ });
60999
+ }
60694
61000
  function getIndexType(type, stringsOnly, noIndexSignatures) {
60695
61001
  if (stringsOnly === void 0) { stringsOnly = keyofStringsOnly; }
60696
61002
  type = getReducedType(type);
60697
- return type.flags & 1048576 /* Union */ ? getIntersectionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) :
61003
+ return type.flags & 1048576 /* Union */ ? isPossiblyReducibleByInstantiation(type)
61004
+ ? getIndexTypeForGenericType(type, stringsOnly)
61005
+ : getIntersectionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) :
60698
61006
  type.flags & 2097152 /* Intersection */ ? getUnionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) :
60699
61007
  type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericTupleType(type) || isGenericMappedType(type) && !hasDistributiveNameType(type) ? getIndexTypeForGenericType(type, stringsOnly) :
60700
61008
  ts.getObjectFlags(type) & 32 /* Mapped */ ? getIndexTypeForMappedType(type, stringsOnly, noIndexSignatures) :
@@ -61322,6 +61630,10 @@ var ts;
61322
61630
  }
61323
61631
  return type;
61324
61632
  }
61633
+ function maybeCloneTypeParameter(p) {
61634
+ var constraint = getConstraintOfTypeParameter(p);
61635
+ return constraint && (isGenericObjectType(constraint) || isGenericIndexType(constraint)) ? cloneTypeParameter(p) : p;
61636
+ }
61325
61637
  function isTypicalNondistributiveConditional(root) {
61326
61638
  return !root.isDistributive && isSingletonTupleType(root.node.checkType) && isSingletonTupleType(root.node.extendsType);
61327
61639
  }
@@ -61340,37 +61652,65 @@ var ts;
61340
61652
  var result;
61341
61653
  var extraTypes;
61342
61654
  var tailCount = 0;
61343
- // We loop here for an immediately nested conditional type in the false position, effectively treating
61344
- // types of the form 'A extends B ? X : C extends D ? Y : E extends F ? Z : ...' as a single construct for
61345
- // purposes of resolution. We also loop here when resolution of a conditional type ends in resolution of
61346
- // another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive
61347
- // cases we increment the tail recursion counter and stop after 1000 iterations.
61348
- while (true) {
61655
+ var _loop_18 = function () {
61349
61656
  if (tailCount === 1000) {
61350
61657
  error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
61351
61658
  result = errorType;
61352
- break;
61659
+ return "break";
61353
61660
  }
61354
61661
  var isUnwrapped = isTypicalNondistributiveConditional(root);
61355
61662
  var checkType = instantiateType(unwrapNondistributiveConditionalTuple(root, getActualTypeVariable(root.checkType)), mapper);
61356
61663
  var checkTypeInstantiable = isGenericType(checkType);
61357
61664
  var extendsType = instantiateType(unwrapNondistributiveConditionalTuple(root, root.extendsType), mapper);
61358
61665
  if (checkType === wildcardType || extendsType === wildcardType) {
61359
- return wildcardType;
61666
+ return { value: wildcardType };
61360
61667
  }
61361
61668
  var combinedMapper = void 0;
61362
61669
  if (root.inferTypeParameters) {
61363
- var context = createInferenceContext(root.inferTypeParameters, /*signature*/ undefined, 0 /* None */);
61364
- if (!checkTypeInstantiable) {
61670
+ // When we're looking at making an inference for an infer type, when we get its constraint, it'll automagically be
61671
+ // instantiated with the context, so it doesn't need the mapper for the inference contex - however the constraint
61672
+ // may refer to another _root_, _uncloned_ `infer` type parameter [1], or to something mapped by `mapper` [2].
61673
+ // [1] Eg, if we have `Foo<T, U extends T>` and `Foo<number, infer B>` - `B` is constrained to `T`, which, in turn, has been instantiated
61674
+ // as `number`
61675
+ // Conversely, if we have `Foo<infer A, infer B>`, `B` is still constrained to `T` and `T` is instantiated as `A`
61676
+ // [2] Eg, if we have `Foo<T, U extends T>` and `Foo<Q, infer B>` where `Q` is mapped by `mapper` into `number` - `B` is constrained to `T`
61677
+ // which is in turn instantiated as `Q`, which is in turn instantiated as `number`.
61678
+ // So we need to:
61679
+ // * Clone the type parameters so their constraints can be instantiated in the context of `mapper` (otherwise theyd only get inference context information)
61680
+ // * Set the clones to both map the conditional's enclosing `mapper` and the original params
61681
+ // * instantiate the extends type with the clones
61682
+ // * incorporate all of the component mappers into the combined mapper for the true and false members
61683
+ // This means we have three mappers that need applying:
61684
+ // * The original `mapper` used to create this conditional
61685
+ // * The mapper that maps the old root type parameter to the clone (`freshMapper`)
61686
+ // * The mapper that maps the clone to its inference result (`context.mapper`)
61687
+ var freshParams = ts.sameMap(root.inferTypeParameters, maybeCloneTypeParameter);
61688
+ var freshMapper = freshParams !== root.inferTypeParameters ? createTypeMapper(root.inferTypeParameters, freshParams) : undefined;
61689
+ var context = createInferenceContext(freshParams, /*signature*/ undefined, 0 /* None */);
61690
+ if (freshMapper) {
61691
+ var freshCombinedMapper = combineTypeMappers(mapper, freshMapper);
61692
+ for (var _i = 0, freshParams_1 = freshParams; _i < freshParams_1.length; _i++) {
61693
+ var p = freshParams_1[_i];
61694
+ if (root.inferTypeParameters.indexOf(p) === -1) {
61695
+ p.mapper = freshCombinedMapper;
61696
+ }
61697
+ }
61698
+ }
61699
+ // We skip inference of the possible `infer` types unles the `extendsType` _is_ an infer type
61700
+ // if it was, it's trivial to say that extendsType = checkType, however such a pattern is used to
61701
+ // "reset" the type being build up during constraint calculation and avoid making an apparently "infinite" constraint
61702
+ // so in those cases we refain from performing inference and retain the uninfered type parameter
61703
+ if (!checkTypeInstantiable || !ts.some(root.inferTypeParameters, function (t) { return t === extendsType; })) {
61365
61704
  // We don't want inferences from constraints as they may cause us to eagerly resolve the
61366
61705
  // conditional type instead of deferring resolution. Also, we always want strict function
61367
61706
  // types rules (i.e. proper contravariance) for inferences.
61368
- inferTypes(context.inferences, checkType, extendsType, 512 /* NoConstraints */ | 1024 /* AlwaysStrict */);
61707
+ inferTypes(context.inferences, checkType, instantiateType(extendsType, freshMapper), 512 /* NoConstraints */ | 1024 /* AlwaysStrict */);
61369
61708
  }
61709
+ var innerMapper = combineTypeMappers(freshMapper, context.mapper);
61370
61710
  // It's possible for 'infer T' type paramteters to be given uninstantiated constraints when the
61371
61711
  // those type parameters are used in type references (see getInferredTypeParameterConstraint). For
61372
61712
  // that reason we need context.mapper to be first in the combined mapper. See #42636 for examples.
61373
- combinedMapper = mapper ? combineTypeMappers(context.mapper, mapper) : context.mapper;
61713
+ combinedMapper = mapper ? combineTypeMappers(innerMapper, mapper) : innerMapper;
61374
61714
  }
61375
61715
  // Instantiate the extends type including inferences for 'infer T' type parameters
61376
61716
  var inferredExtendsType = combinedMapper ? instantiateType(unwrapNondistributiveConditionalTuple(root, root.extendsType), combinedMapper) : extendsType;
@@ -61392,14 +61732,14 @@ var ts;
61392
61732
  var newRoot = falseType_1.root;
61393
61733
  if (newRoot.node.parent === root.node && (!newRoot.isDistributive || newRoot.checkType === root.checkType)) {
61394
61734
  root = newRoot;
61395
- continue;
61735
+ return "continue";
61396
61736
  }
61397
61737
  if (canTailRecurse(falseType_1, mapper)) {
61398
- continue;
61738
+ return "continue";
61399
61739
  }
61400
61740
  }
61401
61741
  result = instantiateType(falseType_1, mapper);
61402
- break;
61742
+ return "break";
61403
61743
  }
61404
61744
  // Return trueType for a definitely true extends check. We check instantiations of the two
61405
61745
  // types with type parameters mapped to their restrictive form, i.e. a form of the type parameter
@@ -61410,10 +61750,10 @@ var ts;
61410
61750
  var trueType_1 = getTypeFromTypeNode(root.node.trueType);
61411
61751
  var trueMapper = combinedMapper || mapper;
61412
61752
  if (canTailRecurse(trueType_1, trueMapper)) {
61413
- continue;
61753
+ return "continue";
61414
61754
  }
61415
61755
  result = instantiateType(trueType_1, trueMapper);
61416
- break;
61756
+ return "break";
61417
61757
  }
61418
61758
  }
61419
61759
  // Return a deferred type for a check that is neither definitely true nor definitely false
@@ -61425,7 +61765,19 @@ var ts;
61425
61765
  result.combinedMapper = combinedMapper;
61426
61766
  result.aliasSymbol = aliasSymbol || root.aliasSymbol;
61427
61767
  result.aliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(root.aliasTypeArguments, mapper); // TODO: GH#18217
61428
- break;
61768
+ return "break";
61769
+ };
61770
+ // We loop here for an immediately nested conditional type in the false position, effectively treating
61771
+ // types of the form 'A extends B ? X : C extends D ? Y : E extends F ? Z : ...' as a single construct for
61772
+ // purposes of resolution. We also loop here when resolution of a conditional type ends in resolution of
61773
+ // another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive
61774
+ // cases we increment the tail recursion counter and stop after 1000 iterations.
61775
+ while (true) {
61776
+ var state_5 = _loop_18();
61777
+ if (typeof state_5 === "object")
61778
+ return state_5.value;
61779
+ if (state_5 === "break")
61780
+ break;
61429
61781
  }
61430
61782
  return extraTypes ? getUnionType(ts.append(extraTypes, result)) : result;
61431
61783
  // We tail-recurse for generic conditional types that (a) have not already been evaluated and cached, and
@@ -61847,9 +62199,11 @@ var ts;
61847
62199
  }
61848
62200
  function getESSymbolLikeTypeForNode(node) {
61849
62201
  if (ts.isValidESSymbolDeclaration(node)) {
61850
- var symbol = getSymbolOfNode(node);
61851
- var links = getSymbolLinks(symbol);
61852
- return links.uniqueESSymbolType || (links.uniqueESSymbolType = createUniqueESSymbolType(symbol));
62202
+ var symbol = ts.isCommonJsExportPropertyAssignment(node) ? getSymbolOfNode(node.left) : getSymbolOfNode(node);
62203
+ if (symbol) {
62204
+ var links = getSymbolLinks(symbol);
62205
+ return links.uniqueESSymbolType || (links.uniqueESSymbolType = createUniqueESSymbolType(symbol));
62206
+ }
61853
62207
  }
61854
62208
  return esSymbolType;
61855
62209
  }
@@ -62493,6 +62847,10 @@ var ts;
62493
62847
  }
62494
62848
  return type; // Nested invocation of `inferTypeForHomomorphicMappedType` or the `source` instantiated into something unmappable
62495
62849
  }
62850
+ function getUniqueLiteralFilledInstantiation(type) {
62851
+ return type.flags & (131068 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type :
62852
+ type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
62853
+ }
62496
62854
  function getPermissiveInstantiation(type) {
62497
62855
  return type.flags & (131068 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type :
62498
62856
  type.permissiveInstantiation || (type.permissiveInstantiation = instantiateType(type, permissiveMapper));
@@ -63381,7 +63739,8 @@ var ts;
63381
63739
  return true;
63382
63740
  }
63383
63741
  }
63384
- else {
63742
+ else if (!((source.flags | target.flags) & (3145728 /* UnionOrIntersection */ | 8388608 /* IndexedAccess */ | 16777216 /* Conditional */ | 33554432 /* Substitution */))) {
63743
+ // We have excluded types that may simplify to other forms, so types must have identical flags
63385
63744
  if (source.flags !== target.flags)
63386
63745
  return false;
63387
63746
  if (source.flags & 67358815 /* Singleton */)
@@ -63952,7 +64311,7 @@ var ts;
63952
64311
  reducedTarget = findMatchingDiscriminantType(source, target, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target);
63953
64312
  checkTypes = reducedTarget.flags & 1048576 /* Union */ ? reducedTarget.types : [reducedTarget];
63954
64313
  }
63955
- var _loop_18 = function (prop) {
64314
+ var _loop_19 = function (prop) {
63956
64315
  if (shouldCheckAsExcessProperty(prop, source.symbol) && !isIgnoredJsxProperty(source, prop)) {
63957
64316
  if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) {
63958
64317
  if (reportErrors) {
@@ -64015,9 +64374,9 @@ var ts;
64015
64374
  };
64016
64375
  for (var _i = 0, _b = getPropertiesOfType(source); _i < _b.length; _i++) {
64017
64376
  var prop = _b[_i];
64018
- var state_5 = _loop_18(prop);
64019
- if (typeof state_5 === "object")
64020
- return state_5.value;
64377
+ var state_6 = _loop_19(prop);
64378
+ if (typeof state_6 === "object")
64379
+ return state_6.value;
64021
64380
  }
64022
64381
  return false;
64023
64382
  }
@@ -65007,11 +65366,11 @@ var ts;
65007
65366
  // constituents of 'target'. If any combination does not have a match then 'source' is not relatable.
65008
65367
  var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes);
65009
65368
  var matchingTypes = [];
65010
- var _loop_19 = function (combination) {
65369
+ var _loop_20 = function (combination) {
65011
65370
  var hasMatch = false;
65012
65371
  outer: for (var _c = 0, _d = target.types; _c < _d.length; _c++) {
65013
65372
  var type = _d[_c];
65014
- var _loop_20 = function (i) {
65373
+ var _loop_21 = function (i) {
65015
65374
  var sourceProperty = sourcePropertiesFiltered[i];
65016
65375
  var targetProperty = getPropertyOfType(type, sourceProperty.escapedName);
65017
65376
  if (!targetProperty)
@@ -65027,8 +65386,8 @@ var ts;
65027
65386
  }
65028
65387
  };
65029
65388
  for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
65030
- var state_7 = _loop_20(i);
65031
- switch (state_7) {
65389
+ var state_8 = _loop_21(i);
65390
+ switch (state_8) {
65032
65391
  case "continue-outer": continue outer;
65033
65392
  }
65034
65393
  }
@@ -65041,9 +65400,9 @@ var ts;
65041
65400
  };
65042
65401
  for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) {
65043
65402
  var combination = discriminantCombinations_1[_a];
65044
- var state_6 = _loop_19(combination);
65045
- if (typeof state_6 === "object")
65046
- return state_6.value;
65403
+ var state_7 = _loop_20(combination);
65404
+ if (typeof state_7 === "object")
65405
+ return state_7.value;
65047
65406
  }
65048
65407
  // Compare the remaining non-discriminant properties of each match.
65049
65408
  var result = -1 /* True */;
@@ -65756,7 +66115,7 @@ var ts;
65756
66115
  // The emptyArray singleton is used to signal a recursive invocation.
65757
66116
  cache.variances = ts.emptyArray;
65758
66117
  variances = [];
65759
- var _loop_21 = function (tp) {
66118
+ var _loop_22 = function (tp) {
65760
66119
  var unmeasurable = false;
65761
66120
  var unreliable = false;
65762
66121
  var oldHandler = outofbandVarianceMarkerHandler;
@@ -65788,7 +66147,7 @@ var ts;
65788
66147
  };
65789
66148
  for (var _i = 0, typeParameters_1 = typeParameters; _i < typeParameters_1.length; _i++) {
65790
66149
  var tp = typeParameters_1[_i];
65791
- _loop_21(tp);
66150
+ _loop_22(tp);
65792
66151
  }
65793
66152
  cache.variances = variances;
65794
66153
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
@@ -68159,7 +68518,7 @@ var ts;
68159
68518
  function mapTypesByKeyProperty(types, name) {
68160
68519
  var map = new ts.Map();
68161
68520
  var count = 0;
68162
- var _loop_22 = function (type) {
68521
+ var _loop_23 = function (type) {
68163
68522
  if (type.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 58982400 /* InstantiableNonPrimitive */)) {
68164
68523
  var discriminant = getTypeOfPropertyOfType(type, name);
68165
68524
  if (discriminant) {
@@ -68185,9 +68544,9 @@ var ts;
68185
68544
  };
68186
68545
  for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
68187
68546
  var type = types_16[_i];
68188
- var state_8 = _loop_22(type);
68189
- if (typeof state_8 === "object")
68190
- return state_8.value;
68547
+ var state_9 = _loop_23(type);
68548
+ if (typeof state_9 === "object")
68549
+ return state_9.value;
68191
68550
  }
68192
68551
  return count >= 10 && count * 2 >= types.length ? map : undefined;
68193
68552
  }
@@ -69457,7 +69816,7 @@ var ts;
69457
69816
  return result;
69458
69817
  }
69459
69818
  function getCandidateDiscriminantPropertyAccess(expr) {
69460
- if (ts.isBindingPattern(reference) || ts.isFunctionExpressionOrArrowFunction(reference)) {
69819
+ if (ts.isBindingPattern(reference) || ts.isFunctionExpressionOrArrowFunction(reference) || ts.isObjectLiteralMethod(reference)) {
69461
69820
  // When the reference is a binding pattern or function or arrow expression, we are narrowing a pesudo-reference in
69462
69821
  // getNarrowedTypeOfSymbol. An identifier for a destructuring variable declared in the same binding pattern or
69463
69822
  // parameter declared in the same parameter list is a candidate.
@@ -74518,7 +74877,7 @@ var ts;
74518
74877
  if (spreadIndex >= 0) {
74519
74878
  // Create synthetic arguments from spreads of tuple types.
74520
74879
  var effectiveArgs_1 = args.slice(0, spreadIndex);
74521
- var _loop_23 = function (i) {
74880
+ var _loop_24 = function (i) {
74522
74881
  var arg = args[i];
74523
74882
  // We can call checkExpressionCached because spread expressions never have a contextual type.
74524
74883
  var spreadType = arg.kind === 224 /* SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
@@ -74535,7 +74894,7 @@ var ts;
74535
74894
  }
74536
74895
  };
74537
74896
  for (var i = spreadIndex; i < args.length; i++) {
74538
- _loop_23(i);
74897
+ _loop_24(i);
74539
74898
  }
74540
74899
  return effectiveArgs_1;
74541
74900
  }
@@ -74848,7 +75207,7 @@ var ts;
74848
75207
  var min_3 = Number.MAX_VALUE;
74849
75208
  var minIndex = 0;
74850
75209
  var i_1 = 0;
74851
- var _loop_24 = function (c) {
75210
+ var _loop_25 = function (c) {
74852
75211
  var chain_2 = function () { return ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Overload_0_of_1_2_gave_the_following_error, i_1 + 1, candidates.length, signatureToString(c)); };
74853
75212
  var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* Normal */, /*reportErrors*/ true, chain_2);
74854
75213
  if (diags_2) {
@@ -74866,7 +75225,7 @@ var ts;
74866
75225
  };
74867
75226
  for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) {
74868
75227
  var c = candidatesForArgumentError_1[_a];
74869
- _loop_24(c);
75228
+ _loop_25(c);
74870
75229
  }
74871
75230
  var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
74872
75231
  ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
@@ -75024,7 +75383,7 @@ var ts;
75024
75383
  }
75025
75384
  var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
75026
75385
  var parameters = [];
75027
- var _loop_25 = function (i) {
75386
+ var _loop_26 = function (i) {
75028
75387
  var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ?
75029
75388
  i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) :
75030
75389
  i < s.parameters.length ? s.parameters[i] : undefined; });
@@ -75032,7 +75391,7 @@ var ts;
75032
75391
  parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
75033
75392
  };
75034
75393
  for (var i = 0; i < maxNonRestParam; i++) {
75035
- _loop_25(i);
75394
+ _loop_26(i);
75036
75395
  }
75037
75396
  var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; });
75038
75397
  var flags = 0 /* None */;
@@ -76429,6 +76788,9 @@ var ts;
76429
76788
  assignBindingElementTypes(declaration.name, links.type);
76430
76789
  }
76431
76790
  }
76791
+ else if (type) {
76792
+ ts.Debug.assertEqual(links.type, type, "Parameter symbol already has a cached type which differs from newly assigned type");
76793
+ }
76432
76794
  }
76433
76795
  // When contextual typing assigns a type to a parameter that contains a binding pattern, we also need to push
76434
76796
  // the destructured type into the contained binding elements.
@@ -78259,7 +78621,7 @@ var ts;
78259
78621
  }
78260
78622
  function checkExpressionForMutableLocation(node, checkMode, contextualType, forceTuple) {
78261
78623
  var type = checkExpression(node, checkMode, forceTuple);
78262
- return isConstContext(node) ? getRegularTypeOfLiteralType(type) :
78624
+ return isConstContext(node) || ts.isCommonJsExportedExpression(node) ? getRegularTypeOfLiteralType(type) :
78263
78625
  isTypeAssertion(node) ? type :
78264
78626
  getWidenedLiteralLikeTypeForContextualType(type, instantiateContextualType(arguments.length === 2 ? getContextualType(node) : contextualType, node));
78265
78627
  }
@@ -79028,7 +79390,7 @@ var ts;
79028
79390
  var indexSymbol = getIndexSymbol(getSymbolOfNode(node));
79029
79391
  if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
79030
79392
  var indexSignatureMap_1 = new ts.Map();
79031
- var _loop_26 = function (declaration) {
79393
+ var _loop_27 = function (declaration) {
79032
79394
  if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
79033
79395
  forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) {
79034
79396
  var entry = indexSignatureMap_1.get(getTypeId(type));
@@ -79043,7 +79405,7 @@ var ts;
79043
79405
  };
79044
79406
  for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
79045
79407
  var declaration = _a[_i];
79046
- _loop_26(declaration);
79408
+ _loop_27(declaration);
79047
79409
  }
79048
79410
  indexSignatureMap_1.forEach(function (entry) {
79049
79411
  if (entry.declarations.length > 1) {
@@ -82422,7 +82784,7 @@ var ts;
82422
82784
  var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* Interface */ ? ts.getDeclarationOfKind(type.symbol, 257 /* InterfaceDeclaration */) : undefined;
82423
82785
  var localPropDeclaration = declaration && declaration.kind === 220 /* BinaryExpression */ ||
82424
82786
  name && name.kind === 161 /* ComputedPropertyName */ || getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
82425
- var _loop_27 = function (info) {
82787
+ var _loop_28 = function (info) {
82426
82788
  var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
82427
82789
  // We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared
82428
82790
  // in the containing type, or (c) the containing type is an interface and no base interface contains both the property and
@@ -82435,7 +82797,7 @@ var ts;
82435
82797
  };
82436
82798
  for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
82437
82799
  var info = indexInfos_9[_i];
82438
- _loop_27(info);
82800
+ _loop_28(info);
82439
82801
  }
82440
82802
  }
82441
82803
  function checkIndexConstraintForIndexSignature(type, checkInfo) {
@@ -82443,7 +82805,7 @@ var ts;
82443
82805
  var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType);
82444
82806
  var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* Interface */ ? ts.getDeclarationOfKind(type.symbol, 257 /* InterfaceDeclaration */) : undefined;
82445
82807
  var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined;
82446
- var _loop_28 = function (info) {
82808
+ var _loop_29 = function (info) {
82447
82809
  if (info === checkInfo)
82448
82810
  return "continue";
82449
82811
  var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
@@ -82458,7 +82820,7 @@ var ts;
82458
82820
  };
82459
82821
  for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
82460
82822
  var info = indexInfos_10[_i];
82461
- _loop_28(info);
82823
+ _loop_29(info);
82462
82824
  }
82463
82825
  }
82464
82826
  function checkTypeNameIsReserved(name, message) {
@@ -82769,7 +83131,7 @@ var ts;
82769
83131
  var baseTypes = baseTypeNode && getBaseTypes(type);
82770
83132
  var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
82771
83133
  var baseStaticType = getBaseConstructorTypeOfClass(type);
82772
- var _loop_29 = function (member) {
83134
+ var _loop_30 = function (member) {
82773
83135
  if (ts.hasAmbientModifier(member)) {
82774
83136
  return "continue";
82775
83137
  }
@@ -82786,7 +83148,7 @@ var ts;
82786
83148
  };
82787
83149
  for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
82788
83150
  var member = _a[_i];
82789
- _loop_29(member);
83151
+ _loop_30(member);
82790
83152
  }
82791
83153
  }
82792
83154
  /**
@@ -82874,7 +83236,7 @@ var ts;
82874
83236
  function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
82875
83237
  // iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible
82876
83238
  var issuedMemberError = false;
82877
- var _loop_30 = function (member) {
83239
+ var _loop_31 = function (member) {
82878
83240
  if (ts.isStatic(member)) {
82879
83241
  return "continue";
82880
83242
  }
@@ -82893,7 +83255,7 @@ var ts;
82893
83255
  };
82894
83256
  for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
82895
83257
  var member = _a[_i];
82896
- _loop_30(member);
83258
+ _loop_31(member);
82897
83259
  }
82898
83260
  if (!issuedMemberError) {
82899
83261
  // check again with diagnostics to generate a less-specific error
@@ -87321,8 +87683,8 @@ var ts;
87321
87683
  }
87322
87684
  else {
87323
87685
  var elements = name.elements;
87324
- for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) {
87325
- var element = elements_1[_i];
87686
+ for (var _i = 0, elements_2 = elements; _i < elements_2.length; _i++) {
87687
+ var element = elements_2[_i];
87326
87688
  if (!ts.isOmittedExpression(element)) {
87327
87689
  return checkESModuleMarker(element.name);
87328
87690
  }
@@ -87338,8 +87700,8 @@ var ts;
87338
87700
  }
87339
87701
  else {
87340
87702
  var elements = name.elements;
87341
- for (var _i = 0, elements_2 = elements; _i < elements_2.length; _i++) {
87342
- var element = elements_2[_i];
87703
+ for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) {
87704
+ var element = elements_3[_i];
87343
87705
  if (!ts.isOmittedExpression(element)) {
87344
87706
  checkGrammarNameInLetOrConstDeclarations(element.name);
87345
87707
  }
@@ -89593,8 +89955,8 @@ var ts;
89593
89955
  }
89594
89956
  function bindingOrAssignmentPatternAssignsToName(pattern, escapedName) {
89595
89957
  var elements = ts.getElementsOfBindingOrAssignmentPattern(pattern);
89596
- for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) {
89597
- var element = elements_3[_i];
89958
+ for (var _i = 0, elements_4 = elements; _i < elements_4.length; _i++) {
89959
+ var element = elements_4[_i];
89598
89960
  if (bindingOrAssignmentElementAssignsToName(element, escapedName)) {
89599
89961
  return true;
89600
89962
  }
@@ -95212,8 +95574,8 @@ var ts;
95212
95574
  function chunkObjectLiteralElements(elements) {
95213
95575
  var chunkObject;
95214
95576
  var objects = [];
95215
- for (var _i = 0, elements_4 = elements; _i < elements_4.length; _i++) {
95216
- var e = elements_4[_i];
95577
+ for (var _i = 0, elements_5 = elements; _i < elements_5.length; _i++) {
95578
+ var e = elements_5[_i];
95217
95579
  if (e.kind === 297 /* SpreadAssignment */) {
95218
95580
  if (chunkObject) {
95219
95581
  objects.push(factory.createObjectLiteralExpression(chunkObject));
@@ -109858,7 +110220,7 @@ var ts;
109858
110220
  return emitRestOrJSDocVariadicType(node);
109859
110221
  case 318 /* JSDocNamepathType */:
109860
110222
  return;
109861
- case 319 /* JSDocComment */:
110223
+ case 319 /* JSDoc */:
109862
110224
  return emitJSDoc(node);
109863
110225
  case 321 /* JSDocTypeLiteral */:
109864
110226
  return emitJSDocTypeLiteral(node);
@@ -114234,7 +114596,7 @@ var ts;
114234
114596
  var existingDirectories = new ts.Map();
114235
114597
  var getCanonicalFileName = ts.createGetCanonicalFileName(system.useCaseSensitiveFileNames);
114236
114598
  var computeHash = ts.maybeBind(system, system.createHash) || ts.generateDjb2Hash;
114237
- function getSourceFile(fileName, languageVersion, onError) {
114599
+ function getSourceFile(fileName, languageVersionOrOptions, onError) {
114238
114600
  var text;
114239
114601
  try {
114240
114602
  ts.performance.mark("beforeIORead");
@@ -114248,7 +114610,7 @@ var ts;
114248
114610
  }
114249
114611
  text = "";
114250
114612
  }
114251
- return text !== undefined ? ts.createSourceFile(fileName, text, languageVersion, setParentNodes) : undefined;
114613
+ return text !== undefined ? ts.createSourceFile(fileName, text, languageVersionOrOptions, setParentNodes) : undefined;
114252
114614
  }
114253
114615
  function directoryExists(directoryPath) {
114254
114616
  if (existingDirectories.has(directoryPath)) {
@@ -115654,8 +116016,8 @@ var ts;
115654
116016
  for (var _i = 0, oldSourceFiles_2 = oldSourceFiles; _i < oldSourceFiles_2.length; _i++) {
115655
116017
  var oldSourceFile = oldSourceFiles_2[_i];
115656
116018
  var newSourceFile = host.getSourceFileByPath
115657
- ? host.getSourceFileByPath(oldSourceFile.fileName, oldSourceFile.resolvedPath, ts.getEmitScriptTarget(options), /*onError*/ undefined, shouldCreateNewSourceFile)
115658
- : host.getSourceFile(oldSourceFile.fileName, ts.getEmitScriptTarget(options), /*onError*/ undefined, shouldCreateNewSourceFile); // TODO: GH#18217
116019
+ ? host.getSourceFileByPath(oldSourceFile.fileName, oldSourceFile.resolvedPath, getCreateSourceFileOptions(oldSourceFile.fileName, moduleResolutionCache, host, options), /*onError*/ undefined, shouldCreateNewSourceFile)
116020
+ : host.getSourceFile(oldSourceFile.fileName, getCreateSourceFileOptions(oldSourceFile.fileName, moduleResolutionCache, host, options), /*onError*/ undefined, shouldCreateNewSourceFile); // TODO: GH#18217
115659
116021
  if (!newSourceFile) {
115660
116022
  return 0 /* Not */;
115661
116023
  }
@@ -115686,7 +116048,6 @@ var ts;
115686
116048
  newSourceFile.originalFileName = oldSourceFile.originalFileName;
115687
116049
  newSourceFile.resolvedPath = oldSourceFile.resolvedPath;
115688
116050
  newSourceFile.fileName = oldSourceFile.fileName;
115689
- newSourceFile.impliedNodeFormat = oldSourceFile.impliedNodeFormat;
115690
116051
  var packageName = oldProgram.sourceFileToPackageName.get(oldSourceFile.path);
115691
116052
  if (packageName !== undefined) {
115692
116053
  // If there are 2 different source files for the same package name and at least one of them changes,
@@ -116605,6 +116966,17 @@ var ts;
116605
116966
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
116606
116967
  return result;
116607
116968
  }
116969
+ function getCreateSourceFileOptions(fileName, moduleResolutionCache, host, options) {
116970
+ // It's a _little odd_ that we can't set `impliedNodeFormat` until the program step - but it's the first and only time we have a resolution cache
116971
+ // and a freshly made source file node on hand at the same time, and we need both to set the field. Persisting the resolution cache all the way
116972
+ // to the check and emit steps would be bad - so we much prefer detecting and storing the format information on the source file node upfront.
116973
+ var impliedNodeFormat = getImpliedNodeFormatForFile(toPath(fileName), moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(), host, options);
116974
+ return {
116975
+ languageVersion: ts.getEmitScriptTarget(options),
116976
+ impliedNodeFormat: impliedNodeFormat,
116977
+ setExternalModuleIndicator: ts.getSetExternalModuleIndicator(options)
116978
+ };
116979
+ }
116608
116980
  function findSourceFileWorker(fileName, isDefaultLib, ignoreNoDefaultLib, reason, packageId) {
116609
116981
  var path = toPath(fileName);
116610
116982
  if (useSourceOfProjectReferenceRedirect) {
@@ -116692,7 +117064,7 @@ var ts;
116692
117064
  }
116693
117065
  }
116694
117066
  // We haven't looked for this file, do so now and cache result
116695
- var file = host.getSourceFile(fileName, ts.getEmitScriptTarget(options), function (hostErrorMessage) { return addFilePreprocessingFileExplainingDiagnostic(/*file*/ undefined, reason, ts.Diagnostics.Cannot_read_file_0_Colon_1, [fileName, hostErrorMessage]); }, shouldCreateNewSourceFile);
117067
+ var file = host.getSourceFile(fileName, getCreateSourceFileOptions(fileName, moduleResolutionCache, host, options), function (hostErrorMessage) { return addFilePreprocessingFileExplainingDiagnostic(/*file*/ undefined, reason, ts.Diagnostics.Cannot_read_file_0_Colon_1, [fileName, hostErrorMessage]); }, shouldCreateNewSourceFile);
116696
117068
  if (packageId) {
116697
117069
  var packageIdKey = ts.packageIdToString(packageId);
116698
117070
  var fileFromPackageId = packageIdToSourceFile.get(packageIdKey);
@@ -116720,10 +117092,6 @@ var ts;
116720
117092
  file.path = path;
116721
117093
  file.resolvedPath = toPath(fileName);
116722
117094
  file.originalFileName = originalFileName;
116723
- // It's a _little odd_ that we can't set `impliedNodeFormat` until the program step - but it's the first and only time we have a resolution cache
116724
- // and a freshly made source file node on hand at the same time, and we need both to set the field. Persisting the resolution cache all the way
116725
- // to the check and emit steps would be bad - so we much prefer detecting and storing the format information on the source file node upfront.
116726
- file.impliedNodeFormat = getImpliedNodeFormatForFile(file.resolvedPath, moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(), host, options);
116727
117095
  addFileIncludeReason(file, reason);
116728
117096
  if (host.useCaseSensitiveFileNames()) {
116729
117097
  var pathLowerCase = ts.toFileNameLowerCase(path);
@@ -117225,7 +117593,7 @@ var ts;
117225
117593
  }
117226
117594
  else if (firstNonAmbientExternalModuleSourceFile && languageVersion < 2 /* ES2015 */ && options.module === ts.ModuleKind.None) {
117227
117595
  // We cannot use createDiagnosticFromNode because nodes do not have parents yet
117228
- var span = ts.getErrorSpanForNode(firstNonAmbientExternalModuleSourceFile, firstNonAmbientExternalModuleSourceFile.externalModuleIndicator);
117596
+ var span = ts.getErrorSpanForNode(firstNonAmbientExternalModuleSourceFile, typeof firstNonAmbientExternalModuleSourceFile.externalModuleIndicator === "boolean" ? firstNonAmbientExternalModuleSourceFile : firstNonAmbientExternalModuleSourceFile.externalModuleIndicator);
117229
117597
  programDiagnostics.add(ts.createFileDiagnostic(firstNonAmbientExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_use_imports_exports_or_module_augmentations_when_module_is_none));
117230
117598
  }
117231
117599
  // Cannot specify module gen that isn't amd or system with --out
@@ -117234,7 +117602,7 @@ var ts;
117234
117602
  createDiagnosticForOptionName(ts.Diagnostics.Only_amd_and_system_modules_are_supported_alongside_0, options.out ? "out" : "outFile", "module");
117235
117603
  }
117236
117604
  else if (options.module === undefined && firstNonAmbientExternalModuleSourceFile) {
117237
- var span = ts.getErrorSpanForNode(firstNonAmbientExternalModuleSourceFile, firstNonAmbientExternalModuleSourceFile.externalModuleIndicator);
117605
+ var span = ts.getErrorSpanForNode(firstNonAmbientExternalModuleSourceFile, typeof firstNonAmbientExternalModuleSourceFile.externalModuleIndicator === "boolean" ? firstNonAmbientExternalModuleSourceFile : firstNonAmbientExternalModuleSourceFile.externalModuleIndicator);
117238
117606
  programDiagnostics.add(ts.createFileDiagnostic(firstNonAmbientExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system, options.out ? "out" : "outFile"));
117239
117607
  }
117240
117608
  }
@@ -120680,7 +121048,7 @@ var ts;
120680
121048
  });
120681
121049
  // Sort by paths closest to importing file Name directory
120682
121050
  var sortedPaths = [];
120683
- var _loop_31 = function (directory) {
121051
+ var _loop_32 = function (directory) {
120684
121052
  var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
120685
121053
  var pathsInDirectory;
120686
121054
  allFileNames.forEach(function (_a, fileName) {
@@ -120704,9 +121072,9 @@ var ts;
120704
121072
  };
120705
121073
  var out_directory_1;
120706
121074
  for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
120707
- var state_9 = _loop_31(directory);
121075
+ var state_10 = _loop_32(directory);
120708
121076
  directory = out_directory_1;
120709
- if (state_9 === "break")
121077
+ if (state_10 === "break")
120710
121078
  break;
120711
121079
  }
120712
121080
  if (allFileNames.size) {
@@ -121496,7 +121864,7 @@ var ts;
121496
121864
  var useCaseSensitiveFileNames = host.useCaseSensitiveFileNames();
121497
121865
  var hostGetNewLine = ts.memoize(function () { return host.getNewLine(); });
121498
121866
  return {
121499
- getSourceFile: function (fileName, languageVersion, onError) {
121867
+ getSourceFile: function (fileName, languageVersionOrOptions, onError) {
121500
121868
  var text;
121501
121869
  try {
121502
121870
  ts.performance.mark("beforeIORead");
@@ -121510,7 +121878,7 @@ var ts;
121510
121878
  }
121511
121879
  text = "";
121512
121880
  }
121513
- return text !== undefined ? ts.createSourceFile(fileName, text, languageVersion) : undefined;
121881
+ return text !== undefined ? ts.createSourceFile(fileName, text, languageVersionOrOptions) : undefined;
121514
121882
  },
121515
121883
  getDefaultLibLocation: ts.maybeBind(host, host.getDefaultLibLocation),
121516
121884
  getDefaultLibFileName: function (options) { return host.getDefaultLibFileName(options); },
@@ -121978,7 +122346,7 @@ var ts;
121978
122346
  }
121979
122347
  return directoryStructureHost.fileExists(fileName);
121980
122348
  }
121981
- function getVersionedSourceFileByPath(fileName, path, languageVersion, onError, shouldCreateNewSourceFile) {
122349
+ function getVersionedSourceFileByPath(fileName, path, languageVersionOrOptions, onError, shouldCreateNewSourceFile) {
121982
122350
  var hostSourceFile = sourceFilesCache.get(path);
121983
122351
  // No source file on the host
121984
122352
  if (isFileMissingOnHost(hostSourceFile)) {
@@ -121986,7 +122354,7 @@ var ts;
121986
122354
  }
121987
122355
  // Create new source file if requested or the versions dont match
121988
122356
  if (hostSourceFile === undefined || shouldCreateNewSourceFile || isFilePresenceUnknownOnHost(hostSourceFile)) {
121989
- var sourceFile = getNewSourceFile(fileName, languageVersion, onError);
122357
+ var sourceFile = getNewSourceFile(fileName, languageVersionOrOptions, onError);
121990
122358
  if (hostSourceFile) {
121991
122359
  if (sourceFile) {
121992
122360
  // Set the source file and create file watcher now that file was present on the disk