typescript 4.9.1-beta → 4.9.2-rc

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.
@@ -45,7 +45,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
45
45
  function verb(n) { return function (v) { return step([n, v]); }; }
46
46
  function step(op) {
47
47
  if (f) throw new TypeError("Generator is already executing.");
48
- while (_) try {
48
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
49
49
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
50
50
  if (y = 0, t) op = [op[0] & 2, t.value];
51
51
  switch (op[0]) {
@@ -89,7 +89,7 @@ var ts;
89
89
  // The following is baselined as a literal template type without intervention
90
90
  /** The version of the TypeScript compiler release */
91
91
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
92
- ts.version = "".concat(ts.versionMajorMinor, ".1-beta");
92
+ ts.version = "".concat(ts.versionMajorMinor, ".2-rc");
93
93
  /* @internal */
94
94
  var Comparison;
95
95
  (function (Comparison) {
@@ -1881,8 +1881,8 @@ var ts;
1881
1881
  return compareValues(a === null || a === void 0 ? void 0 : a.start, b === null || b === void 0 ? void 0 : b.start) || compareValues(a === null || a === void 0 ? void 0 : a.length, b === null || b === void 0 ? void 0 : b.length);
1882
1882
  }
1883
1883
  ts.compareTextSpans = compareTextSpans;
1884
- function min(a, b, compare) {
1885
- return compare(a, b) === -1 /* Comparison.LessThan */ ? a : b;
1884
+ function min(items, compare) {
1885
+ return reduceLeft(items, function (x, y) { return compare(x, y) === -1 /* Comparison.LessThan */ ? x : y; });
1886
1886
  }
1887
1887
  ts.min = min;
1888
1888
  /**
@@ -3195,11 +3195,13 @@ var ts;
3195
3195
  // > alphanumerics and hyphen [0-9A-Za-z-]. Identifiers MUST NOT be empty. Numeric identifiers
3196
3196
  // > MUST NOT include leading zeroes.
3197
3197
  var prereleaseRegExp = /^(?:0|[1-9]\d*|[a-z-][a-z0-9-]*)(?:\.(?:0|[1-9]\d*|[a-z-][a-z0-9-]*))*$/i;
3198
+ var prereleasePartRegExp = /^(?:0|[1-9]\d*|[a-z-][a-z0-9-]*)$/i;
3198
3199
  // https://semver.org/#spec-item-10
3199
3200
  // > Build metadata MAY be denoted by appending a plus sign and a series of dot separated
3200
3201
  // > identifiers immediately following the patch or pre-release version. Identifiers MUST
3201
3202
  // > comprise only ASCII alphanumerics and hyphen [0-9A-Za-z-]. Identifiers MUST NOT be empty.
3202
3203
  var buildRegExp = /^[a-z0-9-]+(?:\.[a-z0-9-]+)*$/i;
3204
+ var buildPartRegExp = /^[a-z0-9-]+$/i;
3203
3205
  // https://semver.org/#spec-item-9
3204
3206
  // > Numeric identifiers MUST NOT include leading zeroes.
3205
3207
  var numericIdentifierRegExp = /^(0|[1-9]\d*)$/;
@@ -3219,13 +3221,15 @@ var ts;
3219
3221
  ts.Debug.assert(major >= 0, "Invalid argument: major");
3220
3222
  ts.Debug.assert(minor >= 0, "Invalid argument: minor");
3221
3223
  ts.Debug.assert(patch >= 0, "Invalid argument: patch");
3222
- ts.Debug.assert(!prerelease || prereleaseRegExp.test(prerelease), "Invalid argument: prerelease");
3223
- ts.Debug.assert(!build || buildRegExp.test(build), "Invalid argument: build");
3224
+ var prereleaseArray = prerelease ? ts.isArray(prerelease) ? prerelease : prerelease.split(".") : ts.emptyArray;
3225
+ var buildArray = build ? ts.isArray(build) ? build : build.split(".") : ts.emptyArray;
3226
+ ts.Debug.assert(ts.every(prereleaseArray, function (s) { return prereleasePartRegExp.test(s); }), "Invalid argument: prerelease");
3227
+ ts.Debug.assert(ts.every(buildArray, function (s) { return buildPartRegExp.test(s); }), "Invalid argument: build");
3224
3228
  this.major = major;
3225
3229
  this.minor = minor;
3226
3230
  this.patch = patch;
3227
- this.prerelease = prerelease ? prerelease.split(".") : ts.emptyArray;
3228
- this.build = build ? build.split(".") : ts.emptyArray;
3231
+ this.prerelease = prereleaseArray;
3232
+ this.build = buildArray;
3229
3233
  }
3230
3234
  Version.tryParse = function (text) {
3231
3235
  var result = tryParseComponents(text);
@@ -3264,6 +3268,10 @@ var ts;
3264
3268
  default: return ts.Debug.assertNever(field);
3265
3269
  }
3266
3270
  };
3271
+ Version.prototype.with = function (fields) {
3272
+ var _a = fields.major, major = _a === void 0 ? this.major : _a, _b = fields.minor, minor = _b === void 0 ? this.minor : _b, _c = fields.patch, patch = _c === void 0 ? this.patch : _c, _d = fields.prerelease, prerelease = _d === void 0 ? this.prerelease : _d, _e = fields.build, build = _e === void 0 ? this.build : _e;
3273
+ return new Version(major, minor, patch, prerelease, build);
3274
+ };
3267
3275
  Version.prototype.toString = function () {
3268
3276
  var result = "".concat(this.major, ".").concat(this.minor, ".").concat(this.patch);
3269
3277
  if (ts.some(this.prerelease))
@@ -3272,7 +3280,7 @@ var ts;
3272
3280
  result += "+".concat(this.build.join("."));
3273
3281
  return result;
3274
3282
  };
3275
- Version.zero = new Version(0, 0, 0);
3283
+ Version.zero = new Version(0, 0, 0, ["0"]);
3276
3284
  return Version;
3277
3285
  }());
3278
3286
  ts.Version = Version;
@@ -3355,6 +3363,10 @@ var ts;
3355
3363
  }
3356
3364
  return undefined;
3357
3365
  };
3366
+ /**
3367
+ * Tests whether a version matches the range. This is equivalent to `satisfies(version, range, { includePrerelease: true })`.
3368
+ * in `node-semver`.
3369
+ */
3358
3370
  VersionRange.prototype.test = function (version) {
3359
3371
  if (typeof version === "string")
3360
3372
  version = new Version(version);
@@ -3465,19 +3477,20 @@ var ts;
3465
3477
  break;
3466
3478
  case "<":
3467
3479
  case ">=":
3468
- comparators.push(createComparator(operator, version));
3480
+ comparators.push(isWildcard(minor) || isWildcard(patch) ? createComparator(operator, version.with({ prerelease: "0" })) :
3481
+ createComparator(operator, version));
3469
3482
  break;
3470
3483
  case "<=":
3471
3484
  case ">":
3472
- comparators.push(isWildcard(minor) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("major")) :
3473
- isWildcard(patch) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("minor")) :
3485
+ comparators.push(isWildcard(minor) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("major").with({ prerelease: "0" })) :
3486
+ isWildcard(patch) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("minor").with({ prerelease: "0" })) :
3474
3487
  createComparator(operator, version));
3475
3488
  break;
3476
3489
  case "=":
3477
3490
  case undefined:
3478
3491
  if (isWildcard(minor) || isWildcard(patch)) {
3479
- comparators.push(createComparator(">=", version));
3480
- comparators.push(createComparator("<", version.increment(isWildcard(minor) ? "major" : "minor")));
3492
+ comparators.push(createComparator(">=", version.with({ prerelease: "0" })));
3493
+ comparators.push(createComparator("<", version.increment(isWildcard(minor) ? "major" : "minor").with({ prerelease: "0" })));
3481
3494
  }
3482
3495
  else {
3483
3496
  comparators.push(createComparator("=", version));
@@ -5086,8 +5099,8 @@ var ts;
5086
5099
  NodeCheckFlags[NodeCheckFlags["SuperInstance"] = 256] = "SuperInstance";
5087
5100
  NodeCheckFlags[NodeCheckFlags["SuperStatic"] = 512] = "SuperStatic";
5088
5101
  NodeCheckFlags[NodeCheckFlags["ContextChecked"] = 1024] = "ContextChecked";
5089
- NodeCheckFlags[NodeCheckFlags["AsyncMethodWithSuper"] = 2048] = "AsyncMethodWithSuper";
5090
- NodeCheckFlags[NodeCheckFlags["AsyncMethodWithSuperBinding"] = 4096] = "AsyncMethodWithSuperBinding";
5102
+ NodeCheckFlags[NodeCheckFlags["MethodWithSuperPropertyAccessInAsync"] = 2048] = "MethodWithSuperPropertyAccessInAsync";
5103
+ NodeCheckFlags[NodeCheckFlags["MethodWithSuperPropertyAssignmentInAsync"] = 4096] = "MethodWithSuperPropertyAssignmentInAsync";
5091
5104
  NodeCheckFlags[NodeCheckFlags["CaptureArguments"] = 8192] = "CaptureArguments";
5092
5105
  NodeCheckFlags[NodeCheckFlags["EnumValuesComputed"] = 16384] = "EnumValuesComputed";
5093
5106
  NodeCheckFlags[NodeCheckFlags["LexicalModuleMergesWithClass"] = 32768] = "LexicalModuleMergesWithClass";
@@ -6722,7 +6735,7 @@ var ts;
6722
6735
  }
6723
6736
  /*@internal*/
6724
6737
  function createSystemWatchFunctions(_a) {
6725
- 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;
6738
+ 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, inodeWatching = _a.inodeWatching, sysLog = _a.sysLog;
6726
6739
  var pollingWatches = new ts.Map();
6727
6740
  var fsWatches = new ts.Map();
6728
6741
  var fsWatchesRecursive = new ts.Map();
@@ -6788,8 +6801,8 @@ var ts;
6788
6801
  return useNonPollingWatchers ?
6789
6802
  // Use notifications from FS to watch with falling back to fs.watchFile
6790
6803
  generateWatchFileOptions(ts.WatchFileKind.UseFsEventsOnParentDirectory, ts.PollingWatchKind.PriorityInterval, options) :
6791
- // Default to do not use fixed polling interval
6792
- { watchFile: (defaultWatchFileKind === null || defaultWatchFileKind === void 0 ? void 0 : defaultWatchFileKind()) || ts.WatchFileKind.UseFsEvents };
6804
+ // Default to using fs events
6805
+ { watchFile: ts.WatchFileKind.UseFsEvents };
6793
6806
  }
6794
6807
  }
6795
6808
  function generateWatchFileOptions(watchFile, fallbackPolling, options) {
@@ -7061,7 +7074,6 @@ var ts;
7061
7074
  tscWatchFile: process.env.TSC_WATCHFILE,
7062
7075
  useNonPollingWatchers: process.env.TSC_NONPOLLING_WATCHER,
7063
7076
  tscWatchDirectory: process.env.TSC_WATCHDIRECTORY,
7064
- defaultWatchFileKind: function () { var _a, _b; return (_b = (_a = sys).defaultWatchFileKind) === null || _b === void 0 ? void 0 : _b.call(_a); },
7065
7077
  inodeWatching: isLinuxOrMacOs,
7066
7078
  sysLog: sysLog,
7067
7079
  }), watchFile = _b.watchFile, watchDirectory = _b.watchDirectory;
@@ -9572,6 +9584,10 @@ var ts;
9572
9584
  Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted: diag(6399, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitte_6399", "Project '{0}' is out of date because buildinfo file '{1}' indicates that some of the changes were not emitted"),
9573
9585
  Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_files: diag(6400, ts.DiagnosticCategory.Message, "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400", "Project '{0}' is up to date but needs to update timestamps of output files that are older than input files"),
9574
9586
  Project_0_is_out_of_date_because_there_was_error_reading_file_1: diag(6401, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401", "Project '{0}' is out of date because there was error reading file '{1}'"),
9587
+ Resolving_in_0_mode_with_conditions_1: diag(6402, ts.DiagnosticCategory.Message, "Resolving_in_0_mode_with_conditions_1_6402", "Resolving in {0} mode with conditions {1}."),
9588
+ Matched_0_condition_1: diag(6403, ts.DiagnosticCategory.Message, "Matched_0_condition_1_6403", "Matched '{0}' condition '{1}'."),
9589
+ Using_0_subpath_1_with_target_2: diag(6404, ts.DiagnosticCategory.Message, "Using_0_subpath_1_with_target_2_6404", "Using '{0}' subpath '{1}' with target '{2}'."),
9590
+ Saw_non_matching_condition_0: diag(6405, ts.DiagnosticCategory.Message, "Saw_non_matching_condition_0_6405", "Saw non-matching condition '{0}'."),
9575
9591
  The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"),
9576
9592
  The_expected_type_comes_from_this_index_signature: diag(6501, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."),
9577
9593
  The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."),
@@ -9888,6 +9904,8 @@ var ts;
9888
9904
  Remove_type_from_import_of_0_from_1: diag(90056, ts.DiagnosticCategory.Message, "Remove_type_from_import_of_0_from_1_90056", "Remove 'type' from import of '{0}' from \"{1}\""),
9889
9905
  Add_import_from_0: diag(90057, ts.DiagnosticCategory.Message, "Add_import_from_0_90057", "Add import from \"{0}\""),
9890
9906
  Update_import_from_0: diag(90058, ts.DiagnosticCategory.Message, "Update_import_from_0_90058", "Update import from \"{0}\""),
9907
+ Export_0_from_module_1: diag(90059, ts.DiagnosticCategory.Message, "Export_0_from_module_1_90059", "Export '{0}' from module '{1}'"),
9908
+ Export_all_referenced_locals: diag(90060, ts.DiagnosticCategory.Message, "Export_all_referenced_locals_90060", "Export all referenced locals"),
9891
9909
  Convert_function_to_an_ES2015_class: diag(95001, ts.DiagnosticCategory.Message, "Convert_function_to_an_ES2015_class_95001", "Convert function to an ES2015 class"),
9892
9910
  Convert_0_to_1_in_0: diag(95003, ts.DiagnosticCategory.Message, "Convert_0_to_1_in_0_95003", "Convert '{0}' to '{1} in {0}'"),
9893
9911
  Extract_to_0_in_1: diag(95004, ts.DiagnosticCategory.Message, "Extract_to_0_in_1_95004", "Extract to {0} in {1}"),
@@ -11345,7 +11363,7 @@ var ts;
11345
11363
  return -1;
11346
11364
  }
11347
11365
  function peekExtendedUnicodeEscape() {
11348
- if (languageVersion >= 2 /* ScriptTarget.ES2015 */ && codePointAt(text, pos + 1) === 117 /* CharacterCodes.u */ && codePointAt(text, pos + 2) === 123 /* CharacterCodes.openBrace */) {
11366
+ if (codePointAt(text, pos + 1) === 117 /* CharacterCodes.u */ && codePointAt(text, pos + 2) === 123 /* CharacterCodes.openBrace */) {
11349
11367
  var start_2 = pos;
11350
11368
  pos += 3;
11351
11369
  var escapedValueString = scanMinimumNumberOfHexDigits(1, /*canHaveSeparators*/ false);
@@ -21648,6 +21666,32 @@ var ts;
21648
21666
  return parameter.kind === 343 /* SyntaxKind.JSDocParameterTag */ ? (_a = parameter.typeExpression) === null || _a === void 0 ? void 0 : _a.type : parameter.type;
21649
21667
  }
21650
21668
  ts.getParameterTypeNode = getParameterTypeNode;
21669
+ function isTypeDeclaration(node) {
21670
+ switch (node.kind) {
21671
+ case 165 /* SyntaxKind.TypeParameter */:
21672
+ case 260 /* SyntaxKind.ClassDeclaration */:
21673
+ case 261 /* SyntaxKind.InterfaceDeclaration */:
21674
+ case 262 /* SyntaxKind.TypeAliasDeclaration */:
21675
+ case 263 /* SyntaxKind.EnumDeclaration */:
21676
+ case 348 /* SyntaxKind.JSDocTypedefTag */:
21677
+ case 341 /* SyntaxKind.JSDocCallbackTag */:
21678
+ case 342 /* SyntaxKind.JSDocEnumTag */:
21679
+ return true;
21680
+ case 270 /* SyntaxKind.ImportClause */:
21681
+ return node.isTypeOnly;
21682
+ case 273 /* SyntaxKind.ImportSpecifier */:
21683
+ case 278 /* SyntaxKind.ExportSpecifier */:
21684
+ return node.parent.parent.isTypeOnly;
21685
+ default:
21686
+ return false;
21687
+ }
21688
+ }
21689
+ ts.isTypeDeclaration = isTypeDeclaration;
21690
+ function canHaveExportModifier(node) {
21691
+ return ts.isEnumDeclaration(node) || ts.isVariableStatement(node) || ts.isFunctionDeclaration(node) || ts.isClassDeclaration(node)
21692
+ || ts.isInterfaceDeclaration(node) || isTypeDeclaration(node) || (ts.isModuleDeclaration(node) && !isExternalModuleAugmentation(node) && !isGlobalScopeAugmentation(node));
21693
+ }
21694
+ ts.canHaveExportModifier = canHaveExportModifier;
21651
21695
  })(ts || (ts = {}));
21652
21696
  /* @internal */
21653
21697
  var ts;
@@ -21656,13 +21700,11 @@ var ts;
21656
21700
  * Creates a `BaseNodeFactory` which can be used to create `Node` instances from the constructors provided by the object allocator.
21657
21701
  */
21658
21702
  function createBaseNodeFactory() {
21659
- // tslint:disable variable-name
21660
21703
  var NodeConstructor;
21661
21704
  var TokenConstructor;
21662
21705
  var IdentifierConstructor;
21663
21706
  var PrivateIdentifierConstructor;
21664
21707
  var SourceFileConstructor;
21665
- // tslint:enable variable-name
21666
21708
  return {
21667
21709
  createBaseSourceFileNode: createBaseSourceFileNode,
21668
21710
  createBaseIdentifierNode: createBaseIdentifierNode,
@@ -23126,7 +23168,7 @@ var ts;
23126
23168
  return node;
23127
23169
  }
23128
23170
  // @api
23129
- function createIdentifier(text, typeArguments, originalKeywordKind) {
23171
+ function createIdentifier(text, typeArguments, originalKeywordKind, hasExtendedUnicodeEscape) {
23130
23172
  var node = createBaseIdentifier(text, originalKeywordKind);
23131
23173
  if (typeArguments) {
23132
23174
  // NOTE: we do not use `setChildren` here because typeArguments in an identifier do not contribute to transformations
@@ -23135,6 +23177,10 @@ var ts;
23135
23177
  if (node.originalKeywordKind === 133 /* SyntaxKind.AwaitKeyword */) {
23136
23178
  node.transformFlags |= 67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */;
23137
23179
  }
23180
+ if (hasExtendedUnicodeEscape) {
23181
+ node.hasExtendedUnicodeEscape = hasExtendedUnicodeEscape;
23182
+ node.transformFlags |= 1024 /* TransformFlags.ContainsES2015 */;
23183
+ }
23138
23184
  return node;
23139
23185
  }
23140
23186
  // @api
@@ -27590,11 +27636,9 @@ var ts;
27590
27636
  rawTextScanner.setText("`" + rawText + "`");
27591
27637
  break;
27592
27638
  case 15 /* SyntaxKind.TemplateHead */:
27593
- // tslint:disable-next-line no-invalid-template-strings
27594
27639
  rawTextScanner.setText("`" + rawText + "${");
27595
27640
  break;
27596
27641
  case 16 /* SyntaxKind.TemplateMiddle */:
27597
- // tslint:disable-next-line no-invalid-template-strings
27598
27642
  rawTextScanner.setText("}" + rawText + "${");
27599
27643
  break;
27600
27644
  case 17 /* SyntaxKind.TemplateTail */:
@@ -27953,7 +27997,6 @@ var ts;
27953
27997
  return node;
27954
27998
  }
27955
27999
  ts.createInputFiles = createInputFiles;
27956
- // tslint:disable-next-line variable-name
27957
28000
  var SourceMapSource;
27958
28001
  /**
27959
28002
  * Create an external source map source file reference
@@ -28745,6 +28788,8 @@ var ts;
28745
28788
  // - The verb (`next`, `throw`, or `return` method) to delegate to the expression
28746
28789
  // of a `yield*`.
28747
28790
  // - The result of evaluating the verb delegated to the expression of a `yield*`.
28791
+ // g A temporary variable that holds onto the generator object until the generator
28792
+ // is started, allowing it to also act as the `suspendedStart` state.
28748
28793
  //
28749
28794
  // functions:
28750
28795
  // verb(n) Creates a bound callback to the `step` function for opcode `n`.
@@ -28783,7 +28828,7 @@ var ts;
28783
28828
  importName: "__generator",
28784
28829
  scoped: false,
28785
28830
  priority: 6,
28786
- text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };"
28831
+ text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };"
28787
28832
  };
28788
28833
  // ES Module Helpers
28789
28834
  ts.createBindingHelper = {
@@ -32087,13 +32132,11 @@ var ts;
32087
32132
  var scanner = ts.createScanner(99 /* ScriptTarget.Latest */, /*skipTrivia*/ true);
32088
32133
  var disallowInAndDecoratorContext = 4096 /* NodeFlags.DisallowInContext */ | 16384 /* NodeFlags.DecoratorContext */;
32089
32134
  // capture constructors in 'initializeState' to avoid null checks
32090
- // tslint:disable variable-name
32091
32135
  var NodeConstructor;
32092
32136
  var TokenConstructor;
32093
32137
  var IdentifierConstructor;
32094
32138
  var PrivateIdentifierConstructor;
32095
32139
  var SourceFileConstructor;
32096
- // tslint:enable variable-name
32097
32140
  function countNode(node) {
32098
32141
  nodeCount++;
32099
32142
  return node;
@@ -33069,8 +33112,9 @@ var ts;
33069
33112
  // Store original token kind if it is not just an Identifier so we can report appropriate error later in type checker
33070
33113
  var originalKeywordKind = token();
33071
33114
  var text = internIdentifier(scanner.getTokenValue());
33115
+ var hasExtendedUnicodeEscape = scanner.hasExtendedUnicodeEscape();
33072
33116
  nextTokenWithoutCheck();
33073
- return finishNode(factory.createIdentifier(text, /*typeArguments*/ undefined, originalKeywordKind), pos);
33117
+ return finishNode(factory.createIdentifier(text, /*typeArguments*/ undefined, originalKeywordKind, hasExtendedUnicodeEscape), pos);
33074
33118
  }
33075
33119
  if (token() === 80 /* SyntaxKind.PrivateIdentifier */) {
33076
33120
  parseErrorAtCurrentToken(privateIdentifierDiagnosticMessage || ts.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
@@ -42209,12 +42253,23 @@ var ts;
42209
42253
  }
42210
42254
  function writeConfigurations() {
42211
42255
  // Filter applicable options to place in the file
42212
- var categorizedOptions = ts.createMultiMap();
42256
+ var categorizedOptions = new ts.Map();
42257
+ // Set allowed categories in order
42258
+ categorizedOptions.set(ts.Diagnostics.Projects, []);
42259
+ categorizedOptions.set(ts.Diagnostics.Language_and_Environment, []);
42260
+ categorizedOptions.set(ts.Diagnostics.Modules, []);
42261
+ categorizedOptions.set(ts.Diagnostics.JavaScript_Support, []);
42262
+ categorizedOptions.set(ts.Diagnostics.Emit, []);
42263
+ categorizedOptions.set(ts.Diagnostics.Interop_Constraints, []);
42264
+ categorizedOptions.set(ts.Diagnostics.Type_Checking, []);
42265
+ categorizedOptions.set(ts.Diagnostics.Completeness, []);
42213
42266
  for (var _i = 0, optionDeclarations_1 = ts.optionDeclarations; _i < optionDeclarations_1.length; _i++) {
42214
42267
  var option = optionDeclarations_1[_i];
42215
- var category = option.category;
42216
42268
  if (isAllowedOptionForOutput(option)) {
42217
- categorizedOptions.add(ts.getLocaleSpecificMessage(category), option);
42269
+ var listForCategory = categorizedOptions.get(option.category);
42270
+ if (!listForCategory)
42271
+ categorizedOptions.set(option.category, listForCategory = []);
42272
+ listForCategory.push(option);
42218
42273
  }
42219
42274
  }
42220
42275
  // Serialize all options and their descriptions
@@ -42225,7 +42280,7 @@ var ts;
42225
42280
  if (entries.length !== 0) {
42226
42281
  entries.push({ value: "" });
42227
42282
  }
42228
- entries.push({ value: "/* ".concat(category, " */") });
42283
+ entries.push({ value: "/* ".concat(ts.getLocaleSpecificMessage(category), " */") });
42229
42284
  for (var _i = 0, options_1 = options; _i < options_1.length; _i++) {
42230
42285
  var option = options_1[_i];
42231
42286
  var optionName = void 0;
@@ -44267,6 +44322,9 @@ var ts;
44267
44322
  requestContainingDirectory: containingDirectory,
44268
44323
  reportDiagnostic: function (diag) { return void diagnostics.push(diag); },
44269
44324
  };
44325
+ if (traceEnabled && ts.getEmitModuleResolutionKind(compilerOptions) >= ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) <= ts.ModuleResolutionKind.NodeNext) {
44326
+ trace(host, ts.Diagnostics.Resolving_in_0_mode_with_conditions_1, features & NodeResolutionFeatures.EsmMode ? "ESM" : "CJS", conditions.map(function (c) { return "'".concat(c, "'"); }).join(", "));
44327
+ }
44270
44328
  var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); });
44271
44329
  return createResolvedModuleWithFailedLookupLocations((_a = result === null || result === void 0 ? void 0 : result.value) === null || _a === void 0 ? void 0 : _a.resolved, (_b = result === null || result === void 0 ? void 0 : result.value) === null || _b === void 0 ? void 0 : _b.isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, state.resultFromCache);
44272
44330
  function tryResolve(extensions) {
@@ -44856,7 +44914,7 @@ var ts;
44856
44914
  }
44857
44915
  if (mainExport) {
44858
44916
  var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, subpath, scope, /*isImports*/ false);
44859
- return loadModuleFromTargetImportOrExport(mainExport, "", /*pattern*/ false);
44917
+ return loadModuleFromTargetImportOrExport(mainExport, "", /*pattern*/ false, ".");
44860
44918
  }
44861
44919
  }
