@typescript-deploys/pr-build 4.9.0-pr-50366-2 → 4.9.0-pr-50241-4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsserver.js CHANGED
@@ -2498,6 +2498,7 @@ var ts;
2498
2498
  var currentAssertionLevel = 0 /* None */;
2499
2499
  Debug.currentLogLevel = LogLevel.Warning;
2500
2500
  Debug.isDebugging = false;
2501
+ Debug.enableDeprecationWarnings = true;
2501
2502
  function getTypeScriptVersion() {
2502
2503
  return typeScriptVersion !== null && typeScriptVersion !== void 0 ? typeScriptVersion : (typeScriptVersion = new ts.Version(ts.version));
2503
2504
  }
@@ -3121,7 +3122,7 @@ var ts;
3121
3122
  function createWarningDeprecation(name, errorAfter, since, message) {
3122
3123
  var hasWrittenDeprecation = false;
3123
3124
  return function () {
3124
- if (!hasWrittenDeprecation) {
3125
+ if (Debug.enableDeprecationWarnings && !hasWrittenDeprecation) {
3125
3126
  log.warn(formatDeprecationMessage(name, /*error*/ false, errorAfter, since, message));
3126
3127
  hasWrittenDeprecation = true;
3127
3128
  }
@@ -6141,6 +6142,7 @@ var ts;
6141
6142
  var pollingChunkSize = createPollingIntervalBasedLevels(defaultChunkLevels);
6142
6143
  /* @internal */
6143
6144
  ts.unchangedPollThresholds = createPollingIntervalBasedLevels(defaultChunkLevels);
6145
+ /* @internal */
6144
6146
  function setCustomPollingValues(system) {
6145
6147
  if (!system.getEnvironmentVariable) {
6146
6148
  return;
@@ -6183,6 +6185,7 @@ var ts;
6183
6185
  createPollingIntervalBasedLevels(customLevels ? __assign(__assign({}, defaultLevels), customLevels) : defaultLevels);
6184
6186
  }
6185
6187
  }
6188
+ ts.setCustomPollingValues = setCustomPollingValues;
6186
6189
  function pollWatchedFileQueue(host, queue, pollIndex, chunkSize, callbackOnWatchFileStat) {
6187
6190
  var definedValueCopyToIndex = pollIndex;
6188
6191
  // Max visit would be all elements of the queue
@@ -6228,6 +6231,7 @@ var ts;
6228
6231
  }
6229
6232
  }
6230
6233
  }
6234
+ /* @internal */
6231
6235
  function createDynamicPriorityPollingWatchFile(host) {
6232
6236
  var watchedFiles = [];
6233
6237
  var changedFilesInLastPoll = [];
@@ -6336,6 +6340,7 @@ var ts;
6336
6340
  pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === PollingInterval.Low ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingIntervalQueue(pollingInterval));
6337
6341
  }
6338
6342
  }
6343
+ ts.createDynamicPriorityPollingWatchFile = createDynamicPriorityPollingWatchFile;
6339
6344
  function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames) {
6340
6345
  // One file can have multiple watchers
6341
6346
  var fileWatcherCallbacks = ts.createMultiMap();
@@ -6414,36 +6419,42 @@ var ts;
6414
6419
  pollScheduled = host.setTimeout(pollQueue, PollingInterval.High);
6415
6420
  }
6416
6421
  }
6417
- function createSingleWatcherPerName(cache, useCaseSensitiveFileNames, name, callback, createWatcher) {
6422
+ /* @internal */
6423
+ function createSingleFileWatcherPerName(watchFile, useCaseSensitiveFileNames) {
6424
+ var cache = new ts.Map();
6425
+ var callbacksCache = ts.createMultiMap();
6418
6426
  var toCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames);
6419
- var path = toCanonicalFileName(name);
6420
- var existing = cache.get(path);
6421
- if (existing) {
6422
- existing.callbacks.push(callback);
6423
- }
6424
- else {
6425
- cache.set(path, {
6426
- watcher: createWatcher((
6427
- // Cant infer types correctly so lets satisfy checker
6428
- function (param1, param2, param3) { var _a; return (_a = cache.get(path)) === null || _a === void 0 ? void 0 : _a.callbacks.slice().forEach(function (cb) { return cb(param1, param2, param3); }); })),
6429
- callbacks: [callback]
6430
- });
6431
- }
6432
- return {
6433
- close: function () {
6434
- var watcher = cache.get(path);
6435
- if (!watcher)
6436
- return;
6437
- if (!ts.orderedRemoveItem(watcher.callbacks, callback) || watcher.callbacks.length)
6438
- return;
6439
- cache.delete(path);
6440
- ts.closeFileWatcherOf(watcher);
6427
+ return function (fileName, callback, pollingInterval, options) {
6428
+ var path = toCanonicalFileName(fileName);
6429
+ var existing = cache.get(path);
6430
+ if (existing) {
6431
+ existing.refCount++;
6432
+ }
6433
+ else {
6434
+ cache.set(path, {
6435
+ watcher: watchFile(fileName, function (fileName, eventKind, modifiedTime) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind, modifiedTime); }); }, pollingInterval, options),
6436
+ refCount: 1
6437
+ });
6441
6438
  }
6439
+ callbacksCache.add(path, callback);
6440
+ return {
6441
+ close: function () {
6442
+ var watcher = ts.Debug.checkDefined(cache.get(path));
6443
+ callbacksCache.remove(path, callback);
6444
+ watcher.refCount--;
6445
+ if (watcher.refCount)
6446
+ return;
6447
+ cache.delete(path);
6448
+ ts.closeFileWatcherOf(watcher);
6449
+ }
6450
+ };
6442
6451
  };
6443
6452
  }
6453
+ ts.createSingleFileWatcherPerName = createSingleFileWatcherPerName;
6444
6454
  /**
6445
6455
  * Returns true if file status changed
6446
6456
  */
6457
+ /*@internal*/
6447
6458
  function onWatchedFileStat(watchedFile, modifiedTime) {
6448
6459
  var oldTime = watchedFile.mtime.getTime();
6449
6460
  var newTime = modifiedTime.getTime();
@@ -6455,6 +6466,7 @@ var ts;
6455
6466
  }
6456
6467
  return false;
6457
6468
  }
6469
+ ts.onWatchedFileStat = onWatchedFileStat;
6458
6470
  /*@internal*/
6459
6471
  function getFileWatcherEventKind(oldTime, newTime) {
6460
6472
  return oldTime === 0
@@ -6482,6 +6494,7 @@ var ts;
6482
6494
  * that means if this is recursive watcher, watch the children directories as well
6483
6495
  * (eg on OS that dont support recursive watch using fs.watch use fs.watchFile)
6484
6496
  */
6497
+ /*@internal*/
6485
6498
  function createDirectoryWatcherSupportingRecursive(_a) {
6486
6499
  var watchDirectory = _a.watchDirectory, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, fileSystemEntryExists = _a.fileSystemEntryExists, realpath = _a.realpath, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout;
6487
6500
  var cache = new ts.Map();
@@ -6690,15 +6703,18 @@ var ts;
6690
6703
  return ts.stringContains(toCanonicalFilePath(path), searchPath);
6691
6704
  }
6692
6705
  }
6706
+ ts.createDirectoryWatcherSupportingRecursive = createDirectoryWatcherSupportingRecursive;
6693
6707
  /*@internal*/
6694
6708
  var FileSystemEntryKind;
6695
6709
  (function (FileSystemEntryKind) {
6696
6710
  FileSystemEntryKind[FileSystemEntryKind["File"] = 0] = "File";
6697
6711
  FileSystemEntryKind[FileSystemEntryKind["Directory"] = 1] = "Directory";
6698
6712
  })(FileSystemEntryKind = ts.FileSystemEntryKind || (ts.FileSystemEntryKind = {}));
6713
+ /*@internal*/
6699
6714
  function createFileWatcherCallback(callback) {
6700
6715
  return function (_fileName, eventKind, modifiedTime) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", "", modifiedTime); };
6701
6716
  }
