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.
package/lib/tsc.js CHANGED
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
69
69
  var ts;
70
70
  (function (ts) {
71
71
  ts.versionMajorMinor = "4.7";
72
- ts.version = ts.versionMajorMinor + ".0-dev.20220309";
72
+ ts.version = ts.versionMajorMinor + ".0-dev.20220312";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  var globals = typeof globalThis !== "undefined" ? globalThis :
@@ -1270,6 +1270,149 @@ var ts;
1270
1270
  return createMultiMap();
1271
1271
  }
1272
1272
  ts.createUnderscoreEscapedMultiMap = createUnderscoreEscapedMultiMap;
1273
+ function createSet(getHashCode, equals) {
1274
+ var multiMap = new ts.Map();
1275
+ var size = 0;
1276
+ function getElementIterator() {
1277
+ var valueIt = multiMap.values();
1278
+ var arrayIt;
1279
+ return {
1280
+ next: function () {
1281
+ while (true) {
1282
+ if (arrayIt) {
1283
+ var n = arrayIt.next();
1284
+ if (!n.done) {
1285
+ return { value: n.value };
1286
+ }
1287
+ arrayIt = undefined;
1288
+ }
1289
+ else {
1290
+ var n = valueIt.next();
1291
+ if (n.done) {
1292
+ return { value: undefined, done: true };
1293
+ }
1294
+ if (!isArray(n.value)) {
1295
+ return { value: n.value };
1296
+ }
1297
+ arrayIt = arrayIterator(n.value);
1298
+ }
1299
+ }
1300
+ }
1301
+ };
1302
+ }
1303
+ var set = {
1304
+ has: function (element) {
1305
+ var hash = getHashCode(element);
1306
+ if (!multiMap.has(hash))
1307
+ return false;
1308
+ var candidates = multiMap.get(hash);
1309
+ if (!isArray(candidates))
1310
+ return equals(candidates, element);
1311
+ for (var _i = 0, candidates_1 = candidates; _i < candidates_1.length; _i++) {
1312
+ var candidate = candidates_1[_i];
1313
+ if (equals(candidate, element)) {
1314
+ return true;
1315
+ }
1316
+ }
1317
+ return false;
1318
+ },
1319
+ add: function (element) {
1320
+ var hash = getHashCode(element);
1321
+ if (multiMap.has(hash)) {
1322
+ var values = multiMap.get(hash);
1323
+ if (isArray(values)) {
1324
+ if (!contains(values, element, equals)) {
1325
+ values.push(element);
1326
+ size++;
1327
+ }
1328
+ }
1329
+ else {
1330
+ var value = values;
1331
+ if (!equals(value, element)) {
1332
+ multiMap.set(hash, [value, element]);
1333
+ size++;
1334
+ }
1335
+ }
1336
+ }
1337
+ else {
1338
+ multiMap.set(hash, element);
1339
+ size++;
1340
+ }
1341
+ return this;
1342
+ },
1343
+ delete: function (element) {
1344
+ var hash = getHashCode(element);
1345
+ if (!multiMap.has(hash))
1346
+ return false;
1347
+ var candidates = multiMap.get(hash);
1348
+ if (isArray(candidates)) {
1349
+ for (var i = 0; i < candidates.length; i++) {
1350
+ if (equals(candidates[i], element)) {
1351
+ if (candidates.length === 1) {
1352
+ multiMap.delete(hash);
1353
+ }
1354
+ else if (candidates.length === 2) {
1355
+ multiMap.set(hash, candidates[1 - i]);
1356
+ }
1357
+ else {
1358
+ unorderedRemoveItemAt(candidates, i);
1359
+ }
1360
+ size--;
1361
+ return true;
1362
+ }
1363
+ }
1364
+ }
1365
+ else {
1366
+ var candidate = candidates;
1367
+ if (equals(candidate, element)) {
1368
+ multiMap.delete(hash);
1369
+ size--;
1370
+ return true;
1371
+ }
1372
+ }
1373
+ return false;
1374
+ },
1375
+ clear: function () {
1376
+ multiMap.clear();
1377
+ size = 0;
1378
+ },
1379
+ get size() {
1380
+ return size;
1381
+ },
1382
+ forEach: function (action) {
1383
+ for (var _i = 0, _a = arrayFrom(multiMap.values()); _i < _a.length; _i++) {
1384
+ var elements = _a[_i];
1385
+ if (isArray(elements)) {
1386
+ for (var _b = 0, elements_1 = elements; _b < elements_1.length; _b++) {
1387
+ var element = elements_1[_b];
1388
+ action(element, element);
1389
+ }
1390
+ }
1391
+ else {
1392
+ var element = elements;
1393
+ action(element, element);
1394
+ }
1395
+ }
1396
+ },
1397
+ keys: function () {
1398
+ return getElementIterator();
1399
+ },
1400
+ values: function () {
1401
+ return getElementIterator();
1402
+ },
1403
+ entries: function () {
1404
+ var it = getElementIterator();
1405
+ return {
1406
+ next: function () {
1407
+ var n = it.next();
1408
+ return n.done ? n : { value: [n.value, n.value] };
1409
+ }
1410
+ };
1411
+ },
1412
+ };
1413
+ return set;
1414
+ }
1415
+ ts.createSet = createSet;
1273
1416
  function isArray(value) {
1274
1417
  return Array.isArray ? Array.isArray(value) : value instanceof Array;
1275
1418
  }
@@ -1524,8 +1667,8 @@ var ts;
1524
1667
  var maximumLengthDifference = Math.min(2, Math.floor(name.length * 0.34));
1525
1668
  var bestDistance = Math.floor(name.length * 0.4) + 1;
1526
1669
  var bestCandidate;
1527
- for (var _i = 0, candidates_1 = candidates; _i < candidates_1.length; _i++) {
1528
- var candidate = candidates_1[_i];
1670
+ for (var _i = 0, candidates_2 = candidates; _i < candidates_2.length; _i++) {
1671
+ var candidate = candidates_2[_i];
1529
1672
  var candidateName = getName(candidate);
1530
1673
  if (candidateName !== undefined && Math.abs(candidateName.length - name.length) <= maximumLengthDifference) {
1531
1674
  if (candidateName === name) {
@@ -1733,13 +1876,15 @@ var ts;
1733
1876
  for (var _i = 0; _i < arguments.length; _i++) {
1734
1877
  args[_i] = arguments[_i];
1735
1878
  }
1879
+ var lastResult;
1736
1880
  for (var _a = 0, fs_1 = fs; _a < fs_1.length; _a++) {
1737
1881
  var f = fs_1[_a];
1738
- if (f.apply(void 0, args)) {
1739
- return true;
1882
+ lastResult = f.apply(void 0, args);
1883
+ if (lastResult) {
1884
+ return lastResult;
1740
1885
  }
1741
1886
  }
1742
- return false;
1887
+ return lastResult;
1743
1888
  };
1744
1889
  }
1745
1890
  ts.or = or;
@@ -3263,6 +3408,12 @@ var ts;
3263
3408
  ModuleResolutionKind[ModuleResolutionKind["Node12"] = 3] = "Node12";
3264
3409
  ModuleResolutionKind[ModuleResolutionKind["NodeNext"] = 99] = "NodeNext";
3265
3410
  })(ModuleResolutionKind = ts.ModuleResolutionKind || (ts.ModuleResolutionKind = {}));
3411
+ var ModuleDetectionKind;
3412
+ (function (ModuleDetectionKind) {
3413
+ ModuleDetectionKind[ModuleDetectionKind["Legacy"] = 1] = "Legacy";
3414
+ ModuleDetectionKind[ModuleDetectionKind["Auto"] = 2] = "Auto";
3415
+ ModuleDetectionKind[ModuleDetectionKind["Force"] = 3] = "Force";
3416
+ })(ModuleDetectionKind = ts.ModuleDetectionKind || (ts.ModuleDetectionKind = {}));
3266
3417
  var WatchFileKind;
3267
3418
  (function (WatchFileKind) {
3268
3419
  WatchFileKind[WatchFileKind["FixedPollingInterval"] = 0] = "FixedPollingInterval";
@@ -5428,6 +5579,8 @@ var ts;
5428
5579
  catch_or_finally_expected: diag(1472, ts.DiagnosticCategory.Error, "catch_or_finally_expected_1472", "'catch' or 'finally' expected."),
5429
5580
  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."),
5430
5581
  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."),
5582
+ 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."),
5583
+ 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."),
5431
5584
  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."),
5432
5585
  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."),
5433
5586
  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.", undefined, true),
@@ -11807,10 +11960,23 @@ var ts;
11807
11960
  && node.parent.parent.kind === 236;
11808
11961
  }
11809
11962
  ts.isVariableDeclarationInVariableStatement = isVariableDeclarationInVariableStatement;
11963
+ function isCommonJsExportedExpression(node) {
11964
+ if (!isInJSFile(node))
11965
+ return false;
11966
+ return (ts.isObjectLiteralExpression(node.parent) && ts.isBinaryExpression(node.parent.parent) && getAssignmentDeclarationKind(node.parent.parent) === 2) ||
11967
+ isCommonJsExportPropertyAssignment(node.parent);
11968
+ }
11969
+ ts.isCommonJsExportedExpression = isCommonJsExportedExpression;
11970
+ function isCommonJsExportPropertyAssignment(node) {
11971
+ if (!isInJSFile(node))
11972
+ return false;
11973
+ return (ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 1);
11974
+ }
11975
+ ts.isCommonJsExportPropertyAssignment = isCommonJsExportPropertyAssignment;
11810
11976
  function isValidESSymbolDeclaration(node) {
11811
- return ts.isVariableDeclaration(node) ? isVarConst(node) && ts.isIdentifier(node.name) && isVariableDeclarationInVariableStatement(node) :
11977
+ return (ts.isVariableDeclaration(node) ? isVarConst(node) && ts.isIdentifier(node.name) && isVariableDeclarationInVariableStatement(node) :
11812
11978
  ts.isPropertyDeclaration(node) ? hasEffectiveReadonlyModifier(node) && hasStaticModifier(node) :
11813
- ts.isPropertySignature(node) && hasEffectiveReadonlyModifier(node);
11979
+ ts.isPropertySignature(node) && hasEffectiveReadonlyModifier(node)) || isCommonJsExportPropertyAssignment(node);
11814
11980
  }
11815
11981
  ts.isValidESSymbolDeclaration = isValidESSymbolDeclaration;
11816
11982
  function introducesArgumentsExoticObject(node) {
@@ -15591,6 +15757,42 @@ var ts;
15591
15757
  return scriptKind === 4 || scriptKind === 2 || scriptKind === 1 || scriptKind === 6 ? 1 : 0;
15592
15758
  }
15593
15759
  ts.getLanguageVariant = getLanguageVariant;
15760
+ function walkTreeForJSXTags(node) {
15761
+ if (!(node.transformFlags & 2))
15762
+ return undefined;
15763
+ return ts.isJsxOpeningLikeElement(node) || ts.isJsxFragment(node) ? node : ts.forEachChild(node, walkTreeForJSXTags);
15764
+ }
15765
+ function isFileModuleFromUsingJSXTag(file) {
15766
+ return !file.isDeclarationFile ? walkTreeForJSXTags(file) : undefined;
15767
+ }
15768
+ function isFileForcedToBeModuleByFormat(file) {
15769
+ return file.impliedNodeFormat === ts.ModuleKind.ESNext && !file.isDeclarationFile ? true : undefined;
15770
+ }
15771
+ function getSetExternalModuleIndicator(options) {
15772
+ switch (getEmitModuleDetectionKind(options)) {
15773
+ case ts.ModuleDetectionKind.Force:
15774
+ return function (file) {
15775
+ file.externalModuleIndicator = !file.isDeclarationFile || ts.isFileProbablyExternalModule(file);
15776
+ };
15777
+ case ts.ModuleDetectionKind.Legacy:
15778
+ return function (file) {
15779
+ file.externalModuleIndicator = ts.isFileProbablyExternalModule(file);
15780
+ };
15781
+ case ts.ModuleDetectionKind.Auto:
15782
+ var checks = [ts.isFileProbablyExternalModule];
15783
+ if (options.jsx === 4 || options.jsx === 5) {
15784
+ checks.push(isFileModuleFromUsingJSXTag);
15785
+ }
15786
+ var moduleKind = getEmitModuleKind(options);
15787
+ if (moduleKind === ts.ModuleKind.Node12 || moduleKind === ts.ModuleKind.NodeNext) {
15788
+ checks.push(isFileForcedToBeModuleByFormat);
15789
+ }
15790
+ var combined_1 = ts.or.apply(void 0, checks);
15791
+ var callback = function (file) { return void (file.externalModuleIndicator = combined_1(file)); };
15792
+ return callback;
15793
+ }
15794
+ }
15795
+ ts.getSetExternalModuleIndicator = getSetExternalModuleIndicator;
15594
15796
  function getEmitScriptTarget(compilerOptions) {
15595
15797
  return compilerOptions.target ||
15596
15798
  (compilerOptions.module === ts.ModuleKind.Node12 && 7) ||
@@ -15625,6 +15827,10 @@ var ts;
15625
15827
  return moduleResolution;
15626
15828
  }
15627
15829
  ts.getEmitModuleResolutionKind = getEmitModuleResolutionKind;
15830
+ function getEmitModuleDetectionKind(options) {
15831
+ return options.moduleDetection || ts.ModuleDetectionKind.Auto;
15832
+ }
15833
+ ts.getEmitModuleDetectionKind = getEmitModuleDetectionKind;
15628
15834
  function hasJsonModuleEmitEnabled(options) {
15629
15835
  switch (getEmitModuleKind(options)) {
15630
15836
  case ts.ModuleKind.CommonJS:
@@ -24060,6 +24266,32 @@ var ts;
24060
24266
  text.charCodeAt(start + 3) !== 47;
24061
24267
  }
24062
24268
  ts.isJSDocLikeText = isJSDocLikeText;
24269
+ function isFileProbablyExternalModule(sourceFile) {
24270
+ return ts.forEach(sourceFile.statements, isAnExternalModuleIndicatorNode) ||
24271
+ getImportMetaIfNecessary(sourceFile);
24272
+ }
24273
+ ts.isFileProbablyExternalModule = isFileProbablyExternalModule;
24274
+ function isAnExternalModuleIndicatorNode(node) {
24275
+ return hasModifierOfKind(node, 93)
24276
+ || ts.isImportEqualsDeclaration(node) && ts.isExternalModuleReference(node.moduleReference)
24277
+ || ts.isImportDeclaration(node)
24278
+ || ts.isExportAssignment(node)
24279
+ || ts.isExportDeclaration(node) ? node : undefined;
24280
+ }
24281
+ function getImportMetaIfNecessary(sourceFile) {
24282
+ return sourceFile.flags & 2097152 ?
24283
+ walkTreeForImportMeta(sourceFile) :
24284
+ undefined;
24285
+ }
24286
+ function walkTreeForImportMeta(node) {
24287
+ return isImportMeta(node) ? node : forEachChild(node, walkTreeForImportMeta);
24288
+ }
24289
+ function hasModifierOfKind(node, kind) {
24290
+ return ts.some(node.modifiers, function (m) { return m.kind === kind; });
24291
+ }
24292
+ function isImportMeta(node) {
24293
+ return ts.isMetaProperty(node) && node.keywordToken === 100 && node.name.escapedText === "meta";
24294
+ }
24063
24295
  function forEachChild(node, cbNode, cbNodes) {
24064
24296
  if (!node || node.kind <= 159) {
24065
24297
  return;
@@ -24613,17 +24845,25 @@ var ts;
24613
24845
  children.unshift(n);
24614
24846
  }
24615
24847
  }
24616
- function createSourceFile(fileName, sourceText, languageVersion, setParentNodes, scriptKind) {
24848
+ function setExternalModuleIndicator(sourceFile) {
24849
+ sourceFile.externalModuleIndicator = isFileProbablyExternalModule(sourceFile);
24850
+ }
24851
+ function createSourceFile(fileName, sourceText, languageVersionOrOptions, setParentNodes, scriptKind) {
24617
24852
  if (setParentNodes === void 0) { setParentNodes = false; }
24618
24853
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("parse", "createSourceFile", { path: fileName }, true);
24619
24854
  ts.performance.mark("beforeParse");
24620
24855
  var result;
24621
24856
  ts.perfLogger.logStartParseSourceFile(fileName);
24857
+ var _a = typeof languageVersionOrOptions === "object" ? languageVersionOrOptions : { languageVersion: languageVersionOrOptions }, languageVersion = _a.languageVersion, overrideSetExternalModuleIndicator = _a.setExternalModuleIndicator, format = _a.impliedNodeFormat;
24622
24858
  if (languageVersion === 100) {
24623
- result = Parser.parseSourceFile(fileName, sourceText, languageVersion, undefined, setParentNodes, 6);
24859
+ result = Parser.parseSourceFile(fileName, sourceText, languageVersion, undefined, setParentNodes, 6, ts.noop);
24624
24860
  }
24625
24861
  else {
24626
- result = Parser.parseSourceFile(fileName, sourceText, languageVersion, undefined, setParentNodes, scriptKind);
24862
+ var setIndicator = format === undefined ? overrideSetExternalModuleIndicator : function (file) {
24863
+ file.impliedNodeFormat = format;
24864
+ return (overrideSetExternalModuleIndicator || setExternalModuleIndicator)(file);
24865
+ };
24866
+ result = Parser.parseSourceFile(fileName, sourceText, languageVersion, undefined, setParentNodes, scriptKind, setIndicator);
24627
24867
  }
24628
24868
  ts.perfLogger.logStopParseSourceFile();
24629
24869
  ts.performance.mark("afterParse");
@@ -24703,7 +24943,7 @@ var ts;
24703
24943
  var contextFlags;
24704
24944
  var topLevel = true;
24705
24945
  var parseErrorBeforeNextFinishedNode = false;
24706
- function parseSourceFile(fileName, sourceText, languageVersion, syntaxCursor, setParentNodes, scriptKind) {
24946
+ function parseSourceFile(fileName, sourceText, languageVersion, syntaxCursor, setParentNodes, scriptKind, setExternalModuleIndicatorOverride) {
24707
24947
  var _a;
24708
24948
  if (setParentNodes === void 0) { setParentNodes = false; }
24709
24949
  scriptKind = ts.ensureScriptKind(fileName, scriptKind);
@@ -24719,7 +24959,7 @@ var ts;
24719
24959
  return result_3;
24720
24960
  }
24721
24961
  initializeState(fileName, sourceText, languageVersion, syntaxCursor, scriptKind);
24722
- var result = parseSourceFileWorker(languageVersion, setParentNodes, scriptKind);
24962
+ var result = parseSourceFileWorker(languageVersion, setParentNodes, scriptKind, setExternalModuleIndicatorOverride || setExternalModuleIndicator);
24723
24963
  clearState();
24724
24964
  return result;
24725
24965
  }
@@ -24795,7 +25035,7 @@ var ts;
24795
25035
  statements = createNodeArray([statement], pos);
24796
25036
  endOfFileToken = parseExpectedToken(1, ts.Diagnostics.Unexpected_token);
24797
25037
  }
24798
- var sourceFile = createSourceFile(fileName, 2, 6, false, statements, endOfFileToken, sourceFlags);
25038
+ var sourceFile = createSourceFile(fileName, 2, 6, false, statements, endOfFileToken, sourceFlags, ts.noop);
24799
25039
  if (setParentNodes) {
24800
25040
  fixupParentReferences(sourceFile);
24801
25041
  }
@@ -24866,7 +25106,7 @@ var ts;
24866
25106
  notParenthesizedArrow = undefined;
24867
25107
  topLevel = true;
24868
25108
  }
24869
- function parseSourceFileWorker(languageVersion, setParentNodes, scriptKind) {
25109
+ function parseSourceFileWorker(languageVersion, setParentNodes, scriptKind, setExternalModuleIndicator) {
24870
25110
  var isDeclarationFile = isDeclarationFileName(fileName);
24871
25111
  if (isDeclarationFile) {
24872
25112
  contextFlags |= 8388608;
@@ -24876,7 +25116,7 @@ var ts;
24876
25116
  var statements = parseList(0, parseStatement);
24877
25117
  ts.Debug.assert(token() === 1);
24878
25118
  var endOfFileToken = addJSDocComment(parseTokenNode());
24879
- var sourceFile = createSourceFile(fileName, languageVersion, scriptKind, isDeclarationFile, statements, endOfFileToken, sourceFlags);
25119
+ var sourceFile = createSourceFile(fileName, languageVersion, scriptKind, isDeclarationFile, statements, endOfFileToken, sourceFlags, setExternalModuleIndicator);
24880
25120
  processCommentPragmas(sourceFile, sourceText);
24881
25121
  processPragmasIntoFields(sourceFile, reportPragmaDiagnostic);
24882
25122
  sourceFile.commentDirectives = scanner.getCommentDirectives();
@@ -25000,22 +25240,27 @@ var ts;
25000
25240
  ts.setParentRecursive(rootNode, true);
25001
25241
  }
25002
25242
  Parser.fixupParentReferences = fixupParentReferences;
25003
- function createSourceFile(fileName, languageVersion, scriptKind, isDeclarationFile, statements, endOfFileToken, flags) {
25243
+ function createSourceFile(fileName, languageVersion, scriptKind, isDeclarationFile, statements, endOfFileToken, flags, setExternalModuleIndicator) {
25004
25244
  var sourceFile = factory.createSourceFile(statements, endOfFileToken, flags);
25005
25245
  ts.setTextRangePosWidth(sourceFile, 0, sourceText.length);
25006
- setExternalModuleIndicator(sourceFile);
25246
+ setFields(sourceFile);
25007
25247
  if (!isDeclarationFile && isExternalModule(sourceFile) && sourceFile.transformFlags & 16777216) {
25008
25248
  sourceFile = reparseTopLevelAwait(sourceFile);
25249
+ setFields(sourceFile);
25009
25250
  }
25010
- sourceFile.text = sourceText;
25011
- sourceFile.bindDiagnostics = [];
25012
- sourceFile.bindSuggestionDiagnostics = undefined;
25013
- sourceFile.languageVersion = languageVersion;
25014
- sourceFile.fileName = fileName;
25015
- sourceFile.languageVariant = ts.getLanguageVariant(scriptKind);
25016
- sourceFile.isDeclarationFile = isDeclarationFile;
25017
- sourceFile.scriptKind = scriptKind;
25018
25251
  return sourceFile;
25252
+ function setFields(sourceFile) {
25253
+ sourceFile.text = sourceText;
25254
+ sourceFile.bindDiagnostics = [];
25255
+ sourceFile.bindSuggestionDiagnostics = undefined;
25256
+ sourceFile.languageVersion = languageVersion;
25257
+ sourceFile.fileName = fileName;
25258
+ sourceFile.languageVariant = ts.getLanguageVariant(scriptKind);
25259
+ sourceFile.isDeclarationFile = isDeclarationFile;
25260
+ sourceFile.scriptKind = scriptKind;
25261
+ setExternalModuleIndicator(sourceFile);
25262
+ sourceFile.setExternalModuleIndicator = setExternalModuleIndicator;
25263
+ }
25019
25264
  }
25020
25265
  function setContextFlag(val, flag) {
25021
25266
  if (val) {
@@ -29460,32 +29705,6 @@ var ts;
29460
29705
  var node = factory.createExportAssignment(decorators, modifiers, isExportEquals, expression);
29461
29706
  return withJSDoc(finishNode(node, pos), hasJSDoc);
29462
29707
  }
29463
- function setExternalModuleIndicator(sourceFile) {
29464
- sourceFile.externalModuleIndicator =
29465
- ts.forEach(sourceFile.statements, isAnExternalModuleIndicatorNode) ||
29466
- getImportMetaIfNecessary(sourceFile);
29467
- }
29468
- function isAnExternalModuleIndicatorNode(node) {
29469
- return hasModifierOfKind(node, 93)
29470
- || ts.isImportEqualsDeclaration(node) && ts.isExternalModuleReference(node.moduleReference)
29471
- || ts.isImportDeclaration(node)
29472
- || ts.isExportAssignment(node)
29473
- || ts.isExportDeclaration(node) ? node : undefined;
29474
- }
29475
- function getImportMetaIfNecessary(sourceFile) {
29476
- return sourceFile.flags & 2097152 ?
29477
- walkTreeForExternalModuleIndicators(sourceFile) :
29478
- undefined;
29479
- }
29480
- function walkTreeForExternalModuleIndicators(node) {
29481
- return isImportMeta(node) ? node : forEachChild(node, walkTreeForExternalModuleIndicators);
29482
- }
29483
- function hasModifierOfKind(node, kind) {
29484
- return ts.some(node.modifiers, function (m) { return m.kind === kind; });
29485
- }
29486
- function isImportMeta(node) {
29487
- return ts.isMetaProperty(node) && node.keywordToken === 100 && node.name.escapedText === "meta";
29488
- }
29489
29708
  var JSDocParser;
29490
29709
  (function (JSDocParser) {
29491
29710
  function parseJSDocTypeExpressionForTests(content, start, length) {
@@ -29493,7 +29712,7 @@ var ts;
29493
29712
  scanner.setText(content, start, length);
29494
29713
  currentToken = scanner.scan();
29495
29714
  var jsDocTypeExpression = parseJSDocTypeExpression();
29496
- var sourceFile = createSourceFile("file.js", 99, 1, false, [], factory.createToken(1), 0);
29715
+ var sourceFile = createSourceFile("file.js", 99, 1, false, [], factory.createToken(1), 0, ts.noop);
29497
29716
  var diagnostics = ts.attachFileToDiagnostics(parseDiagnostics, sourceFile);
29498
29717
  if (jsDocDiagnostics) {
29499
29718
  sourceFile.jsDocDiagnostics = ts.attachFileToDiagnostics(jsDocDiagnostics, sourceFile);
@@ -30389,7 +30608,7 @@ var ts;
30389
30608
  return sourceFile;
30390
30609
  }
30391
30610
  if (sourceFile.statements.length === 0) {
30392
- return Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, undefined, true, sourceFile.scriptKind);
30611
+ return Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, undefined, true, sourceFile.scriptKind, sourceFile.setExternalModuleIndicator);
30393
30612
  }
30394
30613
  var incrementalSourceFile = sourceFile;
30395
30614
  ts.Debug.assert(!incrementalSourceFile.hasBeenIncrementallyParsed);
@@ -30404,7 +30623,7 @@ var ts;
30404
30623
  ts.Debug.assert(ts.textSpanEnd(ts.textChangeRangeNewSpan(changeRange)) === ts.textSpanEnd(ts.textChangeRangeNewSpan(textChangeRange)));
30405
30624
  var delta = ts.textChangeRangeNewSpan(changeRange).length - changeRange.span.length;
30406
30625
  updateTokenPositionsAndMarkElements(incrementalSourceFile, changeRange.span.start, ts.textSpanEnd(changeRange.span), ts.textSpanEnd(ts.textChangeRangeNewSpan(changeRange)), delta, oldText, newText, aggressiveChecks);
30407
- var result = Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, syntaxCursor, true, sourceFile.scriptKind);
30626
+ var result = Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, syntaxCursor, true, sourceFile.scriptKind, sourceFile.setExternalModuleIndicator);
30408
30627
  result.commentDirectives = getNewCommentDirectives(sourceFile.commentDirectives, result.commentDirectives, changeRange.span.start, ts.textSpanEnd(changeRange.span), delta, oldText, newText, aggressiveChecks);
30409
30628
  result.impliedNodeFormat = sourceFile.impliedNodeFormat;
30410
30629
  return result;
@@ -32116,6 +32335,18 @@ var ts;
32116
32335
  description: ts.Diagnostics.Specify_a_list_of_language_service_plugins_to_include,
32117
32336
  category: ts.Diagnostics.Editor_Support,
32118
32337
  },
32338
+ {
32339
+ name: "moduleDetection",
32340
+ type: new ts.Map(ts.getEntries({
32341
+ auto: ts.ModuleDetectionKind.Auto,
32342
+ legacy: ts.ModuleDetectionKind.Legacy,
32343
+ force: ts.ModuleDetectionKind.Force,
32344
+ })),
32345
+ affectsModuleResolution: true,
32346
+ description: ts.Diagnostics.Control_what_method_is_used_to_detect_module_format_JS_files,
32347
+ category: ts.Diagnostics.Language_and_Environment,
32348
+ 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,
32349
+ }
32119
32350
  ];
32120
32351
  ts.optionDeclarations = __spreadArray(__spreadArray([], ts.commonOptionsWithBuild, true), commandOptionsWithoutBuild, true);
32121
32352
  ts.semanticDiagnosticsOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsSemanticDiagnostics; });
@@ -39030,6 +39261,8 @@ var ts;
39030
39261
  var templateConstraintType = getUnionType([stringType, numberType, booleanType, bigintType, nullType, undefinedType]);
39031
39262
  var restrictiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 ? getRestrictiveTypeParameter(t) : t; });
39032
39263
  var permissiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 ? wildcardType : t; });