44862
44920
  else if (allKeysStartWithDot(scope.contents.packageJsonContent.exports)) {
@@ -44936,7 +44994,7 @@ var ts;
44936
44994
  var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports);
44937
44995
  if (!ts.endsWith(moduleName, ts.directorySeparator) && moduleName.indexOf("*") === -1 && ts.hasProperty(lookupTable, moduleName)) {
44938
44996
  var target = lookupTable[moduleName];
44939
- return loadModuleFromTargetImportOrExport(target, /*subpath*/ "", /*pattern*/ false);
44997
+ return loadModuleFromTargetImportOrExport(target, /*subpath*/ "", /*pattern*/ false, moduleName);
44940
44998
  }
44941
44999
  var expandingKeys = ts.sort(ts.filter(ts.getOwnKeys(lookupTable), function (k) { return k.indexOf("*") !== -1 || ts.endsWith(k, "/"); }), comparePatternKeys);
44942
45000
  for (var _i = 0, expandingKeys_1 = expandingKeys; _i < expandingKeys_1.length; _i++) {
@@ -44945,17 +45003,17 @@ var ts;
44945
45003
  var target = lookupTable[potentialTarget];
44946
45004
  var starPos = potentialTarget.indexOf("*");
44947
45005
  var subpath = moduleName.substring(potentialTarget.substring(0, starPos).length, moduleName.length - (potentialTarget.length - 1 - starPos));
44948
- return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true);
45006
+ return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true, potentialTarget);
44949
45007
  }
44950
45008
  else if (ts.endsWith(potentialTarget, "*") && ts.startsWith(moduleName, potentialTarget.substring(0, potentialTarget.length - 1))) {
44951
45009
  var target = lookupTable[potentialTarget];
44952
45010
  var subpath = moduleName.substring(potentialTarget.length - 1);
44953
- return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true);
45011
+ return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true, potentialTarget);
44954
45012
  }
44955
45013
  else if (ts.startsWith(moduleName, potentialTarget)) {
44956
45014
  var target = lookupTable[potentialTarget];
44957
45015
  var subpath = moduleName.substring(potentialTarget.length);
44958
- return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ false);
45016
+ return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ false, potentialTarget);
44959
45017
  }
44960
45018
  }
44961
45019
  function matchesPatternWithTrailer(target, name) {
@@ -44972,7 +45030,7 @@ var ts;
44972
45030
  */
44973
45031
  function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports) {
44974
45032
  return loadModuleFromTargetImportOrExport;
44975
- function loadModuleFromTargetImportOrExport(target, subpath, pattern) {
45033
+ function loadModuleFromTargetImportOrExport(target, subpath, pattern, key) {
44976
45034
  if (typeof target === "string") {
44977
45035
  if (!pattern && subpath.length > 0 && !ts.endsWith(target, "/")) {
44978
45036
  if (state.traceEnabled) {
@@ -44983,6 +45041,8 @@ var ts;
44983
45041
  if (!ts.startsWith(target, "./")) {
44984
45042
  if (isImports && !ts.startsWith(target, "../") && !ts.startsWith(target, "/") && !ts.isRootedDiskPath(target)) {
44985
45043
  var combinedLookup = pattern ? target.replace(/\*/g, subpath) : target + subpath;
45044
+ traceIfEnabled(state, ts.Diagnostics.Using_0_subpath_1_with_target_2, "imports", key, combinedLookup);
45045
+ traceIfEnabled(state, ts.Diagnostics.Resolving_module_0_from_1, combinedLookup, scope.packageDirectory + "/");
44986
45046
  var result = nodeModuleNameResolverWorker(state.features, combinedLookup, scope.packageDirectory + "/", state.compilerOptions, state.host, cache, [extensions], redirectedReference);
44987
45047
  return toSearchResult(result.resolvedModule ? { path: result.resolvedModule.resolvedFileName, extension: result.resolvedModule.extension, packageId: result.resolvedModule.packageId, originalPath: result.resolvedModule.originalPath } : undefined);
44988
45048
  }
@@ -45009,6 +45069,9 @@ var ts;
45009
45069
  }
45010
45070
  return toSearchResult(/*value*/ undefined);
45011
45071
  }
45072
+ if (state.traceEnabled) {
45073
+ trace(state.host, ts.Diagnostics.Using_0_subpath_1_with_target_2, isImports ? "imports" : "exports", key, pattern ? target.replace(/\*/g, subpath) : target + subpath);
45074
+ }
45012
45075
  var finalPath = toAbsolutePath(pattern ? resolvedTarget.replace(/\*/g, subpath) : resolvedTarget + subpath);
45013
45076
  var inputLink = tryLoadInputFileForPath(finalPath, subpath, ts.combinePaths(scope.packageDirectory, "package.json"), isImports);
45014
45077
  if (inputLink)
@@ -45018,14 +45081,18 @@ var ts;
45018
45081
  else if (typeof target === "object" && target !== null) { // eslint-disable-line no-null/no-null
45019
45082
  if (!Array.isArray(target)) {
45020
45083
  for (var _i = 0, _a = ts.getOwnKeys(target); _i < _a.length; _i++) {
45021
- var key = _a[_i];
45022
- if (key === "default" || state.conditions.indexOf(key) >= 0 || isApplicableVersionedTypesKey(state.conditions, key)) {
45023
- var subTarget = target[key];
45024
- var result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern);
45084
+ var condition = _a[_i];
45085
+ if (condition === "default" || state.conditions.indexOf(condition) >= 0 || isApplicableVersionedTypesKey(state.conditions, condition)) {
45086
+ traceIfEnabled(state, ts.Diagnostics.Matched_0_condition_1, isImports ? "imports" : "exports", condition);
45087
+ var subTarget = target[condition];
45088
+ var result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern, key);
45025
45089
  if (result) {
45026
45090
  return result;
45027
45091
  }
45028
45092
  }
45093
+ else {
45094
+ traceIfEnabled(state, ts.Diagnostics.Saw_non_matching_condition_0, condition);
45095
+ }
45029
45096
  }
45030
45097
  return undefined;
45031
45098
  }
@@ -45038,7 +45105,7 @@ var ts;
45038
45105
  }
45039
45106
  for (var _b = 0, target_2 = target; _b < target_2.length; _b++) {
45040
45107
  var elem = target_2[_b];
45041
- var result = loadModuleFromTargetImportOrExport(elem, subpath, pattern);
45108
+ var result = loadModuleFromTargetImportOrExport(elem, subpath, pattern, key);
45042
45109
  if (result) {
45043
45110
  return result;
45044
45111
  }
@@ -45454,6 +45521,15 @@ var ts;
45454
45521
  function toSearchResult(value) {
45455
45522
  return value !== undefined ? { value: value } : undefined;
45456
45523
  }
45524
+ function traceIfEnabled(state, diagnostic) {
45525
+ var args = [];
45526
+ for (var _i = 2; _i < arguments.length; _i++) {
45527
+ args[_i - 2] = arguments[_i];
45528
+ }
45529
+ if (state.traceEnabled) {
45530
+ trace.apply(void 0, __spreadArray([state.host, diagnostic], args, false));
45531
+ }
45532
+ }
45457
45533
  })(ts || (ts = {}));
45458
45534
  /* @internal */
45459
45535
  var ts;
@@ -49045,8 +49121,6 @@ var ts;
49045
49121
  IntersectionState[IntersectionState["None"] = 0] = "None";
49046
49122
  IntersectionState[IntersectionState["Source"] = 1] = "Source";
49047
49123
  IntersectionState[IntersectionState["Target"] = 2] = "Target";
49048
- IntersectionState[IntersectionState["PropertyCheck"] = 4] = "PropertyCheck";
49049
- IntersectionState[IntersectionState["InPropertyCheck"] = 8] = "InPropertyCheck";
49050
49124
  })(IntersectionState || (IntersectionState = {}));
49051
49125
  var RecursionFlags;
49052
49126
  (function (RecursionFlags) {
@@ -49465,6 +49539,12 @@ var ts;
49465
49539
  getOptionalType: function () { return optionalType; },
49466
49540
  getPromiseType: function () { return getGlobalPromiseType(/*reportErrors*/ false); },
49467
49541
  getPromiseLikeType: function () { return getGlobalPromiseLikeType(/*reportErrors*/ false); },
49542
+ getAsyncIterableType: function () {
49543
+ var type = getGlobalAsyncIterableType(/*reportErrors*/ false);
49544
+ if (type === emptyGenericType)
49545
+ return undefined;
49546
+ return type;
49547
+ },
49468
49548
  isSymbolAccessible: isSymbolAccessible,
49469
49549
  isArrayType: isArrayType,
49470
49550
  isTupleType: isTupleType,
@@ -50302,9 +50382,9 @@ var ts;
50302
50382
  return symbol;
50303
50383
  }
50304
50384
  if (symbol.flags & 2097152 /* SymbolFlags.Alias */) {
50305
- var target = resolveAlias(symbol);
50306
- // Unknown symbol means an error occurred in alias resolution, treat it as positive answer to avoid cascading errors
50307
- if (target === unknownSymbol || target.flags & meaning) {
50385
+ var targetFlags = getAllSymbolFlags(symbol);
50386
+ // `targetFlags` will be `SymbolFlags.All` if an error occurred in alias resolution; this avoids cascading errors
50387
+ if (targetFlags & meaning) {
50308
50388
  return symbol;
50309
50389
  }
50310
50390
  }
@@ -50937,8 +51017,8 @@ var ts;
50937
51017
  !checkAndReportErrorForExtendingInterface(errorLocation) &&
50938
51018
  !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) &&
50939
51019
  !checkAndReportErrorForExportingPrimitiveType(errorLocation, name) &&
51020
+ !checkAndReportErrorForUsingNamespaceAsTypeOrValue(errorLocation, name, meaning) &&
50940
51021
  !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) &&
50941
- !checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) &&
50942
51022
  !checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) {
50943
51023
  var suggestion = void 0;
50944
51024
  var suggestedLib = void 0;
@@ -51025,7 +51105,7 @@ var ts;
51025
51105
  }
51026
51106
  }
51027
51107
  if (result && errorLocation && meaning & 111551 /* SymbolFlags.Value */ && result.flags & 2097152 /* SymbolFlags.Alias */ && !(result.flags & 111551 /* SymbolFlags.Value */) && !ts.isValidTypeOnlyAliasUseSite(errorLocation)) {
51028
- var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result);
51108
+ var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result, 111551 /* SymbolFlags.Value */);
51029
51109
  if (typeOnlyDeclaration) {
51030
51110
  var message = typeOnlyDeclaration.kind === 278 /* SyntaxKind.ExportSpecifier */
51031
51111
  ? ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type
@@ -51188,7 +51268,7 @@ var ts;
51188
51268
  return false;
51189
51269
  }