6717
+ ts.createFileWatcherCallback = createFileWatcherCallback;
6702
6718
  function createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime) {
6703
6719
  return function (eventName, _relativeFileName, modifiedTime) {
6704
6720
  if (eventName === "rename") {
@@ -6732,10 +6748,7 @@ var ts;
6732
6748
  }
6733
6749
  /*@internal*/
6734
6750
  function createSystemWatchFunctions(_a) {
6735
- var pollingWatchFileWorker = _a.pollingWatchFileWorker, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatchWorker = _a.fsWatchWorker, fileSystemEntryExists = _a.fileSystemEntryExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind, inodeWatching = _a.inodeWatching, sysLog = _a.sysLog;
6736
- var pollingWatches = new ts.Map();
6737
- var fsWatches = new ts.Map();
6738
- var fsWatchesRecursive = new ts.Map();
6751
+ var pollingWatchFile = _a.pollingWatchFile, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatchWorker = _a.fsWatchWorker, fileSystemEntryExists = _a.fileSystemEntryExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind, inodeWatching = _a.inodeWatching, sysLog = _a.sysLog;
6739
6752
  var dynamicPollingWatchFile;
6740
6753
  var fixedChunkSizePollingWatchFile;
6741
6754
  var nonPollingWatchFile;
@@ -6799,7 +6812,7 @@ var ts;
6799
6812
  // Use notifications from FS to watch with falling back to fs.watchFile
6800
6813
  generateWatchFileOptions(ts.WatchFileKind.UseFsEventsOnParentDirectory, ts.PollingWatchKind.PriorityInterval, options) :
6801
6814
  // Default to do not use fixed polling interval
6802
- { watchFile: (defaultWatchFileKind === null || defaultWatchFileKind === void 0 ? void 0 : defaultWatchFileKind()) || ts.WatchFileKind.UseFsEvents };
6815
+ { watchFile: (defaultWatchFileKind === null || defaultWatchFileKind === void 0 ? void 0 : defaultWatchFileKind()) || ts.WatchFileKind.FixedPollingInterval };
6803
6816
  }
6804
6817
  }
6805
6818
  function generateWatchFileOptions(watchFile, fallbackPolling, options) {
@@ -6870,13 +6883,7 @@ var ts;
6870
6883
  };
6871
6884
  }
6872
6885
  }
6873
- function pollingWatchFile(fileName, callback, pollingInterval, options) {
6874
- return createSingleWatcherPerName(pollingWatches, useCaseSensitiveFileNames, fileName, callback, function (cb) { return pollingWatchFileWorker(fileName, cb, pollingInterval, options); });
6875
- }
6876
6886
  function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
6877
- return createSingleWatcherPerName(recursive ? fsWatchesRecursive : fsWatches, useCaseSensitiveFileNames, fileOrDirectory, callback, function (cb) { return fsWatchHandlingPresence(fileOrDirectory, entryKind, cb, recursive, fallbackPollingInterval, fallbackOptions); });
6878
- }
6879
- function fsWatchHandlingPresence(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
6880
6887
  var lastDirectoryPartWithDirectorySeparator;
6881
6888
  var lastDirectoryPart;
6882
6889
  if (inodeWatching) {
@@ -7055,7 +7062,7 @@ var ts;
7055
7062
  var fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin");
7056
7063
  var getCurrentDirectory = ts.memoize(function () { return process.cwd(); });
7057
7064
  var _b = createSystemWatchFunctions({
7058
- pollingWatchFileWorker: fsWatchFileWorker,
7065
+ pollingWatchFile: createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames),
7059
7066
  getModifiedTime: getModifiedTime,
7060
7067
  setTimeout: setTimeout,
7061
7068
  clearTimeout: clearTimeout,
@@ -21394,7 +21401,7 @@ var ts;
21394
21401
  case 165 /* Decorator */: {
21395
21402
  var parent_2 = node.parent;
21396
21403
  return ts.canHaveDecorators(parent_2) ? parent_2.modifiers :
21397
- ts.canHaveIllegalDecorators(parent_2) ? parent_2.decorators :
21404
+ ts.canHaveIllegalDecorators(parent_2) ? parent_2.illegalDecorators :
21398
21405
  undefined;
21399
21406
  }
21400
21407
  case 291 /* HeritageClause */:
@@ -23471,7 +23478,7 @@ var ts;
23471
23478
  node.body = body;
23472
23479
  node.transformFlags = propagateChildFlags(body) | 16777216 /* ContainsClassFields */;
23473
23480
  // The following properties are used only to report grammar errors
23474
- node.decorators = undefined;
23481
+ node.illegalDecorators = undefined;
23475
23482
  node.modifiers = undefined;
23476
23483
  return node;
23477
23484
  }
@@ -23483,7 +23490,7 @@ var ts;
23483
23490
  }
23484
23491
  function finishUpdateClassStaticBlockDeclaration(updated, original) {
23485
23492
  if (updated !== original) {
23486
- updated.decorators = original.decorators;
23493
+ updated.illegalDecorators = original.illegalDecorators;
23487
23494
  updated.modifiers = original.modifiers;
23488
23495
  }
23489
23496
  return update(updated, original);
@@ -23496,7 +23503,7 @@ var ts;
23496
23503
  /*type*/ undefined, body);
23497
23504
  node.transformFlags |= 1024 /* ContainsES2015 */;
23498
23505
  // The following properties are used only to report grammar errors
23499
- node.decorators = undefined;
23506
+ node.illegalDecorators = undefined;
23500
23507
  node.typeParameters = undefined;
23501
23508
  node.type = undefined;
23502
23509
  return node;
@@ -23511,7 +23518,7 @@ var ts;
23511
23518
  }
23512
23519
  function finishUpdateConstructorDeclaration(updated, original) {
23513
23520
  if (updated !== original) {
23514
- updated.decorators = original.decorators;
23521
+ updated.illegalDecorators = original.illegalDecorators;
23515
23522
  updated.typeParameters = original.typeParameters;
23516
23523
  updated.type = original.type;
23517
23524
  }
@@ -25259,7 +25266,7 @@ var ts;
25259
25266
  }
25260
25267
  }
25261
25268
  // The following properties are used only to report grammar errors
25262
- node.decorators = undefined;
25269
+ node.illegalDecorators = undefined;
25263
25270
  return node;
25264
25271
  }
25265
25272
  // @api
@@ -25277,7 +25284,7 @@ var ts;
25277
25284
  function finishUpdateFunctionDeclaration(updated, original) {
25278
25285
  if (updated !== original) {
25279
25286
  // copy children used only for error reporting
25280
- updated.decorators = original.decorators;
25287
+ updated.illegalDecorators = original.illegalDecorators;
25281
25288
  }
25282
25289
  return finishUpdateBaseSignatureDeclaration(updated, original);
25283
25290
  }
@@ -25311,7 +25318,7 @@ var ts;
25311
25318
  node.members = createNodeArray(members);
25312
25319
  node.transformFlags = 1 /* ContainsTypeScript */;
25313
25320
  // The following properties are used only to report grammar errors
25314
- node.decorators = undefined;
25321
+ node.illegalDecorators = undefined;
25315
25322
  return node;
25316
25323
  }
25317
25324
  // @api
@@ -25326,7 +25333,7 @@ var ts;
25326
25333
  }
25327
25334
  function finishUpdateInterfaceDeclaration(updated, original) {
25328
25335
  if (updated !== original) {
25329
- updated.decorators = original.decorators;
25336
+ updated.illegalDecorators = original.illegalDecorators;
25330
25337
  }
25331
25338
  return update(updated, original);
25332
25339
  }
@@ -25336,7 +25343,7 @@ var ts;
25336
25343
  node.type = type;
25337
25344
  node.transformFlags = 1 /* ContainsTypeScript */;
25338
25345
  // The following properties are used only to report grammar errors
25339
- node.decorators = undefined;
25346
+ node.illegalDecorators = undefined;
25340
25347
  return node;
25341
25348
  }
25342
25349
  // @api
@@ -25350,7 +25357,7 @@ var ts;
25350
25357
  }
25351
25358
  function finishUpdateTypeAliasDeclaration(updated, original) {
25352
25359
  if (updated !== original) {
25353
- updated.decorators = original.decorators;
25360
+ updated.illegalDecorators = original.illegalDecorators;
25354
25361
  }
25355
25362
  return update(updated, original);
25356
25363
  }
@@ -25363,7 +25370,7 @@ var ts;
25363
25370
  1 /* ContainsTypeScript */;
25364
25371
  node.transformFlags &= ~67108864 /* ContainsPossibleTopLevelAwait */; // Enum declarations cannot contain `await`
25365
25372
  // The following properties are used only to report grammar errors
25366
- node.decorators = undefined;
25373
+ node.illegalDecorators = undefined;
25367
25374
  return node;
25368
25375
  }
25369
25376
  // @api