39264
+ var uniqueLiteralType = createIntrinsicType(131072, "never");
39265
+ var uniqueLiteralMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 ? uniqueLiteralType : t; });
39033
39266
  var emptyObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
39034
39267
  var emptyJsxObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
39035
39268
  emptyJsxObjectType.objectFlags |= 2048;
@@ -42458,8 +42691,14 @@ var ts;
42458
42691
  var readonlyToken = type.declaration.readonlyToken ? ts.factory.createToken(type.declaration.readonlyToken.kind) : undefined;
42459
42692
  var questionToken = type.declaration.questionToken ? ts.factory.createToken(type.declaration.questionToken.kind) : undefined;
42460
42693
  var appropriateConstraintTypeNode;
42694
+ var newTypeVariable;
42461
42695
  if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
42462
- appropriateConstraintTypeNode = ts.factory.createTypeOperatorNode(140, typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context));
42696
+ if (!(getModifiersTypeFromMappedType(type).flags & 262144) && context.flags & 4) {
42697
+ var newParam = createTypeParameter(createSymbol(262144, "T"));
42698
+ var name = typeParameterToName(newParam, context);
42699
+ newTypeVariable = ts.factory.createTypeReferenceNode(name);
42700
+ }
42701
+ appropriateConstraintTypeNode = ts.factory.createTypeOperatorNode(140, newTypeVariable || typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context));
42463
42702
  }