51190
51270
  function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) {
51191
- if (meaning & (111551 /* SymbolFlags.Value */ & ~1024 /* SymbolFlags.NamespaceModule */)) {
51271
+ if (meaning & 111551 /* SymbolFlags.Value */) {
51192
51272
  if (isPrimitiveTypeName(name)) {
51193
51273
  if (isExtendedByInterface(errorLocation)) {
51194
51274
  error(errorLocation, ts.Diagnostics.An_interface_cannot_extend_a_primitive_type_like_0_an_interface_can_only_extend_named_types_and_classes, ts.unescapeLeadingUnderscores(name));
@@ -51199,7 +51279,8 @@ var ts;
51199
51279
  return true;
51200
51280
  }
51201
51281
  var symbol = resolveSymbol(resolveName(errorLocation, name, 788968 /* SymbolFlags.Type */ & ~111551 /* SymbolFlags.Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
51202
- if (symbol && !(symbol.flags & 1024 /* SymbolFlags.NamespaceModule */)) {
51282
+ var allFlags = symbol && getAllSymbolFlags(symbol);
51283
+ if (symbol && allFlags !== undefined && !(allFlags & 111551 /* SymbolFlags.Value */)) {
51203
51284
  var rawName = ts.unescapeLeadingUnderscores(name);
51204
51285
  if (isES2015OrLaterConstructorName(name)) {
51205
51286
  error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_es2015_or_later, rawName);
@@ -51247,16 +51328,16 @@ var ts;
51247
51328
  }
51248
51329
  return false;
51249
51330
  }
51250
- function checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) {
51251
- if (meaning & (111551 /* SymbolFlags.Value */ & ~1024 /* SymbolFlags.NamespaceModule */ & ~788968 /* SymbolFlags.Type */)) {
51252
- var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 /* SymbolFlags.NamespaceModule */ & ~111551 /* SymbolFlags.Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
51331
+ function checkAndReportErrorForUsingNamespaceAsTypeOrValue(errorLocation, name, meaning) {
51332
+ if (meaning & (111551 /* SymbolFlags.Value */ & ~788968 /* SymbolFlags.Type */)) {
51333
+ var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 /* SymbolFlags.NamespaceModule */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
51253
51334
  if (symbol) {
51254
51335
  error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_value, ts.unescapeLeadingUnderscores(name));
51255
51336
  return true;
51256
51337
  }
51257
51338
  }
51258
- else if (meaning & (788968 /* SymbolFlags.Type */ & ~1024 /* SymbolFlags.NamespaceModule */ & ~111551 /* SymbolFlags.Value */)) {
51259
- var symbol = resolveSymbol(resolveName(errorLocation, name, (512 /* SymbolFlags.ValueModule */ | 1024 /* SymbolFlags.NamespaceModule */) & ~788968 /* SymbolFlags.Type */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
51339
+ else if (meaning & (788968 /* SymbolFlags.Type */ & ~111551 /* SymbolFlags.Value */)) {
51340
+ var symbol = resolveSymbol(resolveName(errorLocation, name, 1536 /* SymbolFlags.Module */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
51260
51341
  if (symbol) {
51261
51342
  error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_type, ts.unescapeLeadingUnderscores(name));
51262
51343
  return true;
@@ -51846,6 +51927,52 @@ var ts;
51846
51927
  }
51847
51928
  return undefined;
51848
51929
  }
51930
+ /**
51931
+ * Gets combined flags of a `symbol` and all alias targets it resolves to. `resolveAlias`
51932
+ * is typically recursive over chains of aliases, but stops mid-chain if an alias is merged
51933
+ * with another exported symbol, e.g.
51934
+ * ```ts
51935
+ * // a.ts
51936
+ * export const a = 0;
51937
+ * // b.ts
51938
+ * export { a } from "./a";
51939
+ * export type a = number;
51940
+ * // c.ts
51941
+ * import { a } from "./b";
51942
+ * ```
51943
+ * Calling `resolveAlias` on the `a` in c.ts would stop at the merged symbol exported
51944
+ * from b.ts, even though there is still more alias to resolve. Consequently, if we were
51945
+ * trying to determine if the `a` in c.ts has a value meaning, looking at the flags on
51946
+ * the local symbol and on the symbol returned by `resolveAlias` is not enough.
51947
+ * @returns SymbolFlags.All if `symbol` is an alias that ultimately resolves to `unknown`;
51948
+ * combined flags of all alias targets otherwise.
51949
+ */
51950
+ function getAllSymbolFlags(symbol) {
51951
+ var flags = symbol.flags;
51952
+ var seenSymbols;
51953
+ while (symbol.flags & 2097152 /* SymbolFlags.Alias */) {
51954
+ var target = resolveAlias(symbol);
51955
+ if (target === unknownSymbol) {
51956
+ return 67108863 /* SymbolFlags.All */;
51957
+ }
51958
+ // Optimizations - try to avoid creating or adding to
51959
+ // `seenSymbols` if possible
51960
+ if (target === symbol || (seenSymbols === null || seenSymbols === void 0 ? void 0 : seenSymbols.has(target))) {
51961
+ break;
51962
+ }
51963
+ if (target.flags & 2097152 /* SymbolFlags.Alias */) {
51964
+ if (seenSymbols) {
51965
+ seenSymbols.add(target);
51966
+ }
51967
+ else {
51968
+ seenSymbols = new ts.Set([symbol, target]);
51969
+ }
51970
+ }
51971
+ flags |= target.flags;
51972
+ symbol = target;
51973
+ }
51974
+ return flags;
51975
+ }
51849
51976
  /**
51850
51977
  * Marks a symbol as type-only if its declaration is syntactically type-only.
51851
51978
  * If it is not itself marked type-only, but resolves to a type-only alias
@@ -51891,19 +52018,25 @@ var ts;
51891
52018
  return !!aliasDeclarationLinks.typeOnlyDeclaration;
51892
52019
  }
51893
52020
  /** Indicates that a symbol directly or indirectly resolves to a type-only import or export. */
51894
- function getTypeOnlyAliasDeclaration(symbol) {
52021
+ function getTypeOnlyAliasDeclaration(symbol, include) {
51895
52022
  if (!(symbol.flags & 2097152 /* SymbolFlags.Alias */)) {
51896
52023
  return undefined;
51897
52024
  }
51898
52025
  var links = getSymbolLinks(symbol);
51899
- return links.typeOnlyDeclaration || undefined;
52026
+ if (include === undefined) {
52027
+ return links.typeOnlyDeclaration || undefined;
52028
+ }
52029
+ if (links.typeOnlyDeclaration) {
52030
+ return getAllSymbolFlags(resolveAlias(links.typeOnlyDeclaration.symbol)) & include ? links.typeOnlyDeclaration : undefined;
52031
+ }
52032
+ return undefined;
51900
52033
  }
51901
52034
  function markExportAsReferenced(node) {
51902
52035
  var symbol = getSymbolOfNode(node);
51903
52036
  var target = resolveAlias(symbol);
51904
52037
  if (target) {
51905
52038
  var markAlias = target === unknownSymbol ||
51906
- ((target.flags & 111551 /* SymbolFlags.Value */) && !isConstEnumOrConstEnumOnlyModule(target) && !getTypeOnlyAliasDeclaration(symbol));
52039
+ ((getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */) && !isConstEnumOrConstEnumOnlyModule(target) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */));
51907
52040
  if (markAlias) {
51908
52041
  markAliasSymbolAsReferenced(symbol);
51909
52042
  }
@@ -51923,8 +52056,7 @@ var ts;
51923
52056
  // This way a chain of imports can be elided if ultimately the final input is only used in a type
51924
52057
  // position.
51925
52058
  if (ts.isInternalModuleImportEqualsDeclaration(node)) {
51926
- var target = resolveSymbol(symbol);
51927
- if (target === unknownSymbol || target.flags & 111551 /* SymbolFlags.Value */) {
52059
+ if (getAllSymbolFlags(resolveSymbol(symbol)) & 111551 /* SymbolFlags.Value */) {
51928
52060
  // import foo = <symbol>
51929
52061
  checkExpressionCached(node.moduleReference);
51930
52062
  }
@@ -52746,7 +52878,7 @@ var ts;
52746
52878
  }
52747
52879
  function symbolIsValue(symbol, includeTypeOnlyMembers) {
52748
52880
  return !!(symbol.flags & 111551 /* SymbolFlags.Value */ ||
52749
- symbol.flags & 2097152 /* SymbolFlags.Alias */ && resolveAlias(symbol).flags & 111551 /* SymbolFlags.Value */ && (includeTypeOnlyMembers || !getTypeOnlyAliasDeclaration(symbol)));
52881
+ symbol.flags & 2097152 /* SymbolFlags.Alias */ && getAllSymbolFlags(symbol) & 111551 /* SymbolFlags.Value */ && (includeTypeOnlyMembers || !getTypeOnlyAliasDeclaration(symbol)));
52750
52882
  }
52751
52883
  function findConstructorDeclaration(node) {
52752
52884
  var members = node.members;
@@ -53015,8 +53147,10 @@ var ts;
53015
53147
  return true;
53016
53148
  }
53017
53149
  // Qualify if the symbol from symbol table has same meaning as expected
53018
- symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 /* SymbolFlags.Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 278 /* SyntaxKind.ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable;
53019
- if (symbolFromSymbolTable.flags & meaning) {
53150
+ var shouldResolveAlias = (symbolFromSymbolTable.flags & 2097152 /* SymbolFlags.Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 278 /* SyntaxKind.ExportSpecifier */));
53151
+ symbolFromSymbolTable = shouldResolveAlias ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable;
53152
+ var flags = shouldResolveAlias ? getAllSymbolFlags(symbolFromSymbolTable) : symbolFromSymbolTable.flags;
53153
+ if (flags & meaning) {
53020
53154
  qualify = true;
53021
53155
  return true;
53022
53156
  }
@@ -55328,7 +55462,7 @@ var ts;
55328
55462
  // export {name} - look thru `statements` for `name`, and if all results can take an `export` modifier, do so and filter it
55329
55463
  var indices = ts.indicesOf(statements);
55330
55464
  var associatedIndices = ts.filter(indices, function (i) { return ts.nodeHasName(statements[i], e.name); });
55331
- if (ts.length(associatedIndices) && ts.every(associatedIndices, function (i) { return canHaveExportModifier(statements[i]); })) {
55465
+ if (ts.length(associatedIndices) && ts.every(associatedIndices, function (i) { return ts.canHaveExportModifier(statements[i]); })) {
55332
55466
  for (var _i = 0, associatedIndices_1 = associatedIndices; _i < associatedIndices_1.length; _i++) {
55333
55467
  var index_1 = associatedIndices_1[_i];
55334
55468
  statements[index_1] = addExportModifier(statements[index_1]);
@@ -55362,15 +55496,6 @@ var ts;
55362
55496
  }
55363
55497
  return statements;
55364
55498
  }
55365
- function canHaveExportModifier(node) {
55366
- return ts.isEnumDeclaration(node) ||
55367
- ts.isVariableStatement(node) ||
55368
- ts.isFunctionDeclaration(node) ||
55369
- ts.isClassDeclaration(node) ||
55370
- (ts.isModuleDeclaration(node) && !ts.isExternalModuleAugmentation(node) && !ts.isGlobalScopeAugmentation(node)) ||
55371
- ts.isInterfaceDeclaration(node) ||
55372
- isTypeDeclaration(node);
55373
- }
55374
55499
  function addExportModifier(node) {
55375
55500
  var flags = (ts.getEffectiveModifierFlags(node) | 1 /* ModifierFlags.Export */) & ~2 /* ModifierFlags.Ambient */;
55376
55501
  return ts.factory.updateModifiers(node, flags);
@@ -55617,7 +55742,7 @@ var ts;
55617
55742
  (ts.isJSDocTypeAlias(context.enclosingDeclaration) ? ts.getSourceFileOfNode(context.enclosingDeclaration) : context.enclosingDeclaration);
55618
55743
  if (additionalModifierFlags & 1 /* ModifierFlags.Export */ &&
55619
55744
  enclosingDeclaration_1 && (isExportingScope(enclosingDeclaration_1) || ts.isModuleDeclaration(enclosingDeclaration_1)) &&
55620
- canHaveExportModifier(node)) {
55745
+ ts.canHaveExportModifier(node)) {
55621
55746
  // Classes, namespaces, variables, functions, interfaces, and types should all be `export`ed in a module context if not private
55622
55747
  newModifierFlags |= 1 /* ModifierFlags.Export */;
55623
55748
  }
@@ -55673,7 +55798,7 @@ var ts;
55673
55798
  return !symbol.exports ? [] : ts.filter(ts.arrayFrom(symbol.exports.values()), isNamespaceMember);
55674
55799
  }
55675
55800
  function isTypeOnlyNamespace(symbol) {
55676
- return ts.every(getNamespaceMembersForSerialization(symbol), function (m) { return !(resolveSymbol(m).flags & 111551 /* SymbolFlags.Value */); });
55801
+ return ts.every(getNamespaceMembersForSerialization(symbol), function (m) { return !(getAllSymbolFlags(resolveSymbol(m)) & 111551 /* SymbolFlags.Value */); });
55677
55802
  }
55678
55803
  function serializeModule(symbol, symbolName, modifierFlags) {
55679
55804
  var members = getNamespaceMembersForSerialization(symbol);
@@ -57893,7 +58018,7 @@ var ts;
57893
58018
  links.type = (exportSymbol === null || exportSymbol === void 0 ? void 0 : exportSymbol.declarations) && isDuplicatedCommonJSExport(exportSymbol.declarations) && symbol.declarations.length ? getFlowTypeFromCommonJSExport(exportSymbol)
57894
58019
  : isDuplicatedCommonJSExport(symbol.declarations) ? autoType
57895
58020
  : declaredType ? declaredType
57896
- : targetSymbol.flags & 111551 /* SymbolFlags.Value */ ? getTypeOfSymbol(targetSymbol)
58021
+ : getAllSymbolFlags(targetSymbol) & 111551 /* SymbolFlags.Value */ ? getTypeOfSymbol(targetSymbol)
57897
58022
  : errorType;
57898
58023
  }
57899
58024
  return links.type;
@@ -59776,7 +59901,20 @@ var ts;
59776
59901
  return !!(ts.getObjectFlags(type) & 32 /* ObjectFlags.Mapped */ && getMappedTypeModifiers(type) & 4 /* MappedTypeModifiers.IncludeOptional */);
59777
59902
  }
59778
59903
  function isGenericMappedType(type) {
59779
- return !!(ts.getObjectFlags(type) & 32 /* ObjectFlags.Mapped */) && isGenericIndexType(getConstraintTypeFromMappedType(type));
59904
+ if (ts.getObjectFlags(type) & 32 /* ObjectFlags.Mapped */) {
59905
+ var constraint = getConstraintTypeFromMappedType(type);
59906
+ if (isGenericIndexType(constraint)) {
59907
+ return true;
59908
+ }
59909
+ // A mapped type is generic if the 'as' clause references generic types other than the iteration type.
59910
+ // To determine this, we substitute the constraint type (that we now know isn't generic) for the iteration
59911
+ // type and check whether the resulting type is generic.
59912
+ var nameType = getNameTypeFromMappedType(type);
59913
+ if (nameType && isGenericIndexType(instantiateType(nameType, makeUnaryTypeMapper(getTypeParameterFromMappedType(type), constraint)))) {
59914
+ return true;
59915
+ }
59916
+ }
59917
+ return false;
59780
59918
  }
59781
59919
  function resolveStructuredTypeMembers(type) {
59782
59920
  if (!type.members) {
@@ -60246,7 +60384,7 @@ var ts;
60246
60384
  var indexTypes;
60247
60385
  var isUnion = containingType.flags & 1048576 /* TypeFlags.Union */;
60248
60386
  // Flags we want to propagate to the result if they exist in all source symbols
60249
- var optionalFlag = isUnion ? 0 /* SymbolFlags.None */ : 16777216 /* SymbolFlags.Optional */;
60387
+ var optionalFlag;
60250
60388
  var syntheticFlag = 4 /* CheckFlags.SyntheticMethod */;
60251
60389
  var checkFlags = isUnion ? 0 : 8 /* CheckFlags.Readonly */;
60252
60390
  var mergedInstantiations = false;
@@ -60257,11 +60395,14 @@ var ts;
60257
60395
  var prop = getPropertyOfType(type, name, skipObjectFunctionPropertyAugment);
60258
60396
  var modifiers = prop ? ts.getDeclarationModifierFlagsFromSymbol(prop) : 0;
60259
60397
  if (prop) {
60260
- if (isUnion) {
60261
- optionalFlag |= (prop.flags & 16777216 /* SymbolFlags.Optional */);
60262
- }
60263
- else {
60264
- optionalFlag &= prop.flags;
60398
+ if (prop.flags & 106500 /* SymbolFlags.ClassMember */) {
60399
+ optionalFlag !== null && optionalFlag !== void 0 ? optionalFlag : (optionalFlag = isUnion ? 0 /* SymbolFlags.None */ : 16777216 /* SymbolFlags.Optional */);
60400
+ if (isUnion) {
60401
+ optionalFlag |= (prop.flags & 16777216 /* SymbolFlags.Optional */);
60402
+ }
60403
+ else {
60404
+ optionalFlag &= prop.flags;
60405
+ }
60265
60406
  }
60266
60407
  if (!singleProp) {
60267
60408
  singleProp = prop;
@@ -60380,7 +60521,7 @@ var ts;
60380
60521
  propTypes.push(type);
60381
60522
  }
60382
60523
  ts.addRange(propTypes, indexTypes);
60383
- var result = createSymbol(4 /* SymbolFlags.Property */ | optionalFlag, name, syntheticFlag | checkFlags);
60524
+ var result = createSymbol(4 /* SymbolFlags.Property */ | (optionalFlag !== null && optionalFlag !== void 0 ? optionalFlag : 0), name, syntheticFlag | checkFlags);
60384
60525
  result.containingType = containingType;
60385
60526
  if (!hasNonUniformValueDeclaration && firstValueDeclaration) {
60386
60527
  result.valueDeclaration = firstValueDeclaration;
@@ -63093,8 +63234,14 @@ var ts;
63093
63234
  return getStringLiteralType(text);
63094
63235
  }
63095
63236
  newTexts.push(text);
63096
- if (ts.every(newTexts, function (t) { return t === ""; }) && ts.every(newTypes, function (t) { return !!(t.flags & 4 /* TypeFlags.String */); })) {
63097
- return stringType;
63237
+ if (ts.every(newTexts, function (t) { return t === ""; })) {
63238
+ if (ts.every(newTypes, function (t) { return !!(t.flags & 4 /* TypeFlags.String */); })) {
63239
+ return stringType;
63240
+ }
63241
+ // Normalize `${Mapping<xxx>}` into Mapping<xxx>
63242
+ if (newTypes.length === 1 && isPatternLiteralType(newTypes[0])) {
63243
+ return newTypes[0];
63244
+ }
63098
63245
  }
63099
63246
  var id = "".concat(getTypeListId(newTypes), "|").concat(ts.map(newTexts, function (t) { return t.length; }).join(","), "|").concat(newTexts.join(""));
63100
63247
  var type = templateLiteralTypes.get(id);
@@ -63153,12 +63300,14 @@ var ts;
63153
63300
  }
63154
63301
  function getStringMappingType(symbol, type) {
63155
63302
  return type.flags & (1048576 /* TypeFlags.Union */ | 131072 /* TypeFlags.Never */) ? mapType(type, function (t) { return getStringMappingType(symbol, t); }) :
63156
- // Mapping<Mapping<T>> === Mapping<T>
63157
- type.flags & 268435456 /* TypeFlags.StringMapping */ && symbol === type.symbol ? type :
63158
- isGenericIndexType(type) || isPatternLiteralPlaceholderType(type) ? getStringMappingTypeForGenericType(symbol, isPatternLiteralPlaceholderType(type) && !(type.flags & 268435456 /* TypeFlags.StringMapping */) ? getTemplateLiteralType(["", ""], [type]) : type) :
63159
- type.flags & 128 /* TypeFlags.StringLiteral */ ? getStringLiteralType(applyStringMapping(symbol, type.value)) :
63160
- type.flags & 134217728 /* TypeFlags.TemplateLiteral */ ? getTemplateLiteralType.apply(void 0, applyTemplateStringMapping(symbol, type.texts, type.types)) :
63161
- type;
63303
+ type.flags & 128 /* TypeFlags.StringLiteral */ ? getStringLiteralType(applyStringMapping(symbol, type.value)) :
63304
+ type.flags & 134217728 /* TypeFlags.TemplateLiteral */ ? getTemplateLiteralType.apply(void 0, applyTemplateStringMapping(symbol, type.texts, type.types)) :
63305
+ // Mapping<Mapping<T>> === Mapping<T>
63306
+ type.flags & 268435456 /* TypeFlags.StringMapping */ && symbol === type.symbol ? type :
63307
+ type.flags & (1 /* TypeFlags.Any */ | 4 /* TypeFlags.String */ | 268435456 /* TypeFlags.StringMapping */) || isGenericIndexType(type) ? getStringMappingTypeForGenericType(symbol, type) :
63308
+ // This handles Mapping<`${number}`> and Mapping<`${bigint}`>
63309
+ isPatternLiteralPlaceholderType(type) ? getStringMappingTypeForGenericType(symbol, getTemplateLiteralType(["", ""], [type])) :
63310
+ type;
63162
63311
  }
63163
63312
  function applyStringMapping(symbol, str) {
63164
63313
  switch (intrinsicTypeKinds.get(symbol.escapedName)) {
@@ -63323,7 +63472,18 @@ var ts;
63323
63472
  return accessFlags & 1 /* AccessFlags.IncludeUndefined */ ? getUnionType([indexInfo.type, undefinedType]) : indexInfo.type;
63324
63473
  }
63325
63474
  errorIfWritingToReadonlyIndex(indexInfo);
63326
- return accessFlags & 1 /* AccessFlags.IncludeUndefined */ ? getUnionType([indexInfo.type, undefinedType]) : indexInfo.type;
63475
+ // When accessing an enum object with its own type,
63476
+ // e.g. E[E.A] for enum E { A }, undefined shouldn't
63477
+ // be included in the result type
63478
+ if ((accessFlags & 1 /* AccessFlags.IncludeUndefined */) &&
63479
+ !(objectType.symbol &&
63480
+ objectType.symbol.flags & (256 /* SymbolFlags.RegularEnum */ | 128 /* SymbolFlags.ConstEnum */) &&
63481
+ (indexType.symbol &&
63482
+ indexType.flags & 1024 /* TypeFlags.EnumLiteral */ &&
63483
+ getParentOfSymbol(indexType.symbol) === objectType.symbol))) {
63484
+ return getUnionType([indexInfo.type, undefinedType]);
63485
+ }
63486
+ return indexInfo.type;
63327
63487
  }
63328
63488
  if (indexType.flags & 131072 /* TypeFlags.Never */) {
63329
63489
  return neverType;
@@ -63426,10 +63586,11 @@ var ts;
63426
63586
  accessNode;
63427
63587
  }
63428
63588
  function isPatternLiteralPlaceholderType(type) {
63429
- return !!(type.flags & (1 /* TypeFlags.Any */ | 4 /* TypeFlags.String */ | 8 /* TypeFlags.Number */ | 64 /* TypeFlags.BigInt */)) || !!(type.flags & 268435456 /* TypeFlags.StringMapping */ && isPatternLiteralPlaceholderType(type.type));
63589
+ return !!(type.flags & (1 /* TypeFlags.Any */ | 4 /* TypeFlags.String */ | 8 /* TypeFlags.Number */ | 64 /* TypeFlags.BigInt */)) || isPatternLiteralType(type);
63430
63590
  }
63431
63591
  function isPatternLiteralType(type) {
63432
- return !!(type.flags & 134217728 /* TypeFlags.TemplateLiteral */) && ts.every(type.types, isPatternLiteralPlaceholderType);
63592
+ return !!(type.flags & 134217728 /* TypeFlags.TemplateLiteral */) && ts.every(type.types, isPatternLiteralPlaceholderType) ||
63593
+ !!(type.flags & 268435456 /* TypeFlags.StringMapping */) && isPatternLiteralPlaceholderType(type.type);
63433
63594
  }
63434
63595
  function isGenericType(type) {
63435
63596
  return !!getGenericObjectFlags(type);
@@ -63708,18 +63869,23 @@ var ts;
63708
63869
  var result;
63709
63870
  var extraTypes;
63710
63871
  var tailCount = 0;
63711
- var _loop_20 = function () {
63872
+ // We loop here for an immediately nested conditional type in the false position, effectively treating
63873
+ // types of the form 'A extends B ? X : C extends D ? Y : E extends F ? Z : ...' as a single construct for
63874
+ // purposes of resolution. We also loop here when resolution of a conditional type ends in resolution of
63875
+ // another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive
63876
+ // cases we increment the tail recursion counter and stop after 1000 iterations.
63877
+ while (true) {
63712
63878
  if (tailCount === 1000) {
63713
63879
  error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
63714
63880
  result = errorType;
63715
- return "break";
63881
+ break;
63716
63882
  }
63717
63883
  var isUnwrapped = isTypicalNondistributiveConditional(root);
63718
63884
  var checkType = instantiateType(unwrapNondistributiveConditionalTuple(root, getActualTypeVariable(root.checkType)), mapper);
63719
63885
  var checkTypeInstantiable = isGenericType(checkType);
63720
63886
  var extendsType = instantiateType(unwrapNondistributiveConditionalTuple(root, root.extendsType), mapper);
63721
63887
  if (checkType === wildcardType || extendsType === wildcardType) {
63722
- return { value: wildcardType };
63888
+ return wildcardType;
63723
63889
  }
63724
63890
  var combinedMapper = void 0;
63725
63891
  if (root.inferTypeParameters) {
@@ -63752,11 +63918,7 @@ var ts;
63752
63918
  }
63753
63919
  }
63754
63920
  }
63755
- // We skip inference of the possible `infer` types unles the `extendsType` _is_ an infer type
63756
- // if it was, it's trivial to say that extendsType = checkType, however such a pattern is used to
63757
- // "reset" the type being build up during constraint calculation and avoid making an apparently "infinite" constraint
63758
- // so in those cases we refain from performing inference and retain the uninfered type parameter
63759
- if (!checkTypeInstantiable || !ts.some(root.inferTypeParameters, function (t) { return t === extendsType; })) {
63921
+ if (!checkTypeInstantiable) {
63760
63922
  // We don't want inferences from constraints as they may cause us to eagerly resolve the
63761
63923
  // conditional type instead of deferring resolution. Also, we always want strict function
63762
63924
  // types rules (i.e. proper contravariance) for inferences.
@@ -63788,14 +63950,14 @@ var ts;
63788
63950
  var newRoot = falseType_1.root;
63789
63951
  if (newRoot.node.parent === root.node && (!newRoot.isDistributive || newRoot.checkType === root.checkType)) {
63790
63952
  root = newRoot;
63791
- return "continue";
63953
+ continue;
63792
63954
  }
63793
63955
  if (canTailRecurse(falseType_1, mapper)) {
63794
- return "continue";
63956
+ continue;
63795
63957
  }
63796
63958
  }
63797
63959
  result = instantiateType(falseType_1, mapper);
63798
- return "break";
63960
+ break;
63799
63961
  }
63800
63962
  // Return trueType for a definitely true extends check. We check instantiations of the two
63801
63963
  // types with type parameters mapped to their restrictive form, i.e. a form of the type parameter
@@ -63806,10 +63968,10 @@ var ts;
63806
63968
  var trueType_1 = getTypeFromTypeNode(root.node.trueType);
63807
63969
  var trueMapper = combinedMapper || mapper;
63808
63970
  if (canTailRecurse(trueType_1, trueMapper)) {
63809
- return "continue";
63971
+ continue;
63810
63972
  }
63811
63973
  result = instantiateType(trueType_1, trueMapper);
63812
- return "break";
63974
+ break;
63813
63975
  }
63814
63976
  }
63815
63977
  // Return a deferred type for a check that is neither definitely true nor definitely false
@@ -63821,19 +63983,7 @@ var ts;
63821
63983
  result.combinedMapper = combinedMapper;
63822
63984
  result.aliasSymbol = aliasSymbol || root.aliasSymbol;
63823
63985
  result.aliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(root.aliasTypeArguments, mapper); // TODO: GH#18217
63824
- return "break";
63825
- };
63826
- // We loop here for an immediately nested conditional type in the false position, effectively treating
63827
- // types of the form 'A extends B ? X : C extends D ? Y : E extends F ? Z : ...' as a single construct for
63828
- // purposes of resolution. We also loop here when resolution of a conditional type ends in resolution of
63829
- // another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive
63830
- // cases we increment the tail recursion counter and stop after 1000 iterations.
63831
- while (true) {
63832
- var state_6 = _loop_20();
63833
- if (typeof state_6 === "object")
63834
- return state_6.value;
63835
- if (state_6 === "break")
63836
- break;
63986
+ break;
63837
63987
  }
63838
63988
  return extraTypes ? getUnionType(ts.append(extraTypes, result)) : result;
63839
63989
  // We tail-recurse for generic conditional types that (a) have not already been evaluated and cached, and
@@ -66287,7 +66437,7 @@ var ts;
66287
66437
  return 0 /* Ternary.False */;
66288
66438
  }
66289
66439
  }
66290
- var isPerformingCommonPropertyChecks = (relation !== comparableRelation || !(source.flags & 1048576 /* TypeFlags.Union */) && isLiteralType(source)) &&
66440
+ var isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source)) &&
66291
66441
  !(intersectionState & 2 /* IntersectionState.Target */) &&
66292
66442
  source.flags & (131068 /* TypeFlags.Primitive */ | 524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) && source !== globalObjectType &&
66293
66443
  target.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) && isWeakType(target) &&
@@ -66315,27 +66465,6 @@ var ts;
66315
66465
  var result_7 = skipCaching ?
66316
66466
  unionOrIntersectionRelatedTo(source, target, reportErrors, intersectionState) :
66317
66467
  recursiveTypeRelatedTo(source, target, reportErrors, intersectionState, recursionFlags);
66318
- // For certain combinations involving intersections and optional, excess, or mismatched properties we need
66319
- // an extra property check where the intersection is viewed as a single object. The following are motivating
66320
- // examples that all should be errors, but aren't without this extra property check:
66321
- //
66322
- // let obj: { a: { x: string } } & { c: number } = { a: { x: 'hello', y: 2 }, c: 5 }; // Nested excess property
66323
- //
66324
- // declare let wrong: { a: { y: string } };
66325
- // let weak: { a?: { x?: number } } & { c?: string } = wrong; // Nested weak object type
66326
- //
66327
- // function foo<T extends object>(x: { a?: string }, y: T & { a: boolean }) {
66328
- // x = y; // Mismatched property in source intersection
66329
- // }
66330
- //
66331
- // We suppress recursive intersection property checks because they can generate lots of work when relating
66332
- // recursive intersections that are structurally similar but not exactly identical. See #37854.
66333
- if (result_7 && !inPropertyCheck && (target.flags & 2097152 /* TypeFlags.Intersection */ && (isPerformingExcessPropertyChecks || isPerformingCommonPropertyChecks) ||
66334
- isNonGenericObjectType(target) && !isArrayOrTupleType(target) && source.flags & 2097152 /* TypeFlags.Intersection */ && getApparentType(source).flags & 3670016 /* TypeFlags.StructuredType */ && !ts.some(source.types, function (t) { return !!(ts.getObjectFlags(t) & 262144 /* ObjectFlags.NonInferrableType */); }))) {
66335
- inPropertyCheck = true;
66336
- result_7 &= recursiveTypeRelatedTo(source, target, reportErrors, 4 /* IntersectionState.PropertyCheck */, recursionFlags);
66337
- inPropertyCheck = false;
66338
- }
66339
66468
  if (result_7) {
66340
66469
  return result_7;
66341
66470
  }
@@ -66447,7 +66576,7 @@ var ts;
66447
66576
  reducedTarget = findMatchingDiscriminantType(source, target, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target);
66448
66577
  checkTypes = reducedTarget.flags & 1048576 /* TypeFlags.Union */ ? reducedTarget.types : [reducedTarget];
66449
66578
  }
66450
- var _loop_21 = function (prop) {
66579
+ var _loop_20 = function (prop) {
66451
66580
  if (shouldCheckAsExcessProperty(prop, source.symbol) && !isIgnoredJsxProperty(source, prop)) {
66452
66581
  if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) {
66453
66582
  if (reportErrors) {
@@ -66510,9 +66639,9 @@ var ts;
66510
66639
  };
66511
66640
  for (var _i = 0, _b = getPropertiesOfType(source); _i < _b.length; _i++) {
66512
66641
  var prop = _b[_i];
66513
- var state_7 = _loop_21(prop);
66514
- if (typeof state_7 === "object")
66515
- return state_7.value;
66642
+ var state_6 = _loop_20(prop);
66643
+ if (typeof state_6 === "object")
66644
+ return state_6.value;
66516
66645
  }
66517
66646
  return false;
66518
66647
  }
@@ -66733,8 +66862,7 @@ var ts;
66733
66862
  if (overflow) {
66734
66863
  return 0 /* Ternary.False */;
66735
66864
  }
66736
- var keyIntersectionState = intersectionState | (inPropertyCheck ? 8 /* IntersectionState.InPropertyCheck */ : 0);
66737
- var id = getRelationKey(source, target, keyIntersectionState, relation, /*ingnoreConstraints*/ false);
66865
+ var id = getRelationKey(source, target, intersectionState, relation, /*ingnoreConstraints*/ false);
66738
66866
  var entry = relation.get(id);
66739
66867
  if (entry !== undefined) {
66740
66868
  if (reportErrors && entry & 2 /* RelationComparisonResult.Failed */ && !(entry & 4 /* RelationComparisonResult.Reported */)) {
@@ -66764,7 +66892,7 @@ var ts;
66764
66892
  // A key that starts with "*" is an indication that we have type references that reference constrained
66765
66893
  // type parameters. For such keys we also check against the key we would have gotten if all type parameters
66766
66894
  // were unconstrained.
66767
- var broadestEquivalentId = id.startsWith("*") ? getRelationKey(source, target, keyIntersectionState, relation, /*ignoreConstraints*/ true) : undefined;
66895
+ var broadestEquivalentId = id.startsWith("*") ? getRelationKey(source, target, intersectionState, relation, /*ignoreConstraints*/ true) : undefined;
66768
66896
  for (var i = 0; i < maybeCount; i++) {
66769
66897
  // If source and target are already being compared, consider them related with assumptions
66770
66898
  if (id === maybeKeys[i] || broadestEquivalentId && broadestEquivalentId === maybeKeys[i]) {
@@ -66851,7 +66979,7 @@ var ts;
66851
66979
  function structuredTypeRelatedTo(source, target, reportErrors, intersectionState) {
66852
66980
  var saveErrorInfo = captureErrorCalculationState();
66853
66981
  var result = structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo);
66854
- if (!result && (source.flags & 2097152 /* TypeFlags.Intersection */ || source.flags & 262144 /* TypeFlags.TypeParameter */ && target.flags & 1048576 /* TypeFlags.Union */)) {
66982
+ if (relation !== identityRelation) {
66855
66983
  // The combined constraint of an intersection type is the intersection of the constraints of
66856
66984
  // the constituents. When an intersection type contains instantiable types with union type
66857
66985
  // constraints, there are situations where we need to examine the combined constraint. One is
@@ -66865,10 +66993,33 @@ var ts;
66865
66993
  // needs to have its constraint hoisted into an intersection with said type parameter, this way
66866
66994
  // the type param can be compared with itself in the target (with the influence of its constraint to match other parts)
66867
66995
  // For example, if `T extends 1 | 2` and `U extends 2 | 3` and we compare `T & U` to `T & U & (1 | 2 | 3)`
66868
- var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* TypeFlags.Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* TypeFlags.Union */));
66869
- if (constraint && !(constraint.flags & 131072 /* TypeFlags.Never */) && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
66870
- // TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this
66871
- result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState);
66996
+ if (!result && (source.flags & 2097152 /* TypeFlags.Intersection */ || source.flags & 262144 /* TypeFlags.TypeParameter */ && target.flags & 1048576 /* TypeFlags.Union */)) {
66997
+ var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* TypeFlags.Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* TypeFlags.Union */));
66998
+ if (constraint && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
66999
+ // TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this
67000
+ result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState);
67001
+ }
67002
+ }
67003
+ // For certain combinations involving intersections and optional, excess, or mismatched properties we need
67004
+ // an extra property check where the intersection is viewed as a single object. The following are motivating
67005
+ // examples that all should be errors, but aren't without this extra property check:
67006
+ //
67007
+ // let obj: { a: { x: string } } & { c: number } = { a: { x: 'hello', y: 2 }, c: 5 }; // Nested excess property
67008
+ //
67009
+ // declare let wrong: { a: { y: string } };
67010
+ // let weak: { a?: { x?: number } } & { c?: string } = wrong; // Nested weak object type
67011
+ //
67012
+ // function foo<T extends object>(x: { a?: string }, y: T & { a: boolean }) {
67013
+ // x = y; // Mismatched property in source intersection
67014
+ // }
67015
+ //
67016
+ // We suppress recursive intersection property checks because they can generate lots of work when relating
67017
+ // recursive intersections that are structurally similar but not exactly identical. See #37854.
67018
+ if (result && !inPropertyCheck && (target.flags & 2097152 /* TypeFlags.Intersection */ && !isGenericObjectType(target) && source.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) ||
67019
+ isNonGenericObjectType(target) && !isArrayOrTupleType(target) && source.flags & 2097152 /* TypeFlags.Intersection */ && getApparentType(source).flags & 3670016 /* TypeFlags.StructuredType */ && !ts.some(source.types, function (t) { return !!(ts.getObjectFlags(t) & 262144 /* ObjectFlags.NonInferrableType */); }))) {
67020
+ inPropertyCheck = true;
67021
+ result &= propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined, 0 /* IntersectionState.None */);
67022
+ inPropertyCheck = false;
66872
67023
  }
66873
67024
  }
66874
67025
  if (result) {
@@ -66877,9 +67028,6 @@ var ts;
66877
67028
  return result;
66878
67029
  }
66879
67030
  function structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo) {
66880
- if (intersectionState & 4 /* IntersectionState.PropertyCheck */) {
66881
- return propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined, 0 /* IntersectionState.None */);
66882
- }
66883
67031
  var result;
66884
67032
  var originalErrorInfo;
66885
67033
  var varianceCheckFailed = false;
@@ -66980,7 +67128,7 @@ var ts;
66980
67128
  // with another type parameter unless one extends the other. (Remember: comparability is mostly bidirectional!)
66981
67129
  var constraint = getConstraintOfTypeParameter(source);
66982
67130
  if (constraint && hasNonCircularBaseConstraint(source)) {
66983
- while (constraint && constraint.flags & 262144 /* TypeFlags.TypeParameter */) {
67131
+ while (constraint && someType(constraint, function (c) { return !!(c.flags & 262144 /* TypeFlags.TypeParameter */); })) {
66984
67132
  if (result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false)) {
66985
67133
  return result;
66986
67134
  }
@@ -67503,11 +67651,11 @@ var ts;
67503
67651
  // constituents of 'target'. If any combination does not have a match then 'source' is not relatable.
67504
67652
  var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes);
67505
67653
  var matchingTypes = [];
67506
- var _loop_22 = function (combination) {
67654
+ var _loop_21 = function (combination) {
67507
67655
  var hasMatch = false;
67508
67656
  outer: for (var _c = 0, _d = target.types; _c < _d.length; _c++) {
67509
67657
  var type = _d[_c];
67510
- var _loop_23 = function (i) {
67658
+ var _loop_22 = function (i) {
67511
67659
  var sourceProperty = sourcePropertiesFiltered[i];
67512
67660
  var targetProperty = getPropertyOfType(type, sourceProperty.escapedName);
67513
67661
  if (!targetProperty)
@@ -67523,8 +67671,8 @@ var ts;
67523
67671
  }
67524
67672
  };
67525
67673
  for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
67526
- var state_9 = _loop_23(i);
67527
- switch (state_9) {
67674
+ var state_8 = _loop_22(i);
67675
+ switch (state_8) {
67528
67676
  case "continue-outer": continue outer;
67529
67677
  }
67530
67678
  }
@@ -67537,9 +67685,9 @@ var ts;
67537
67685
  };
67538
67686
  for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) {
67539
67687
  var combination = discriminantCombinations_1[_a];
67540
- var state_8 = _loop_22(combination);
67541
- if (typeof state_8 === "object")
67542
- return state_8.value;
67688
+ var state_7 = _loop_21(combination);
67689
+ if (typeof state_7 === "object")
67690
+ return state_7.value;
67543
67691
  }
67544
67692
  // Compare the remaining non-discriminant properties of each match.
67545
67693
  var result = -1 /* Ternary.True */;
@@ -67636,7 +67784,7 @@ var ts;
67636
67784
  return 0 /* Ternary.False */;
67637
67785
  }
67638
67786
  // When checking for comparability, be more lenient with optional properties.
67639
- if (!skipOptional && sourceProp.flags & 16777216 /* SymbolFlags.Optional */ && !(targetProp.flags & 16777216 /* SymbolFlags.Optional */)) {
67787
+ if (!skipOptional && sourceProp.flags & 16777216 /* SymbolFlags.Optional */ && targetProp.flags & 106500 /* SymbolFlags.ClassMember */ && !(targetProp.flags & 16777216 /* SymbolFlags.Optional */)) {
67640
67788
  // TypeScript 1.0 spec (April 2014): 3.8.3
67641
67789
  // S is a subtype of a type T, and T is a supertype of S if ...
67642
67790
  // S' and T are object types and, for each member M in T..
@@ -68244,7 +68392,7 @@ var ts;
68244
68392
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* tracing.Phase.CheckTypes */, "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) });
68245
68393
  links.variances = ts.emptyArray;
68246
68394
  var variances = [];
68247
- var _loop_24 = function (tp) {
68395
+ var _loop_23 = function (tp) {
68248
68396
  var modifiers = getVarianceModifiers(tp);
68249
68397
  var variance = modifiers & 65536 /* ModifierFlags.Out */ ?
68250
68398
  modifiers & 32768 /* ModifierFlags.In */ ? 0 /* VarianceFlags.Invariant */ : 1 /* VarianceFlags.Covariant */ :
@@ -68282,7 +68430,7 @@ var ts;
68282
68430
  };
68283
68431
  for (var _i = 0, typeParameters_2 = typeParameters; _i < typeParameters_2.length; _i++) {
68284
68432
  var tp = typeParameters_2[_i];
68285
- _loop_24(tp);
68433
+ _loop_23(tp);
68286
68434
  }
68287
68435
  links.variances = variances;
68288
68436
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop({ variances: variances.map(ts.Debug.formatVariance) });
@@ -68736,8 +68884,7 @@ var ts;
68736
68884
  return !!(type.flags & 109440 /* TypeFlags.Unit */);
68737
68885
  }
68738
68886
  function isUnitLikeType(type) {
68739
- return type.flags & 2097152 /* TypeFlags.Intersection */ ? ts.some(type.types, isUnitType) :
68740
- !!(type.flags & 109440 /* TypeFlags.Unit */);
68887
+ return isUnitType(getBaseConstraintOrType(type));
68741
68888
  }
68742
68889
  function extractUnitType(type) {
68743
68890
  return type.flags & 2097152 /* TypeFlags.Intersection */ ? ts.find(type.types, isUnitType) || type : type;
@@ -69616,7 +69763,7 @@ var ts;
69616
69763
  && (!roundTripOnly || s === ts.pseudoBigIntToString({ negative: negative, base10Value: ts.parsePseudoBigInt(scanner.getTokenValue()) }));
69617
69764
  }
69618
69765
  function isMemberOfStringMapping(source, target) {
69619
- if (target.flags & (4 /* TypeFlags.String */ | 3 /* TypeFlags.AnyOrUnknown */)) {
69766
+ if (target.flags & (4 /* TypeFlags.String */ | 1 /* TypeFlags.Any */)) {
69620
69767
  return true;
69621
69768
  }
69622
69769
  if (target.flags & 134217728 /* TypeFlags.TemplateLiteral */) {
@@ -70240,7 +70387,7 @@ var ts;
70240
70387
  // upon instantiation, would collapse all the placeholders to just 'string', and an assignment check might
70241
70388
  // succeed. That would be a pointless and confusing outcome.
70242
70389
  if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) {
70243
- var _loop_25 = function (i) {
70390
+ var _loop_24 = function (i) {
70244
70391
  var source_1 = matches ? matches[i] : neverType;
70245
70392
  var target_3 = types[i];
70246
70393
  // If we are inferring from a string literal type to a type variable whose constraint includes one of the
@@ -70290,7 +70437,7 @@ var ts;
70290
70437
  inferFromTypes(source_1, target_3);
70291
70438
  };
70292
70439
  for (var i = 0; i < types.length; i++) {
70293
- _loop_25(i);
70440
+ _loop_24(i);
70294
70441
  }
70295
70442
  }
70296
70443
  }
@@ -70742,7 +70889,7 @@ var ts;
70742
70889
  }
70743
70890
  if (ts.isEntityNameExpression(node.argumentExpression)) {
70744
70891
  var symbol = resolveEntityName(node.argumentExpression, 111551 /* SymbolFlags.Value */, /*ignoreErrors*/ true);
70745
- if (!symbol || !isConstVariable(symbol))
70892
+ if (!symbol || !(isConstVariable(symbol) || (symbol.flags & 8 /* SymbolFlags.EnumMember */)))
70746
70893
  return undefined;
70747
70894
  var declaration = symbol.valueDeclaration;
70748
70895
  if (declaration === undefined)
@@ -70756,7 +70903,12 @@ var ts;
70756
70903
  }
70757
70904
  if (ts.hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node.argumentExpression)) {
70758
70905
  var initializer = ts.getEffectiveInitializer(declaration);
70759
- return initializer && tryGetNameFromType(getTypeOfExpression(initializer));
70906
+ if (initializer) {
70907
+ return tryGetNameFromType(getTypeOfExpression(initializer));
70908
+ }
70909
+ if (ts.isEnumMember(declaration)) {
70910
+ return ts.getTextOfPropertyName(declaration.name);
70911
+ }
70760
70912
  }
70761
70913
  }
70762
70914
  return undefined;
@@ -70814,7 +70966,7 @@ var ts;
70814
70966
  function mapTypesByKeyProperty(types, name) {
70815
70967
  var map = new ts.Map();
70816
70968
  var count = 0;
70817
- var _loop_26 = function (type) {
70969
+ var _loop_25 = function (type) {
70818
70970
  if (type.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */)) {
70819
70971
  var discriminant = getTypeOfPropertyOfType(type, name);
70820
70972
  if (discriminant) {
@@ -70840,9 +70992,9 @@ var ts;
70840
70992
  };
70841
70993
  for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
70842
70994
  var type = types_15[_i];
70843
- var state_10 = _loop_26(type);
70844
- if (typeof state_10 === "object")
70845
- return state_10.value;
70995
+ var state_9 = _loop_25(type);
70996
+ if (typeof state_9 === "object")
70997
+ return state_9.value;
70846
70998
  }
70847
70999
  return count >= 10 && count * 2 >= types.length ? map : undefined;
70848
71000
  }
@@ -71439,6 +71591,7 @@ var ts;
71439
71591
  ts.isInJSFile(node) && ts.hasInitializer(node) && node.initializer && ts.isFunctionExpressionOrArrowFunction(node.initializer) && ts.getEffectiveReturnTypeNode(node.initializer));
71440
71592
  }
71441
71593
  function getExplicitTypeOfSymbol(symbol, diagnostic) {
71594
+ symbol = resolveSymbol(symbol);
71442
71595
  if (symbol.flags & (16 /* SymbolFlags.Function */ | 8192 /* SymbolFlags.Method */ | 32 /* SymbolFlags.Class */ | 512 /* SymbolFlags.ValueModule */)) {
71443
71596
  return getTypeOfSymbol(symbol);
71444
71597
  }
@@ -71477,7 +71630,7 @@ var ts;
71477
71630
  switch (node.kind) {
71478
71631
  case 79 /* SyntaxKind.Identifier */:
71479
71632
  var symbol = getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(node));
71480
- return getExplicitTypeOfSymbol(symbol.flags & 2097152 /* SymbolFlags.Alias */ ? resolveAlias(symbol) : symbol, diagnostic);
71633
+ return getExplicitTypeOfSymbol(symbol, diagnostic);
71481
71634
  case 108 /* SyntaxKind.ThisKeyword */:
71482
71635
  return getExplicitThisType(node);
71483
71636
  case 106 /* SyntaxKind.SuperKeyword */:
@@ -71964,7 +72117,7 @@ var ts;
71964
72117
  type = narrowTypeBySwitchOnDiscriminant(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
71965
72118
  }
71966
72119
  else if (expr.kind === 218 /* SyntaxKind.TypeOfExpression */ && isMatchingReference(reference, expr.expression)) {
71967
- type = narrowBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
72120
+ type = narrowTypeBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
71968
72121
  }
71969
72122
  else {
71970
72123
  if (strictNullChecks) {
@@ -72245,7 +72398,7 @@ var ts;
72245
72398
  !!(prop.flags & 16777216 /* SymbolFlags.Optional */) || assumeTrue :
72246
72399
  !!getApplicableIndexInfoForName(type, propName) || !assumeTrue;
72247
72400
  }
72248
- function narrowByInKeyword(type, nameType, assumeTrue) {
72401
+ function narrowTypeByInKeyword(type, nameType, assumeTrue) {
72249
72402
  var name = getPropertyNameFromType(nameType);
72250
72403
  var isKnownProperty = someType(type, function (t) { return isTypePresencePossible(t, name, /*assumeTrue*/ true); });
72251
72404
  if (isKnownProperty) {
@@ -72326,7 +72479,7 @@ var ts;
72326
72479
  return getTypeWithFacts(type, assumeTrue ? 524288 /* TypeFacts.NEUndefined */ : 65536 /* TypeFacts.EQUndefined */);
72327
72480
  }
72328
72481
  if (isMatchingReference(reference, target)) {
72329
- return narrowByInKeyword(type, leftType, assumeTrue);
72482
+ return narrowTypeByInKeyword(type, leftType, assumeTrue);
72330
72483
  }
72331
72484
  }
72332
72485
  break;
@@ -72515,7 +72668,7 @@ var ts;
72515
72668
  neverType;
72516
72669
  });
72517
72670
  }
72518
- function narrowBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) {
72671
+ function narrowTypeBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) {
72519
72672
  var witnesses = getSwitchClauseTypeOfWitnesses(switchStatement);
72520
72673
  if (!witnesses) {
72521
72674
  return type;
@@ -72903,15 +73056,15 @@ var ts;
72903
73056
  });
72904
73057
  }