@@ -25376,7 +25383,7 @@ var ts;
25376
25383
  }
25377
25384
  function finishUpdateEnumDeclaration(updated, original) {
25378
25385
  if (updated !== original) {
25379
- updated.decorators = original.decorators;
25386
+ updated.illegalDecorators = original.illegalDecorators;
25380
25387
  }
25381
25388
  return update(updated, original);
25382
25389
  }
@@ -25400,7 +25407,7 @@ var ts;
25400
25407
  }
25401
25408
  node.transformFlags &= ~67108864 /* ContainsPossibleTopLevelAwait */; // Module declarations cannot contain `await`.
25402
25409
  // The following properties are used only to report grammar errors
25403
- node.decorators = undefined;
25410
+ node.illegalDecorators = undefined;
25404
25411
  return node;
25405
25412
  }
25406
25413
  // @api
@@ -25413,7 +25420,7 @@ var ts;
25413
25420
  }
25414
25421
  function finishUpdateModuleDeclaration(updated, original) {
25415
25422
  if (updated !== original) {
25416
- updated.decorators = original.decorators;
25423
+ updated.illegalDecorators = original.illegalDecorators;
25417
25424
  }
25418
25425
  return update(updated, original);
25419
25426
  }
@@ -25449,7 +25456,7 @@ var ts;
25449
25456
  /*modifiers*/ undefined, name);
25450
25457
  node.transformFlags = 1 /* ContainsTypeScript */;
25451
25458
  // The following properties are used only to report grammar errors
25452
- node.decorators = undefined;
25459
+ node.illegalDecorators = undefined;
25453
25460
  node.modifiers = undefined;
25454
25461
  return node;
25455
25462
  }
@@ -25461,7 +25468,7 @@ var ts;
25461
25468
  }
25462
25469
  function finishUpdateNamespaceExportDeclaration(updated, original) {
25463
25470
  if (updated !== original) {
25464
- updated.decorators = original.decorators;
25471
+ updated.illegalDecorators = original.illegalDecorators;
25465
25472
  updated.modifiers = original.modifiers;
25466
25473
  }
25467
25474
  return update(updated, original);
@@ -25476,7 +25483,7 @@ var ts;
25476
25483
  node.transformFlags |= 1 /* ContainsTypeScript */;
25477
25484
  node.transformFlags &= ~67108864 /* ContainsPossibleTopLevelAwait */; // Import= declaration is always parsed in an Await context
25478
25485
  // The following properties are used only to report grammar errors
25479
- node.decorators = undefined;
25486
+ node.illegalDecorators = undefined;
25480
25487
  return node;
25481
25488
  }
25482
25489
  // @api
@@ -25490,7 +25497,7 @@ var ts;
25490
25497
  }
25491
25498
  function finishUpdateImportEqualsDeclaration(updated, original) {
25492
25499
  if (updated !== original) {
25493
- updated.decorators = original.decorators;
25500
+ updated.illegalDecorators = original.illegalDecorators;
25494
25501
  }
25495
25502
  return update(updated, original);
25496
25503
  }
@@ -25506,7 +25513,7 @@ var ts;
25506
25513
  propagateChildFlags(node.moduleSpecifier);
25507
25514
  node.transformFlags &= ~67108864 /* ContainsPossibleTopLevelAwait */; // always parsed in an Await context
25508
25515
  // The following properties are used only to report grammar errors
25509
- node.decorators = undefined;
25516
+ node.illegalDecorators = undefined;
25510
25517
  return node;
25511
25518
  }
25512
25519
  // @api
@@ -25520,7 +25527,7 @@ var ts;
25520
25527
  }
25521
25528
  function finishUpdateImportDeclaration(updated, original) {
25522
25529
  if (updated !== original) {
25523
- updated.decorators = original.decorators;
25530
+ updated.illegalDecorators = original.illegalDecorators;
25524
25531
  }
25525
25532
  return update(updated, original);
25526
25533
  }
@@ -25666,7 +25673,7 @@ var ts;
25666
25673
  node.transformFlags |= propagateChildrenFlags(node.modifiers) | propagateChildFlags(node.expression);
25667
25674
  node.transformFlags &= ~67108864 /* ContainsPossibleTopLevelAwait */; // always parsed in an Await context
25668
25675
  // The following properties are used only to report grammar errors
25669
- node.decorators = undefined;
25676
+ node.illegalDecorators = undefined;
25670
25677
  return node;
25671
25678
  }
25672
25679
  // @api
@@ -25678,7 +25685,7 @@ var ts;
25678
25685
  }
25679
25686
  function finishUpdateExportAssignment(updated, original) {
25680
25687
  if (updated !== original) {
25681
- updated.decorators = original.decorators;
25688
+ updated.illegalDecorators = original.illegalDecorators;
25682
25689
  }
25683
25690
  return update(updated, original);
25684
25691
  }
@@ -25696,7 +25703,7 @@ var ts;
25696
25703
  propagateChildFlags(node.moduleSpecifier);
25697
25704
  node.transformFlags &= ~67108864 /* ContainsPossibleTopLevelAwait */; // always parsed in an Await context
25698
25705
  // The following properties are used only to report grammar errors
25699
- node.decorators = undefined;
25706
+ node.illegalDecorators = undefined;
25700
25707
  return node;
25701
25708
  }
25702
25709
  // @api
@@ -25711,7 +25718,7 @@ var ts;
25711
25718
  }
25712
25719
  function finishUpdateExportDeclaration(updated, original) {
25713
25720
  if (updated !== original) {
25714
- updated.decorators = original.decorators;
25721
+ updated.illegalDecorators = original.illegalDecorators;
25715
25722
  }
25716
25723
  return update(updated, original);
25717
25724
  }
@@ -26475,7 +26482,7 @@ var ts;
26475
26482
  propagateChildFlags(node.name) |
26476
26483
  propagateChildFlags(node.initializer);
26477
26484
  // The following properties are used only to report grammar errors
26478
- node.decorators = undefined;
26485
+ node.illegalDecorators = undefined;
26479
26486
  node.modifiers = undefined;
26480
26487
  node.questionToken = undefined;
26481
26488
  node.exclamationToken = undefined;