42464
42703
  else {
42465
42704
  appropriateConstraintTypeNode = typeToTypeNodeHelper(getConstraintTypeFromMappedType(type), context);
@@ -42469,7 +42708,11 @@ var ts;
42469
42708
  var templateTypeNode = typeToTypeNodeHelper(removeMissingType(getTemplateTypeFromMappedType(type), !!(getMappedTypeModifiers(type) & 4)), context);
42470
42709
  var mappedTypeNode = ts.factory.createMappedTypeNode(readonlyToken, typeParameterNode, nameTypeNode, questionToken, templateTypeNode, undefined);
42471
42710
  context.approximateLength += 10;
42472
- return ts.setEmitFlags(mappedTypeNode, 1);
42711
+ var result = ts.setEmitFlags(mappedTypeNode, 1);
42712
+ if (isMappedTypeWithKeyofConstraintDeclaration(type) && !(getModifiersTypeFromMappedType(type).flags & 262144) && context.flags & 4) {
42713
+ return ts.factory.createConditionalTypeNode(typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context), ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(ts.factory.cloneNode(newTypeVariable.typeName))), result, ts.factory.createKeywordTypeNode(143));
42714
+ }
42715
+ return result;
42473
42716
  }
42474
42717
  function createAnonymousTypeNode(type) {
42475
42718
  var _a;
@@ -43925,7 +44168,7 @@ var ts;
43925
44168
  }