72905
73058
  function markAliasReferenced(symbol, location) {
72906
- if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol)) {
73059
+ if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */)) {
72907
73060
  var target = resolveAlias(symbol);
72908
- if (target.flags & 111551 /* SymbolFlags.Value */) {
73061
+ if (getAllSymbolFlags(target) & (111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */)) {
72909
73062
  // An alias resolving to a const enum cannot be elided if (1) 'isolatedModules' is enabled
72910
73063
  // (because the const enum value will not be inlined), or if (2) the alias is an export
72911
73064
  // of a const enum declaration that will be preserved.
72912
73065
  if (compilerOptions.isolatedModules ||
72913
73066
  ts.shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(location) ||
72914
- !isConstEnumOrConstEnumOnlyModule(target)) {
73067
+ !isConstEnumOrConstEnumOnlyModule(getExportSymbolOfValueSymbolIfExported(target))) {
72915
73068
  markAliasSymbolAsReferenced(symbol);
72916
73069
  }
72917
73070
  else {
@@ -73139,7 +73292,7 @@ var ts;
73139
73292
  // We only look for uninitialized variables in strict null checking mode, and only when we can analyze
73140
73293
  // the entire control flow graph from the variable's declaration (i.e. when the flow container and
73141
73294
  // declaration container are the same).
73142
- var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || ts.isBindingElement(declaration) ||
73295
+ var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) ||
73143
73296
  type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* TypeFlags.AnyOrUnknown */ | 16384 /* TypeFlags.Void */)) !== 0 ||
73144
73297
  isInTypeQuery(node) || node.parent.kind === 278 /* SyntaxKind.ExportSpecifier */) ||