@@ -26491,7 +26498,7 @@ var ts;
26491
26498
  function finishUpdatePropertyAssignment(updated, original) {
26492
26499
  // copy children used only for error reporting
26493
26500
  if (updated !== original) {
26494
- updated.decorators = original.decorators;
26501
+ updated.illegalDecorators = original.illegalDecorators;
26495
26502
  updated.modifiers = original.modifiers;
26496
26503
  updated.questionToken = original.questionToken;
26497
26504
  updated.exclamationToken = original.exclamationToken;
@@ -26508,7 +26515,7 @@ var ts;
26508
26515
  1024 /* ContainsES2015 */;
26509
26516
  // The following properties are used only to report grammar errors
26510
26517
  node.equalsToken = undefined;
26511
- node.decorators = undefined;
26518
+ node.illegalDecorators = undefined;
26512
26519
  node.modifiers = undefined;
26513
26520
  node.questionToken = undefined;
26514
26521
  node.exclamationToken = undefined;
@@ -26525,7 +26532,7 @@ var ts;
26525
26532
  if (updated !== original) {
26526
26533
  // copy children used only for error reporting
26527
26534
  updated.equalsToken = original.equalsToken;
26528
- updated.decorators = original.decorators;
26535
+ updated.illegalDecorators = original.illegalDecorators;
26529
26536
  updated.modifiers = original.modifiers;
26530
26537
  updated.questionToken = original.questionToken;
26531
26538
  updated.exclamationToken = original.exclamationToken;
@@ -31004,7 +31011,7 @@ var ts;
31004
31011
  visitNode(cbNode, node.default) ||
31005
31012
  visitNode(cbNode, node.expression);
31006
31013
  case 297 /* ShorthandPropertyAssignment */:
31007
- return visitNodes(cbNode, cbNodes, node.decorators) ||
31014
+ return visitNodes(cbNode, cbNodes, node.illegalDecorators) ||
31008
31015
  visitNodes(cbNode, cbNodes, node.modifiers) ||
31009
31016
  visitNode(cbNode, node.name) ||
31010
31017
  visitNode(cbNode, node.questionToken) ||
@@ -31034,7 +31041,7 @@ var ts;
31034
31041
  visitNode(cbNode, node.type) ||
31035
31042
  visitNode(cbNode, node.initializer);
31036
31043
  case 296 /* PropertyAssignment */:
31037
- return visitNodes(cbNode, cbNodes, node.decorators) ||
31044
+ return visitNodes(cbNode, cbNodes, node.illegalDecorators) ||
31038
31045
  visitNodes(cbNode, cbNodes, node.modifiers) ||
31039
31046
  visitNode(cbNode, node.name) ||
31040
31047
  visitNode(cbNode, node.questionToken) ||
@@ -31051,7 +31058,7 @@ var ts;
31051
31058
  visitNode(cbNode, node.name) ||
31052
31059
  visitNode(cbNode, node.initializer);
31053
31060
  case 176 /* IndexSignature */:
31054
- return visitNodes(cbNode, cbNodes, node.decorators) ||
31061
+ return visitNodes(cbNode, cbNodes, node.illegalDecorators) ||
31055
31062
  visitNodes(cbNode, cbNodes, node.modifiers) ||
31056
31063
  visitNodes(cbNode, cbNodes, node.typeParameters) ||
31057
31064
  visitNodes(cbNode, cbNodes, node.parameters) ||
@@ -31089,7 +31096,7 @@ var ts;
31089
31096
  visitNodes(cbNode, cbNodes, node.parameters) ||
31090
31097
  visitNode(cbNode, node.type);
31091
31098
  case 171 /* Constructor */:
31092
- return visitNodes(cbNode, cbNodes, node.decorators) ||
31099
+ return visitNodes(cbNode, cbNodes, node.illegalDecorators) ||
31093
31100
  visitNodes(cbNode, cbNodes, node.modifiers) ||
31094
31101
  visitNode(cbNode, node.name) ||
31095
31102
  visitNodes(cbNode, cbNodes, node.typeParameters) ||
@@ -31111,7 +31118,7 @@ var ts;
31111
31118
  visitNode(cbNode, node.type) ||
31112
31119
  visitNode(cbNode, node.body);
31113
31120
  case 256 /* FunctionDeclaration */:
31114
- return visitNodes(cbNode, cbNodes, node.decorators) ||
31121
+ return visitNodes(cbNode, cbNodes, node.illegalDecorators) ||
31115
31122
  visitNodes(cbNode, cbNodes, node.modifiers) ||
31116
31123
  visitNode(cbNode, node.asteriskToken) ||
31117
31124
  visitNode(cbNode, node.name) ||
@@ -31135,7 +31142,7 @@ var ts;
31135
31142
  visitNode(cbNode, node.equalsGreaterThanToken) ||
31136
31143
  visitNode(cbNode, node.body);
31137
31144
  case 170 /* ClassStaticBlockDeclaration */:
31138
- return visitNodes(cbNode, cbNodes, node.decorators) ||
31145
+ return visitNodes(cbNode, cbNodes, node.illegalDecorators) ||
31139
31146
  visitNodes(cbNode, cbNodes, node.modifiers) ||
31140
31147
  visitNode(cbNode, node.body);
31141
31148
  case 178 /* TypeReference */:
@@ -31263,7 +31270,7 @@ var ts;
31263
31270
  return visitNodes(cbNode, cbNodes, node.statements) ||
31264
31271
  visitNode(cbNode, node.endOfFileToken);
31265
31272
  case 237 /* VariableStatement */:
31266
- return visitNodes(cbNode, cbNodes, node.decorators) ||
31273
+ return visitNodes(cbNode, cbNodes, node.illegalDecorators) ||
31267
31274
  visitNodes(cbNode, cbNodes, node.modifiers) ||
31268
31275
  visitNode(cbNode, node.declarationList);
31269
31276
  case 255 /* VariableDeclarationList */:
@@ -31334,20 +31341,20 @@ var ts;
31334
31341
  visitNodes(cbNode, cbNodes, node.heritageClauses) ||
31335
31342
  visitNodes(cbNode, cbNodes, node.members);
31336
31343
  case 258 /* InterfaceDeclaration */:
31337
- return visitNodes(cbNode, cbNodes, node.decorators) ||
31344
+ return visitNodes(cbNode, cbNodes, node.illegalDecorators) ||
31338
31345
  visitNodes(cbNode, cbNodes, node.modifiers) ||
31339
31346
  visitNode(cbNode, node.name) ||
31340
31347
  visitNodes(cbNode, cbNodes, node.typeParameters) ||
31341
31348
  visitNodes(cbNode, cbNodes, node.heritageClauses) ||
31342
31349
  visitNodes(cbNode, cbNodes, node.members);
31343
31350
  case 259 /* TypeAliasDeclaration */:
31344
- return visitNodes(cbNode, cbNodes, node.decorators) ||
31351
+ return visitNodes(cbNode, cbNodes, node.illegalDecorators) ||
31345
31352
  visitNodes(cbNode, cbNodes, node.modifiers) ||
31346
31353
  visitNode(cbNode, node.name) ||
31347
31354
  visitNodes(cbNode, cbNodes, node.typeParameters) ||
31348
31355
  visitNode(cbNode, node.type);
31349
31356
  case 260 /* EnumDeclaration */:
31350
- return visitNodes(cbNode, cbNodes, node.decorators) ||
31357
+ return visitNodes(cbNode, cbNodes, node.illegalDecorators) ||
31351
31358
  visitNodes(cbNode, cbNodes, node.modifiers) ||
31352
31359
  visitNode(cbNode, node.name) ||
31353
31360
  visitNodes(cbNode, cbNodes, node.members);
@@ -31355,17 +31362,17 @@ var ts;
31355
31362
  return visitNode(cbNode, node.name) ||
31356
31363
  visitNode(cbNode, node.initializer);
31357
31364
  case 261 /* ModuleDeclaration */:
31358
- return visitNodes(cbNode, cbNodes, node.decorators) ||
31365
+ return visitNodes(cbNode, cbNodes, node.illegalDecorators) ||
31359
31366
  visitNodes(cbNode, cbNodes, node.modifiers) ||
31360
31367
  visitNode(cbNode, node.name) ||
31361
31368
  visitNode(cbNode, node.body);
31362
31369
  case 265 /* ImportEqualsDeclaration */:
31363
- return visitNodes(cbNode, cbNodes, node.decorators) ||
31370
+ return visitNodes(cbNode, cbNodes, node.illegalDecorators) ||
31364
31371
  visitNodes(cbNode, cbNodes, node.modifiers) ||
31365
31372
  visitNode(cbNode, node.name) ||
31366
31373
  visitNode(cbNode, node.moduleReference);
31367
31374
  case 266 /* ImportDeclaration */:
31368
- return visitNodes(cbNode, cbNodes, node.decorators) ||
31375
+ return visitNodes(cbNode, cbNodes, node.illegalDecorators) ||
31369
31376
  visitNodes(cbNode, cbNodes, node.modifiers) ||
31370
31377
  visitNode(cbNode, node.importClause) ||
31371
31378
  visitNode(cbNode, node.moduleSpecifier) ||
@@ -31379,7 +31386,7 @@ var ts;
31379
31386
  return visitNode(cbNode, node.name) ||
31380
31387
  visitNode(cbNode, node.value);
31381
31388
  case 264 /* NamespaceExportDeclaration */:
31382
- return visitNodes(cbNode, cbNodes, node.decorators) ||
31389
+ return visitNodes(cbNode, cbNodes, node.illegalDecorators) ||
31383
31390
  visitNode(cbNode, node.name);
31384
31391
  case 268 /* NamespaceImport */:
31385
31392
  return visitNode(cbNode, node.name);
@@ -31389,7 +31396,7 @@ var ts;
31389
31396
  case 273 /* NamedExports */:
31390
31397
  return visitNodes(cbNode, cbNodes, node.elements);
31391
31398
  case 272 /* ExportDeclaration */:
31392
- return visitNodes(cbNode, cbNodes, node.decorators) ||
31399
+ return visitNodes(cbNode, cbNodes, node.illegalDecorators) ||
31393
31400
  visitNodes(cbNode, cbNodes, node.modifiers) ||
31394
31401
  visitNode(cbNode, node.exportClause) ||
31395
31402
  visitNode(cbNode, node.moduleSpecifier) ||
@@ -31399,7 +31406,7 @@ var ts;
31399
31406
  return visitNode(cbNode, node.propertyName) ||
31400
31407
  visitNode(cbNode, node.name);
31401
31408
  case 271 /* ExportAssignment */:
31402
- return visitNodes(cbNode, cbNodes, node.decorators) ||
31409
+ return visitNodes(cbNode, cbNodes, node.illegalDecorators) ||
31403
31410
  visitNodes(cbNode, cbNodes, node.modifiers) ||
31404
31411
  visitNode(cbNode, node.expression);
31405
31412
  case 223 /* TemplateExpression */:
@@ -31424,7 +31431,7 @@ var ts;
31424
31431
  case 277 /* ExternalModuleReference */:
31425
31432
  return visitNode(cbNode, node.expression);
31426
31433
  case 276 /* MissingDeclaration */:
31427
- return visitNodes(cbNode, cbNodes, node.decorators) ||
31434
+ return visitNodes(cbNode, cbNodes, node.illegalDecorators) ||
31428
31435
  visitNodes(cbNode, cbNodes, node.modifiers);
31429
31436
  case 351 /* CommaListExpression */:
31430
31437
  return visitNodes(cbNode, cbNodes, node.elements);
@@ -33975,7 +33982,7 @@ var ts;
33975
33982
  var type = parseTypeAnnotation();
33976
33983
  parseTypeMemberSemicolon();
33977
33984
  var node = factory.createIndexSignature(modifiers, parameters, type);
33978
- node.decorators = decorators;
33985
+ node.illegalDecorators = decorators;
33979
33986
  return withJSDoc(finishNode(node, pos), hasJSDoc);
33980
33987
  }
33981
33988
  function parsePropertyOrMethodSignature(pos, hasJSDoc, modifiers) {
@@ -36135,7 +36142,7 @@ var ts;
36135
36142
  node = factory.createPropertyAssignment(name, initializer);
36136
36143
  }
36137
36144
  // Decorators, Modifiers, questionToken, and exclamationToken are not supported by property assignments and are reported in the grammar checker
36138
- node.decorators = decorators;
36145
+ node.illegalDecorators = decorators;
36139
36146
  node.modifiers = modifiers;
36140
36147
  node.questionToken = questionToken;
36141
36148
  node.exclamationToken = exclamationToken;
@@ -36783,7 +36790,7 @@ var ts;
36783
36790
  // would follow. For recovery and error reporting purposes, return an incomplete declaration.
36784
36791
  var missing = createMissingNode(276 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected);
36785
36792
  ts.setTextRangePos(missing, pos);
36786
- missing.decorators = decorators;
36793
+ missing.illegalDecorators = decorators;
36787
36794
  missing.modifiers = modifiers;
36788
36795
  return missing;
36789
36796
  }
@@ -36926,7 +36933,7 @@ var ts;
36926
36933
  parseSemicolon();
36927
36934
  var node = factory.createVariableStatement(modifiers, declarationList);
36928
36935
  // Decorators are not allowed on a variable statement, so we keep track of them to report them in the grammar checker.
36929
- node.decorators = decorators;
36936
+ node.illegalDecorators = decorators;
36930
36937
  return withJSDoc(finishNode(node, pos), hasJSDoc);
36931
36938
  }