43926
44169
  }
43927
44170
  function serializeSymbolWorker(symbol, isPrivate, propertyAsAlias) {
43928
- var _a, _b;
44171
+ var _a, _b, _c, _d;
43929
44172
  var symbolName = ts.unescapeLeadingUnderscores(symbol.escapedName);
43930
44173
  var isDefault = symbol.escapedName === "default";
43931
44174
  if (isPrivate && !(context.flags & 131072) && ts.isStringANonContextualKeyword(symbolName) && !isDefault) {
@@ -43968,17 +44211,21 @@ var ts;
43968
44211
  serializeAsFunctionNamespaceMerge(type, symbol, localName, modifierFlags);
43969
44212
  }
43970
44213
  else {
43971
- var flags = !(symbol.flags & 2) ? undefined
43972
- : isConstVariable(symbol) ? 2
44214
+ var flags = !(symbol.flags & 2)
44215
+ ? ((_a = symbol.parent) === null || _a === void 0 ? void 0 : _a.valueDeclaration) && ts.isSourceFile((_b = symbol.parent) === null || _b === void 0 ? void 0 : _b.valueDeclaration)
44216
+ ? 2
44217
+ : undefined
44218
+ : isConstVariable(symbol)
44219
+ ? 2
43973
44220
  : 1;
43974
44221
  var name = (needsPostExportDefault || !(symbol.flags & 4)) ? localName : getUnusedName(localName, symbol);
43975
44222
  var textRange = symbol.declarations && ts.find(symbol.declarations, function (d) { return ts.isVariableDeclaration(d); });
43976
44223
  if (textRange && ts.isVariableDeclarationList(textRange.parent) && textRange.parent.declarations.length === 1) {
43977
44224
  textRange = textRange.parent.parent;
43978
44225
  }
43979
- var propertyAccessRequire = (_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isPropertyAccessExpression);
44226
+ var propertyAccessRequire = (_c = symbol.declarations) === null || _c === void 0 ? void 0 : _c.find(ts.isPropertyAccessExpression);
43980
44227
  if (propertyAccessRequire && ts.isBinaryExpression(propertyAccessRequire.parent) && ts.isIdentifier(propertyAccessRequire.parent.right)
43981
- && ((_b = type.symbol) === null || _b === void 0 ? void 0 : _b.valueDeclaration) && ts.isSourceFile(type.symbol.valueDeclaration)) {
44228
+ && ((_d = type.symbol) === null || _d === void 0 ? void 0 : _d.valueDeclaration) && ts.isSourceFile(type.symbol.valueDeclaration)) {
43982
44229
  var alias = localName === propertyAccessRequire.parent.right.escapedText ? undefined : propertyAccessRequire.parent.right;
43983
44230
  addResult(ts.factory.createExportDeclaration(undefined, undefined, false, ts.factory.createNamedExports([ts.factory.createExportSpecifier(false, alias, localName)])), 0);
43984
44231
  context.tracker.trackSymbol(type.symbol, context.enclosingDeclaration, 111551);
@@ -44025,8 +44272,8 @@ var ts;
44025
44272
  }
44026
44273
  if (symbol.flags & 8388608) {
44027
44274
  if (symbol.declarations) {
44028
- for (var _i = 0, _c = symbol.declarations; _i < _c.length; _i++) {
44029
- var node = _c[_i];
44275
+ for (var _i = 0, _e = symbol.declarations; _i < _e.length; _i++) {
44276
+ var node = _e[_i];
44030
44277
  var resolvedModule = resolveExternalModuleName(node, node.moduleSpecifier);
44031
44278
  if (!resolvedModule)
44032
44279
  continue;
@@ -45519,7 +45766,10 @@ var ts;
45519
45766
  if (containsSameNamedThisProperty(expression.left, expression.right)) {
45520
45767
  return anyType;
45521
45768
  }
45522
- var type = resolvedSymbol ? getTypeOfSymbol(resolvedSymbol) : getWidenedLiteralType(checkExpressionCached(expression.right));
45769
+ var isDirectExport = kind === 1 && (ts.isPropertyAccessExpression(expression.left) || ts.isElementAccessExpression(expression.left)) && (ts.isModuleExportsAccessExpression(expression.left.expression) || (ts.isIdentifier(expression.left.expression) && ts.isExportsIdentifier(expression.left.expression)));
45770
+ var type = resolvedSymbol ? getTypeOfSymbol(resolvedSymbol)
45771
+ : isDirectExport ? getRegularTypeOfLiteralType(checkExpressionCached(expression.right))
45772
+ : getWidenedLiteralType(checkExpressionCached(expression.right));
45523
45773
  if (type.flags & 524288 &&
45524
45774
  kind === 2 &&
45525
45775
  symbol.escapedName === "export=") {
@@ -48122,10 +48372,10 @@ var ts;
48122
48372
  else if (type !== firstType) {
48123
48373
  checkFlags |= 64;
48124
48374
  }
48125
- if (isLiteralType(type) || isPatternLiteralType(type)) {
48375
+ if (isLiteralType(type) || isPatternLiteralType(type) || type === uniqueLiteralType) {
48126
48376
  checkFlags |= 128;
48127
48377
  }
48128
- if (type.flags & 131072) {
48378
+ if (type.flags & 131072 && type !== uniqueLiteralType) {
48129
48379
  checkFlags |= 131072;
48130
48380
  }
48131
48381
  propTypes.push(type);
@@ -50376,10 +50626,18 @@ var ts;
50376
50626
  info.keyType === stringType && include & 8 ? stringOrNumberType : info.keyType : neverType; });
50377
50627
  return getUnionType(ts.concatenate(propertyTypes, indexKeyTypes), 1, undefined, undefined, origin);
50378
50628
  }
50629
+ function isPossiblyReducibleByInstantiation(type) {
50630
+ return ts.some(type.types, function (t) {
50631
+ var uniqueFilled = getUniqueLiteralFilledInstantiation(t);
50632
+ return getReducedType(uniqueFilled) !== uniqueFilled;
50633
+ });
50634
+ }
50379
50635
  function getIndexType(type, stringsOnly, noIndexSignatures) {
50380
50636
  if (stringsOnly === void 0) { stringsOnly = keyofStringsOnly; }
50381
50637
  type = getReducedType(type);
50382
- return type.flags & 1048576 ? getIntersectionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) :
50638
+ return type.flags & 1048576 ? isPossiblyReducibleByInstantiation(type)
50639
+ ? getIndexTypeForGenericType(type, stringsOnly)
50640
+ : getIntersectionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) :
50383
50641
  type.flags & 2097152 ? getUnionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) :
50384
50642
  type.flags & 58982400 || isGenericTupleType(type) || isGenericMappedType(type) && !hasDistributiveNameType(type) ? getIndexTypeForGenericType(type, stringsOnly) :
50385
50643
  ts.getObjectFlags(type) & 32 ? getIndexTypeForMappedType(type, stringsOnly, noIndexSignatures) :
@@ -50949,6 +51207,10 @@ var ts;
50949
51207
  }
50950
51208
  return type;
50951
51209
  }
51210
+ function maybeCloneTypeParameter(p) {
51211
+ var constraint = getConstraintOfTypeParameter(p);
51212
+ return constraint && (isGenericObjectType(constraint) || isGenericIndexType(constraint)) ? cloneTypeParameter(p) : p;
51213
+ }
50952
51214
  function isTypicalNondistributiveConditional(root) {
50953
51215
  return !root.isDistributive && isSingletonTupleType(root.node.checkType) && isSingletonTupleType(root.node.extendsType);
50954
51216
  }
@@ -50962,26 +51224,38 @@ var ts;
50962
51224
  var result;
50963
51225
  var extraTypes;
50964
51226
  var tailCount = 0;
50965
- while (true) {
51227
+ var _loop_18 = function () {
50966
51228
  if (tailCount === 1000) {
50967
51229
  error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
50968
51230
  result = errorType;
50969
- break;
51231
+ return "break";
50970
51232
  }
50971
51233
  var isUnwrapped = isTypicalNondistributiveConditional(root);
50972
51234
  var checkType = instantiateType(unwrapNondistributiveConditionalTuple(root, getActualTypeVariable(root.checkType)), mapper);
50973
51235
  var checkTypeInstantiable = isGenericType(checkType);
50974
51236
  var extendsType = instantiateType(unwrapNondistributiveConditionalTuple(root, root.extendsType), mapper);
50975
51237
  if (checkType === wildcardType || extendsType === wildcardType) {
50976
- return wildcardType;
51238
+ return { value: wildcardType };
50977
51239
  }
50978
51240
  var combinedMapper = void 0;
50979
51241
  if (root.inferTypeParameters) {
50980
- var context = createInferenceContext(root.inferTypeParameters, undefined, 0);
50981
- if (!checkTypeInstantiable) {
50982
- inferTypes(context.inferences, checkType, extendsType, 512 | 1024);
51242
+ var freshParams = ts.sameMap(root.inferTypeParameters, maybeCloneTypeParameter);
51243
+ var freshMapper = freshParams !== root.inferTypeParameters ? createTypeMapper(root.inferTypeParameters, freshParams) : undefined;
51244
+ var context = createInferenceContext(freshParams, undefined, 0);
51245
+ if (freshMapper) {
51246
+ var freshCombinedMapper = combineTypeMappers(mapper, freshMapper);
51247
+ for (var _i = 0, freshParams_1 = freshParams; _i < freshParams_1.length; _i++) {
51248
+ var p = freshParams_1[_i];
51249
+ if (root.inferTypeParameters.indexOf(p) === -1) {
51250
+ p.mapper = freshCombinedMapper;
51251
+ }
51252
+ }
51253
+ }
51254
+ if (!checkTypeInstantiable || !ts.some(root.inferTypeParameters, function (t) { return t === extendsType; })) {
51255
+ inferTypes(context.inferences, checkType, instantiateType(extendsType, freshMapper), 512 | 1024);
50983
51256
  }
50984
- combinedMapper = mapper ? combineTypeMappers(context.mapper, mapper) : context.mapper;
51257
+ var innerMapper = combineTypeMappers(freshMapper, context.mapper);
51258
+ combinedMapper = mapper ? combineTypeMappers(innerMapper, mapper) : innerMapper;
50985
51259
  }
50986
51260
  var inferredExtendsType = combinedMapper ? instantiateType(unwrapNondistributiveConditionalTuple(root, root.extendsType), combinedMapper) : extendsType;
50987
51261
  if (!checkTypeInstantiable && !isGenericType(inferredExtendsType)) {
@@ -50994,23 +51268,23 @@ var ts;
50994
51268
  var newRoot = falseType_1.root;
50995
51269
  if (newRoot.node.parent === root.node && (!newRoot.isDistributive || newRoot.checkType === root.checkType)) {
50996
51270
  root = newRoot;
50997
- continue;
51271
+ return "continue";
50998
51272
  }
50999
51273
  if (canTailRecurse(falseType_1, mapper)) {
51000
- continue;
51274
+ return "continue";
51001
51275
  }
51002
51276
  }
51003
51277
  result = instantiateType(falseType_1, mapper);
51004
- break;
51278
+ return "break";
51005
51279
  }
51006
51280
  if (inferredExtendsType.flags & 3 || isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(inferredExtendsType))) {
51007
51281
  var trueType_1 = getTypeFromTypeNode(root.node.trueType);
51008
51282
  var trueMapper = combinedMapper || mapper;
51009
51283
  if (canTailRecurse(trueType_1, trueMapper)) {
51010
- continue;
51284
+ return "continue";
51011
51285
  }
51012
51286
  result = instantiateType(trueType_1, trueMapper);
51013
- break;
51287
+ return "break";
51014
51288
  }
51015
51289
  }
51016
51290
  result = createType(16777216);
@@ -51021,7 +51295,14 @@ var ts;
51021
51295
  result.combinedMapper = combinedMapper;
51022
51296
  result.aliasSymbol = aliasSymbol || root.aliasSymbol;
51023
51297
  result.aliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(root.aliasTypeArguments, mapper);
51024
- break;
51298
+ return "break";
51299
+ };
51300
+ while (true) {
51301
+ var state_5 = _loop_18();
51302
+ if (typeof state_5 === "object")
51303
+ return state_5.value;
51304
+ if (state_5 === "break")
51305
+ break;
51025
51306
  }
51026
51307
  return extraTypes ? getUnionType(ts.append(extraTypes, result)) : result;
51027
51308
  function canTailRecurse(newType, newMapper) {
@@ -51423,9 +51704,11 @@ var ts;
51423
51704
  }
51424
51705
  function getESSymbolLikeTypeForNode(node) {
51425
51706
  if (ts.isValidESSymbolDeclaration(node)) {
51426
- var symbol = getSymbolOfNode(node);
51427
- var links = getSymbolLinks(symbol);
51428
- return links.uniqueESSymbolType || (links.uniqueESSymbolType = createUniqueESSymbolType(symbol));
51707
+ var symbol = ts.isCommonJsExportPropertyAssignment(node) ? getSymbolOfNode(node.left) : getSymbolOfNode(node);
51708
+ if (symbol) {
51709
+ var links = getSymbolLinks(symbol);
51710
+ return links.uniqueESSymbolType || (links.uniqueESSymbolType = createUniqueESSymbolType(symbol));
51711
+ }
51429
51712
  }
51430
51713
  return esSymbolType;
51431
51714
  }
@@ -52005,6 +52288,10 @@ var ts;
52005
52288
  }