73145
73298
  node.parent.kind === 232 /* SyntaxKind.NonNullExpression */ ||
@@ -73168,6 +73321,12 @@ var ts;
73168
73321
  }
73169
73322
  return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType;
73170
73323
  }
73324
+ function isSameScopedBindingElement(node, declaration) {
73325
+ if (ts.isBindingElement(declaration)) {
73326
+ var bindingElement = ts.findAncestor(node, ts.isBindingElement);
73327
+ return bindingElement && ts.getRootDeclaration(bindingElement) === ts.getRootDeclaration(declaration);
73328
+ }
73329
+ }
73171
73330
  function shouldMarkIdentifierAliasReferenced(node) {
73172
73331
  var _a;
73173
73332
  var parent = node.parent;
@@ -73509,12 +73668,17 @@ var ts;
73509
73668
  var immediateContainer = ts.getSuperContainer(node, /*stopOnFunctions*/ true);
73510
73669
  var container = immediateContainer;
73511
73670
  var needToCaptureLexicalThis = false;
73671
+ var inAsyncFunction = false;
73512
73672
  // adjust the container reference in case if super is used inside arrow functions with arbitrarily deep nesting
73513
73673
  if (!isCallExpression) {
73514
73674
  while (container && container.kind === 216 /* SyntaxKind.ArrowFunction */) {
73675
+ if (ts.hasSyntacticModifier(container, 512 /* ModifierFlags.Async */))
73676
+ inAsyncFunction = true;
73515
73677
  container = ts.getSuperContainer(container, /*stopOnFunctions*/ true);
73516
73678
  needToCaptureLexicalThis = languageVersion < 2 /* ScriptTarget.ES2015 */;
73517
73679
  }
73680
+ if (container && ts.hasSyntacticModifier(container, 512 /* ModifierFlags.Async */))
73681
+ inAsyncFunction = true;
73518
73682
  }
73519
73683
  var canUseSuperExpression = isLegalUsageOfSuperExpression(container);
73520
73684
  var nodeCheckFlag = 0;
@@ -73620,12 +73784,12 @@ var ts;
73620
73784
  // as a call expression cannot be used as the target of a destructuring assignment while a property access can.
73621
73785
  //
73622
73786
  // For element access expressions (`super[x]`), we emit a generic helper that forwards the element access in both situations.
73623
- if (container.kind === 171 /* SyntaxKind.MethodDeclaration */ && ts.hasSyntacticModifier(container, 512 /* ModifierFlags.Async */)) {
73787
+ if (container.kind === 171 /* SyntaxKind.MethodDeclaration */ && inAsyncFunction) {
73624
73788
  if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) {
73625
- getNodeLinks(container).flags |= 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */;
73789
+ getNodeLinks(container).flags |= 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */;
73626
73790
  }
73627
73791
  else {
73628
- getNodeLinks(container).flags |= 2048 /* NodeCheckFlags.AsyncMethodWithSuper */;
73792
+ getNodeLinks(container).flags |= 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */;
73629
73793
  }
73630
73794
  }
73631
73795
  if (needToCaptureLexicalThis) {
@@ -74321,9 +74485,10 @@ var ts;
74321
74485
  function instantiateContextualType(contextualType, node, contextFlags) {
74322
74486
  if (contextualType && maybeTypeOfKind(contextualType, 465829888 /* TypeFlags.Instantiable */)) {
74323
74487
  var inferenceContext = getInferenceContext(node);
74324
- // If no inferences have been made, nothing is gained from instantiating as type parameters
74325
- // would just be replaced with their defaults similar to the apparent type.
74326
- if (inferenceContext && contextFlags & 1 /* ContextFlags.Signature */ && ts.some(inferenceContext.inferences, hasInferenceCandidates)) {
74488
+ // If no inferences have been made, and none of the type parameters for which we are inferring
74489
+ // specify default types, nothing is gained from instantiating as type parameters would just be
74490
+ // replaced with their constraints similar to the apparent type.
74491
+ if (inferenceContext && contextFlags & 1 /* ContextFlags.Signature */ && ts.some(inferenceContext.inferences, hasInferenceCandidatesOrDefault)) {
74327
74492
  // For contextual signatures we incorporate all inferences made so far, e.g. from return
74328
74493
  // types as well as arguments to the left in a function call.
74329
74494
  return instantiateInstantiableTypes(contextualType, inferenceContext.nonFixingMapper);
@@ -77297,7 +77462,7 @@ var ts;
77297
77462
  if (spreadIndex >= 0) {
77298
77463
  // Create synthetic arguments from spreads of tuple types.
77299
77464
  var effectiveArgs_1 = args.slice(0, spreadIndex);
77300
- var _loop_27 = function (i) {
77465
+ var _loop_26 = function (i) {
77301
77466
  var arg = args[i];
77302
77467
  // We can call checkExpressionCached because spread expressions never have a contextual type.
77303
77468
  var spreadType = arg.kind === 227 /* SyntaxKind.SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
@@ -77314,7 +77479,7 @@ var ts;
77314
77479
  }
77315
77480
  };
77316
77481
  for (var i = spreadIndex; i < args.length; i++) {
77317
- _loop_27(i);
77482
+ _loop_26(i);
77318
77483
  }
77319
77484
  return effectiveArgs_1;
77320
77485
  }
@@ -77643,7 +77808,7 @@ var ts;
77643
77808
  var min_3 = Number.MAX_VALUE;
77644
77809
  var minIndex = 0;
77645
77810
  var i_1 = 0;
77646
- var _loop_28 = function (c) {
77811
+ var _loop_27 = function (c) {
77647
77812
  var chain_2 = function () { return ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Overload_0_of_1_2_gave_the_following_error, i_1 + 1, candidates.length, signatureToString(c)); };
77648
77813
  var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* CheckMode.Normal */, /*reportErrors*/ true, chain_2);
77649
77814
  if (diags_2) {
@@ -77661,7 +77826,7 @@ var ts;
77661
77826
  };
77662
77827
  for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) {
77663
77828
  var c = candidatesForArgumentError_1[_a];
77664
- _loop_28(c);
77829
+ _loop_27(c);
77665
77830
  }
77666
77831
  var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
77667
77832
  ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
@@ -77819,7 +77984,7 @@ var ts;
77819
77984
  }
77820
77985
  var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
77821
77986
  var parameters = [];
77822
- var _loop_29 = function (i) {
77987
+ var _loop_28 = function (i) {
77823
77988
  var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ?
77824
77989
  i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) :
77825
77990
  i < s.parameters.length ? s.parameters[i] : undefined; });
@@ -77827,7 +77992,7 @@ var ts;
77827
77992
  parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
77828
77993
  };
77829
77994
  for (var i = 0; i < maxNonRestParam; i++) {
77830
- _loop_29(i);
77995
+ _loop_28(i);
77831
77996
  }
77832
77997
  var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; });
77833
77998
  var flags = 0 /* SignatureFlags.None */;
@@ -78797,7 +78962,7 @@ var ts;
78797
78962
  if (symbol && symbol.flags & 2097152 /* SymbolFlags.Alias */) {
78798
78963
  symbol = resolveAlias(symbol);
78799
78964
  }
78800
- return !!(symbol && (symbol.flags & 384 /* SymbolFlags.Enum */) && getEnumKind(symbol) === 1 /* EnumKind.Literal */);
78965
+ return !!(symbol && (getAllSymbolFlags(symbol) & 384 /* SymbolFlags.Enum */) && getEnumKind(symbol) === 1 /* EnumKind.Literal */);
78801
78966
  }
78802
78967
  return false;
78803
78968
  }
@@ -79459,7 +79624,17 @@ var ts;
79459
79624
  }
79460
79625
  function isExhaustiveSwitchStatement(node) {
79461
79626
  var links = getNodeLinks(node);
79462
- return links.isExhaustive !== undefined ? links.isExhaustive : (links.isExhaustive = computeExhaustiveSwitchStatement(node));
79627
+ if (links.isExhaustive === undefined) {
79628
+ links.isExhaustive = 0; // Indicate resolution is in process
79629
+ var exhaustive = computeExhaustiveSwitchStatement(node);
79630
+ if (links.isExhaustive === 0) {
79631
+ links.isExhaustive = exhaustive;
79632
+ }
79633
+ }
79634
+ else if (links.isExhaustive === 0) {
79635
+ links.isExhaustive = false; // Resolve circularity to false
79636
+ }
79637
+ return links.isExhaustive;
79463
79638
  }