36932
36939
  function parseFunctionDeclaration(pos, hasJSDoc, decorators, modifiers) {
@@ -36946,7 +36953,7 @@ var ts;
36946
36953
  var body = parseFunctionBlockOrSemicolon(isGenerator | isAsync, ts.Diagnostics.or_expected);
36947
36954
  setAwaitContext(savedAwaitContext);
36948
36955
  var node = factory.createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, body);
36949
- node.decorators = decorators;
36956
+ node.illegalDecorators = decorators;
36950
36957
  return withJSDoc(finishNode(node, pos), hasJSDoc);
36951
36958
  }
36952
36959
  function parseConstructorName() {
@@ -36969,7 +36976,7 @@ var ts;
36969
36976
  var body = parseFunctionBlockOrSemicolon(0 /* None */, ts.Diagnostics.or_expected);
36970
36977
  var node = factory.createConstructorDeclaration(modifiers, parameters, body);
36971
36978
  // Attach invalid nodes if they exist so that we can report them in the grammar checker.
36972
- node.decorators = decorators;
36979
+ node.illegalDecorators = decorators;
36973
36980
  node.typeParameters = typeParameters;
36974
36981
  node.type = type;
36975
36982
  return withJSDoc(finishNode(node, pos), hasJSDoc);
@@ -37085,7 +37092,7 @@ var ts;
37085
37092
  parseExpectedToken(124 /* StaticKeyword */);
37086
37093
  var body = parseClassStaticBlockBody();
37087
37094
  var node = withJSDoc(finishNode(factory.createClassStaticBlockDeclaration(body), pos), hasJSDoc);
37088
- node.decorators = decorators;
37095
+ node.illegalDecorators = decorators;
37089
37096
  node.modifiers = modifiers;
37090
37097
  return node;
37091
37098
  }
@@ -37326,7 +37333,7 @@ var ts;
37326
37333
  var heritageClauses = parseHeritageClauses();
37327
37334
  var members = parseObjectTypeMembers();
37328
37335
  var node = factory.createInterfaceDeclaration(modifiers, name, typeParameters, heritageClauses, members);
37329
- node.decorators = decorators;
37336
+ node.illegalDecorators = decorators;
37330
37337
  return withJSDoc(finishNode(node, pos), hasJSDoc);
37331
37338
  }
37332
37339
  function parseTypeAliasDeclaration(pos, hasJSDoc, decorators, modifiers) {
@@ -37337,7 +37344,7 @@ var ts;
37337
37344
  var type = token() === 138 /* IntrinsicKeyword */ && tryParse(parseKeywordAndNoDot) || parseType();
37338
37345
  parseSemicolon();
37339
37346
  var node = factory.createTypeAliasDeclaration(modifiers, name, typeParameters, type);
37340
- node.decorators = decorators;
37347
+ node.illegalDecorators = decorators;
37341
37348
  return withJSDoc(finishNode(node, pos), hasJSDoc);
37342
37349
  }
37343
37350
  // In an ambient declaration, the grammar only allows integer literals as initializers.
@@ -37363,7 +37370,7 @@ var ts;
37363
37370
  members = createMissingList();
37364
37371
  }
37365
37372
  var node = factory.createEnumDeclaration(modifiers, name, members);
37366
- node.decorators = decorators;
37373
+ node.illegalDecorators = decorators;
37367
37374
  return withJSDoc(finishNode(node, pos), hasJSDoc);
37368
37375
  }
37369
37376
  function parseModuleBlock() {
@@ -37387,7 +37394,7 @@ var ts;
37387
37394
  ? parseModuleOrNamespaceDeclaration(getNodePos(), /*hasJSDoc*/ false, /*decorators*/ undefined, /*modifiers*/ undefined, 4 /* NestedNamespace */ | namespaceFlag)
37388
37395
  : parseModuleBlock();
37389
37396
  var node = factory.createModuleDeclaration(modifiers, name, body, flags);
37390
- node.decorators = decorators;
37397
+ node.illegalDecorators = decorators;
37391
37398
  return withJSDoc(finishNode(node, pos), hasJSDoc);
37392
37399
  }
37393
37400
  function parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers) {
@@ -37410,7 +37417,7 @@ var ts;
37410
37417
  parseSemicolon();
37411
37418
  }
37412
37419
  var node = factory.createModuleDeclaration(modifiers, name, body, flags);
37413
- node.decorators = decorators;
37420
+ node.illegalDecorators = decorators;
37414
37421
  return withJSDoc(finishNode(node, pos), hasJSDoc);
37415
37422
  }
37416
37423
  function parseModuleDeclaration(pos, hasJSDoc, decorators, modifiers) {
@@ -37450,7 +37457,7 @@ var ts;
37450
37457
  parseSemicolon();
37451
37458
  var node = factory.createNamespaceExportDeclaration(name);
37452
37459
  // NamespaceExportDeclaration nodes cannot have decorators or modifiers, so we attach them here so we can report them in the grammar checker
37453
- node.decorators = decorators;
37460
+ node.illegalDecorators = decorators;
37454
37461
  node.modifiers = modifiers;
37455
37462
  return withJSDoc(finishNode(node, pos), hasJSDoc);
37456
37463
  }
@@ -37490,7 +37497,7 @@ var ts;
37490
37497
  }
37491
37498
  parseSemicolon();
37492
37499
  var node = factory.createImportDeclaration(modifiers, importClause, moduleSpecifier, assertClause);
37493
- node.decorators = decorators;
37500
+ node.illegalDecorators = decorators;
37494
37501
  return withJSDoc(finishNode(node, pos), hasJSDoc);
37495
37502
  }