52006
52289
  return type;
52007
52290
  }
52291
+ function getUniqueLiteralFilledInstantiation(type) {
52292
+ return type.flags & (131068 | 3 | 131072) ? type :
52293
+ type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
52294
+ }
52008
52295
  function getPermissiveInstantiation(type) {
52009
52296
  return type.flags & (131068 | 3 | 131072) ? type :
52010
52297
  type.permissiveInstantiation || (type.permissiveInstantiation = instantiateType(type, permissiveMapper));
@@ -52805,7 +53092,7 @@ var ts;
52805
53092
  return true;
52806
53093
  }
52807
53094
  }
52808
- else {
53095
+ else if (!((source.flags | target.flags) & (3145728 | 8388608 | 16777216 | 33554432))) {
52809
53096
  if (source.flags !== target.flags)
52810
53097
  return false;
52811
53098
  if (source.flags & 67358815)
@@ -53301,7 +53588,7 @@ var ts;
53301
53588
  reducedTarget = findMatchingDiscriminantType(source, target, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target);
53302
53589
  checkTypes = reducedTarget.flags & 1048576 ? reducedTarget.types : [reducedTarget];
53303
53590
  }
53304
- var _loop_18 = function (prop) {
53591
+ var _loop_19 = function (prop) {
53305
53592
  if (shouldCheckAsExcessProperty(prop, source.symbol) && !isIgnoredJsxProperty(source, prop)) {
53306
53593
  if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) {
53307
53594
  if (reportErrors) {
@@ -53354,9 +53641,9 @@ var ts;
53354
53641
  };
53355
53642
  for (var _i = 0, _b = getPropertiesOfType(source); _i < _b.length; _i++) {
53356
53643
  var prop = _b[_i];
53357
- var state_5 = _loop_18(prop);
53358
- if (typeof state_5 === "object")
53359
- return state_5.value;
53644
+ var state_6 = _loop_19(prop);
53645
+ if (typeof state_6 === "object")
53646
+ return state_6.value;
53360
53647
  }
53361
53648
  return false;
53362
53649
  }
@@ -54133,11 +54420,11 @@ var ts;
54133
54420
  }
54134
54421
  var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes);
54135
54422
  var matchingTypes = [];
54136
- var _loop_19 = function (combination) {
54423
+ var _loop_20 = function (combination) {
54137
54424
  var hasMatch = false;
54138
54425
  outer: for (var _c = 0, _d = target.types; _c < _d.length; _c++) {
54139
54426
  var type = _d[_c];
54140
- var _loop_20 = function (i) {
54427
+ var _loop_21 = function (i) {
54141
54428
  var sourceProperty = sourcePropertiesFiltered[i];
54142
54429
  var targetProperty = getPropertyOfType(type, sourceProperty.escapedName);
54143
54430
  if (!targetProperty)
@@ -54150,8 +54437,8 @@ var ts;
54150
54437
  }
54151
54438
  };
54152
54439
  for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
54153
- var state_7 = _loop_20(i);
54154
- switch (state_7) {
54440
+ var state_8 = _loop_21(i);
54441
+ switch (state_8) {
54155
54442
  case "continue-outer": continue outer;
54156
54443
  }
54157
54444
  }
@@ -54164,9 +54451,9 @@ var ts;
54164
54451
  };
54165
54452
  for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) {
54166
54453
  var combination = discriminantCombinations_1[_a];
54167
- var state_6 = _loop_19(combination);
54168
- if (typeof state_6 === "object")
54169
- return state_6.value;
54454
+ var state_7 = _loop_20(combination);
54455
+ if (typeof state_7 === "object")
54456
+ return state_7.value;
54170
54457
  }
54171
54458
  var result = -1;
54172
54459
  for (var _b = 0, matchingTypes_1 = matchingTypes; _b < matchingTypes_1.length; _b++) {
@@ -54814,7 +55101,7 @@ var ts;
54814
55101
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes", "getVariancesWorker", { arity: typeParameters.length, id: (_c = (_a = cache.id) !== null && _a !== void 0 ? _a : (_b = cache.declaredType) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : -1 });
54815
55102
  cache.variances = ts.emptyArray;
54816
55103
  variances = [];
54817
- var _loop_21 = function (tp) {
55104
+ var _loop_22 = function (tp) {
54818
55105
  var unmeasurable = false;
54819
55106
  var unreliable = false;
54820
55107
  var oldHandler = outofbandVarianceMarkerHandler;
@@ -54839,7 +55126,7 @@ var ts;
54839
55126
  };
54840
55127
  for (var _i = 0, typeParameters_1 = typeParameters; _i < typeParameters_1.length; _i++) {
54841
55128
  var tp = typeParameters_1[_i];
54842
- _loop_21(tp);
55129
+ _loop_22(tp);
54843
55130
  }
54844
55131
  cache.variances = variances;
54845
55132
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
@@ -56890,7 +57177,7 @@ var ts;
56890
57177
  function mapTypesByKeyProperty(types, name) {
56891
57178
  var map = new ts.Map();
56892
57179
  var count = 0;
56893
- var _loop_22 = function (type) {
57180
+ var _loop_23 = function (type) {
56894
57181
  if (type.flags & (524288 | 2097152 | 58982400)) {
56895
57182
  var discriminant = getTypeOfPropertyOfType(type, name);
56896
57183
  if (discriminant) {
@@ -56916,9 +57203,9 @@ var ts;
56916
57203
  };
56917
57204
  for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
56918
57205
  var type = types_16[_i];
56919
- var state_8 = _loop_22(type);
56920
- if (typeof state_8 === "object")
56921
- return state_8.value;
57206
+ var state_9 = _loop_23(type);
57207
+ if (typeof state_9 === "object")
57208
+ return state_9.value;
56922
57209
  }
56923
57210
  return count >= 10 && count * 2 >= types.length ? map : undefined;
56924
57211
  }
@@ -58051,7 +58338,7 @@ var ts;
58051
58338
  return result;
58052
58339
  }
58053
58340
  function getCandidateDiscriminantPropertyAccess(expr) {
58054
- if (ts.isBindingPattern(reference) || ts.isFunctionExpressionOrArrowFunction(reference)) {
58341
+ if (ts.isBindingPattern(reference) || ts.isFunctionExpressionOrArrowFunction(reference) || ts.isObjectLiteralMethod(reference)) {
58055
58342
  if (ts.isIdentifier(expr)) {
58056
58343
  var symbol = getResolvedSymbol(expr);
58057
58344
  var declaration = symbol.valueDeclaration;
@@ -62299,7 +62586,7 @@ var ts;
62299
62586
  var spreadIndex = getSpreadArgumentIndex(args);
62300
62587
  if (spreadIndex >= 0) {
62301
62588
  var effectiveArgs_1 = args.slice(0, spreadIndex);
62302
- var _loop_23 = function (i) {
62589
+ var _loop_24 = function (i) {
62303
62590
  var arg = args[i];
62304
62591
  var spreadType = arg.kind === 224 && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
62305
62592
  if (spreadType && isTupleType(spreadType)) {
@@ -62315,7 +62602,7 @@ var ts;
62315
62602
  }
62316
62603
  };
62317
62604
  for (var i = spreadIndex; i < args.length; i++) {
62318
- _loop_23(i);
62605
+ _loop_24(i);
62319
62606
  }
62320
62607
  return effectiveArgs_1;
62321
62608
  }
@@ -62556,7 +62843,7 @@ var ts;
62556
62843
  var min_3 = Number.MAX_VALUE;
62557
62844
  var minIndex = 0;
62558
62845
  var i_1 = 0;
62559
- var _loop_24 = function (c) {
62846
+ var _loop_25 = function (c) {
62560
62847
  var chain_2 = function () { return ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Overload_0_of_1_2_gave_the_following_error, i_1 + 1, candidates.length, signatureToString(c)); };
62561
62848
  var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0, true, chain_2);
62562
62849
  if (diags_2) {
@@ -62574,7 +62861,7 @@ var ts;
62574
62861
  };
62575
62862
  for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) {
62576
62863
  var c = candidatesForArgumentError_1[_a];
62577
- _loop_24(c);
62864
+ _loop_25(c);
62578
62865
  }
62579
62866
  var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
62580
62867
  ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
@@ -62717,7 +63004,7 @@ var ts;
62717
63004
  }
62718
63005
  var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
62719
63006
  var parameters = [];
62720
- var _loop_25 = function (i) {
63007
+ var _loop_26 = function (i) {
62721
63008
  var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ?
62722
63009
  i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) :
62723
63010
  i < s.parameters.length ? s.parameters[i] : undefined; });
@@ -62725,7 +63012,7 @@ var ts;
62725
63012
  parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
62726
63013
  };
62727
63014
  for (var i = 0; i < maxNonRestParam; i++) {
62728
- _loop_25(i);
63015
+ _loop_26(i);
62729
63016
  }
62730
63017
  var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; });
62731
63018
  var flags = 0;
@@ -63975,6 +64262,9 @@ var ts;
63975
64262
  assignBindingElementTypes(declaration.name, links.type);
63976
64263
  }
63977
64264
  }
64265
+ else if (type) {
64266
+ ts.Debug.assertEqual(links.type, type, "Parameter symbol already has a cached type which differs from newly assigned type");
64267
+ }
63978
64268
  }
63979
64269
  function assignBindingElementTypes(pattern, parentType) {
63980
64270
  for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) {
@@ -65589,7 +65879,7 @@ var ts;
65589
65879
  }
65590
65880
  function checkExpressionForMutableLocation(node, checkMode, contextualType, forceTuple) {
65591
65881
  var type = checkExpression(node, checkMode, forceTuple);
65592
- return isConstContext(node) ? getRegularTypeOfLiteralType(type) :
65882
+ return isConstContext(node) || ts.isCommonJsExportedExpression(node) ? getRegularTypeOfLiteralType(type) :
65593
65883
  isTypeAssertion(node) ? type :
65594
65884
  getWidenedLiteralLikeTypeForContextualType(type, instantiateContextualType(arguments.length === 2 ? getContextualType(node) : contextualType, node));
65595
65885
  }
@@ -66265,7 +66555,7 @@ var ts;
66265
66555
  var indexSymbol = getIndexSymbol(getSymbolOfNode(node));
66266
66556
  if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
66267
66557
  var indexSignatureMap_1 = new ts.Map();
66268
- var _loop_26 = function (declaration) {
66558
+ var _loop_27 = function (declaration) {
66269
66559
  if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
66270
66560
  forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) {
66271
66561
  var entry = indexSignatureMap_1.get(getTypeId(type));
@@ -66280,7 +66570,7 @@ var ts;
66280
66570
  };
66281
66571
  for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
66282
66572
  var declaration = _a[_i];
66283
- _loop_26(declaration);
66573
+ _loop_27(declaration);
66284
66574
  }
66285
66575
  indexSignatureMap_1.forEach(function (entry) {
66286
66576
  if (entry.declarations.length > 1) {
@@ -69019,7 +69309,7 @@ var ts;
69019
69309
  var interfaceDeclaration = ts.getObjectFlags(type) & 2 ? ts.getDeclarationOfKind(type.symbol, 257) : undefined;
69020
69310
  var localPropDeclaration = declaration && declaration.kind === 220 ||
69021
69311
  name && name.kind === 161 || getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
69022
- var _loop_27 = function (info) {
69312
+ var _loop_28 = function (info) {
69023
69313
  var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
69024
69314
  var errorNode = localPropDeclaration || localIndexDeclaration ||
69025
69315
  (interfaceDeclaration && !ts.some(getBaseTypes(type), function (base) { return !!getPropertyOfObjectType(base, prop.escapedName) && !!getIndexTypeOfType(base, info.keyType); }) ? interfaceDeclaration : undefined);
@@ -69029,7 +69319,7 @@ var ts;
69029
69319
  };
69030
69320
  for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
69031
69321
  var info = indexInfos_9[_i];
69032
- _loop_27(info);
69322
+ _loop_28(info);
69033
69323
  }
69034
69324
  }
69035
69325
  function checkIndexConstraintForIndexSignature(type, checkInfo) {
@@ -69037,7 +69327,7 @@ var ts;
69037
69327
  var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType);
69038
69328
  var interfaceDeclaration = ts.getObjectFlags(type) & 2 ? ts.getDeclarationOfKind(type.symbol, 257) : undefined;
69039
69329
  var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined;
69040
- var _loop_28 = function (info) {
69330
+ var _loop_29 = function (info) {
69041
69331
  if (info === checkInfo)
69042
69332
  return "continue";
69043
69333
  var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
@@ -69049,7 +69339,7 @@ var ts;
69049
69339
  };
69050
69340
  for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
69051
69341
  var info = indexInfos_10[_i];
69052
- _loop_28(info);
69342
+ _loop_29(info);
69053
69343
  }
69054
69344
  }
69055
69345
  function checkTypeNameIsReserved(name, message) {
@@ -69335,7 +69625,7 @@ var ts;
69335
69625
  var baseTypes = baseTypeNode && getBaseTypes(type);
69336
69626
  var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
69337
69627
  var baseStaticType = getBaseConstructorTypeOfClass(type);
69338
- var _loop_29 = function (member) {
69628
+ var _loop_30 = function (member) {
69339
69629
  if (ts.hasAmbientModifier(member)) {
69340
69630
  return "continue";
69341
69631
  }
@@ -69350,7 +69640,7 @@ var ts;
69350
69640
  };
69351
69641
  for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
69352
69642
  var member = _a[_i];
69353
- _loop_29(member);
69643
+ _loop_30(member);
69354
69644
  }
69355
69645
  }
69356
69646
  function checkExistingMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, member, memberIsParameterProperty, reportErrors) {
@@ -69425,7 +69715,7 @@ var ts;
69425
69715
  }
69426
69716
  function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
69427
69717
  var issuedMemberError = false;
69428
- var _loop_30 = function (member) {
69718
+ var _loop_31 = function (member) {
69429
69719
  if (ts.isStatic(member)) {
69430
69720
  return "continue";
69431
69721
  }
@@ -69443,7 +69733,7 @@ var ts;
69443
69733
  };
69444
69734
  for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
69445
69735
  var member = _a[_i];
69446
- _loop_30(member);
69736
+ _loop_31(member);
69447
69737
  }
69448
69738
  if (!issuedMemberError) {
69449
69739
  checkTypeAssignableTo(typeWithThis, baseWithThis, node.name || node, broadDiag);
@@ -73461,8 +73751,8 @@ var ts;
73461
73751
  }
73462
73752
  else {
73463
73753
  var elements = name.elements;
73464
- for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) {
73465
- var element = elements_1[_i];
73754
+ for (var _i = 0, elements_2 = elements; _i < elements_2.length; _i++) {
73755
+ var element = elements_2[_i];
73466
73756
  if (!ts.isOmittedExpression(element)) {
73467
73757
  return checkESModuleMarker(element.name);
73468
73758
  }
@@ -73478,8 +73768,8 @@ var ts;
73478
73768
  }
73479
73769
  else {
73480
73770
  var elements = name.elements;
73481
- for (var _i = 0, elements_2 = elements; _i < elements_2.length; _i++) {
73482
- var element = elements_2[_i];
73771
+ for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) {
73772
+ var element = elements_3[_i];
73483
73773
  if (!ts.isOmittedExpression(element)) {
73484
73774
  checkGrammarNameInLetOrConstDeclarations(element.name);
73485
73775
  }
@@ -75497,8 +75787,8 @@ var ts;
75497
75787
  }
75498
75788
  function bindingOrAssignmentPatternAssignsToName(pattern, escapedName) {
75499
75789
  var elements = ts.getElementsOfBindingOrAssignmentPattern(pattern);
75500
- for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) {
75501
- var element = elements_3[_i];
75790
+ for (var _i = 0, elements_4 = elements; _i < elements_4.length; _i++) {
75791
+ var element = elements_4[_i];
75502
75792
  if (bindingOrAssignmentElementAssignsToName(element, escapedName)) {
75503
75793
  return true;
75504
75794
  }
@@ -79539,8 +79829,8 @@ var ts;
79539
79829
  function chunkObjectLiteralElements(elements) {
79540
79830
  var chunkObject;
79541
79831
  var objects = [];
79542
- for (var _i = 0, elements_4 = elements; _i < elements_4.length; _i++) {
79543
- var e = elements_4[_i];
79832
+ for (var _i = 0, elements_5 = elements; _i < elements_5.length; _i++) {
79833
+ var e = elements_5[_i];
79544
79834
  if (e.kind === 297) {
79545
79835
  if (chunkObject) {
79546
79836
  objects.push(factory.createObjectLiteralExpression(chunkObject));
@@ -94215,7 +94505,7 @@ var ts;
94215
94505
  var existingDirectories = new ts.Map();
94216
94506
  var getCanonicalFileName = ts.createGetCanonicalFileName(system.useCaseSensitiveFileNames);
94217
94507
  var computeHash = ts.maybeBind(system, system.createHash) || ts.generateDjb2Hash;
94218
- function getSourceFile(fileName, languageVersion, onError) {
94508
+ function getSourceFile(fileName, languageVersionOrOptions, onError) {
94219
94509
  var text;
94220
94510
  try {
94221
94511
  ts.performance.mark("beforeIORead");
@@ -94229,7 +94519,7 @@ var ts;
94229
94519
  }
94230
94520
  text = "";
94231
94521
  }
94232
- return text !== undefined ? ts.createSourceFile(fileName, text, languageVersion, setParentNodes) : undefined;
94522
+ return text !== undefined ? ts.createSourceFile(fileName, text, languageVersionOrOptions, setParentNodes) : undefined;
94233
94523
  }
94234
94524
  function directoryExists(directoryPath) {
94235
94525
  if (existingDirectories.has(directoryPath)) {
@@ -95450,8 +95740,8 @@ var ts;
95450
95740
  for (var _i = 0, oldSourceFiles_2 = oldSourceFiles; _i < oldSourceFiles_2.length; _i++) {
95451
95741
  var oldSourceFile = oldSourceFiles_2[_i];
95452
95742
  var newSourceFile = host.getSourceFileByPath
95453
- ? host.getSourceFileByPath(oldSourceFile.fileName, oldSourceFile.resolvedPath, ts.getEmitScriptTarget(options), undefined, shouldCreateNewSourceFile)
95454
- : host.getSourceFile(oldSourceFile.fileName, ts.getEmitScriptTarget(options), undefined, shouldCreateNewSourceFile);
95743
+ ? host.getSourceFileByPath(oldSourceFile.fileName, oldSourceFile.resolvedPath, getCreateSourceFileOptions(oldSourceFile.fileName, moduleResolutionCache, host, options), undefined, shouldCreateNewSourceFile)
95744
+ : host.getSourceFile(oldSourceFile.fileName, getCreateSourceFileOptions(oldSourceFile.fileName, moduleResolutionCache, host, options), undefined, shouldCreateNewSourceFile);
95455
95745
  if (!newSourceFile) {
95456
95746
  return 0;
95457
95747
  }
@@ -95477,7 +95767,6 @@ var ts;
95477
95767
  newSourceFile.originalFileName = oldSourceFile.originalFileName;
95478
95768
  newSourceFile.resolvedPath = oldSourceFile.resolvedPath;
95479
95769
  newSourceFile.fileName = oldSourceFile.fileName;
95480
- newSourceFile.impliedNodeFormat = oldSourceFile.impliedNodeFormat;
95481
95770
  var packageName = oldProgram.sourceFileToPackageName.get(oldSourceFile.path);
95482
95771
  if (packageName !== undefined) {
95483
95772
  var prevKind = seenPackageNames.get(packageName);
@@ -96284,6 +96573,14 @@ var ts;
96284
96573
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
96285
96574
  return result;
96286
96575
  }
96576
+ function getCreateSourceFileOptions(fileName, moduleResolutionCache, host, options) {
96577
+ var impliedNodeFormat = getImpliedNodeFormatForFile(toPath(fileName), moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(), host, options);
96578
+ return {
96579
+ languageVersion: ts.getEmitScriptTarget(options),
96580
+ impliedNodeFormat: impliedNodeFormat,
96581
+ setExternalModuleIndicator: ts.getSetExternalModuleIndicator(options)
96582
+ };
96583
+ }
96287
96584
  function findSourceFileWorker(fileName, isDefaultLib, ignoreNoDefaultLib, reason, packageId) {
96288
96585
  var path = toPath(fileName);
96289
96586
  if (useSourceOfProjectReferenceRedirect) {
@@ -96354,7 +96651,7 @@ var ts;
96354
96651
  redirectedPath = toPath(redirect);
96355
96652
  }
96356
96653
  }
96357
- var file = host.getSourceFile(fileName, ts.getEmitScriptTarget(options), function (hostErrorMessage) { return addFilePreprocessingFileExplainingDiagnostic(undefined, reason, ts.Diagnostics.Cannot_read_file_0_Colon_1, [fileName, hostErrorMessage]); }, shouldCreateNewSourceFile);
96654
+ var file = host.getSourceFile(fileName, getCreateSourceFileOptions(fileName, moduleResolutionCache, host, options), function (hostErrorMessage) { return addFilePreprocessingFileExplainingDiagnostic(undefined, reason, ts.Diagnostics.Cannot_read_file_0_Colon_1, [fileName, hostErrorMessage]); }, shouldCreateNewSourceFile);
96358
96655
  if (packageId) {
96359
96656
  var packageIdKey = ts.packageIdToString(packageId);
96360
96657
  var fileFromPackageId = packageIdToSourceFile.get(packageIdKey);
@@ -96379,7 +96676,6 @@ var ts;
96379
96676
  file.path = path;
96380
96677
  file.resolvedPath = toPath(fileName);
96381
96678
  file.originalFileName = originalFileName;
96382
- file.impliedNodeFormat = getImpliedNodeFormatForFile(file.resolvedPath, moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(), host, options);
96383
96679
  addFileIncludeReason(file, reason);
96384
96680
  if (host.useCaseSensitiveFileNames()) {
96385
96681
  var pathLowerCase = ts.toFileNameLowerCase(path);
@@ -96840,7 +97136,7 @@ var ts;
96840
97136
  }
96841
97137
  }
96842
97138
  else if (firstNonAmbientExternalModuleSourceFile && languageVersion < 2 && options.module === ts.ModuleKind.None) {
96843
- var span = ts.getErrorSpanForNode(firstNonAmbientExternalModuleSourceFile, firstNonAmbientExternalModuleSourceFile.externalModuleIndicator);
97139
+ var span = ts.getErrorSpanForNode(firstNonAmbientExternalModuleSourceFile, typeof firstNonAmbientExternalModuleSourceFile.externalModuleIndicator === "boolean" ? firstNonAmbientExternalModuleSourceFile : firstNonAmbientExternalModuleSourceFile.externalModuleIndicator);
96844
97140
  programDiagnostics.add(ts.createFileDiagnostic(firstNonAmbientExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_use_imports_exports_or_module_augmentations_when_module_is_none));
96845
97141
  }
96846
97142
  if (outputFile && !options.emitDeclarationOnly) {
@@ -96848,7 +97144,7 @@ var ts;
96848
97144
  createDiagnosticForOptionName(ts.Diagnostics.Only_amd_and_system_modules_are_supported_alongside_0, options.out ? "out" : "outFile", "module");
96849
97145
  }
96850
97146
  else if (options.module === undefined && firstNonAmbientExternalModuleSourceFile) {
96851
- var span = ts.getErrorSpanForNode(firstNonAmbientExternalModuleSourceFile, firstNonAmbientExternalModuleSourceFile.externalModuleIndicator);
97147
+ var span = ts.getErrorSpanForNode(firstNonAmbientExternalModuleSourceFile, typeof firstNonAmbientExternalModuleSourceFile.externalModuleIndicator === "boolean" ? firstNonAmbientExternalModuleSourceFile : firstNonAmbientExternalModuleSourceFile.externalModuleIndicator);
96852
97148
  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"));
96853
97149
  }
96854
97150
  }
@@ -99766,7 +100062,7 @@ var ts;
99766
100062
  importedFileFromNodeModules = importedFileFromNodeModules || isInNodeModules;
99767
100063
  });
99768
100064
  var sortedPaths = [];
99769
- var _loop_31 = function (directory) {
100065
+ var _loop_32 = function (directory) {
99770
100066
  var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
99771
100067
  var pathsInDirectory;
99772
100068
  allFileNames.forEach(function (_a, fileName) {
@@ -99790,9 +100086,9 @@ var ts;
99790
100086
  };
99791
100087
  var out_directory_1;
99792
100088
  for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
99793
- var state_9 = _loop_31(directory);
100089
+ var state_10 = _loop_32(directory);
99794
100090
  directory = out_directory_1;
99795
- if (state_9 === "break")
100091
+ if (state_10 === "break")
99796
100092
  break;
99797
100093
  }
99798
100094
  if (allFileNames.size) {
@@ -100512,7 +100808,7 @@ var ts;
100512
100808
  var useCaseSensitiveFileNames = host.useCaseSensitiveFileNames();
100513
100809
  var hostGetNewLine = ts.memoize(function () { return host.getNewLine(); });
100514
100810
  return {
100515
- getSourceFile: function (fileName, languageVersion, onError) {
100811
+ getSourceFile: function (fileName, languageVersionOrOptions, onError) {
100516
100812
  var text;
100517
100813
  try {
100518
100814
  ts.performance.mark("beforeIORead");
@@ -100526,7 +100822,7 @@ var ts;
100526
100822
  }
100527
100823
  text = "";
100528
100824
  }
100529
- return text !== undefined ? ts.createSourceFile(fileName, text, languageVersion) : undefined;
100825
+ return text !== undefined ? ts.createSourceFile(fileName, text, languageVersionOrOptions) : undefined;
100530
100826
  },
100531
100827
  getDefaultLibLocation: ts.maybeBind(host, host.getDefaultLibLocation),
100532
100828
  getDefaultLibFileName: function (options) { return host.getDefaultLibFileName(options); },
@@ -100957,13 +101253,13 @@ var ts;
100957
101253
  }
100958
101254
  return directoryStructureHost.fileExists(fileName);
100959
101255
  }
100960
- function getVersionedSourceFileByPath(fileName, path, languageVersion, onError, shouldCreateNewSourceFile) {
101256
+ function getVersionedSourceFileByPath(fileName, path, languageVersionOrOptions, onError, shouldCreateNewSourceFile) {
100961
101257
  var hostSourceFile = sourceFilesCache.get(path);
100962
101258
  if (isFileMissingOnHost(hostSourceFile)) {
100963
101259
  return undefined;
100964
101260
  }
100965
101261
  if (hostSourceFile === undefined || shouldCreateNewSourceFile || isFilePresenceUnknownOnHost(hostSourceFile)) {
100966
- var sourceFile = getNewSourceFile(fileName, languageVersion, onError);
101262
+ var sourceFile = getNewSourceFile(fileName, languageVersionOrOptions, onError);
100967
101263
  if (hostSourceFile) {
100968
101264
  if (sourceFile) {
100969
101265
  hostSourceFile.sourceFile = sourceFile;