79464
79639
  function computeExhaustiveSwitchStatement(node) {
79465
79640
  if (node.expression.kind === 218 /* SyntaxKind.TypeOfExpression */) {
@@ -79467,7 +79642,7 @@ var ts;
79467
79642
  if (!witnesses) {
79468
79643
  return false;
79469
79644
  }
79470
- var operandConstraint = getBaseConstraintOrType(getTypeOfExpression(node.expression.expression));
79645
+ var operandConstraint = getBaseConstraintOrType(checkExpressionCached(node.expression.expression));
79471
79646
  // Get the not-equal flags for all handled cases.
79472
79647
  var notEqualFacts_2 = getNotEqualFactsFromTypeofSwitch(0, 0, witnesses);
79473
79648
  if (operandConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */) {
@@ -79477,7 +79652,7 @@ var ts;
79477
79652
  // A missing not-equal flag indicates that the type wasn't handled by some case.
79478
79653
  return !someType(operandConstraint, function (t) { return (getTypeFacts(t) & notEqualFacts_2) === notEqualFacts_2; });
79479
79654
  }
79480
- var type = getTypeOfExpression(node.expression);
79655
+ var type = checkExpressionCached(node.expression);
79481
79656
  if (!isLiteralType(type)) {
79482
79657
  return false;
79483
79658
  }
@@ -81171,6 +81346,9 @@ var ts;
81171
81346
  function hasInferenceCandidates(info) {
81172
81347
  return !!(info.candidates || info.contraCandidates);
81173
81348
  }
81349
+ function hasInferenceCandidatesOrDefault(info) {
81350
+ return !!(info.candidates || info.contraCandidates || hasTypeParameterDefault(info.typeParameter));
81351
+ }
81174
81352
  function hasOverlappingInferences(a, b) {
81175
81353
  for (var i = 0; i < a.length; i++) {
81176
81354
  if (hasInferenceCandidates(a[i]) && hasInferenceCandidates(b[i])) {
@@ -81872,7 +82050,7 @@ var ts;
81872
82050
  var indexSymbol = getIndexSymbol(getSymbolOfNode(node));
81873
82051
  if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
81874
82052
  var indexSignatureMap_1 = new ts.Map();
81875
- var _loop_30 = function (declaration) {
82053
+ var _loop_29 = function (declaration) {
81876
82054
  if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
81877
82055
  forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) {
81878
82056
  var entry = indexSignatureMap_1.get(getTypeId(type));
@@ -81887,7 +82065,7 @@ var ts;
81887
82065
  };
81888
82066
  for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
81889
82067
  var declaration = _a[_i];
81890
- _loop_30(declaration);
82068
+ _loop_29(declaration);
81891
82069
  }
81892
82070
  indexSignatureMap_1.forEach(function (entry) {
81893
82071
  if (entry.declarations.length > 1) {
@@ -82164,7 +82342,7 @@ var ts;
82164
82342
  }
82165
82343
  var symbol = getNodeLinks(node).resolvedSymbol;
82166
82344
  if (symbol) {
82167
- if (ts.some(symbol.declarations, function (d) { return isTypeDeclaration(d) && !!(d.flags & 268435456 /* NodeFlags.Deprecated */); })) {
82345
+ if (ts.some(symbol.declarations, function (d) { return ts.isTypeDeclaration(d) && !!(d.flags & 268435456 /* NodeFlags.Deprecated */); })) {
82168
82346
  addDeprecatedSuggestion(getDeprecatedSuggestionNode(node), symbol.declarations, symbol.escapedName);
82169
82347
  }
82170
82348
  if (type.flags & 32 /* TypeFlags.Enum */ && symbol.flags & 8 /* SymbolFlags.EnumMember */) {
@@ -82767,7 +82945,7 @@ var ts;
82767
82945
  return typeAsPromise.promisedTypeOfPromise = getTypeArguments(type)[0];
82768
82946
  }
82769
82947
  // primitives with a `{ then() }` won't be unwrapped/adopted.
82770
- if (allTypesAssignableToKind(type, 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) {
82948
+ if (allTypesAssignableToKind(getBaseConstraintOrType(type), 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) {
82771
82949
  return undefined;
82772
82950
  }
82773
82951
  var thenFunction = getTypeOfPropertyOfType(type, "then"); // TODO: GH#18217
@@ -82834,7 +83012,7 @@ var ts;
82834
83012
  * Determines whether a type is an object with a callable `then` member.
82835
83013
  */
82836
83014
  function isThenableType(type) {
82837
- if (allTypesAssignableToKind(type, 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) {
83015
+ if (allTypesAssignableToKind(getBaseConstraintOrType(type), 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) {
82838
83016
  // primitive types cannot be considered "thenable" since they are not objects.
82839
83017
  return false;
82840
83018
  }
@@ -82868,7 +83046,7 @@ var ts;
82868
83046
  // We only need `Awaited<T>` if `T` is a type variable that has no base constraint, or the base constraint of `T` is `any`, `unknown`, `{}`, `object`,
82869
83047
  // or is promise-like.
82870
83048
  if (baseConstraint ?
82871
- baseConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || isEmptyObjectType(baseConstraint) || isThenableType(baseConstraint) :
83049
+ baseConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || isEmptyObjectType(baseConstraint) || someType(baseConstraint, isThenableType) :
82872
83050
  maybeTypeOfKind(type, 8650752 /* TypeFlags.TypeVariable */)) {
82873
83051
  return true;
82874
83052
  }
@@ -83542,7 +83720,7 @@ var ts;
83542
83720
  }
83543
83721
  function errorUnusedLocal(declaration, name, addDiagnostic) {
83544
83722
  var node = ts.getNameOfDeclaration(declaration) || declaration;
83545
- var message = isTypeDeclaration(declaration) ? ts.Diagnostics._0_is_declared_but_never_used : ts.Diagnostics._0_is_declared_but_its_value_is_never_read;
83723
+ var message = ts.isTypeDeclaration(declaration) ? ts.Diagnostics._0_is_declared_but_never_used : ts.Diagnostics._0_is_declared_but_its_value_is_never_read;
83546
83724
  addDiagnostic(declaration, 0 /* UnusedKind.Local */, ts.createDiagnosticForNode(node, message, name));
83547
83725
  }
83548
83726
  function isIdentifierThatStartsWithUnderscore(node) {
@@ -84972,7 +85150,16 @@ var ts;
84972
85150
  var message = allowAsyncIterables
84973
85151
  ? ts.Diagnostics.Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator
84974
85152
  : ts.Diagnostics.Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator;
84975
- return errorAndMaybeSuggestAwait(errorNode, !!getAwaitedTypeOfPromise(type), message, typeToString(type));
85153
+ var suggestAwait =
85154
+ // for (const x of Promise<...>) or [...Promise<...>]
85155
+ !!getAwaitedTypeOfPromise(type)
85156
+ // for (const x of AsyncIterable<...>)
85157
+ || (!allowAsyncIterables &&
85158
+ ts.isForOfStatement(errorNode.parent) &&
85159
+ errorNode.parent.expression === errorNode &&
85160
+ getGlobalAsyncIterableType(/** reportErrors */ false) !== emptyGenericType &&
85161
+ isTypeAssignableTo(type, getGlobalAsyncIterableType(/** reportErrors */ false)));
85162
+ return errorAndMaybeSuggestAwait(errorNode, suggestAwait, message, typeToString(type));
84976
85163
  }
84977
85164
  /**
84978
85165
  * Gets the *yield*, *return*, and *next* types from an `Iterator`-like or `AsyncIterator`-like type.
@@ -85487,7 +85674,7 @@ var ts;
85487
85674
  var propDeclaration = declaration && declaration.kind === 223 /* SyntaxKind.BinaryExpression */ ||
85488
85675
  name && name.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? declaration : undefined;
85489
85676
  var localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
85490
- var _loop_31 = function (info) {
85677
+ var _loop_30 = function (info) {
85491
85678
  var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
85492
85679
  // We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared
85493
85680
  // in the containing type, or (c) the containing type is an interface and no base interface contains both the property and
@@ -85504,7 +85691,7 @@ var ts;
85504
85691
  };
85505
85692
  for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
85506
85693
  var info = indexInfos_9[_i];
85507
- _loop_31(info);
85694
+ _loop_30(info);
85508
85695
  }
85509
85696
  }
85510
85697
  function checkIndexConstraintForIndexSignature(type, checkInfo) {
@@ -85512,7 +85699,7 @@ var ts;
85512
85699
  var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType);
85513
85700
  var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 261 /* SyntaxKind.InterfaceDeclaration */) : undefined;
85514
85701
  var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined;
85515
- var _loop_32 = function (info) {
85702
+ var _loop_31 = function (info) {
85516
85703
  if (info === checkInfo)
85517
85704
  return "continue";
85518
85705
  var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
@@ -85527,7 +85714,7 @@ var ts;
85527
85714
  };
85528
85715
  for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
85529
85716
  var info = indexInfos_10[_i];
85530
- _loop_32(info);
85717
+ _loop_31(info);
85531
85718
  }
85532
85719
  }
85533
85720
  function checkTypeNameIsReserved(name, message) {
@@ -85582,7 +85769,7 @@ var ts;
85582
85769
  }
85583
85770
  else {
85584
85771
  ts.forEach(jsdocParameters, function (_a, index) {
85585
- var name = _a.name;
85772
+ var name = _a.name, isNameFirst = _a.isNameFirst;
85586
85773
  if (excludedParameters.has(index) || ts.isIdentifier(name) && parameters.has(name.escapedText)) {
85587
85774
  return;
85588
85775
  }
@@ -85592,7 +85779,9 @@ var ts;
85592
85779
  }
85593
85780
  }
85594
85781
  else {
85595
- errorOrSuggestion(isJs, name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(name));
85782
+ if (!isNameFirst) {
85783
+ errorOrSuggestion(isJs, name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(name));
85784
+ }
85596
85785
  }
85597
85786
  });
85598
85787
  }
@@ -85847,7 +86036,7 @@ var ts;
85847
86036
  var baseTypes = baseTypeNode && getBaseTypes(type);
85848
86037
  var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
85849
86038
  var baseStaticType = getBaseConstructorTypeOfClass(type);
85850
- var _loop_33 = function (member) {
86039
+ var _loop_32 = function (member) {
85851
86040
  if (ts.hasAmbientModifier(member)) {
85852
86041
  return "continue";
85853
86042
  }
@@ -85864,7 +86053,7 @@ var ts;
85864
86053
  };
85865
86054
  for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
85866
86055
  var member = _a[_i];
85867
- _loop_33(member);
86056
+ _loop_32(member);
85868
86057
  }
85869
86058
  }
85870
86059
  /**
@@ -85952,7 +86141,7 @@ var ts;
85952
86141
  function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
85953
86142
  // iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible
85954
86143
  var issuedMemberError = false;
85955
- var _loop_34 = function (member) {
86144
+ var _loop_33 = function (member) {
85956
86145
  if (ts.isStatic(member)) {
85957
86146
  return "continue";
85958
86147
  }
@@ -85971,7 +86160,7 @@ var ts;
85971
86160
  };
85972
86161
  for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
85973
86162
  var member = _a[_i];
85974
- _loop_34(member);
86163
+ _loop_33(member);
85975
86164
  }
85976
86165
  if (!issuedMemberError) {
85977
86166
  // check again with diagnostics to generate a less-specific error
@@ -86042,7 +86231,7 @@ var ts;
86042
86231
  var _a, _b, _c, _d;
86043
86232
  // NOTE: assignability is checked in checkClassDeclaration
86044
86233
  var baseProperties = getPropertiesOfType(baseType);
86045
- var _loop_35 = function (baseProperty) {
86234
+ var _loop_34 = function (baseProperty) {
86046
86235
  var base = getTargetSymbol(baseProperty);
86047
86236
  if (base.flags & 4194304 /* SymbolFlags.Prototype */) {
86048
86237
  return "continue";
@@ -86152,8 +86341,8 @@ var ts;
86152
86341
  };
86153
86342
  basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
86154
86343
  var baseProperty = baseProperties_1[_i];
86155
- var state_11 = _loop_35(baseProperty);
86156
- switch (state_11) {
86344
+ var state_10 = _loop_34(baseProperty);
86345
+ switch (state_10) {
86157
86346
  case "continue-basePropertyCheck": continue basePropertyCheck;
86158
86347
  }
86159
86348
  }
@@ -86672,12 +86861,11 @@ var ts;
86672
86861
  }
86673
86862
  }
86674
86863
  function checkModuleAugmentationElement(node, isGlobalAugmentation) {
86675
- var _a;
86676
86864
  switch (node.kind) {
86677
86865
  case 240 /* SyntaxKind.VariableStatement */:
86678
86866
  // error each individual name in variable statement instead of marking the entire variable statement
86679
- for (var _i = 0, _b = node.declarationList.declarations; _i < _b.length; _i++) {
86680
- var decl = _b[_i];
86867
+ for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {
86868
+ var decl = _a[_i];
86681
86869
  checkModuleAugmentationElement(decl, isGlobalAugmentation);
86682
86870
  }
86683
86871
  break;
@@ -86693,8 +86881,8 @@ var ts;
86693
86881
  case 257 /* SyntaxKind.VariableDeclaration */:
86694
86882
  var name = node.name;
86695
86883
  if (ts.isBindingPattern(name)) {
86696
- for (var _c = 0, _d = name.elements; _c < _d.length; _c++) {
86697
- var el = _d[_c];
86884
+ for (var _b = 0, _c = name.elements; _b < _c.length; _b++) {
86885
+ var el = _c[_b];
86698
86886
  // mark individual names in binding pattern
86699
86887
  checkModuleAugmentationElement(el, isGlobalAugmentation);
86700
86888
  }
@@ -86710,18 +86898,6 @@ var ts;
86710
86898
  if (isGlobalAugmentation) {
86711
86899
  return;
86712
86900
  }
86713
- var symbol = getSymbolOfNode(node);
86714
- if (symbol) {
86715
- // module augmentations cannot introduce new names on the top level scope of the module
86716
- // this is done it two steps
86717
- // 1. quick check - if symbol for node is not merged - this is local symbol to this augmentation - report error
86718
- // 2. main check - report error if value declaration of the parent symbol is module augmentation)
86719
- var reportError = !(symbol.flags & 33554432 /* SymbolFlags.Transient */);
86720
- if (!reportError) {
86721
- // symbol should not originate in augmentation
86722
- reportError = !!((_a = symbol.parent) === null || _a === void 0 ? void 0 : _a.declarations) && ts.isExternalModuleAugmentation(symbol.parent.declarations[0]);
86723
- }
86724
- }
86725
86901
  break;
86726
86902
  }
86727
86903
  }
@@ -86823,10 +86999,11 @@ var ts;
86823
86999
  }
86824
87000
  return;
86825
87001
  }
87002
+ var targetFlags = getAllSymbolFlags(target);
86826
87003
  var excludedMeanings = (symbol.flags & (111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */) ? 111551 /* SymbolFlags.Value */ : 0) |
86827
87004
  (symbol.flags & 788968 /* SymbolFlags.Type */ ? 788968 /* SymbolFlags.Type */ : 0) |
86828
87005
  (symbol.flags & 1920 /* SymbolFlags.Namespace */ ? 1920 /* SymbolFlags.Namespace */ : 0);
86829
- if (target.flags & excludedMeanings) {
87006
+ if (targetFlags & excludedMeanings) {
86830
87007
  var message = node.kind === 278 /* SyntaxKind.ExportSpecifier */ ?
86831
87008
  ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 :
86832
87009
  ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0;
@@ -86836,7 +87013,7 @@ var ts;
86836
87013
  && !ts.isTypeOnlyImportOrExportDeclaration(node)
86837
87014
  && !(node.flags & 16777216 /* NodeFlags.Ambient */)) {
86838
87015
  var typeOnlyAlias = getTypeOnlyAliasDeclaration(symbol);
86839
- var isType = !(target.flags & 111551 /* SymbolFlags.Value */);
87016
+ var isType = !(targetFlags & 111551 /* SymbolFlags.Value */);
86840
87017
  if (isType || typeOnlyAlias) {
86841
87018
  switch (node.kind) {
86842
87019
  case 270 /* SyntaxKind.ImportClause */:
@@ -86996,14 +87173,15 @@ var ts;
86996
87173
  if (node.moduleReference.kind !== 280 /* SyntaxKind.ExternalModuleReference */) {
86997
87174
  var target = resolveAlias(getSymbolOfNode(node));
86998
87175
  if (target !== unknownSymbol) {
86999
- if (target.flags & 111551 /* SymbolFlags.Value */) {
87176
+ var targetFlags = getAllSymbolFlags(target);
87177
+ if (targetFlags & 111551 /* SymbolFlags.Value */) {
87000
87178
  // Target is a value symbol, check that it is not hidden by a local declaration with the same name
87001
87179
  var moduleName = ts.getFirstIdentifier(node.moduleReference);
87002
87180
  if (!(resolveEntityName(moduleName, 111551 /* SymbolFlags.Value */ | 1920 /* SymbolFlags.Namespace */).flags & 1920 /* SymbolFlags.Namespace */)) {
87003
87181
  error(moduleName, ts.Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, ts.declarationNameToString(moduleName));
87004
87182
  }
87005
87183
  }
87006
- if (target.flags & 788968 /* SymbolFlags.Type */) {
87184
+ if (targetFlags & 788968 /* SymbolFlags.Type */) {
87007
87185
  checkTypeNameIsReserved(node.name, ts.Diagnostics.Import_name_cannot_be_0);
87008
87186
  }
87009
87187
  }
@@ -87142,7 +87320,7 @@ var ts;
87142
87320
  markExportAsReferenced(node);
87143
87321
  }
87144
87322
  var target = symbol && (symbol.flags & 2097152 /* SymbolFlags.Alias */ ? resolveAlias(symbol) : symbol);
87145
- if (!target || target === unknownSymbol || target.flags & 111551 /* SymbolFlags.Value */) {
87323
+ if (!target || getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */) {
87146
87324
  checkExpressionCached(node.propertyName || node.name);
87147
87325
  }
87148
87326
  }
@@ -87189,7 +87367,7 @@ var ts;
87189
87367
  markAliasReferenced(sym, id);
87190
87368
  // If not a value, we're interpreting the identifier as a type export, along the lines of (`export { Id as default }`)
87191
87369
  var target = sym.flags & 2097152 /* SymbolFlags.Alias */ ? resolveAlias(sym) : sym;
87192
- if (target === unknownSymbol || target.flags & 111551 /* SymbolFlags.Value */) {
87370
+ if (getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */) {
87193
87371
  // However if it is a value, we need to check it's being used correctly
87194
87372
  checkExpressionCached(node.expression);
87195
87373
  }
@@ -87861,29 +88039,9 @@ var ts;
87861
88039
  }
87862
88040
  function isTypeDeclarationName(name) {
87863
88041
  return name.kind === 79 /* SyntaxKind.Identifier */ &&
87864
- isTypeDeclaration(name.parent) &&
88042
+ ts.isTypeDeclaration(name.parent) &&
87865
88043
  ts.getNameOfDeclaration(name.parent) === name;
87866
88044
  }
87867
- function isTypeDeclaration(node) {
87868
- switch (node.kind) {
87869
- case 165 /* SyntaxKind.TypeParameter */:
87870
- case 260 /* SyntaxKind.ClassDeclaration */:
87871
- case 261 /* SyntaxKind.InterfaceDeclaration */:
87872
- case 262 /* SyntaxKind.TypeAliasDeclaration */:
87873
- case 263 /* SyntaxKind.EnumDeclaration */:
87874
- case 348 /* SyntaxKind.JSDocTypedefTag */:
87875
- case 341 /* SyntaxKind.JSDocCallbackTag */:
87876
- case 342 /* SyntaxKind.JSDocEnumTag */:
87877
- return true;
87878
- case 270 /* SyntaxKind.ImportClause */:
87879
- return node.isTypeOnly;
87880
- case 273 /* SyntaxKind.ImportSpecifier */:
87881
- case 278 /* SyntaxKind.ExportSpecifier */:
87882
- return node.parent.parent.isTypeOnly;
87883
- default:
87884
- return false;
87885
- }
87886
- }
87887
88045
  // True if the given identifier is part of a type reference
87888
88046
  function isTypeReferenceIdentifier(node) {
87889
88047
  while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */) {
@@ -88316,7 +88474,7 @@ var ts;
88316
88474
  var baseType = ts.firstOrUndefined(getBaseTypes(classType));
88317
88475
  return baseType ? getTypeWithThisArgument(baseType, classType.thisType) : errorType;
88318
88476
  }
88319
- if (isTypeDeclaration(node)) {
88477
+ if (ts.isTypeDeclaration(node)) {
88320
88478
  // In this case, we call getSymbolOfNode instead of getSymbolAtLocation because it is a declaration
88321
88479
  var symbol = getSymbolOfNode(node);
88322
88480
  return getDeclaredTypeOfSymbol(symbol);
@@ -88511,7 +88669,7 @@ var ts;
88511
88669
  return symbolLinks.exportsSomeValue;
88512
88670
  function isValue(s) {
88513
88671
  s = resolveSymbol(s);
88514
- return s && !!(s.flags & 111551 /* SymbolFlags.Value */);
88672
+ return s && !!(getAllSymbolFlags(s) & 111551 /* SymbolFlags.Value */);
88515
88673
  }
88516
88674
  }
88517
88675
  function isNameOfModuleOrEnumDeclaration(node) {
@@ -88564,7 +88722,7 @@ var ts;
88564
88722
  var symbol = getReferencedValueOrAliasSymbol(node);
88565
88723
  // We should only get the declaration of an alias if there isn't a local value
88566
88724
  // declaration for the symbol
88567
- if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !getTypeOnlyAliasDeclaration(symbol)) {
88725
+ if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */)) {
88568
88726
  return getDeclarationOfAliasSymbol(symbol);
88569
88727
  }
88570
88728
  }
@@ -88652,7 +88810,7 @@ var ts;
88652
88810
  case 273 /* SyntaxKind.ImportSpecifier */:
88653
88811
  case 278 /* SyntaxKind.ExportSpecifier */:
88654
88812
  var symbol = getSymbolOfNode(node);
88655
- return !!symbol && isAliasResolvedToValue(symbol) && !getTypeOnlyAliasDeclaration(symbol);
88813
+ return !!symbol && isAliasResolvedToValue(symbol) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */);
88656
88814
  case 275 /* SyntaxKind.ExportDeclaration */:
88657
88815
  var exportClause = node.exportClause;
88658
88816
  return !!exportClause && (ts.isNamespaceExport(exportClause) ||
@@ -88674,6 +88832,7 @@ var ts;
88674
88832
  return isValue && node.moduleReference && !ts.nodeIsMissing(node.moduleReference);
88675
88833
  }
88676
88834
  function isAliasResolvedToValue(symbol) {
88835
+ var _a;
88677
88836
  if (!symbol) {
88678
88837
  return false;
88679
88838
  }
@@ -88683,7 +88842,7 @@ var ts;
88683
88842
  }
88684
88843
  // const enums and modules that contain only const enums are not considered values from the emit perspective
88685
88844
  // unless 'preserveConstEnums' option is set to true
88686
- return !!(target.flags & 111551 /* SymbolFlags.Value */) &&
88845
+ return !!(((_a = getAllSymbolFlags(target)) !== null && _a !== void 0 ? _a : -1) & 111551 /* SymbolFlags.Value */) &&
88687
88846
  (ts.shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target));
88688
88847
  }
88689
88848
  function isConstEnumOrConstEnumOnlyModule(s) {
@@ -88698,7 +88857,7 @@ var ts;
88698
88857
  }
88699
88858
  var target = getSymbolLinks(symbol).aliasTarget; // TODO: GH#18217
88700
88859
  if (target && ts.getEffectiveModifierFlags(node) & 1 /* ModifierFlags.Export */ &&
88701
- target.flags & 111551 /* SymbolFlags.Value */ &&
88860
+ getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */ &&
88702
88861
  (ts.shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target))) {
88703
88862
  // An `export import ... =` of a value symbol is always considered referenced
88704
88863
  return true;
@@ -98352,8 +98511,11 @@ var ts;
98352
98511
  }
98353
98512
  return ts.visitEachChild(node, visitor, context);
98354
98513
  case 174 /* SyntaxKind.GetAccessor */:
98514
+ return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitGetAccessorDeclaration, node);
98355
98515
  case 175 /* SyntaxKind.SetAccessor */:
98516
+ return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitSetAccessorDeclaration, node);
98356
98517
  case 173 /* SyntaxKind.Constructor */:
98518
+ return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitConstructorDeclaration, node);
98357
98519
  case 260 /* SyntaxKind.ClassDeclaration */:
98358
98520
  case 228 /* SyntaxKind.ClassExpression */:
98359
98521
  return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitDefault, node);
@@ -98454,6 +98616,9 @@ var ts;
98454
98616
  return ts.setOriginalNode(ts.setTextRange(factory.createYieldExpression(
98455
98617
  /*asteriskToken*/ undefined, ts.visitNode(node.expression, visitor, ts.isExpression)), node), node);
98456
98618
  }
98619
+ function visitConstructorDeclaration(node) {
98620
+ return factory.updateConstructorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), ts.visitParameterList(node.parameters, visitor, context), transformMethodBody(node));
98621
+ }
98457
98622
  /**
98458
98623
  * Visits a MethodDeclaration node.
98459
98624
  *
@@ -98468,7 +98633,14 @@ var ts;
98468
98633
  /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context),
98469
98634
  /*type*/ undefined, ts.getFunctionFlags(node) & 2 /* FunctionFlags.Async */
98470
98635
  ? transformAsyncFunctionBody(node)
98471
- : ts.visitFunctionBody(node.body, visitor, context));
98636
+ : transformMethodBody(node));
98637
+ }
98638
+ function visitGetAccessorDeclaration(node) {
98639
+ return factory.updateGetAccessorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, ts.visitParameterList(node.parameters, visitor, context),
98640
+ /*type*/ undefined, transformMethodBody(node));
98641
+ }
98642
+ function visitSetAccessorDeclaration(node) {
98643
+ return factory.updateSetAccessorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, ts.visitParameterList(node.parameters, visitor, context), transformMethodBody(node));
98472
98644
  }