37496
37503
  function parseAssertEntry() {
@@ -37535,7 +37542,7 @@ var ts;
37535
37542
  var moduleReference = parseModuleReference();
37536
37543
  parseSemicolon();
37537
37544
  var node = factory.createImportEqualsDeclaration(modifiers, isTypeOnly, identifier, moduleReference);
37538
- node.decorators = decorators;
37545
+ node.illegalDecorators = decorators;
37539
37546
  var finished = withJSDoc(finishNode(node, pos), hasJSDoc);
37540
37547
  return finished;
37541
37548
  }
@@ -37725,7 +37732,7 @@ var ts;
37725
37732
  parseSemicolon();
37726
37733
  setAwaitContext(savedAwaitContext);
37727
37734
  var node = factory.createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause);
37728
- node.decorators = decorators;
37735
+ node.illegalDecorators = decorators;
37729
37736
  return withJSDoc(finishNode(node, pos), hasJSDoc);
37730
37737
  }
37731
37738
  function parseExportAssignment(pos, hasJSDoc, decorators, modifiers) {
@@ -37742,7 +37749,7 @@ var ts;
37742
37749
  parseSemicolon();
37743
37750
  setAwaitContext(savedAwaitContext);
37744
37751
  var node = factory.createExportAssignment(modifiers, isExportEquals, expression);
37745
- node.decorators = decorators;
37752
+ node.illegalDecorators = decorators;
37746
37753
  return withJSDoc(finishNode(node, pos), hasJSDoc);
37747
37754
  }
37748
37755
  var ParsingContext;
@@ -51040,41 +51047,61 @@ var ts;
51040
51047
  return typeof file.externalModuleIndicator !== "object" && !resolveExportByName(moduleSymbol, ts.escapeLeadingUnderscores("__esModule"), /*sourceNode*/ undefined, dontResolveAlias);
51041
51048
  }
51042
51049
  function getTargetOfImportClause(node, dontResolveAlias) {
51043
- var _a;
51044
51050
  var moduleSymbol = resolveExternalModuleName(node, node.parent.moduleSpecifier);
51045
51051
  if (moduleSymbol) {
51046
- var exportDefaultSymbol = void 0;
51047
- if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) {
51048
- exportDefaultSymbol = moduleSymbol;
51049
- }
51050
- else {
51051
- exportDefaultSymbol = resolveExportByName(moduleSymbol, "default" /* Default */, node, dontResolveAlias);
51052
- }
51053
- var file = (_a = moduleSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isSourceFile);
51054
- var hasDefaultOnly = isOnlyImportedAsDefault(node.parent.moduleSpecifier);
51055
- var hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, node.parent.moduleSpecifier);
51056
- if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
51057
- if (hasExportAssignmentSymbol(moduleSymbol)) {
51058
- var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015 ? "allowSyntheticDefaultImports" : "esModuleInterop";
51059
- var exportEqualsSymbol = moduleSymbol.exports.get("export=" /* ExportEquals */);
51060
- var exportAssignment = exportEqualsSymbol.valueDeclaration;
51061
- var err = error(node.name, ts.Diagnostics.Module_0_can_only_be_default_imported_using_the_1_flag, symbolToString(moduleSymbol), compilerOptionName);
51062
- if (exportAssignment) {
51063
- ts.addRelatedInfo(err, ts.createDiagnosticForNode(exportAssignment, ts.Diagnostics.This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag, compilerOptionName));
51064
- }
51065
- }
51066
- else {
51067
- reportNonDefaultExport(moduleSymbol, node);
51052
+ return getTargetofModuleDefault(moduleSymbol, node, dontResolveAlias);
51053
+ }
51054
+ }
51055
+ function getTargetofModuleDefault(moduleSymbol, node, dontResolveAlias) {
51056
+ var _a;
51057
+ var exportDefaultSymbol;
51058
+ if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) {
51059
+ exportDefaultSymbol = moduleSymbol;
51060
+ }
51061
+ else {
51062
+ exportDefaultSymbol = resolveExportByName(moduleSymbol, "default" /* Default */, node, dontResolveAlias);
51063
+ }
51064
+ var file = (_a = moduleSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isSourceFile);
51065
+ var specifier = getModuleSpecifierForImportOrExport(node);
51066
+ if (!specifier) {
51067
+ return exportDefaultSymbol;
51068
+ }
51069
+ var hasDefaultOnly = isOnlyImportedAsDefault(specifier);
51070
+ var hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, specifier);
51071
+ if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
51072
+ if (hasExportAssignmentSymbol(moduleSymbol)) {
51073
+ var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015 ? "allowSyntheticDefaultImports" : "esModuleInterop";
51074
+ var exportEqualsSymbol = moduleSymbol.exports.get("export=" /* ExportEquals */);
51075
+ var exportAssignment = exportEqualsSymbol.valueDeclaration;
51076
+ var err = error(node.name, ts.Diagnostics.Module_0_can_only_be_default_imported_using_the_1_flag, symbolToString(moduleSymbol), compilerOptionName);
51077
+ if (exportAssignment) {
51078
+ ts.addRelatedInfo(err, ts.createDiagnosticForNode(exportAssignment, ts.Diagnostics.This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag, compilerOptionName));
51068
51079
  }
51069
51080
  }
51070
- else if (hasSyntheticDefault || hasDefaultOnly) {
51071
- // per emit behavior, a synthetic default overrides a "real" .default member if `__esModule` is not present
51072
- var resolved = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
51073
- markSymbolOfAliasDeclarationIfTypeOnly(node, moduleSymbol, resolved, /*overwriteTypeOnly*/ false);
51074
- return resolved;
51081
+ else if (ts.isImportClause(node)) {
51082
+ reportNonDefaultExport(moduleSymbol, node);
51075
51083
  }
51076
- markSymbolOfAliasDeclarationIfTypeOnly(node, exportDefaultSymbol, /*finalTarget*/ undefined, /*overwriteTypeOnly*/ false);
51077
- return exportDefaultSymbol;
51084
+ else {
51085
+ errorNoModuleMemberSymbol(moduleSymbol, moduleSymbol, node, ts.isImportOrExportSpecifier(node) && node.propertyName || node.name);
51086
+ }
51087
+ }
51088
+ else if (hasSyntheticDefault || hasDefaultOnly) {
51089
+ // per emit behavior, a synthetic default overrides a "real" .default member if `__esModule` is not present
51090
+ var resolved = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
51091
+ markSymbolOfAliasDeclarationIfTypeOnly(node, moduleSymbol, resolved, /*overwriteTypeOnly*/ false);
51092
+ return resolved;
51093
+ }
51094
+ markSymbolOfAliasDeclarationIfTypeOnly(node, exportDefaultSymbol, /*finalTarget*/ undefined, /*overwriteTypeOnly*/ false);
51095
+ return exportDefaultSymbol;
51096
+ }
51097
+ function getModuleSpecifierForImportOrExport(node) {
51098
+ switch (node.kind) {
51099
+ case 267 /* ImportClause */: return node.parent.moduleSpecifier;
51100
+ case 265 /* ImportEqualsDeclaration */: return ts.isExternalModuleReference(node.moduleReference) ? node.moduleReference.expression : undefined;
51101
+ case 268 /* NamespaceImport */: return node.parent.parent.moduleSpecifier;
51102
+ case 270 /* ImportSpecifier */: return node.parent.parent.parent.moduleSpecifier;
51103
+ case 275 /* ExportSpecifier */: return node.parent.parent.moduleSpecifier;
51104
+ default: return ts.Debug.assertNever(node);
51078
51105
  }
51079
51106
  }
51080
51107
  function reportNonDefaultExport(moduleSymbol, node) {
@@ -51164,7 +51191,7 @@ var ts;
51164
51191
  }
51165
51192
  }
51166
51193
  function getExternalModuleMember(node, specifier, dontResolveAlias) {
51167
- var _a, _b;
51194
+ var _a;
51168
51195
  if (dontResolveAlias === void 0) { dontResolveAlias = false; }
51169
51196
  var moduleSpecifier = ts.getExternalModuleRequireArgument(node) || node.moduleSpecifier;
51170
51197
  var moduleSymbol = resolveExternalModuleName(node, moduleSpecifier); // TODO: GH#18217
@@ -51200,29 +51227,33 @@ var ts;
51200
51227
  combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) :
51201
51228
  symbolFromModule || symbolFromVariable;
51202
51229
  if (!symbol) {
51203
- var moduleName = getFullyQualifiedName(moduleSymbol, node);
51204
- var declarationName = ts.declarationNameToString(name);
51205
- var suggestion = getSuggestedSymbolForNonexistentModule(name, targetSymbol);
51206
- if (suggestion !== undefined) {
51207
- var suggestionName = symbolToString(suggestion);
51208
- var diagnostic = error(name, ts.Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, moduleName, declarationName, suggestionName);
51209
- if (suggestion.valueDeclaration) {
51210
- ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(suggestion.valueDeclaration, ts.Diagnostics._0_is_declared_here, suggestionName));
51211
- }
51212
- }
51213
- else {
51214
- if ((_b = moduleSymbol.exports) === null || _b === void 0 ? void 0 : _b.has("default" /* Default */)) {
51215
- error(name, ts.Diagnostics.Module_0_has_no_exported_member_1_Did_you_mean_to_use_import_1_from_0_instead, moduleName, declarationName);
51216
- }
51217
- else {
51218
- reportNonExportedMember(node, name, declarationName, moduleSymbol, moduleName);
51219
- }
51220
- }
51230
+ errorNoModuleMemberSymbol(moduleSymbol, targetSymbol, node, name);
51221
51231
  }
51222
51232
  return symbol;
51223
51233
  }
51224
51234
  }
51225
51235
  }
51236
+ function errorNoModuleMemberSymbol(moduleSymbol, targetSymbol, node, name) {
51237
+ var _a;
51238
+ var moduleName = getFullyQualifiedName(moduleSymbol, node);
51239
+ var declarationName = ts.declarationNameToString(name);
51240
+ var suggestion = getSuggestedSymbolForNonexistentModule(name, targetSymbol);
51241
+ if (suggestion !== undefined) {
51242
+ var suggestionName = symbolToString(suggestion);
51243
+ var diagnostic = error(name, ts.Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, moduleName, declarationName, suggestionName);
51244
+ if (suggestion.valueDeclaration) {
51245
+ ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(suggestion.valueDeclaration, ts.Diagnostics._0_is_declared_here, suggestionName));
51246
+ }
51247
+ }
51248
+ else {
51249
+ if ((_a = moduleSymbol.exports) === null || _a === void 0 ? void 0 : _a.has("default" /* Default */)) {
51250
+ error(name, ts.Diagnostics.Module_0_has_no_exported_member_1_Did_you_mean_to_use_import_1_from_0_instead, moduleName, declarationName);
51251
+ }
51252
+ else {
51253
+ reportNonExportedMember(node, name, declarationName, moduleSymbol, moduleName);
51254
+ }
51255
+ }
51256
+ }
51226
51257
  function reportNonExportedMember(node, name, declarationName, moduleSymbol, moduleName) {
51227
51258
  var _a, _b;
51228
51259
  var localSymbol = (_b = (_a = moduleSymbol.valueDeclaration) === null || _a === void 0 ? void 0 : _a.locals) === null || _b === void 0 ? void 0 : _b.get(name.escapedText);
@@ -51268,6 +51299,13 @@ var ts;
51268
51299
  }
51269
51300
  }
51270
51301
  function getTargetOfImportSpecifier(node, dontResolveAlias) {
51302
+ if (ts.isImportSpecifier(node) && ts.idText(node.propertyName || node.name) === "default" /* Default */) {
51303
+ var specifier = getModuleSpecifierForImportOrExport(node);
51304
+ var moduleSymbol = specifier && resolveExternalModuleName(node, specifier);
51305
+ if (moduleSymbol) {
51306
+ return getTargetofModuleDefault(moduleSymbol, node, dontResolveAlias);
51307
+ }
51308
+ }
51271
51309
  var root = ts.isBindingElement(node) ? ts.getRootDeclaration(node) : node.parent.parent.parent;
51272
51310
  var commonJSPropertyAccess = getCommonJSPropertyAccess(root);
51273
51311
  var resolved = getExternalModuleMember(root, commonJSPropertyAccess || node, dontResolveAlias);
@@ -51289,6 +51327,13 @@ var ts;
51289
51327
  return resolved;
51290
51328
  }
51291
51329
  function getTargetOfExportSpecifier(node, meaning, dontResolveAlias) {
51330
+ if (ts.idText(node.propertyName || node.name) === "default" /* Default */) {
51331
+ var specifier = getModuleSpecifierForImportOrExport(node);
51332
+ var moduleSymbol = specifier && resolveExternalModuleName(node, specifier);
51333
+ if (moduleSymbol) {
51334
+ return getTargetofModuleDefault(moduleSymbol, node, !!dontResolveAlias);
51335
+ }
51336
+ }
51292
51337
  var resolved = node.parent.parent.moduleSpecifier ?
51293
51338
  getExternalModuleMember(node.parent.parent, node, dontResolveAlias) :
51294
51339
  resolveEntityName(node.propertyName || node.name, meaning, /*ignoreErrors*/ false, dontResolveAlias);
@@ -55737,7 +55782,7 @@ var ts;
55737
55782
  // This is an else/if as accessors and properties can't merge in TS, but might in JS
55738
55783
  // If this happens, we assume the accessor takes priority, as it imposes more constraints
55739
55784
  else if (p.flags & (4 /* Property */ | 3 /* Variable */ | 98304 /* Accessor */)) {
55740
- return ts.setTextRange(createProperty(ts.factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 64 /* Readonly */ : 0) | flag), name, p.flags & 16777216 /* Optional */ ? ts.factory.createToken(57 /* QuestionToken */) : undefined, isPrivate ? undefined : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled),
55785
+ return ts.setTextRange(createProperty(ts.factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 64 /* Readonly */ : 0) | flag), name, p.flags & 16777216 /* Optional */ ? ts.factory.createToken(57 /* QuestionToken */) : undefined, isPrivate ? undefined : serializeTypeForDeclaration(context, getWriteTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled),
55741
55786
  // TODO: https://github.com/microsoft/TypeScript/pull/32372#discussion_r328386357
55742
55787
  // interface members can't have initializers, however class members _can_
55743
55788
  /*initializer*/ undefined), ((_d = p.declarations) === null || _d === void 0 ? void 0 : _d.find(ts.or(ts.isPropertyDeclaration, ts.isVariableDeclaration))) || firstPropertyLikeDecl);
@@ -56989,8 +57034,32 @@ var ts;
56989
57034
  // The type implied by a binding pattern is independent of context, so we check the initializer with no
56990
57035
  // contextual type or, if the element itself is a binding pattern, with the type implied by that binding
56991
57036
  // pattern.
56992
- var contextualType = ts.isBindingPattern(element.name) ? getTypeFromBindingPattern(element.name, /*includePatternInType*/ true, /*reportErrors*/ false) : unknownType;
56993
- return addOptionality(widenTypeInferredFromInitializer(element, checkDeclarationInitializer(element, 0 /* Normal */, contextualType)));
57037
+ if (ts.isBindingPattern(element.name)) {
57038
+ var contextualType = getTypeFromBindingPattern(element.name, /*includePatternInType*/ true, /*reportErrors*/ false);
57039
+ return addOptionality(widenTypeInferredFromInitializer(element, checkDeclarationInitializer(element, 0 /* Normal */, contextualType)));
57040
+ }
57041
+ // (#49989)
57042
+ // In cases where the intitializer is an identifier referencing a sibling symbol (i.e., one that is
57043
+ // defined in the same declaration) a false circular relationship will be concluded. For example, take
57044
+ // the declarations below:
57045
+ //
57046
+ // const [a, b = a] = [1];
57047
+ // const {a, b = a} = {a: 1};
57048
+ //
57049
+ // Here, when the `element` is the second binding element (i.e., `b = a`) the initializer is `a` which
57050
+ // itself is defined within the same binding pattern.
57051
+ //
57052
+ // So, we check the initializer expression for any references to sibling symbols and if any, then we'd
57053
+ // conclude the binding element type as `unknownType` and thus skip further circulations in type
57054
+ // checking.
57055
+ var siblings_1 = ts.mapDefined(element.parent.elements, function (x) { return x !== element && ts.isBindingElement(x) && ts.isIdentifier(x.name) ? x : undefined; });
57056
+ var checkIsSiblingInvolved = function (node) {
57057
+ var declaration = ts.isIdentifier(node) && getReferencedValueDeclaration(node);
57058
+ return declaration && ts.isBindingElement(declaration) && siblings_1.includes(declaration);
57059
+ };
57060
+ var isSiblingElementInvolded = checkIsSiblingInvolved(element.initializer) || ts.forEachChildRecursively(element.initializer, checkIsSiblingInvolved);
57061
+ return isSiblingElementInvolded ? anyType
57062
+ : addOptionality(widenTypeInferredFromInitializer(element, checkDeclarationInitializer(element, 0 /* Normal */, unknownType)));
56994
57063
  }