98473
98645
  /**
98474
98646
  * Visits a FunctionDeclaration node.
@@ -98582,6 +98754,42 @@ var ts;
98582
98754
  }
98583
98755
  return false;
98584
98756
  }
98757
+ function transformMethodBody(node) {
98758
+ ts.Debug.assertIsDefined(node.body);
98759
+ var savedCapturedSuperProperties = capturedSuperProperties;
98760
+ var savedHasSuperElementAccess = hasSuperElementAccess;
98761
+ capturedSuperProperties = new ts.Set();
98762
+ hasSuperElementAccess = false;
98763
+ var updated = ts.visitFunctionBody(node.body, visitor, context);
98764
+ // Minor optimization, emit `_super` helper to capture `super` access in an arrow.
98765
+ // This step isn't needed if we eventually transform this to ES5.
98766
+ var originalMethod = ts.getOriginalNode(node, ts.isFunctionLikeDeclaration);
98767
+ var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ &&
98768
+ resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */ | 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) &&
98769
+ (ts.getFunctionFlags(originalMethod) & 3 /* FunctionFlags.AsyncGenerator */) !== 3 /* FunctionFlags.AsyncGenerator */;
98770
+ if (emitSuperHelpers) {
98771
+ enableSubstitutionForAsyncMethodsWithSuper();
98772
+ if (capturedSuperProperties.size) {
98773
+ var variableStatement = createSuperAccessVariableStatement(factory, resolver, node, capturedSuperProperties);
98774
+ substitutedSuperAccessors[ts.getNodeId(variableStatement)] = true;
98775
+ var statements = updated.statements.slice();
98776
+ ts.insertStatementsAfterStandardPrologue(statements, [variableStatement]);
98777
+ updated = factory.updateBlock(updated, statements);
98778
+ }
98779
+ if (hasSuperElementAccess) {
98780
+ // Emit helpers for super element access expressions (`super[x]`).
98781
+ if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) {
98782
+ ts.addEmitHelper(updated, ts.advancedAsyncSuperHelper);
98783
+ }
98784
+ else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) {
98785
+ ts.addEmitHelper(updated, ts.asyncSuperHelper);
98786
+ }
98787
+ }
98788
+ }
98789
+ capturedSuperProperties = savedCapturedSuperProperties;
98790
+ hasSuperElementAccess = savedHasSuperElementAccess;
98791
+ return updated;
98792
+ }
98585
98793
  function transformAsyncFunctionBody(node) {
98586
98794
  resumeLexicalEnvironment();
98587
98795
  var original = ts.getOriginalNode(node, ts.isFunctionLike);
@@ -98614,7 +98822,7 @@ var ts;
98614
98822
  ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
98615
98823
  // Minor optimization, emit `_super` helper to capture `super` access in an arrow.
98616
98824
  // This step isn't needed if we eventually transform this to ES5.
98617
- var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */ | 2048 /* NodeCheckFlags.AsyncMethodWithSuper */);
98825
+ var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */ | 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */);
98618
98826
  if (emitSuperHelpers) {
98619
98827
  enableSubstitutionForAsyncMethodsWithSuper();
98620
98828
  if (capturedSuperProperties.size) {
@@ -98627,10 +98835,10 @@ var ts;
98627
98835
  ts.setTextRange(block, node.body);
98628
98836
  if (emitSuperHelpers && hasSuperElementAccess) {
98629
98837
  // Emit helpers for super element access expressions (`super[x]`).
98630
- if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) {
98838
+ if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) {
98631
98839
  ts.addEmitHelper(block, ts.advancedAsyncSuperHelper);
98632
98840
  }
98633
- else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.AsyncMethodWithSuper */) {
98841
+ else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) {
98634
98842
  ts.addEmitHelper(block, ts.asyncSuperHelper);
98635
98843
  }
98636
98844
  }
@@ -98702,7 +98910,7 @@ var ts;
98702
98910
  // If we need to support substitutions for `super` in an async method,
98703
98911
  // we should track it here.
98704
98912
  if (enabledSubstitutions & 1 /* ES2017SubstitutionFlags.AsyncMethodsWithSuper */ && isSuperContainer(node)) {
98705
- var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.AsyncMethodWithSuper */ | 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */);
98913
+ var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */ | 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */);
98706
98914
  if (superContainerFlags !== enclosingSuperContainerFlags) {
98707
98915
  var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags;
98708
98916
  enclosingSuperContainerFlags = superContainerFlags;
@@ -98779,7 +98987,7 @@ var ts;
98779
98987
  || kind === 175 /* SyntaxKind.SetAccessor */;
98780
98988
  }
98781
98989
  function createSuperElementAccessInAsyncMethod(argumentExpression, location) {
98782
- if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) {
98990
+ if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) {
98783
98991
  return ts.setTextRange(factory.createPropertyAccessExpression(factory.createCallExpression(factory.createUniqueName("_superIndex", 16 /* GeneratedIdentifierFlags.Optimistic */ | 32 /* GeneratedIdentifierFlags.FileLevel */),
98784
98992
  /*typeArguments*/ undefined, [argumentExpression]), "value"), location);
98785
98993
  }
@@ -98794,7 +99002,7 @@ var ts;
98794
99002
  function createSuperAccessVariableStatement(factory, resolver, node, names) {
98795
99003
  // Create a variable declaration with a getter/setter (if binding) definition for each name:
98796
99004
  // const _super = Object.create(null, { x: { get: () => super.x, set: (v) => super.x = v }, ... });
98797
- var hasBinding = (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) !== 0;
99005
+ var hasBinding = (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) !== 0;
98798
99006
  var accessors = [];
98799
99007
  names.forEach(function (_, key) {
98800
99008
  var name = ts.unescapeLeadingUnderscores(key);
@@ -99287,11 +99495,22 @@ var ts;
99287
99495
  }
99288
99496
  return node;
99289
99497
  }
99290
- function convertForOfStatementHead(node, boundValue) {
99291
- var binding = ts.createForOfBindingStatement(factory, node.initializer, boundValue);
99498
+ function convertForOfStatementHead(node, boundValue, nonUserCode) {
99499
+ var value = factory.createTempVariable(hoistVariableDeclaration);
99500
+ var iteratorValueExpression = factory.createAssignment(value, boundValue);
99501
+ var iteratorValueStatement = factory.createExpressionStatement(iteratorValueExpression);
99502
+ ts.setSourceMapRange(iteratorValueStatement, node.expression);
99503
+ var exitNonUserCodeExpression = factory.createAssignment(nonUserCode, factory.createFalse());
99504
+ var exitNonUserCodeStatement = factory.createExpressionStatement(exitNonUserCodeExpression);
99505
+ ts.setSourceMapRange(exitNonUserCodeStatement, node.expression);
99506
+ var enterNonUserCodeExpression = factory.createAssignment(nonUserCode, factory.createTrue());
99507
+ var enterNonUserCodeStatement = factory.createExpressionStatement(enterNonUserCodeExpression);
99508
+ ts.setSourceMapRange(exitNonUserCodeStatement, node.expression);
99509
+ var statements = [];
99510
+ var binding = ts.createForOfBindingStatement(factory, node.initializer, value);
99511
+ statements.push(ts.visitNode(binding, visitor, ts.isStatement));
99292
99512
  var bodyLocation;
99293
99513
  var statementsLocation;
99294
- var statements = [ts.visitNode(binding, visitor, ts.isStatement)];
99295
99514
  var statement = ts.visitIterationBody(node.statement, visitor, context);
99296
99515
  if (ts.isBlock(statement)) {
99297
99516
  ts.addRange(statements, statement.statements);
@@ -99301,8 +99520,16 @@ var ts;
99301
99520
  else {
99302
99521
  statements.push(statement);
99303
99522
  }
99304
- return ts.setEmitFlags(ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), statementsLocation),
99523
+ var body = ts.setEmitFlags(ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), statementsLocation),
99305
99524
  /*multiLine*/ true), bodyLocation), 48 /* EmitFlags.NoSourceMap */ | 384 /* EmitFlags.NoTokenSourceMaps */);
99525
+ return factory.createBlock([
99526
+ iteratorValueStatement,
99527
+ exitNonUserCodeStatement,
99528
+ factory.createTryStatement(body,
99529
+ /*catchClause*/ undefined, factory.createBlock([
99530
+ enterNonUserCodeStatement
99531
+ ]))
99532
+ ]);
99306
99533
  }
99307
99534
  function createDownlevelAwait(expression) {
99308
99535
  return enclosingFunctionFlags & 1 /* FunctionFlags.Generator */
@@ -99313,6 +99540,8 @@ var ts;
99313
99540
  var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
99314
99541
  var iterator = ts.isIdentifier(expression) ? factory.getGeneratedNameForNode(expression) : factory.createTempVariable(/*recordTempVariable*/ undefined);
99315
99542
  var result = ts.isIdentifier(expression) ? factory.getGeneratedNameForNode(iterator) : factory.createTempVariable(/*recordTempVariable*/ undefined);
99543
+ var nonUserCode = factory.createTempVariable(/*recordTempVariable*/ undefined);
99544
+ var done = factory.createTempVariable(hoistVariableDeclaration);
99316
99545
  var errorRecord = factory.createUniqueName("e");
99317
99546
  var catchVariable = factory.getGeneratedNameForNode(errorRecord);
99318
99547
  var returnMethod = factory.createTempVariable(/*recordTempVariable*/ undefined);
@@ -99329,12 +99558,17 @@ var ts;
99329
99558
  callValues;
99330
99559
  var forStatement = ts.setEmitFlags(ts.setTextRange(factory.createForStatement(
99331
99560
  /*initializer*/ ts.setEmitFlags(ts.setTextRange(factory.createVariableDeclarationList([
99561
+ factory.createVariableDeclaration(nonUserCode, /*exclamationToken*/ undefined, /*type*/ undefined, factory.createTrue()),
99332
99562
  ts.setTextRange(factory.createVariableDeclaration(iterator, /*exclamationToken*/ undefined, /*type*/ undefined, initializer), node.expression),
99333
99563
  factory.createVariableDeclaration(result)
99334
99564
  ]), node.expression), 2097152 /* EmitFlags.NoHoisting */),
99335
- /*condition*/ factory.createComma(factory.createAssignment(result, createDownlevelAwait(callNext)), factory.createLogicalNot(getDone)),
99565
+ /*condition*/ factory.inlineExpressions([
99566
+ factory.createAssignment(result, createDownlevelAwait(callNext)),
99567
+ factory.createAssignment(done, getDone),
99568
+ factory.createLogicalNot(done)
99569
+ ]),
99336
99570
  /*incrementor*/ undefined,
99337
- /*statement*/ convertForOfStatementHead(node, getValue)),
99571
+ /*statement*/ convertForOfStatementHead(node, getValue, nonUserCode)),
99338
99572
  /*location*/ node), 256 /* EmitFlags.NoTokenTrailingSourceMaps */);
99339
99573
  ts.setOriginalNode(forStatement, node);
99340
99574
  return factory.createTryStatement(factory.createBlock([
@@ -99346,7 +99580,7 @@ var ts;
99346
99580
  ]), 1 /* EmitFlags.SingleLine */)), factory.createBlock([
99347
99581
  factory.createTryStatement(
99348
99582
  /*tryBlock*/ factory.createBlock([
99349
- ts.setEmitFlags(factory.createIfStatement(factory.createLogicalAnd(factory.createLogicalAnd(result, factory.createLogicalNot(getDone)), factory.createAssignment(returnMethod, factory.createPropertyAccessExpression(iterator, "return"))), factory.createExpressionStatement(createDownlevelAwait(callReturn))), 1 /* EmitFlags.SingleLine */)
99583
+ ts.setEmitFlags(factory.createIfStatement(factory.createLogicalAnd(factory.createLogicalAnd(factory.createLogicalNot(nonUserCode), factory.createLogicalNot(done)), factory.createAssignment(returnMethod, factory.createPropertyAccessExpression(iterator, "return"))), factory.createExpressionStatement(createDownlevelAwait(callReturn))), 1 /* EmitFlags.SingleLine */)
99350
99584
  ]),
99351
99585
  /*catchClause*/ undefined,
99352
99586
  /*finallyBlock*/ ts.setEmitFlags(factory.createBlock([
@@ -99502,7 +99736,7 @@ var ts;
99502
99736
  /*type*/ undefined, factory.updateBlock(node.body, ts.visitLexicalEnvironment(node.body.statements, visitor, context, statementOffset))), !!(hierarchyFacts & 1 /* HierarchyFacts.HasLexicalThis */)));
99503
99737
  // Minor optimization, emit `_super` helper to capture `super` access in an arrow.
99504
99738
  // This step isn't needed if we eventually transform this to ES5.
99505
- var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */ | 2048 /* NodeCheckFlags.AsyncMethodWithSuper */);
99739
+ var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */ | 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */);
99506
99740
  if (emitSuperHelpers) {
99507
99741
  enableSubstitutionForAsyncMethodsWithSuper();
99508
99742
  var variableStatement = ts.createSuperAccessVariableStatement(factory, resolver, node, capturedSuperProperties);
@@ -99513,10 +99747,10 @@ var ts;
99513
99747
  ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
99514
99748
  var block = factory.updateBlock(node.body, statements);
99515
99749
  if (emitSuperHelpers && hasSuperElementAccess) {
99516
- if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) {
99750
+ if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) {
99517
99751
  ts.addEmitHelper(block, ts.advancedAsyncSuperHelper);
99518
99752
  }
99519
- else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.AsyncMethodWithSuper */) {
99753
+ else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) {
99520
99754
  ts.addEmitHelper(block, ts.asyncSuperHelper);
99521
99755
  }
99522
99756
  }
@@ -99645,7 +99879,7 @@ var ts;
99645
99879
  // If we need to support substitutions for `super` in an async method,
99646
99880
  // we should track it here.
99647
99881
  if (enabledSubstitutions & 1 /* ESNextSubstitutionFlags.AsyncMethodsWithSuper */ && isSuperContainer(node)) {
99648
- var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.AsyncMethodWithSuper */ | 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */);
99882
+ var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */ | 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */);
99649
99883
  if (superContainerFlags !== enclosingSuperContainerFlags) {
99650
99884
  var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags;
99651
99885
  enclosingSuperContainerFlags = superContainerFlags;
@@ -99722,7 +99956,7 @@ var ts;
99722
99956
  || kind === 175 /* SyntaxKind.SetAccessor */;
99723
99957
  }
99724
99958
  function createSuperElementAccessInAsyncMethod(argumentExpression, location) {
99725
- if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) {
99959
+ if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) {
99726
99960
  return ts.setTextRange(factory.createPropertyAccessExpression(factory.createCallExpression(factory.createIdentifier("_superIndex"),
99727
99961
  /*typeArguments*/ undefined, [argumentExpression]), "value"), location);
99728
99962
  }
@@ -101191,11 +101425,13 @@ var ts;
101191
101425
  return ts.visitEachChild(node, visitorWithUnusedExpressionResult, context);
101192
101426
  }