56995
57064
  if (ts.isBindingPattern(element.name)) {
56996
57065
  return getTypeFromBindingPattern(element.name, includePatternInType, reportErrors);
@@ -68436,19 +68505,19 @@ var ts;
68436
68505
  }
68437
68506
  function getSiblingsOfContext(context) {
68438
68507
  if (!context.siblings) {
68439
- var siblings_1 = [];
68508
+ var siblings_2 = [];
68440
68509
  for (var _i = 0, _a = getSiblingsOfContext(context.parent); _i < _a.length; _i++) {
68441
68510
  var type = _a[_i];
68442
68511
  if (isObjectLiteralType(type)) {
68443
68512
  var prop = getPropertyOfObjectType(type, context.propertyName);
68444
68513
  if (prop) {
68445
68514
  forEachType(getTypeOfSymbol(prop), function (t) {
68446
- siblings_1.push(t);
68515
+ siblings_2.push(t);
68447
68516
  });
68448
68517
  }
68449
68518
  }
68450
68519
  }
68451
- context.siblings = siblings_1;
68520
+ context.siblings = siblings_2;
68452
68521
  }
68453
68522
  return context.siblings;
68454
68523
  }
@@ -88761,7 +88830,7 @@ var ts;
88761
88830
  return checkGrammarDecorators(node) || checkGrammarModifiers(node);
88762
88831
  }
88763
88832
  function checkGrammarDecorators(node) {
88764
- if (ts.canHaveIllegalDecorators(node) && ts.some(node.decorators)) {
88833
+ if (ts.canHaveIllegalDecorators(node) && ts.some(node.illegalDecorators)) {
88765
88834
  return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here);
88766
88835
  }
88767
88836
  if (!ts.canHaveDecorators(node) || !ts.hasDecorators(node)) {
@@ -182693,9 +182762,9 @@ var ts;
182693
182762
  // - error: 5.0
182694
182763
  var ts;
182695
182764
  (function (ts) {
182696
- var MUST_MERGE = { since: "4.8", warnAfter: "4.9.0-0", message: "Decorators have been combined with modifiers. Callers should switch to an overload without a 'decorators' parameter." };
182697
- var DISALLOW_DECORATORS = { since: "4.8", warnAfter: "4.9.0-0", message: "Decorators are no longer supported for this function. Callers should switch to an overload without a 'decorators' parameter." };
182698
- var DISALLOW_DECORATORS_AND_MODIFIERS = { since: "4.8", warnAfter: "4.9.0-0", message: "Decorators and modifiers are no longer supported for this function. Callers should switch to an overload without the 'decorators' or 'modifiers' parameters." };
182765
+ var MUST_MERGE = { since: "4.8", warnAfter: "4.9.0-0", message: "Decorators have been combined with modifiers. Callers should switch to an overload that does not accept a 'decorators' parameter." };
182766
+ var DISALLOW_DECORATORS = { since: "4.8", warnAfter: "4.9.0-0", message: "Decorators are no longer supported for this function. Callers should switch to an overload that does not accept a 'decorators' parameter." };
182767
+ var DISALLOW_DECORATORS_AND_MODIFIERS = { since: "4.8", warnAfter: "4.9.0-0", message: "Decorators and modifiers are no longer supported for this function. Callers should switch to an overload that does not accept the 'decorators' and 'modifiers' parameters." };
182699
182768
  function patchNodeFactory(factory) {
182700
182769
  var createParameterDeclaration = factory.createParameterDeclaration, updateParameterDeclaration = factory.updateParameterDeclaration, createPropertyDeclaration = factory.createPropertyDeclaration, updatePropertyDeclaration = factory.updatePropertyDeclaration, createMethodDeclaration = factory.createMethodDeclaration, updateMethodDeclaration = factory.updateMethodDeclaration, createConstructorDeclaration = factory.createConstructorDeclaration, updateConstructorDeclaration = factory.updateConstructorDeclaration, createGetAccessorDeclaration = factory.createGetAccessorDeclaration, updateGetAccessorDeclaration = factory.updateGetAccessorDeclaration, createSetAccessorDeclaration = factory.createSetAccessorDeclaration, updateSetAccessorDeclaration = factory.updateSetAccessorDeclaration, createIndexSignature = factory.createIndexSignature, updateIndexSignature = factory.updateIndexSignature, createClassStaticBlockDeclaration = factory.createClassStaticBlockDeclaration, updateClassStaticBlockDeclaration = factory.updateClassStaticBlockDeclaration, createClassExpression = factory.createClassExpression, updateClassExpression = factory.updateClassExpression, createFunctionDeclaration = factory.createFunctionDeclaration, updateFunctionDeclaration = factory.updateFunctionDeclaration, createClassDeclaration = factory.createClassDeclaration, updateClassDeclaration = factory.updateClassDeclaration, createInterfaceDeclaration = factory.createInterfaceDeclaration, updateInterfaceDeclaration = factory.updateInterfaceDeclaration, createTypeAliasDeclaration = factory.createTypeAliasDeclaration, updateTypeAliasDeclaration = factory.updateTypeAliasDeclaration, createEnumDeclaration = factory.createEnumDeclaration, updateEnumDeclaration = factory.updateEnumDeclaration, createModuleDeclaration = factory.createModuleDeclaration, updateModuleDeclaration = factory.updateModuleDeclaration, createImportEqualsDeclaration = factory.createImportEqualsDeclaration, updateImportEqualsDeclaration = factory.updateImportEqualsDeclaration, createImportDeclaration = factory.createImportDeclaration, updateImportDeclaration = factory.updateImportDeclaration, createExportAssignment = factory.createExportAssignment, updateExportAssignment = factory.updateExportAssignment, createExportDeclaration = factory.createExportDeclaration, updateExportDeclaration = factory.updateExportDeclaration;
182701
182770
  factory.createParameterDeclaration = ts.buildOverload("createParameterDeclaration")
@@ -182922,7 +182991,7 @@ var ts;
182922
182991
  return (decorators === undefined || !ts.some(decorators, ts.isModifier)) &&
182923
182992
  (modifiers === undefined || !ts.some(modifiers, ts.isParameter)) &&
182924
182993
  (parameters === undefined || ts.isArray(parameters)) &&
182925
- (body === undefined || !ts.isBlock(body));
182994
+ (body === undefined || ts.isBlock(body));
182926
182995
  },
182927
182996
  })
182928
182997
  .deprecate({
@@ -182951,7 +183020,7 @@ var ts;
182951
183020
  return (decorators === undefined || !ts.some(decorators, ts.isModifier)) &&
182952
183021
  (modifiers === undefined || !ts.some(modifiers, ts.isParameter)) &&
182953
183022
  (parameters === undefined || ts.isArray(parameters)) &&
182954
- (body === undefined || !ts.isBlock(body));
183023
+ (body === undefined || ts.isBlock(body));
182955
183024
  },
182956
183025
  })
182957
183026
  .deprecate({
@@ -184064,6 +184133,20 @@ var ts;
184064
184133
  }
184065
184134
  // Override sys.write because fs.writeSync is not reliable on Node 4
184066
184135
  sys.write = function (s) { return writeMessage(sys.bufferFrom(s, "utf8")); };
184136
+ // REVIEW: for now this implementation uses polling.
184137
+ // The advantage of polling is that it works reliably
184138
+ // on all os and with network mounted files.
184139
+ // For 90 referenced files, the average time to detect
184140
+ // changes is 2*msInterval (by default 5 seconds).
184141
+ // The overhead of this is .04 percent (1/2500) with
184142
+ // average pause of < 1 millisecond (and max
184143
+ // pause less than 1.5 milliseconds); question is
184144
+ // do we anticipate reference sets in the 100s and
184145
+ // do we care about waiting 10-20 seconds to detect
184146
+ // changes for large reference sets? If so, do we want
184147
+ // to increase the chunk size or decrease the interval
184148
+ // time dynamically to match the large reference set?
184149
+ sys.defaultWatchFileKind = function () { return ts.WatchFileKind.FixedChunkSizePolling; };
184067
184150
  /* eslint-disable no-restricted-globals */
184068
184151
  sys.setTimeout = setTimeout;
184069
184152
  sys.clearTimeout = clearTimeout;