101193
101427
  function visitIdentifier(node) {
101194
- if (!convertedLoopState) {
101195
- return node;
101428
+ if (convertedLoopState) {
101429
+ if (resolver.isArgumentsLocalBinding(node)) {
101430
+ return convertedLoopState.argumentsName || (convertedLoopState.argumentsName = factory.createUniqueName("arguments"));
101431
+ }
101196
101432
  }
101197
- if (resolver.isArgumentsLocalBinding(node)) {
101198
- return convertedLoopState.argumentsName || (convertedLoopState.argumentsName = factory.createUniqueName("arguments"));
101433
+ if (node.hasExtendedUnicodeEscape) {
101434
+ return ts.setOriginalNode(ts.setTextRange(factory.createIdentifier(ts.unescapeLeadingUnderscores(node.escapedText)), node), node);
101199
101435
  }
101200
101436
  return node;
101201
101437
  }
@@ -105342,7 +105578,6 @@ var ts;
105342
105578
  return node;
105343
105579
  }
105344
105580
  function transformAndEmitForInStatement(node) {
105345
- // TODO(rbuckton): Source map locations
105346
105581
  if (containsYield(node)) {
105347
105582
  // [source]
105348
105583
  // for (var p in o) {
@@ -105350,34 +105585,41 @@ var ts;
105350
105585
  // }
105351
105586
  //
105352
105587
  // [intermediate]
105353
- // .local _a, _b, _i
105354
- // _a = [];
105355
- // for (_b in o) _a.push(_b);
105588
+ // .local _b, _a, _c, _i
105589
+ // _b = [];
105590
+ // _a = o;
105591
+ // for (_c in _a) _b.push(_c);
105356
105592
  // _i = 0;
105357
105593
  // .loop incrementLabel, endLoopLabel
105358
105594
  // .mark conditionLabel
105359
- // .brfalse endLoopLabel, (_i < _a.length)
105360
- // p = _a[_i];
105595
+ // .brfalse endLoopLabel, (_i < _b.length)
105596
+ // _c = _b[_i];
105597
+ // .brfalse incrementLabel, (_c in _a)
105598
+ // p = _c;
105361
105599
  // /*body*/
105362
105600
  // .mark incrementLabel
105363
- // _b++;
105601
+ // _c++;
105364
105602
  // .br conditionLabel
105365
105603
  // .endloop
105366
105604
  // .mark endLoopLabel
105367
- var keysArray = declareLocal(); // _a
105368
- var key = declareLocal(); // _b
105605
+ var obj = declareLocal(); // _a
105606
+ var keysArray = declareLocal(); // _b
105607
+ var key = declareLocal(); // _c
105369
105608
  var keysIndex = factory.createLoopVariable(); // _i
105370
105609
  var initializer = node.initializer;
105371
105610
  hoistVariableDeclaration(keysIndex);
105611
+ emitAssignment(obj, ts.visitNode(node.expression, visitor, ts.isExpression));
105372
105612
  emitAssignment(keysArray, factory.createArrayLiteralExpression());
105373
- emitStatement(factory.createForInStatement(key, ts.visitNode(node.expression, visitor, ts.isExpression), factory.createExpressionStatement(factory.createCallExpression(factory.createPropertyAccessExpression(keysArray, "push"),
105613
+ emitStatement(factory.createForInStatement(key, obj, factory.createExpressionStatement(factory.createCallExpression(factory.createPropertyAccessExpression(keysArray, "push"),
105374
105614
  /*typeArguments*/ undefined, [key]))));
105375
105615
  emitAssignment(keysIndex, factory.createNumericLiteral(0));
105376
105616
  var conditionLabel = defineLabel();
105377
105617
  var incrementLabel = defineLabel();
105378
- var endLabel = beginLoopBlock(incrementLabel);
105618
+ var endLoopLabel = beginLoopBlock(incrementLabel);
105379
105619
  markLabel(conditionLabel);
105380
- emitBreakWhenFalse(endLabel, factory.createLessThan(keysIndex, factory.createPropertyAccessExpression(keysArray, "length")));
105620
+ emitBreakWhenFalse(endLoopLabel, factory.createLessThan(keysIndex, factory.createPropertyAccessExpression(keysArray, "length")));
105621
+ emitAssignment(key, factory.createElementAccessExpression(keysArray, keysIndex));
105622
+ emitBreakWhenFalse(incrementLabel, factory.createBinaryExpression(key, 101 /* SyntaxKind.InKeyword */, obj));
105381
105623
  var variable = void 0;
105382
105624
  if (ts.isVariableDeclarationList(initializer)) {
105383
105625
  for (var _i = 0, _a = initializer.declarations; _i < _a.length; _i++) {
@@ -105390,7 +105632,7 @@ var ts;
105390
105632
  variable = ts.visitNode(initializer, visitor, ts.isExpression);
105391
105633
  ts.Debug.assert(ts.isLeftHandSideExpression(variable));
105392
105634
  }
105393
- emitAssignment(variable, factory.createElementAccessExpression(keysArray, keysIndex));
105635
+ emitAssignment(variable, key);
105394
105636
  transformAndEmitEmbeddedStatement(node.statement);
105395
105637
  markLabel(incrementLabel);
105396
105638
  emitStatement(factory.createExpressionStatement(factory.createPostfixIncrement(keysIndex)));
@@ -107231,7 +107473,7 @@ var ts;
107231
107473
  return createImportCallExpressionUMD(argument !== null && argument !== void 0 ? argument : factory.createVoidZero(), containsLexicalThis);
107232
107474
  case ts.ModuleKind.CommonJS:
107233
107475
  default:
107234
- return createImportCallExpressionCommonJS(argument, containsLexicalThis);
107476
+ return createImportCallExpressionCommonJS(argument);
107235
107477
  }
107236
107478
  }
107237
107479
  function createImportCallExpressionUMD(arg, containsLexicalThis) {
@@ -107254,7 +107496,7 @@ var ts;
107254
107496
  return factory.createConditionalExpression(
107255
107497
  /*condition*/ factory.createIdentifier("__syncRequire"),
107256
107498
  /*questionToken*/ undefined,
107257
- /*whenTrue*/ createImportCallExpressionCommonJS(arg, containsLexicalThis),
107499
+ /*whenTrue*/ createImportCallExpressionCommonJS(arg),
107258
107500
  /*colonToken*/ undefined,
107259
107501
  /*whenFalse*/ createImportCallExpressionAMD(argClone, containsLexicalThis));
107260
107502
  }
@@ -107263,7 +107505,7 @@ var ts;
107263
107505
  return factory.createComma(factory.createAssignment(temp, arg), factory.createConditionalExpression(
107264
107506
  /*condition*/ factory.createIdentifier("__syncRequire"),
107265
107507
  /*questionToken*/ undefined,
107266
- /*whenTrue*/ createImportCallExpressionCommonJS(temp, containsLexicalThis),
107508
+ /*whenTrue*/ createImportCallExpressionCommonJS(temp, /* isInlineable */ true),
107267
107509
  /*colonToken*/ undefined,
107268
107510
  /*whenFalse*/ createImportCallExpressionAMD(temp, containsLexicalThis)));
107269
107511
  }
@@ -107313,14 +107555,20 @@ var ts;
107313
107555
  }
107314
107556
  return promise;
107315
107557
  }
107316
- function createImportCallExpressionCommonJS(arg, containsLexicalThis) {
107317
- // import("./blah")
107558
+ function createImportCallExpressionCommonJS(arg, isInlineable) {
107559
+ // import(x)
107318
107560
  // emit as
107319
- // Promise.resolve().then(function () { return require(x); }) /*CommonJs Require*/
107561
+ // var _a;
107562
+ // (_a = x, Promise.resolve().then(() => require(_a)) /*CommonJs Require*/
107320
107563
  // We have to wrap require in then callback so that require is done in asynchronously
107321
107564
  // if we simply do require in resolve callback in Promise constructor. We will execute the loading immediately
107322
- var promiseResolveCall = factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Promise"), "resolve"), /*typeArguments*/ undefined, /*argumentsArray*/ []);
107323
- var requireCall = factory.createCallExpression(factory.createIdentifier("require"), /*typeArguments*/ undefined, arg ? [arg] : []);
107565
+ // If the arg is not inlineable, we have to evaluate it in the current scope with a temp var
107566
+ var temp = arg && !ts.isSimpleInlineableExpression(arg) && !isInlineable ? factory.createTempVariable(hoistVariableDeclaration) : undefined;
107567
+ var promiseResolveCall = factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Promise"), "resolve"),
107568
+ /*typeArguments*/ undefined,
107569
+ /*argumentsArray*/ []);
107570
+ var requireCall = factory.createCallExpression(factory.createIdentifier("require"),
107571
+ /*typeArguments*/ undefined, temp ? [temp] : arg ? [arg] : []);
107324
107572
  if (ts.getESModuleInterop(compilerOptions)) {
107325
107573
  requireCall = emitHelpers().createImportStarHelper(requireCall);
107326
107574
  }
@@ -107341,14 +107589,9 @@ var ts;
107341
107589
  /*typeParameters*/ undefined,
107342
107590
  /*parameters*/ [],
107343
107591
  /*type*/ undefined, factory.createBlock([factory.createReturnStatement(requireCall)]));
107344
- // if there is a lexical 'this' in the import call arguments, ensure we indicate
107345
- // that this new function expression indicates it captures 'this' so that the
107346
- // es2015 transformer will properly substitute 'this' with '_this'.
107347
- if (containsLexicalThis) {
107348
- ts.setEmitFlags(func, 8 /* EmitFlags.CapturesThis */);
107349
- }
107350
107592
  }
107351
- return factory.createCallExpression(factory.createPropertyAccessExpression(promiseResolveCall, "then"), /*typeArguments*/ undefined, [func]);
107593
+ var downleveledImport = factory.createCallExpression(factory.createPropertyAccessExpression(promiseResolveCall, "then"), /*typeArguments*/ undefined, [func]);
107594
+ return temp === undefined ? downleveledImport : factory.createCommaListExpression([factory.createAssignment(temp, arg), downleveledImport]);
107352
107595
  }
107353
107596
  function getHelperExpressionForExport(node, innerExpr) {
107354
107597
  if (!ts.getESModuleInterop(compilerOptions) || ts.getEmitFlags(node) & 67108864 /* EmitFlags.NeverApplyImportHelper */) {
@@ -118341,14 +118584,16 @@ var ts;
118341
118584
  }
118342
118585
  return setReadFileCache(key, fileName);
118343
118586
  };
118344
- var getSourceFileWithCache = getSourceFile ? function (fileName, languageVersion, onError, shouldCreateNewSourceFile) {
118587
+ var getSourceFileWithCache = getSourceFile ? function (fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile) {
118345
118588
  var key = toPath(fileName);
118346
- var value = sourceFileCache.get(key);
118589
+ var impliedNodeFormat = typeof languageVersionOrOptions === "object" ? languageVersionOrOptions.impliedNodeFormat : undefined;
118590
+ var forImpliedNodeFormat = sourceFileCache.get(impliedNodeFormat);
118591
+ var value = forImpliedNodeFormat === null || forImpliedNodeFormat === void 0 ? void 0 : forImpliedNodeFormat.get(key);
118347
118592
  if (value)
118348
118593
  return value;
118349
- var sourceFile = getSourceFile(fileName, languageVersion, onError, shouldCreateNewSourceFile);
118594
+ var sourceFile = getSourceFile(fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile);
118350
118595
  if (sourceFile && (ts.isDeclarationFileName(fileName) || ts.fileExtensionIs(fileName, ".json" /* Extension.Json */))) {
118351
- sourceFileCache.set(key, sourceFile);
118596
+ sourceFileCache.set(impliedNodeFormat, (forImpliedNodeFormat || new ts.Map()).set(key, sourceFile));
118352
118597
  }
118353
118598
  return sourceFile;
118354
118599
  } : undefined;
@@ -118373,13 +118618,15 @@ var ts;
118373
118618
  var value = readFileCache.get(key);
118374
118619
  if (value !== undefined && value !== data) {
118375
118620
  readFileCache.delete(key);
118376
- sourceFileCache.delete(key);
118621
+ sourceFileCache.forEach(function (map) { return map.delete(key); });
118377
118622
  }
118378
118623
  else if (getSourceFileWithCache) {
118379
- var sourceFile = sourceFileCache.get(key);
118380
- if (sourceFile && sourceFile.text !== data) {
118381
- sourceFileCache.delete(key);
118382
- }
118624
+ sourceFileCache.forEach(function (map) {
118625
+ var sourceFile = map.get(key);
118626
+ if (sourceFile && sourceFile.text !== data) {
118627
+ map.delete(key);
118628
+ }
118629
+ });
118383
118630
  }
118384
118631
  originalWriteFile.call.apply(originalWriteFile, __spreadArray([host, fileName, data], rest, false));
118385
118632
  };
@@ -122521,10 +122768,16 @@ var ts;
122521
122768
  var oldCompilerOptions = useOldState ? oldState.compilerOptions : undefined;
122522
122769
  var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile &&
122523
122770
  !ts.compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions);
122771
+ // We can only reuse emit signatures (i.e. .d.ts signatures) if the .d.ts file is unchanged,
122772
+ // which will eg be depedent on change in options like declarationDir and outDir options are unchanged.
122773
+ // We need to look in oldState.compilerOptions, rather than oldCompilerOptions (i.e.we need to disregard useOldState) because
122774
+ // oldCompilerOptions can be undefined if there was change in say module from None to some other option
122775
+ // which would make useOldState as false since we can now use reference maps that are needed to track what to emit, what to check etc
122776
+ // but that option change does not affect d.ts file name so emitSignatures should still be reused.
122524
122777
  var canCopyEmitSignatures = compilerOptions.composite &&
122525
122778
  (oldState === null || oldState === void 0 ? void 0 : oldState.emitSignatures) &&
122526
122779
  !outFilePath &&
122527
- !ts.compilerOptionsAffectDeclarationPath(compilerOptions, oldCompilerOptions);
122780
+ !ts.compilerOptionsAffectDeclarationPath(compilerOptions, oldState.compilerOptions);
122528
122781
  if (useOldState) {
122529
122782
  // Copy old state's changed files set
122530
122783
  (_a = oldState.changedFilesSet) === null || _a === void 0 ? void 0 : _a.forEach(function (value) { return state.changedFilesSet.add(value); });
@@ -123739,7 +123992,7 @@ var ts;
123739
123992
  var isNonDirectorySeparatorRoot = rootLength > 1 || dirPath.charCodeAt(0) !== 47 /* CharacterCodes.slash */;
123740
123993
  if (isNonDirectorySeparatorRoot &&
123741
123994
  dirPath.search(/[a-zA-Z]:/) !== 0 && // Non dos style paths
123742
- pathPartForUserCheck.search(/[a-zA-z]\$\//) === 0) { // Dos style nextPart
123995
+ pathPartForUserCheck.search(/[a-zA-Z]\$\//) === 0) { // Dos style nextPart
123743
123996
  nextDirectorySeparator = dirPath.indexOf(ts.directorySeparator, nextDirectorySeparator + 1);
123744
123997
  if (nextDirectorySeparator === -1) {
123745
123998
  // ignore "//vda1cs4850/c$/folderAtRoot"
@@ -124993,7 +125246,7 @@ var ts;
124993
125246
  });
124994
125247
  // Sort by paths closest to importing file Name directory
124995
125248
  var sortedPaths = [];
124996
- var _loop_36 = function (directory) {
125249
+ var _loop_35 = function (directory) {
124997
125250
  var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
124998
125251
  var pathsInDirectory;
124999
125252
  allFileNames.forEach(function (_a, fileName) {
@@ -125017,9 +125270,9 @@ var ts;
125017
125270
  };
125018
125271
  var out_directory_1;
125019
125272
  for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
125020
- var state_12 = _loop_36(directory);
125273
+ var state_11 = _loop_35(directory);
125021
125274
  directory = out_directory_1;
125022
- if (state_12 === "break")
125275
+ if (state_11 === "break")
125023
125276
  break;
125024
125277
  }
125025
125278
  if (allFileNames.size) {
@@ -125088,7 +125341,7 @@ var ts;
125088
125341
  }
125089
125342
  function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) {
125090
125343
  for (var key in paths) {
125091
- var _loop_37 = function (patternText_1) {
125344
+ var _loop_36 = function (patternText_1) {
125092
125345
  var pattern = ts.normalizePath(patternText_1);
125093
125346
  var indexOfStar = pattern.indexOf("*");
125094
125347
  // In module resolution, if `pattern` itself has an extension, a file with that extension is looked up directly,
@@ -125155,9 +125408,9 @@ var ts;
125155
125408
  };
125156
125409
  for (var _i = 0, _a = paths[key]; _i < _a.length; _i++) {
125157
125410
  var patternText_1 = _a[_i];
125158
- var state_13 = _loop_37(patternText_1);
125159
- if (typeof state_13 === "object")
125160
- return state_13.value;
125411
+ var state_12 = _loop_36(patternText_1);
125412
+ if (typeof state_12 === "object")
125413
+ return state_12.value;
125161
125414
  }
125162
125415
  }
125163
125416
  function validateEnding(_a) {
@@ -125245,15 +125498,21 @@ var ts;
125245
125498
  return undefined;
125246
125499
  }
125247
125500
  function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions) {
125248
- var normalizedTargetPath = getPathRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName);
125249
- if (normalizedTargetPath === undefined) {
125501
+ var normalizedTargetPaths = getPathsRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName);
125502
+ if (normalizedTargetPaths === undefined) {
125503
+ return undefined;
125504
+ }
125505
+ var normalizedSourcePaths = getPathsRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName);
125506
+ var relativePaths = ts.flatMap(normalizedSourcePaths, function (sourcePath) {
125507
+ return ts.map(normalizedTargetPaths, function (targetPath) { return ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(sourcePath, targetPath, getCanonicalFileName)); });
125508
+ });
125509
+ var shortest = ts.min(relativePaths, ts.compareNumberOfDirectorySeparators);
125510
+ if (!shortest) {
125250
125511
  return undefined;
125251
125512
  }
125252
- var normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName);
125253
- var relativePath = normalizedSourcePath !== undefined ? ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(normalizedSourcePath, normalizedTargetPath, getCanonicalFileName)) : normalizedTargetPath;
125254
125513
  return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs
125255
- ? removeExtensionAndIndexPostFix(relativePath, ending, compilerOptions)
125256
- : ts.removeFileExtension(relativePath);
125514
+ ? removeExtensionAndIndexPostFix(shortest, ending, compilerOptions)
125515
+ : ts.removeFileExtension(shortest);
125257
125516
  }
125258
125517
  function tryGetModuleNameAsNodeModule(_a, _b, importingSourceFile, host, options, userPreferences, packageNameOnly, overrideMode) {
125259
125518
  var path = _a.path, isRedirect = _a.isRedirect;
@@ -125390,8 +125649,8 @@ var ts;
125390
125649
  }
125391
125650
  }
125392
125651
  }
125393
- function getPathRelativeToRootDirs(path, rootDirs, getCanonicalFileName) {
125394
- return ts.firstDefined(rootDirs, function (rootDir) {
125652
+ function getPathsRelativeToRootDirs(path, rootDirs, getCanonicalFileName) {
125653
+ return ts.mapDefined(rootDirs, function (rootDir) {
125395
125654
  var relativePath = getRelativePathIfInDirectory(path, rootDir, getCanonicalFileName);
125396
125655
  return relativePath !== undefined && isPathRelativeToParent(relativePath) ? undefined : relativePath;
125397
125656
  });
@@ -127959,8 +128218,15 @@ var ts;
127959
128218
  }
127960
128219
  if (buildInfo.program) {
127961
128220
  // If there are pending changes that are not emitted, project is out of date
128221
+ // When there are syntax errors, changeFileSet will have list of files changed (irrespective of noEmit)
128222
+ // But in case of semantic error we need special treatment.
128223
+ // Checking presence of affectedFilesPendingEmit list is fast and good way to tell if there were semantic errors and file emit was blocked
128224
+ // But if noEmit is true, affectedFilesPendingEmit will have file list even if there are no semantic errors to preserve list of files to be emitted when running with noEmit false
128225
+ // So with noEmit set to true, check on semantic diagnostics needs to be explicit as oppose to when it is false when only files pending emit is sufficient
127962
128226
  if (((_a = buildInfo.program.changeFileSet) === null || _a === void 0 ? void 0 : _a.length) ||
127963
- (!project.options.noEmit && ((_b = buildInfo.program.affectedFilesPendingEmit) === null || _b === void 0 ? void 0 : _b.length))) {
128227
+ (!project.options.noEmit ?
128228
+ (_b = buildInfo.program.affectedFilesPendingEmit) === null || _b === void 0 ? void 0 : _b.length :
128229
+ ts.some(buildInfo.program.semanticDiagnosticsPerFile, ts.isArray))) {
127964
128230
  return {
127965
128231
  type: ts.UpToDateStatusType.OutOfDateBuildInfo,
127966
128232
  buildInfoFile: buildInfoPath