typescript 4.9.1-beta → 5.0.0-dev.20221101

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.
@@ -85,11 +85,11 @@ var ts;
85
85
  (function (ts) {
86
86
  // WARNING: The script `configurePrerelease.ts` uses a regexp to parse out these values.
87
87
  // If changing the text in this section, be sure to test `configurePrerelease` too.
88
- ts.versionMajorMinor = "4.9";
88
+ ts.versionMajorMinor = "5.0";
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, ".0-dev.20221101");
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);
@@ -40319,9 +40363,6 @@ var ts;
40319
40363
  name: "listFilesOnly",
40320
40364
  type: "boolean",
40321
40365
  category: ts.Diagnostics.Command_line_Options,
40322
- affectsSemanticDiagnostics: true,
40323
- affectsEmit: true,
40324
- affectsMultiFileEmitBuildInfo: true,
40325
40366
  isCommandLineOnly: true,
40326
40367
  description: ts.Diagnostics.Print_names_of_files_that_are_part_of_the_compilation_and_then_stop_processing,
40327
40368
  defaultValueDescription: false,
@@ -42049,12 +42090,14 @@ var ts;
42049
42090
  return config;
42050
42091
  }
42051
42092
  ts.convertToTSConfig = convertToTSConfig;
42093
+ /*@internal*/
42052
42094
  function optionMapToObject(optionMap) {
42053
42095
  return __assign({}, ts.arrayFrom(optionMap.entries()).reduce(function (prev, cur) {
42054
42096
  var _a;
42055
42097
  return (__assign(__assign({}, prev), (_a = {}, _a[cur[0]] = cur[1], _a)));
42056
42098
  }, {}));
42057
42099
  }
42100
+ ts.optionMapToObject = optionMapToObject;
42058
42101
  function filterSameAsDefaultInclude(specs) {
42059
42102
  if (!ts.length(specs))
42060
42103
  return undefined;
@@ -42103,9 +42146,11 @@ var ts;
42103
42146
  });
42104
42147
  }
42105
42148
  ts.getNameOfCompilerOptionValue = getNameOfCompilerOptionValue;
42149
+ /* @internal */
42106
42150
  function serializeCompilerOptions(options, pathOptions) {
42107
42151
  return serializeOptionBaseObject(options, getOptionsNameMap(), pathOptions);
42108
42152
  }
42153
+ ts.serializeCompilerOptions = serializeCompilerOptions;
42109
42154
  function serializeWatchOptions(options) {
42110
42155
  return serializeOptionBaseObject(options, getWatchOptionsNameMap());
42111
42156
  }
@@ -42209,12 +42254,23 @@ var ts;
42209
42254
  }
42210
42255
  function writeConfigurations() {
42211
42256
  // Filter applicable options to place in the file
42212
- var categorizedOptions = ts.createMultiMap();
42257
+ var categorizedOptions = new ts.Map();
42258
+ // Set allowed categories in order
42259
+ categorizedOptions.set(ts.Diagnostics.Projects, []);
42260
+ categorizedOptions.set(ts.Diagnostics.Language_and_Environment, []);
42261
+ categorizedOptions.set(ts.Diagnostics.Modules, []);
42262
+ categorizedOptions.set(ts.Diagnostics.JavaScript_Support, []);
42263
+ categorizedOptions.set(ts.Diagnostics.Emit, []);
42264
+ categorizedOptions.set(ts.Diagnostics.Interop_Constraints, []);
42265
+ categorizedOptions.set(ts.Diagnostics.Type_Checking, []);
42266
+ categorizedOptions.set(ts.Diagnostics.Completeness, []);
42213
42267
  for (var _i = 0, optionDeclarations_1 = ts.optionDeclarations; _i < optionDeclarations_1.length; _i++) {
42214
42268
  var option = optionDeclarations_1[_i];
42215
- var category = option.category;
42216
42269
  if (isAllowedOptionForOutput(option)) {
42217
- categorizedOptions.add(ts.getLocaleSpecificMessage(category), option);
42270
+ var listForCategory = categorizedOptions.get(option.category);
42271
+ if (!listForCategory)
42272
+ categorizedOptions.set(option.category, listForCategory = []);
42273
+ listForCategory.push(option);
42218
42274
  }
42219
42275
  }
42220
42276
  // Serialize all options and their descriptions
@@ -42225,7 +42281,7 @@ var ts;
42225
42281
  if (entries.length !== 0) {
42226
42282
  entries.push({ value: "" });
42227
42283
  }
42228
- entries.push({ value: "/* ".concat(category, " */") });
42284
+ entries.push({ value: "/* ".concat(ts.getLocaleSpecificMessage(category), " */") });
42229
42285
  for (var _i = 0, options_1 = options; _i < options_1.length; _i++) {
42230
42286
  var option = options_1[_i];
42231
42287
  var optionName = void 0;
@@ -44267,6 +44323,9 @@ var ts;
44267
44323
  requestContainingDirectory: containingDirectory,
44268
44324
  reportDiagnostic: function (diag) { return void diagnostics.push(diag); },
44269
44325
  };
44326
+ if (traceEnabled && ts.getEmitModuleResolutionKind(compilerOptions) >= ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) <= ts.ModuleResolutionKind.NodeNext) {
44327
+ trace(host, ts.Diagnostics.Resolving_in_0_mode_with_conditions_1, features & NodeResolutionFeatures.EsmMode ? "ESM" : "CJS", conditions.map(function (c) { return "'".concat(c, "'"); }).join(", "));
44328
+ }
44270
44329
  var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); });
44271
44330
  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
44331
  function tryResolve(extensions) {
@@ -44856,7 +44915,7 @@ var ts;
44856
44915
  }
44857
44916
  if (mainExport) {
44858
44917
  var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, subpath, scope, /*isImports*/ false);
44859
- return loadModuleFromTargetImportOrExport(mainExport, "", /*pattern*/ false);
44918
+ return loadModuleFromTargetImportOrExport(mainExport, "", /*pattern*/ false, ".");
44860
44919
  }
44861
44920
  }
44862
44921
  else if (allKeysStartWithDot(scope.contents.packageJsonContent.exports)) {
@@ -44936,7 +44995,7 @@ var ts;
44936
44995
  var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports);
44937
44996
  if (!ts.endsWith(moduleName, ts.directorySeparator) && moduleName.indexOf("*") === -1 && ts.hasProperty(lookupTable, moduleName)) {
44938
44997
  var target = lookupTable[moduleName];
44939
- return loadModuleFromTargetImportOrExport(target, /*subpath*/ "", /*pattern*/ false);
44998
+ return loadModuleFromTargetImportOrExport(target, /*subpath*/ "", /*pattern*/ false, moduleName);
44940
44999
  }
44941
45000
  var expandingKeys = ts.sort(ts.filter(ts.getOwnKeys(lookupTable), function (k) { return k.indexOf("*") !== -1 || ts.endsWith(k, "/"); }), comparePatternKeys);
44942
45001
  for (var _i = 0, expandingKeys_1 = expandingKeys; _i < expandingKeys_1.length; _i++) {
@@ -44945,17 +45004,17 @@ var ts;
44945
45004
  var target = lookupTable[potentialTarget];
44946
45005
  var starPos = potentialTarget.indexOf("*");
44947
45006
  var subpath = moduleName.substring(potentialTarget.substring(0, starPos).length, moduleName.length - (potentialTarget.length - 1 - starPos));
44948
- return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true);
45007
+ return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true, potentialTarget);
44949
45008
  }
44950
45009
  else if (ts.endsWith(potentialTarget, "*") && ts.startsWith(moduleName, potentialTarget.substring(0, potentialTarget.length - 1))) {
44951
45010
  var target = lookupTable[potentialTarget];
44952
45011
  var subpath = moduleName.substring(potentialTarget.length - 1);
44953
- return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true);
45012
+ return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true, potentialTarget);
44954
45013
  }
44955
45014
  else if (ts.startsWith(moduleName, potentialTarget)) {
44956
45015
  var target = lookupTable[potentialTarget];
44957
45016
  var subpath = moduleName.substring(potentialTarget.length);
44958
- return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ false);
45017
+ return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ false, potentialTarget);
44959
45018
  }
44960
45019
  }
44961
45020
  function matchesPatternWithTrailer(target, name) {
@@ -44972,7 +45031,7 @@ var ts;
44972
45031
  */
44973
45032
  function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports) {
44974
45033
  return loadModuleFromTargetImportOrExport;
44975
- function loadModuleFromTargetImportOrExport(target, subpath, pattern) {
45034
+ function loadModuleFromTargetImportOrExport(target, subpath, pattern, key) {
44976
45035
  if (typeof target === "string") {
44977
45036
  if (!pattern && subpath.length > 0 && !ts.endsWith(target, "/")) {
44978
45037
  if (state.traceEnabled) {
@@ -44983,6 +45042,8 @@ var ts;
44983
45042
  if (!ts.startsWith(target, "./")) {
44984
45043
  if (isImports && !ts.startsWith(target, "../") && !ts.startsWith(target, "/") && !ts.isRootedDiskPath(target)) {
44985
45044
  var combinedLookup = pattern ? target.replace(/\*/g, subpath) : target + subpath;
45045
+ traceIfEnabled(state, ts.Diagnostics.Using_0_subpath_1_with_target_2, "imports", key, combinedLookup);
45046
+ traceIfEnabled(state, ts.Diagnostics.Resolving_module_0_from_1, combinedLookup, scope.packageDirectory + "/");
44986
45047
  var result = nodeModuleNameResolverWorker(state.features, combinedLookup, scope.packageDirectory + "/", state.compilerOptions, state.host, cache, [extensions], redirectedReference);
44987
45048
  return toSearchResult(result.resolvedModule ? { path: result.resolvedModule.resolvedFileName, extension: result.resolvedModule.extension, packageId: result.resolvedModule.packageId, originalPath: result.resolvedModule.originalPath } : undefined);
44988
45049
  }
@@ -45009,6 +45070,9 @@ var ts;
45009
45070
  }
45010
45071
  return toSearchResult(/*value*/ undefined);
45011
45072
  }
45073
+ if (state.traceEnabled) {
45074
+ trace(state.host, ts.Diagnostics.Using_0_subpath_1_with_target_2, isImports ? "imports" : "exports", key, pattern ? target.replace(/\*/g, subpath) : target + subpath);
45075
+ }
45012
45076
  var finalPath = toAbsolutePath(pattern ? resolvedTarget.replace(/\*/g, subpath) : resolvedTarget + subpath);
45013
45077
  var inputLink = tryLoadInputFileForPath(finalPath, subpath, ts.combinePaths(scope.packageDirectory, "package.json"), isImports);
45014
45078
  if (inputLink)
@@ -45018,14 +45082,18 @@ var ts;
45018
45082
  else if (typeof target === "object" && target !== null) { // eslint-disable-line no-null/no-null
45019
45083
  if (!Array.isArray(target)) {
45020
45084
  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);
45085
+ var condition = _a[_i];
45086
+ if (condition === "default" || state.conditions.indexOf(condition) >= 0 || isApplicableVersionedTypesKey(state.conditions, condition)) {
45087
+ traceIfEnabled(state, ts.Diagnostics.Matched_0_condition_1, isImports ? "imports" : "exports", condition);
45088
+ var subTarget = target[condition];
45089
+ var result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern, key);
45025
45090
  if (result) {
45026
45091
  return result;
45027
45092
  }
45028
45093
  }
45094
+ else {
45095
+ traceIfEnabled(state, ts.Diagnostics.Saw_non_matching_condition_0, condition);
45096
+ }
45029
45097
  }
45030
45098
  return undefined;
45031
45099
  }
@@ -45038,7 +45106,7 @@ var ts;
45038
45106
  }
45039
45107
  for (var _b = 0, target_2 = target; _b < target_2.length; _b++) {
45040
45108
  var elem = target_2[_b];
45041
- var result = loadModuleFromTargetImportOrExport(elem, subpath, pattern);
45109
+ var result = loadModuleFromTargetImportOrExport(elem, subpath, pattern, key);
45042
45110
  if (result) {
45043
45111
  return result;
45044
45112
  }
@@ -45454,6 +45522,15 @@ var ts;
45454
45522
  function toSearchResult(value) {
45455
45523
  return value !== undefined ? { value: value } : undefined;
45456
45524
  }
45525
+ function traceIfEnabled(state, diagnostic) {
45526
+ var args = [];
45527
+ for (var _i = 2; _i < arguments.length; _i++) {
45528
+ args[_i - 2] = arguments[_i];
45529
+ }
45530
+ if (state.traceEnabled) {
45531
+ trace.apply(void 0, __spreadArray([state.host, diagnostic], args, false));
45532
+ }
45533
+ }
45457
45534
  })(ts || (ts = {}));
45458
45535
  /* @internal */
45459
45536
  var ts;
@@ -49045,8 +49122,6 @@ var ts;
49045
49122
  IntersectionState[IntersectionState["None"] = 0] = "None";
49046
49123
  IntersectionState[IntersectionState["Source"] = 1] = "Source";
49047
49124
  IntersectionState[IntersectionState["Target"] = 2] = "Target";
49048
- IntersectionState[IntersectionState["PropertyCheck"] = 4] = "PropertyCheck";
49049
- IntersectionState[IntersectionState["InPropertyCheck"] = 8] = "InPropertyCheck";
49050
49125
  })(IntersectionState || (IntersectionState = {}));
49051
49126
  var RecursionFlags;
49052
49127
  (function (RecursionFlags) {
@@ -49465,6 +49540,12 @@ var ts;
49465
49540
  getOptionalType: function () { return optionalType; },
49466
49541
  getPromiseType: function () { return getGlobalPromiseType(/*reportErrors*/ false); },
49467
49542
  getPromiseLikeType: function () { return getGlobalPromiseLikeType(/*reportErrors*/ false); },
49543
+ getAsyncIterableType: function () {
49544
+ var type = getGlobalAsyncIterableType(/*reportErrors*/ false);
49545
+ if (type === emptyGenericType)
49546
+ return undefined;
49547
+ return type;
49548
+ },
49468
49549
  isSymbolAccessible: isSymbolAccessible,
49469
49550
  isArrayType: isArrayType,
49470
49551
  isTupleType: isTupleType,
@@ -50302,9 +50383,9 @@ var ts;
50302
50383
  return symbol;
50303
50384
  }
50304
50385
  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) {
50386
+ var targetFlags = getAllSymbolFlags(symbol);
50387
+ // `targetFlags` will be `SymbolFlags.All` if an error occurred in alias resolution; this avoids cascading errors
50388
+ if (targetFlags & meaning) {
50308
50389
  return symbol;
50309
50390
  }
50310
50391
  }
@@ -50937,8 +51018,8 @@ var ts;
50937
51018
  !checkAndReportErrorForExtendingInterface(errorLocation) &&
50938
51019
  !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) &&
50939
51020
  !checkAndReportErrorForExportingPrimitiveType(errorLocation, name) &&
51021
+ !checkAndReportErrorForUsingNamespaceAsTypeOrValue(errorLocation, name, meaning) &&
50940
51022
  !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) &&
50941
- !checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) &&
50942
51023
  !checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) {
50943
51024
  var suggestion = void 0;
50944
51025
  var suggestedLib = void 0;
@@ -51025,7 +51106,7 @@ var ts;
51025
51106
  }
51026
51107
  }
51027
51108
  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);
51109
+ var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result, 111551 /* SymbolFlags.Value */);
51029
51110
  if (typeOnlyDeclaration) {
51030
51111
  var message = typeOnlyDeclaration.kind === 278 /* SyntaxKind.ExportSpecifier */
51031
51112
  ? ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type
@@ -51188,7 +51269,7 @@ var ts;
51188
51269
  return false;
51189
51270
  }
51190
51271
  function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) {
51191
- if (meaning & (111551 /* SymbolFlags.Value */ & ~1024 /* SymbolFlags.NamespaceModule */)) {
51272
+ if (meaning & 111551 /* SymbolFlags.Value */) {
51192
51273
  if (isPrimitiveTypeName(name)) {
51193
51274
  if (isExtendedByInterface(errorLocation)) {
51194
51275
  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 +51280,8 @@ var ts;
51199
51280
  return true;
51200
51281
  }
51201
51282
  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 */)) {
51283
+ var allFlags = symbol && getAllSymbolFlags(symbol);
51284
+ if (symbol && allFlags !== undefined && !(allFlags & 111551 /* SymbolFlags.Value */)) {
51203
51285
  var rawName = ts.unescapeLeadingUnderscores(name);
51204
51286
  if (isES2015OrLaterConstructorName(name)) {
51205
51287
  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 +51329,16 @@ var ts;
51247
51329
  }
51248
51330
  return false;
51249
51331
  }
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));
51332
+ function checkAndReportErrorForUsingNamespaceAsTypeOrValue(errorLocation, name, meaning) {
51333
+ if (meaning & (111551 /* SymbolFlags.Value */ & ~788968 /* SymbolFlags.Type */)) {
51334
+ var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 /* SymbolFlags.NamespaceModule */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
51253
51335
  if (symbol) {
51254
51336
  error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_value, ts.unescapeLeadingUnderscores(name));
51255
51337
  return true;
51256
51338
  }
51257
51339
  }
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));
51340
+ else if (meaning & (788968 /* SymbolFlags.Type */ & ~111551 /* SymbolFlags.Value */)) {
51341
+ var symbol = resolveSymbol(resolveName(errorLocation, name, 1536 /* SymbolFlags.Module */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
51260
51342
  if (symbol) {
51261
51343
  error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_type, ts.unescapeLeadingUnderscores(name));
51262
51344
  return true;
@@ -51846,6 +51928,52 @@ var ts;
51846
51928
  }
51847
51929
  return undefined;
51848
51930
  }
51931
+ /**
51932
+ * Gets combined flags of a `symbol` and all alias targets it resolves to. `resolveAlias`
51933
+ * is typically recursive over chains of aliases, but stops mid-chain if an alias is merged
51934
+ * with another exported symbol, e.g.
51935
+ * ```ts
51936
+ * // a.ts
51937
+ * export const a = 0;
51938
+ * // b.ts
51939
+ * export { a } from "./a";
51940
+ * export type a = number;
51941
+ * // c.ts
51942
+ * import { a } from "./b";
51943
+ * ```
51944
+ * Calling `resolveAlias` on the `a` in c.ts would stop at the merged symbol exported
51945
+ * from b.ts, even though there is still more alias to resolve. Consequently, if we were
51946
+ * trying to determine if the `a` in c.ts has a value meaning, looking at the flags on
51947
+ * the local symbol and on the symbol returned by `resolveAlias` is not enough.
51948
+ * @returns SymbolFlags.All if `symbol` is an alias that ultimately resolves to `unknown`;
51949
+ * combined flags of all alias targets otherwise.
51950
+ */
51951
+ function getAllSymbolFlags(symbol) {
51952
+ var flags = symbol.flags;
51953
+ var seenSymbols;
51954
+ while (symbol.flags & 2097152 /* SymbolFlags.Alias */) {
51955
+ var target = resolveAlias(symbol);
51956
+ if (target === unknownSymbol) {
51957
+ return 67108863 /* SymbolFlags.All */;
51958
+ }
51959
+ // Optimizations - try to avoid creating or adding to
51960
+ // `seenSymbols` if possible
51961
+ if (target === symbol || (seenSymbols === null || seenSymbols === void 0 ? void 0 : seenSymbols.has(target))) {
51962
+ break;
51963
+ }
51964
+ if (target.flags & 2097152 /* SymbolFlags.Alias */) {
51965
+ if (seenSymbols) {
51966
+ seenSymbols.add(target);
51967
+ }
51968
+ else {
51969
+ seenSymbols = new ts.Set([symbol, target]);
51970
+ }
51971
+ }
51972
+ flags |= target.flags;
51973
+ symbol = target;
51974
+ }
51975
+ return flags;
51976
+ }
51849
51977
  /**
51850
51978
  * Marks a symbol as type-only if its declaration is syntactically type-only.
51851
51979
  * If it is not itself marked type-only, but resolves to a type-only alias
@@ -51891,19 +52019,25 @@ var ts;
51891
52019
  return !!aliasDeclarationLinks.typeOnlyDeclaration;
51892
52020
  }
51893
52021
  /** Indicates that a symbol directly or indirectly resolves to a type-only import or export. */
51894
- function getTypeOnlyAliasDeclaration(symbol) {
52022
+ function getTypeOnlyAliasDeclaration(symbol, include) {
51895
52023
  if (!(symbol.flags & 2097152 /* SymbolFlags.Alias */)) {
51896
52024
  return undefined;
51897
52025
  }
51898
52026
  var links = getSymbolLinks(symbol);
51899
- return links.typeOnlyDeclaration || undefined;
52027
+ if (include === undefined) {
52028
+ return links.typeOnlyDeclaration || undefined;
52029
+ }
52030
+ if (links.typeOnlyDeclaration) {
52031
+ return getAllSymbolFlags(resolveAlias(links.typeOnlyDeclaration.symbol)) & include ? links.typeOnlyDeclaration : undefined;
52032
+ }
52033
+ return undefined;
51900
52034
  }
51901
52035
  function markExportAsReferenced(node) {
51902
52036
  var symbol = getSymbolOfNode(node);
51903
52037
  var target = resolveAlias(symbol);
51904
52038
  if (target) {
51905
52039
  var markAlias = target === unknownSymbol ||
51906
- ((target.flags & 111551 /* SymbolFlags.Value */) && !isConstEnumOrConstEnumOnlyModule(target) && !getTypeOnlyAliasDeclaration(symbol));
52040
+ ((getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */) && !isConstEnumOrConstEnumOnlyModule(target) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */));
51907
52041
  if (markAlias) {
51908
52042
  markAliasSymbolAsReferenced(symbol);
51909
52043
  }
@@ -51923,8 +52057,7 @@ var ts;
51923
52057
  // This way a chain of imports can be elided if ultimately the final input is only used in a type
51924
52058
  // position.
51925
52059
  if (ts.isInternalModuleImportEqualsDeclaration(node)) {
51926
- var target = resolveSymbol(symbol);
51927
- if (target === unknownSymbol || target.flags & 111551 /* SymbolFlags.Value */) {
52060
+ if (getAllSymbolFlags(resolveSymbol(symbol)) & 111551 /* SymbolFlags.Value */) {
51928
52061
  // import foo = <symbol>
51929
52062
  checkExpressionCached(node.moduleReference);
51930
52063
  }
@@ -52746,7 +52879,7 @@ var ts;
52746
52879
  }
52747
52880
  function symbolIsValue(symbol, includeTypeOnlyMembers) {
52748
52881
  return !!(symbol.flags & 111551 /* SymbolFlags.Value */ ||
52749
- symbol.flags & 2097152 /* SymbolFlags.Alias */ && resolveAlias(symbol).flags & 111551 /* SymbolFlags.Value */ && (includeTypeOnlyMembers || !getTypeOnlyAliasDeclaration(symbol)));
52882
+ symbol.flags & 2097152 /* SymbolFlags.Alias */ && getAllSymbolFlags(symbol) & 111551 /* SymbolFlags.Value */ && (includeTypeOnlyMembers || !getTypeOnlyAliasDeclaration(symbol)));
52750
52883
  }
52751
52884
  function findConstructorDeclaration(node) {
52752
52885
  var members = node.members;
@@ -53015,8 +53148,10 @@ var ts;
53015
53148
  return true;
53016
53149
  }
53017
53150
  // 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) {
53151
+ var shouldResolveAlias = (symbolFromSymbolTable.flags & 2097152 /* SymbolFlags.Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 278 /* SyntaxKind.ExportSpecifier */));
53152
+ symbolFromSymbolTable = shouldResolveAlias ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable;
53153
+ var flags = shouldResolveAlias ? getAllSymbolFlags(symbolFromSymbolTable) : symbolFromSymbolTable.flags;
53154
+ if (flags & meaning) {
53020
53155
  qualify = true;
53021
53156
  return true;
53022
53157
  }
@@ -55328,7 +55463,7 @@ var ts;
55328
55463
  // export {name} - look thru `statements` for `name`, and if all results can take an `export` modifier, do so and filter it
55329
55464
  var indices = ts.indicesOf(statements);
55330
55465
  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]); })) {
55466
+ if (ts.length(associatedIndices) && ts.every(associatedIndices, function (i) { return ts.canHaveExportModifier(statements[i]); })) {
55332
55467
  for (var _i = 0, associatedIndices_1 = associatedIndices; _i < associatedIndices_1.length; _i++) {
55333
55468
  var index_1 = associatedIndices_1[_i];
55334
55469
  statements[index_1] = addExportModifier(statements[index_1]);
@@ -55362,15 +55497,6 @@ var ts;
55362
55497
  }
55363
55498
  return statements;
55364
55499
  }
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
55500
  function addExportModifier(node) {
55375
55501
  var flags = (ts.getEffectiveModifierFlags(node) | 1 /* ModifierFlags.Export */) & ~2 /* ModifierFlags.Ambient */;
55376
55502
  return ts.factory.updateModifiers(node, flags);
@@ -55617,7 +55743,7 @@ var ts;
55617
55743
  (ts.isJSDocTypeAlias(context.enclosingDeclaration) ? ts.getSourceFileOfNode(context.enclosingDeclaration) : context.enclosingDeclaration);
55618
55744
  if (additionalModifierFlags & 1 /* ModifierFlags.Export */ &&
55619
55745
  enclosingDeclaration_1 && (isExportingScope(enclosingDeclaration_1) || ts.isModuleDeclaration(enclosingDeclaration_1)) &&
55620
- canHaveExportModifier(node)) {
55746
+ ts.canHaveExportModifier(node)) {
55621
55747
  // Classes, namespaces, variables, functions, interfaces, and types should all be `export`ed in a module context if not private
55622
55748
  newModifierFlags |= 1 /* ModifierFlags.Export */;
55623
55749
  }
@@ -55673,7 +55799,7 @@ var ts;
55673
55799
  return !symbol.exports ? [] : ts.filter(ts.arrayFrom(symbol.exports.values()), isNamespaceMember);
55674
55800
  }
55675
55801
  function isTypeOnlyNamespace(symbol) {
55676
- return ts.every(getNamespaceMembersForSerialization(symbol), function (m) { return !(resolveSymbol(m).flags & 111551 /* SymbolFlags.Value */); });
55802
+ return ts.every(getNamespaceMembersForSerialization(symbol), function (m) { return !(getAllSymbolFlags(resolveSymbol(m)) & 111551 /* SymbolFlags.Value */); });
55677
55803
  }
55678
55804
  function serializeModule(symbol, symbolName, modifierFlags) {
55679
55805
  var members = getNamespaceMembersForSerialization(symbol);
@@ -57587,16 +57713,32 @@ var ts;
57587
57713
  return getTypeFromTypeNode(typeNode);
57588
57714
  }
57589
57715
  }
57716
+ function isParameterOfContextSensitiveSignature(symbol) {
57717
+ var decl = symbol.valueDeclaration;
57718
+ if (!decl) {
57719
+ return false;
57720
+ }
57721
+ if (ts.isBindingElement(decl)) {
57722
+ decl = ts.walkUpBindingElementsAndPatterns(decl);
57723
+ }
57724
+ if (ts.isParameter(decl)) {
57725
+ return isContextSensitiveFunctionOrObjectLiteralMethod(decl.parent);
57726
+ }
57727
+ return false;
57728
+ }
57590
57729
  function getTypeOfVariableOrParameterOrProperty(symbol) {
57591
57730
  var links = getSymbolLinks(symbol);
57592
57731
  if (!links.type) {
57593
57732
  var type = getTypeOfVariableOrParameterOrPropertyWorker(symbol);
57594
57733
  // For a contextually typed parameter it is possible that a type has already
57595
57734
  // been assigned (in assignTypeToParameterAndFixTypeParameters), and we want
57596
- // to preserve this type.
57597
- if (!links.type) {
57735
+ // to preserve this type. In fact, we need to _prefer_ that type, but it won't
57736
+ // be assigned until contextual typing is complete, so we need to defer in
57737
+ // cases where contextual typing may take place.
57738
+ if (!links.type && !isParameterOfContextSensitiveSignature(symbol)) {
57598
57739
  links.type = type;
57599
57740
  }
57741
+ return type;
57600
57742
  }
57601
57743
  return links.type;
57602
57744
  }
@@ -57893,7 +58035,7 @@ var ts;
57893
58035
  links.type = (exportSymbol === null || exportSymbol === void 0 ? void 0 : exportSymbol.declarations) && isDuplicatedCommonJSExport(exportSymbol.declarations) && symbol.declarations.length ? getFlowTypeFromCommonJSExport(exportSymbol)
57894
58036
  : isDuplicatedCommonJSExport(symbol.declarations) ? autoType
57895
58037
  : declaredType ? declaredType
57896
- : targetSymbol.flags & 111551 /* SymbolFlags.Value */ ? getTypeOfSymbol(targetSymbol)
58038
+ : getAllSymbolFlags(targetSymbol) & 111551 /* SymbolFlags.Value */ ? getTypeOfSymbol(targetSymbol)
57897
58039
  : errorType;
57898
58040
  }
57899
58041
  return links.type;
@@ -59776,7 +59918,20 @@ var ts;
59776
59918
  return !!(ts.getObjectFlags(type) & 32 /* ObjectFlags.Mapped */ && getMappedTypeModifiers(type) & 4 /* MappedTypeModifiers.IncludeOptional */);
59777
59919
  }
59778
59920
  function isGenericMappedType(type) {
59779
- return !!(ts.getObjectFlags(type) & 32 /* ObjectFlags.Mapped */) && isGenericIndexType(getConstraintTypeFromMappedType(type));
59921
+ if (ts.getObjectFlags(type) & 32 /* ObjectFlags.Mapped */) {
59922
+ var constraint = getConstraintTypeFromMappedType(type);
59923
+ if (isGenericIndexType(constraint)) {
59924
+ return true;
59925
+ }
59926
+ // A mapped type is generic if the 'as' clause references generic types other than the iteration type.
59927
+ // To determine this, we substitute the constraint type (that we now know isn't generic) for the iteration
59928
+ // type and check whether the resulting type is generic.
59929
+ var nameType = getNameTypeFromMappedType(type);
59930
+ if (nameType && isGenericIndexType(instantiateType(nameType, makeUnaryTypeMapper(getTypeParameterFromMappedType(type), constraint)))) {
59931
+ return true;
59932
+ }
59933
+ }
59934
+ return false;
59780
59935
  }
59781
59936
  function resolveStructuredTypeMembers(type) {
59782
59937
  if (!type.members) {
@@ -60246,7 +60401,7 @@ var ts;
60246
60401
  var indexTypes;
60247
60402
  var isUnion = containingType.flags & 1048576 /* TypeFlags.Union */;
60248
60403
  // 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 */;
60404
+ var optionalFlag;
60250
60405
  var syntheticFlag = 4 /* CheckFlags.SyntheticMethod */;
60251
60406
  var checkFlags = isUnion ? 0 : 8 /* CheckFlags.Readonly */;
60252
60407
  var mergedInstantiations = false;
@@ -60257,11 +60412,14 @@ var ts;
60257
60412
  var prop = getPropertyOfType(type, name, skipObjectFunctionPropertyAugment);
60258
60413
  var modifiers = prop ? ts.getDeclarationModifierFlagsFromSymbol(prop) : 0;
60259
60414
  if (prop) {
60260
- if (isUnion) {
60261
- optionalFlag |= (prop.flags & 16777216 /* SymbolFlags.Optional */);
60262
- }
60263
- else {
60264
- optionalFlag &= prop.flags;
60415
+ if (prop.flags & 106500 /* SymbolFlags.ClassMember */) {
60416
+ optionalFlag !== null && optionalFlag !== void 0 ? optionalFlag : (optionalFlag = isUnion ? 0 /* SymbolFlags.None */ : 16777216 /* SymbolFlags.Optional */);
60417
+ if (isUnion) {
60418
+ optionalFlag |= (prop.flags & 16777216 /* SymbolFlags.Optional */);
60419
+ }
60420
+ else {
60421
+ optionalFlag &= prop.flags;
60422
+ }
60265
60423
  }
60266
60424
  if (!singleProp) {
60267
60425
  singleProp = prop;
@@ -60380,7 +60538,7 @@ var ts;
60380
60538
  propTypes.push(type);
60381
60539
  }
60382
60540
  ts.addRange(propTypes, indexTypes);
60383
- var result = createSymbol(4 /* SymbolFlags.Property */ | optionalFlag, name, syntheticFlag | checkFlags);
60541
+ var result = createSymbol(4 /* SymbolFlags.Property */ | (optionalFlag !== null && optionalFlag !== void 0 ? optionalFlag : 0), name, syntheticFlag | checkFlags);
60384
60542
  result.containingType = containingType;
60385
60543
  if (!hasNonUniformValueDeclaration && firstValueDeclaration) {
60386
60544
  result.valueDeclaration = firstValueDeclaration;
@@ -63093,8 +63251,14 @@ var ts;
63093
63251
  return getStringLiteralType(text);
63094
63252
  }
63095
63253
  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;
63254
+ if (ts.every(newTexts, function (t) { return t === ""; })) {
63255
+ if (ts.every(newTypes, function (t) { return !!(t.flags & 4 /* TypeFlags.String */); })) {
63256
+ return stringType;
63257
+ }
63258
+ // Normalize `${Mapping<xxx>}` into Mapping<xxx>
63259
+ if (newTypes.length === 1 && isPatternLiteralType(newTypes[0])) {
63260
+ return newTypes[0];
63261
+ }
63098
63262
  }
63099
63263
  var id = "".concat(getTypeListId(newTypes), "|").concat(ts.map(newTexts, function (t) { return t.length; }).join(","), "|").concat(newTexts.join(""));
63100
63264
  var type = templateLiteralTypes.get(id);
@@ -63153,12 +63317,14 @@ var ts;
63153
63317
  }
63154
63318
  function getStringMappingType(symbol, type) {
63155
63319
  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;
63320
+ type.flags & 128 /* TypeFlags.StringLiteral */ ? getStringLiteralType(applyStringMapping(symbol, type.value)) :
63321
+ type.flags & 134217728 /* TypeFlags.TemplateLiteral */ ? getTemplateLiteralType.apply(void 0, applyTemplateStringMapping(symbol, type.texts, type.types)) :
63322
+ // Mapping<Mapping<T>> === Mapping<T>
63323
+ type.flags & 268435456 /* TypeFlags.StringMapping */ && symbol === type.symbol ? type :
63324
+ type.flags & (1 /* TypeFlags.Any */ | 4 /* TypeFlags.String */ | 268435456 /* TypeFlags.StringMapping */) || isGenericIndexType(type) ? getStringMappingTypeForGenericType(symbol, type) :
63325
+ // This handles Mapping<`${number}`> and Mapping<`${bigint}`>
63326
+ isPatternLiteralPlaceholderType(type) ? getStringMappingTypeForGenericType(symbol, getTemplateLiteralType(["", ""], [type])) :
63327
+ type;
63162
63328
  }
63163
63329
  function applyStringMapping(symbol, str) {
63164
63330
  switch (intrinsicTypeKinds.get(symbol.escapedName)) {
@@ -63323,7 +63489,18 @@ var ts;
63323
63489
  return accessFlags & 1 /* AccessFlags.IncludeUndefined */ ? getUnionType([indexInfo.type, undefinedType]) : indexInfo.type;
63324
63490
  }
63325
63491
  errorIfWritingToReadonlyIndex(indexInfo);
63326
- return accessFlags & 1 /* AccessFlags.IncludeUndefined */ ? getUnionType([indexInfo.type, undefinedType]) : indexInfo.type;
63492
+ // When accessing an enum object with its own type,
63493
+ // e.g. E[E.A] for enum E { A }, undefined shouldn't
63494
+ // be included in the result type
63495
+ if ((accessFlags & 1 /* AccessFlags.IncludeUndefined */) &&
63496
+ !(objectType.symbol &&
63497
+ objectType.symbol.flags & (256 /* SymbolFlags.RegularEnum */ | 128 /* SymbolFlags.ConstEnum */) &&
63498
+ (indexType.symbol &&
63499
+ indexType.flags & 1024 /* TypeFlags.EnumLiteral */ &&
63500
+ getParentOfSymbol(indexType.symbol) === objectType.symbol))) {
63501
+ return getUnionType([indexInfo.type, undefinedType]);
63502
+ }
63503
+ return indexInfo.type;
63327
63504
  }
63328
63505
  if (indexType.flags & 131072 /* TypeFlags.Never */) {
63329
63506
  return neverType;
@@ -63426,10 +63603,11 @@ var ts;
63426
63603
  accessNode;
63427
63604
  }
63428
63605
  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));
63606
+ return !!(type.flags & (1 /* TypeFlags.Any */ | 4 /* TypeFlags.String */ | 8 /* TypeFlags.Number */ | 64 /* TypeFlags.BigInt */)) || isPatternLiteralType(type);
63430
63607
  }
63431
63608
  function isPatternLiteralType(type) {
63432
- return !!(type.flags & 134217728 /* TypeFlags.TemplateLiteral */) && ts.every(type.types, isPatternLiteralPlaceholderType);
63609
+ return !!(type.flags & 134217728 /* TypeFlags.TemplateLiteral */) && ts.every(type.types, isPatternLiteralPlaceholderType) ||
63610
+ !!(type.flags & 268435456 /* TypeFlags.StringMapping */) && isPatternLiteralPlaceholderType(type.type);
63433
63611
  }
63434
63612
  function isGenericType(type) {
63435
63613
  return !!getGenericObjectFlags(type);
@@ -63708,18 +63886,23 @@ var ts;
63708
63886
  var result;
63709
63887
  var extraTypes;
63710
63888
  var tailCount = 0;
63711
- var _loop_20 = function () {
63889
+ // We loop here for an immediately nested conditional type in the false position, effectively treating
63890
+ // types of the form 'A extends B ? X : C extends D ? Y : E extends F ? Z : ...' as a single construct for
63891
+ // purposes of resolution. We also loop here when resolution of a conditional type ends in resolution of
63892
+ // another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive
63893
+ // cases we increment the tail recursion counter and stop after 1000 iterations.
63894
+ while (true) {
63712
63895
  if (tailCount === 1000) {
63713
63896
  error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
63714
63897
  result = errorType;
63715
- return "break";
63898
+ break;
63716
63899
  }
63717
63900
  var isUnwrapped = isTypicalNondistributiveConditional(root);
63718
63901
  var checkType = instantiateType(unwrapNondistributiveConditionalTuple(root, getActualTypeVariable(root.checkType)), mapper);
63719
63902
  var checkTypeInstantiable = isGenericType(checkType);
63720
63903
  var extendsType = instantiateType(unwrapNondistributiveConditionalTuple(root, root.extendsType), mapper);
63721
63904
  if (checkType === wildcardType || extendsType === wildcardType) {
63722
- return { value: wildcardType };
63905
+ return wildcardType;
63723
63906
  }
63724
63907
  var combinedMapper = void 0;
63725
63908
  if (root.inferTypeParameters) {
@@ -63752,11 +63935,7 @@ var ts;
63752
63935
  }
63753
63936
  }
63754
63937
  }
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; })) {
63938
+ if (!checkTypeInstantiable) {
63760
63939
  // We don't want inferences from constraints as they may cause us to eagerly resolve the
63761
63940
  // conditional type instead of deferring resolution. Also, we always want strict function
63762
63941
  // types rules (i.e. proper contravariance) for inferences.
@@ -63788,14 +63967,14 @@ var ts;
63788
63967
  var newRoot = falseType_1.root;
63789
63968
  if (newRoot.node.parent === root.node && (!newRoot.isDistributive || newRoot.checkType === root.checkType)) {
63790
63969
  root = newRoot;
63791
- return "continue";
63970
+ continue;
63792
63971
  }
63793
63972
  if (canTailRecurse(falseType_1, mapper)) {
63794
- return "continue";
63973
+ continue;
63795
63974
  }
63796
63975
  }
63797
63976
  result = instantiateType(falseType_1, mapper);
63798
- return "break";
63977
+ break;
63799
63978
  }
63800
63979
  // Return trueType for a definitely true extends check. We check instantiations of the two
63801
63980
  // types with type parameters mapped to their restrictive form, i.e. a form of the type parameter
@@ -63806,10 +63985,10 @@ var ts;
63806
63985
  var trueType_1 = getTypeFromTypeNode(root.node.trueType);
63807
63986
  var trueMapper = combinedMapper || mapper;
63808
63987
  if (canTailRecurse(trueType_1, trueMapper)) {
63809
- return "continue";
63988
+ continue;
63810
63989
  }
63811
63990
  result = instantiateType(trueType_1, trueMapper);
63812
- return "break";
63991
+ break;
63813
63992
  }
63814
63993
  }
63815
63994
  // Return a deferred type for a check that is neither definitely true nor definitely false
@@ -63821,19 +64000,7 @@ var ts;
63821
64000
  result.combinedMapper = combinedMapper;
63822
64001
  result.aliasSymbol = aliasSymbol || root.aliasSymbol;
63823
64002
  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;
64003
+ break;
63837
64004
  }
63838
64005
  return extraTypes ? getUnionType(ts.append(extraTypes, result)) : result;
63839
64006
  // We tail-recurse for generic conditional types that (a) have not already been evaluated and cached, and
@@ -66287,7 +66454,7 @@ var ts;
66287
66454
  return 0 /* Ternary.False */;
66288
66455
  }
66289
66456
  }
66290
- var isPerformingCommonPropertyChecks = (relation !== comparableRelation || !(source.flags & 1048576 /* TypeFlags.Union */) && isLiteralType(source)) &&
66457
+ var isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source)) &&
66291
66458
  !(intersectionState & 2 /* IntersectionState.Target */) &&
66292
66459
  source.flags & (131068 /* TypeFlags.Primitive */ | 524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) && source !== globalObjectType &&
66293
66460
  target.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) && isWeakType(target) &&
@@ -66315,27 +66482,6 @@ var ts;
66315
66482
  var result_7 = skipCaching ?
66316
66483
  unionOrIntersectionRelatedTo(source, target, reportErrors, intersectionState) :
66317
66484
  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
66485
  if (result_7) {
66340
66486
  return result_7;
66341
66487
  }
@@ -66447,7 +66593,7 @@ var ts;
66447
66593
  reducedTarget = findMatchingDiscriminantType(source, target, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target);
66448
66594
  checkTypes = reducedTarget.flags & 1048576 /* TypeFlags.Union */ ? reducedTarget.types : [reducedTarget];
66449
66595
  }
66450
- var _loop_21 = function (prop) {
66596
+ var _loop_20 = function (prop) {
66451
66597
  if (shouldCheckAsExcessProperty(prop, source.symbol) && !isIgnoredJsxProperty(source, prop)) {
66452
66598
  if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) {
66453
66599
  if (reportErrors) {
@@ -66510,9 +66656,9 @@ var ts;
66510
66656
  };
66511
66657
  for (var _i = 0, _b = getPropertiesOfType(source); _i < _b.length; _i++) {
66512
66658
  var prop = _b[_i];
66513
- var state_7 = _loop_21(prop);
66514
- if (typeof state_7 === "object")
66515
- return state_7.value;
66659
+ var state_6 = _loop_20(prop);
66660
+ if (typeof state_6 === "object")
66661
+ return state_6.value;
66516
66662
  }
66517
66663
  return false;
66518
66664
  }
@@ -66733,8 +66879,7 @@ var ts;
66733
66879
  if (overflow) {
66734
66880
  return 0 /* Ternary.False */;
66735
66881
  }
66736
- var keyIntersectionState = intersectionState | (inPropertyCheck ? 8 /* IntersectionState.InPropertyCheck */ : 0);
66737
- var id = getRelationKey(source, target, keyIntersectionState, relation, /*ingnoreConstraints*/ false);
66882
+ var id = getRelationKey(source, target, intersectionState, relation, /*ingnoreConstraints*/ false);
66738
66883
  var entry = relation.get(id);
66739
66884
  if (entry !== undefined) {
66740
66885
  if (reportErrors && entry & 2 /* RelationComparisonResult.Failed */ && !(entry & 4 /* RelationComparisonResult.Reported */)) {
@@ -66764,7 +66909,7 @@ var ts;
66764
66909
  // A key that starts with "*" is an indication that we have type references that reference constrained
66765
66910
  // type parameters. For such keys we also check against the key we would have gotten if all type parameters
66766
66911
  // were unconstrained.
66767
- var broadestEquivalentId = id.startsWith("*") ? getRelationKey(source, target, keyIntersectionState, relation, /*ignoreConstraints*/ true) : undefined;
66912
+ var broadestEquivalentId = id.startsWith("*") ? getRelationKey(source, target, intersectionState, relation, /*ignoreConstraints*/ true) : undefined;
66768
66913
  for (var i = 0; i < maybeCount; i++) {
66769
66914
  // If source and target are already being compared, consider them related with assumptions
66770
66915
  if (id === maybeKeys[i] || broadestEquivalentId && broadestEquivalentId === maybeKeys[i]) {
@@ -66851,7 +66996,7 @@ var ts;
66851
66996
  function structuredTypeRelatedTo(source, target, reportErrors, intersectionState) {
66852
66997
  var saveErrorInfo = captureErrorCalculationState();
66853
66998
  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 */)) {
66999
+ if (relation !== identityRelation) {
66855
67000
  // The combined constraint of an intersection type is the intersection of the constraints of
66856
67001
  // the constituents. When an intersection type contains instantiable types with union type
66857
67002
  // constraints, there are situations where we need to examine the combined constraint. One is
@@ -66865,10 +67010,33 @@ var ts;
66865
67010
  // needs to have its constraint hoisted into an intersection with said type parameter, this way
66866
67011
  // the type param can be compared with itself in the target (with the influence of its constraint to match other parts)
66867
67012
  // 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);
67013
+ if (!result && (source.flags & 2097152 /* TypeFlags.Intersection */ || source.flags & 262144 /* TypeFlags.TypeParameter */ && target.flags & 1048576 /* TypeFlags.Union */)) {
67014
+ var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* TypeFlags.Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* TypeFlags.Union */));
67015
+ if (constraint && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
67016
+ // TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this
67017
+ result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState);
67018
+ }
67019
+ }
67020
+ // For certain combinations involving intersections and optional, excess, or mismatched properties we need
67021
+ // an extra property check where the intersection is viewed as a single object. The following are motivating
67022
+ // examples that all should be errors, but aren't without this extra property check:
67023
+ //
67024
+ // let obj: { a: { x: string } } & { c: number } = { a: { x: 'hello', y: 2 }, c: 5 }; // Nested excess property
67025
+ //
67026
+ // declare let wrong: { a: { y: string } };
67027
+ // let weak: { a?: { x?: number } } & { c?: string } = wrong; // Nested weak object type
67028
+ //
67029
+ // function foo<T extends object>(x: { a?: string }, y: T & { a: boolean }) {
67030
+ // x = y; // Mismatched property in source intersection
67031
+ // }
67032
+ //
67033
+ // We suppress recursive intersection property checks because they can generate lots of work when relating
67034
+ // recursive intersections that are structurally similar but not exactly identical. See #37854.
67035
+ if (result && !inPropertyCheck && (target.flags & 2097152 /* TypeFlags.Intersection */ && !isGenericObjectType(target) && source.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) ||
67036
+ 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 */); }))) {
67037
+ inPropertyCheck = true;
67038
+ result &= propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined, 0 /* IntersectionState.None */);
67039
+ inPropertyCheck = false;
66872
67040
  }
66873
67041
  }
66874
67042
  if (result) {
@@ -66877,9 +67045,6 @@ var ts;
66877
67045
  return result;
66878
67046
  }
66879
67047
  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
67048
  var result;
66884
67049
  var originalErrorInfo;
66885
67050
  var varianceCheckFailed = false;
@@ -66980,7 +67145,7 @@ var ts;
66980
67145
  // with another type parameter unless one extends the other. (Remember: comparability is mostly bidirectional!)
66981
67146
  var constraint = getConstraintOfTypeParameter(source);
66982
67147
  if (constraint && hasNonCircularBaseConstraint(source)) {
66983
- while (constraint && constraint.flags & 262144 /* TypeFlags.TypeParameter */) {
67148
+ while (constraint && someType(constraint, function (c) { return !!(c.flags & 262144 /* TypeFlags.TypeParameter */); })) {
66984
67149
  if (result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false)) {
66985
67150
  return result;
66986
67151
  }
@@ -67503,11 +67668,11 @@ var ts;
67503
67668
  // constituents of 'target'. If any combination does not have a match then 'source' is not relatable.
67504
67669
  var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes);
67505
67670
  var matchingTypes = [];
67506
- var _loop_22 = function (combination) {
67671
+ var _loop_21 = function (combination) {
67507
67672
  var hasMatch = false;
67508
67673
  outer: for (var _c = 0, _d = target.types; _c < _d.length; _c++) {
67509
67674
  var type = _d[_c];
67510
- var _loop_23 = function (i) {
67675
+ var _loop_22 = function (i) {
67511
67676
  var sourceProperty = sourcePropertiesFiltered[i];
67512
67677
  var targetProperty = getPropertyOfType(type, sourceProperty.escapedName);
67513
67678
  if (!targetProperty)
@@ -67523,8 +67688,8 @@ var ts;
67523
67688
  }
67524
67689
  };
67525
67690
  for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
67526
- var state_9 = _loop_23(i);
67527
- switch (state_9) {
67691
+ var state_8 = _loop_22(i);
67692
+ switch (state_8) {
67528
67693
  case "continue-outer": continue outer;
67529
67694
  }
67530
67695
  }
@@ -67537,9 +67702,9 @@ var ts;
67537
67702
  };
67538
67703
  for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) {
67539
67704
  var combination = discriminantCombinations_1[_a];
67540
- var state_8 = _loop_22(combination);
67541
- if (typeof state_8 === "object")
67542
- return state_8.value;
67705
+ var state_7 = _loop_21(combination);
67706
+ if (typeof state_7 === "object")
67707
+ return state_7.value;
67543
67708
  }
67544
67709
  // Compare the remaining non-discriminant properties of each match.
67545
67710
  var result = -1 /* Ternary.True */;
@@ -67636,7 +67801,7 @@ var ts;
67636
67801
  return 0 /* Ternary.False */;
67637
67802
  }
67638
67803
  // When checking for comparability, be more lenient with optional properties.
67639
- if (!skipOptional && sourceProp.flags & 16777216 /* SymbolFlags.Optional */ && !(targetProp.flags & 16777216 /* SymbolFlags.Optional */)) {
67804
+ if (!skipOptional && sourceProp.flags & 16777216 /* SymbolFlags.Optional */ && targetProp.flags & 106500 /* SymbolFlags.ClassMember */ && !(targetProp.flags & 16777216 /* SymbolFlags.Optional */)) {
67640
67805
  // TypeScript 1.0 spec (April 2014): 3.8.3
67641
67806
  // S is a subtype of a type T, and T is a supertype of S if ...
67642
67807
  // S' and T are object types and, for each member M in T..
@@ -68244,7 +68409,7 @@ var ts;
68244
68409
  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
68410
  links.variances = ts.emptyArray;
68246
68411
  var variances = [];
68247
- var _loop_24 = function (tp) {
68412
+ var _loop_23 = function (tp) {
68248
68413
  var modifiers = getVarianceModifiers(tp);
68249
68414
  var variance = modifiers & 65536 /* ModifierFlags.Out */ ?
68250
68415
  modifiers & 32768 /* ModifierFlags.In */ ? 0 /* VarianceFlags.Invariant */ : 1 /* VarianceFlags.Covariant */ :
@@ -68282,7 +68447,7 @@ var ts;
68282
68447
  };
68283
68448
  for (var _i = 0, typeParameters_2 = typeParameters; _i < typeParameters_2.length; _i++) {
68284
68449
  var tp = typeParameters_2[_i];
68285
- _loop_24(tp);
68450
+ _loop_23(tp);
68286
68451
  }
68287
68452
  links.variances = variances;
68288
68453
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop({ variances: variances.map(ts.Debug.formatVariance) });
@@ -68736,8 +68901,7 @@ var ts;
68736
68901
  return !!(type.flags & 109440 /* TypeFlags.Unit */);
68737
68902
  }
68738
68903
  function isUnitLikeType(type) {
68739
- return type.flags & 2097152 /* TypeFlags.Intersection */ ? ts.some(type.types, isUnitType) :
68740
- !!(type.flags & 109440 /* TypeFlags.Unit */);
68904
+ return isUnitType(getBaseConstraintOrType(type));
68741
68905
  }
68742
68906
  function extractUnitType(type) {
68743
68907
  return type.flags & 2097152 /* TypeFlags.Intersection */ ? ts.find(type.types, isUnitType) || type : type;
@@ -69616,7 +69780,7 @@ var ts;
69616
69780
  && (!roundTripOnly || s === ts.pseudoBigIntToString({ negative: negative, base10Value: ts.parsePseudoBigInt(scanner.getTokenValue()) }));
69617
69781
  }
69618
69782
  function isMemberOfStringMapping(source, target) {
69619
- if (target.flags & (4 /* TypeFlags.String */ | 3 /* TypeFlags.AnyOrUnknown */)) {
69783
+ if (target.flags & (4 /* TypeFlags.String */ | 1 /* TypeFlags.Any */)) {
69620
69784
  return true;
69621
69785
  }
69622
69786
  if (target.flags & 134217728 /* TypeFlags.TemplateLiteral */) {
@@ -70240,7 +70404,7 @@ var ts;
70240
70404
  // upon instantiation, would collapse all the placeholders to just 'string', and an assignment check might
70241
70405
  // succeed. That would be a pointless and confusing outcome.
70242
70406
  if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) {
70243
- var _loop_25 = function (i) {
70407
+ var _loop_24 = function (i) {
70244
70408
  var source_1 = matches ? matches[i] : neverType;
70245
70409
  var target_3 = types[i];
70246
70410
  // If we are inferring from a string literal type to a type variable whose constraint includes one of the
@@ -70290,7 +70454,7 @@ var ts;
70290
70454
  inferFromTypes(source_1, target_3);
70291
70455
  };
70292
70456
  for (var i = 0; i < types.length; i++) {
70293
- _loop_25(i);
70457
+ _loop_24(i);
70294
70458
  }
70295
70459
  }
70296
70460
  }
@@ -70742,7 +70906,7 @@ var ts;
70742
70906
  }
70743
70907
  if (ts.isEntityNameExpression(node.argumentExpression)) {
70744
70908
  var symbol = resolveEntityName(node.argumentExpression, 111551 /* SymbolFlags.Value */, /*ignoreErrors*/ true);
70745
- if (!symbol || !isConstVariable(symbol))
70909
+ if (!symbol || !(isConstVariable(symbol) || (symbol.flags & 8 /* SymbolFlags.EnumMember */)))
70746
70910
  return undefined;
70747
70911
  var declaration = symbol.valueDeclaration;
70748
70912
  if (declaration === undefined)
@@ -70756,7 +70920,12 @@ var ts;
70756
70920
  }
70757
70921
  if (ts.hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node.argumentExpression)) {
70758
70922
  var initializer = ts.getEffectiveInitializer(declaration);
70759
- return initializer && tryGetNameFromType(getTypeOfExpression(initializer));
70923
+ if (initializer) {
70924
+ return tryGetNameFromType(getTypeOfExpression(initializer));
70925
+ }
70926
+ if (ts.isEnumMember(declaration)) {
70927
+ return ts.getTextOfPropertyName(declaration.name);
70928
+ }
70760
70929
  }
70761
70930
  }
70762
70931
  return undefined;
@@ -70814,7 +70983,7 @@ var ts;
70814
70983
  function mapTypesByKeyProperty(types, name) {
70815
70984
  var map = new ts.Map();
70816
70985
  var count = 0;
70817
- var _loop_26 = function (type) {
70986
+ var _loop_25 = function (type) {
70818
70987
  if (type.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */)) {
70819
70988
  var discriminant = getTypeOfPropertyOfType(type, name);
70820
70989
  if (discriminant) {
@@ -70840,9 +71009,9 @@ var ts;
70840
71009
  };
70841
71010
  for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
70842
71011
  var type = types_15[_i];
70843
- var state_10 = _loop_26(type);
70844
- if (typeof state_10 === "object")
70845
- return state_10.value;
71012
+ var state_9 = _loop_25(type);
71013
+ if (typeof state_9 === "object")
71014
+ return state_9.value;
70846
71015
  }
70847
71016
  return count >= 10 && count * 2 >= types.length ? map : undefined;
70848
71017
  }
@@ -71439,6 +71608,7 @@ var ts;
71439
71608
  ts.isInJSFile(node) && ts.hasInitializer(node) && node.initializer && ts.isFunctionExpressionOrArrowFunction(node.initializer) && ts.getEffectiveReturnTypeNode(node.initializer));
71440
71609
  }
71441
71610
  function getExplicitTypeOfSymbol(symbol, diagnostic) {
71611
+ symbol = resolveSymbol(symbol);
71442
71612
  if (symbol.flags & (16 /* SymbolFlags.Function */ | 8192 /* SymbolFlags.Method */ | 32 /* SymbolFlags.Class */ | 512 /* SymbolFlags.ValueModule */)) {
71443
71613
  return getTypeOfSymbol(symbol);
71444
71614
  }
@@ -71477,7 +71647,7 @@ var ts;
71477
71647
  switch (node.kind) {
71478
71648
  case 79 /* SyntaxKind.Identifier */:
71479
71649
  var symbol = getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(node));
71480
- return getExplicitTypeOfSymbol(symbol.flags & 2097152 /* SymbolFlags.Alias */ ? resolveAlias(symbol) : symbol, diagnostic);
71650
+ return getExplicitTypeOfSymbol(symbol, diagnostic);
71481
71651
  case 108 /* SyntaxKind.ThisKeyword */:
71482
71652
  return getExplicitThisType(node);
71483
71653
  case 106 /* SyntaxKind.SuperKeyword */:
@@ -71964,7 +72134,7 @@ var ts;
71964
72134
  type = narrowTypeBySwitchOnDiscriminant(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
71965
72135
  }
71966
72136
  else if (expr.kind === 218 /* SyntaxKind.TypeOfExpression */ && isMatchingReference(reference, expr.expression)) {
71967
- type = narrowBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
72137
+ type = narrowTypeBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
71968
72138
  }
71969
72139
  else {
71970
72140
  if (strictNullChecks) {
@@ -72245,7 +72415,7 @@ var ts;
72245
72415
  !!(prop.flags & 16777216 /* SymbolFlags.Optional */) || assumeTrue :
72246
72416
  !!getApplicableIndexInfoForName(type, propName) || !assumeTrue;
72247
72417
  }
72248
- function narrowByInKeyword(type, nameType, assumeTrue) {
72418
+ function narrowTypeByInKeyword(type, nameType, assumeTrue) {
72249
72419
  var name = getPropertyNameFromType(nameType);
72250
72420
  var isKnownProperty = someType(type, function (t) { return isTypePresencePossible(t, name, /*assumeTrue*/ true); });
72251
72421
  if (isKnownProperty) {
@@ -72326,7 +72496,7 @@ var ts;
72326
72496
  return getTypeWithFacts(type, assumeTrue ? 524288 /* TypeFacts.NEUndefined */ : 65536 /* TypeFacts.EQUndefined */);
72327
72497
  }
72328
72498
  if (isMatchingReference(reference, target)) {
72329
- return narrowByInKeyword(type, leftType, assumeTrue);
72499
+ return narrowTypeByInKeyword(type, leftType, assumeTrue);
72330
72500
  }
72331
72501
  }
72332
72502
  break;
@@ -72515,7 +72685,7 @@ var ts;
72515
72685
  neverType;
72516
72686
  });
72517
72687
  }
72518
- function narrowBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) {
72688
+ function narrowTypeBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) {
72519
72689
  var witnesses = getSwitchClauseTypeOfWitnesses(switchStatement);
72520
72690
  if (!witnesses) {
72521
72691
  return type;
@@ -72903,15 +73073,15 @@ var ts;
72903
73073
  });
72904
73074
  }
72905
73075
  function markAliasReferenced(symbol, location) {
72906
- if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol)) {
73076
+ if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */)) {
72907
73077
  var target = resolveAlias(symbol);
72908
- if (target.flags & 111551 /* SymbolFlags.Value */) {
73078
+ if (getAllSymbolFlags(target) & (111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */)) {
72909
73079
  // An alias resolving to a const enum cannot be elided if (1) 'isolatedModules' is enabled
72910
73080
  // (because the const enum value will not be inlined), or if (2) the alias is an export
72911
73081
  // of a const enum declaration that will be preserved.
72912
73082
  if (compilerOptions.isolatedModules ||
72913
73083
  ts.shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(location) ||
72914
- !isConstEnumOrConstEnumOnlyModule(target)) {
73084
+ !isConstEnumOrConstEnumOnlyModule(getExportSymbolOfValueSymbolIfExported(target))) {
72915
73085
  markAliasSymbolAsReferenced(symbol);
72916
73086
  }
72917
73087
  else {
@@ -73139,7 +73309,7 @@ var ts;
73139
73309
  // We only look for uninitialized variables in strict null checking mode, and only when we can analyze
73140
73310
  // the entire control flow graph from the variable's declaration (i.e. when the flow container and
73141
73311
  // declaration container are the same).
73142
- var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || ts.isBindingElement(declaration) ||
73312
+ var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) ||
73143
73313
  type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* TypeFlags.AnyOrUnknown */ | 16384 /* TypeFlags.Void */)) !== 0 ||
73144
73314
  isInTypeQuery(node) || node.parent.kind === 278 /* SyntaxKind.ExportSpecifier */) ||
73145
73315
  node.parent.kind === 232 /* SyntaxKind.NonNullExpression */ ||
@@ -73168,6 +73338,12 @@ var ts;
73168
73338
  }
73169
73339
  return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType;
73170
73340
  }
73341
+ function isSameScopedBindingElement(node, declaration) {
73342
+ if (ts.isBindingElement(declaration)) {
73343
+ var bindingElement = ts.findAncestor(node, ts.isBindingElement);
73344
+ return bindingElement && ts.getRootDeclaration(bindingElement) === ts.getRootDeclaration(declaration);
73345
+ }
73346
+ }
73171
73347
  function shouldMarkIdentifierAliasReferenced(node) {
73172
73348
  var _a;
73173
73349
  var parent = node.parent;
@@ -73509,12 +73685,17 @@ var ts;
73509
73685
  var immediateContainer = ts.getSuperContainer(node, /*stopOnFunctions*/ true);
73510
73686
  var container = immediateContainer;
73511
73687
  var needToCaptureLexicalThis = false;
73688
+ var inAsyncFunction = false;
73512
73689
  // adjust the container reference in case if super is used inside arrow functions with arbitrarily deep nesting
73513
73690
  if (!isCallExpression) {
73514
73691
  while (container && container.kind === 216 /* SyntaxKind.ArrowFunction */) {
73692
+ if (ts.hasSyntacticModifier(container, 512 /* ModifierFlags.Async */))
73693
+ inAsyncFunction = true;
73515
73694
  container = ts.getSuperContainer(container, /*stopOnFunctions*/ true);
73516
73695
  needToCaptureLexicalThis = languageVersion < 2 /* ScriptTarget.ES2015 */;
73517
73696
  }
73697
+ if (container && ts.hasSyntacticModifier(container, 512 /* ModifierFlags.Async */))
73698
+ inAsyncFunction = true;
73518
73699
  }
73519
73700
  var canUseSuperExpression = isLegalUsageOfSuperExpression(container);
73520
73701
  var nodeCheckFlag = 0;
@@ -73620,12 +73801,12 @@ var ts;
73620
73801
  // as a call expression cannot be used as the target of a destructuring assignment while a property access can.
73621
73802
  //
73622
73803
  // 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 */)) {
73804
+ if (container.kind === 171 /* SyntaxKind.MethodDeclaration */ && inAsyncFunction) {
73624
73805
  if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) {
73625
- getNodeLinks(container).flags |= 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */;
73806
+ getNodeLinks(container).flags |= 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */;
73626
73807
  }
73627
73808
  else {
73628
- getNodeLinks(container).flags |= 2048 /* NodeCheckFlags.AsyncMethodWithSuper */;
73809
+ getNodeLinks(container).flags |= 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */;
73629
73810
  }
73630
73811
  }
73631
73812
  if (needToCaptureLexicalThis) {
@@ -74321,9 +74502,10 @@ var ts;
74321
74502
  function instantiateContextualType(contextualType, node, contextFlags) {
74322
74503
  if (contextualType && maybeTypeOfKind(contextualType, 465829888 /* TypeFlags.Instantiable */)) {
74323
74504
  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)) {
74505
+ // If no inferences have been made, and none of the type parameters for which we are inferring
74506
+ // specify default types, nothing is gained from instantiating as type parameters would just be
74507
+ // replaced with their constraints similar to the apparent type.
74508
+ if (inferenceContext && contextFlags & 1 /* ContextFlags.Signature */ && ts.some(inferenceContext.inferences, hasInferenceCandidatesOrDefault)) {
74327
74509
  // For contextual signatures we incorporate all inferences made so far, e.g. from return
74328
74510
  // types as well as arguments to the left in a function call.
74329
74511
  return instantiateInstantiableTypes(contextualType, inferenceContext.nonFixingMapper);
@@ -77297,7 +77479,7 @@ var ts;
77297
77479
  if (spreadIndex >= 0) {
77298
77480
  // Create synthetic arguments from spreads of tuple types.
77299
77481
  var effectiveArgs_1 = args.slice(0, spreadIndex);
77300
- var _loop_27 = function (i) {
77482
+ var _loop_26 = function (i) {
77301
77483
  var arg = args[i];
77302
77484
  // We can call checkExpressionCached because spread expressions never have a contextual type.
77303
77485
  var spreadType = arg.kind === 227 /* SyntaxKind.SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
@@ -77314,7 +77496,7 @@ var ts;
77314
77496
  }
77315
77497
  };
77316
77498
  for (var i = spreadIndex; i < args.length; i++) {
77317
- _loop_27(i);
77499
+ _loop_26(i);
77318
77500
  }
77319
77501
  return effectiveArgs_1;
77320
77502
  }
@@ -77643,7 +77825,7 @@ var ts;
77643
77825
  var min_3 = Number.MAX_VALUE;
77644
77826
  var minIndex = 0;
77645
77827
  var i_1 = 0;
77646
- var _loop_28 = function (c) {
77828
+ var _loop_27 = function (c) {
77647
77829
  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
77830
  var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* CheckMode.Normal */, /*reportErrors*/ true, chain_2);
77649
77831
  if (diags_2) {
@@ -77661,7 +77843,7 @@ var ts;
77661
77843
  };
77662
77844
  for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) {
77663
77845
  var c = candidatesForArgumentError_1[_a];
77664
- _loop_28(c);
77846
+ _loop_27(c);
77665
77847
  }
77666
77848
  var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
77667
77849
  ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
@@ -77819,7 +78001,7 @@ var ts;
77819
78001
  }
77820
78002
  var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
77821
78003
  var parameters = [];
77822
- var _loop_29 = function (i) {
78004
+ var _loop_28 = function (i) {
77823
78005
  var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ?
77824
78006
  i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) :
77825
78007
  i < s.parameters.length ? s.parameters[i] : undefined; });
@@ -77827,7 +78009,7 @@ var ts;
77827
78009
  parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
77828
78010
  };
77829
78011
  for (var i = 0; i < maxNonRestParam; i++) {
77830
- _loop_29(i);
78012
+ _loop_28(i);
77831
78013
  }
77832
78014
  var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; });
77833
78015
  var flags = 0 /* SignatureFlags.None */;
@@ -78797,7 +78979,7 @@ var ts;
78797
78979
  if (symbol && symbol.flags & 2097152 /* SymbolFlags.Alias */) {
78798
78980
  symbol = resolveAlias(symbol);
78799
78981
  }
78800
- return !!(symbol && (symbol.flags & 384 /* SymbolFlags.Enum */) && getEnumKind(symbol) === 1 /* EnumKind.Literal */);
78982
+ return !!(symbol && (getAllSymbolFlags(symbol) & 384 /* SymbolFlags.Enum */) && getEnumKind(symbol) === 1 /* EnumKind.Literal */);
78801
78983
  }
78802
78984
  return false;
78803
78985
  }
@@ -79459,7 +79641,17 @@ var ts;
79459
79641
  }
79460
79642
  function isExhaustiveSwitchStatement(node) {
79461
79643
  var links = getNodeLinks(node);
79462
- return links.isExhaustive !== undefined ? links.isExhaustive : (links.isExhaustive = computeExhaustiveSwitchStatement(node));
79644
+ if (links.isExhaustive === undefined) {
79645
+ links.isExhaustive = 0; // Indicate resolution is in process
79646
+ var exhaustive = computeExhaustiveSwitchStatement(node);
79647
+ if (links.isExhaustive === 0) {
79648
+ links.isExhaustive = exhaustive;
79649
+ }
79650
+ }
79651
+ else if (links.isExhaustive === 0) {
79652
+ links.isExhaustive = false; // Resolve circularity to false
79653
+ }
79654
+ return links.isExhaustive;
79463
79655
  }
79464
79656
  function computeExhaustiveSwitchStatement(node) {
79465
79657
  if (node.expression.kind === 218 /* SyntaxKind.TypeOfExpression */) {
@@ -79467,7 +79659,7 @@ var ts;
79467
79659
  if (!witnesses) {
79468
79660
  return false;
79469
79661
  }
79470
- var operandConstraint = getBaseConstraintOrType(getTypeOfExpression(node.expression.expression));
79662
+ var operandConstraint = getBaseConstraintOrType(checkExpressionCached(node.expression.expression));
79471
79663
  // Get the not-equal flags for all handled cases.
79472
79664
  var notEqualFacts_2 = getNotEqualFactsFromTypeofSwitch(0, 0, witnesses);
79473
79665
  if (operandConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */) {
@@ -79477,7 +79669,7 @@ var ts;
79477
79669
  // A missing not-equal flag indicates that the type wasn't handled by some case.
79478
79670
  return !someType(operandConstraint, function (t) { return (getTypeFacts(t) & notEqualFacts_2) === notEqualFacts_2; });
79479
79671
  }
79480
- var type = getTypeOfExpression(node.expression);
79672
+ var type = checkExpressionCached(node.expression);
79481
79673
  if (!isLiteralType(type)) {
79482
79674
  return false;
79483
79675
  }
@@ -81171,6 +81363,9 @@ var ts;
81171
81363
  function hasInferenceCandidates(info) {
81172
81364
  return !!(info.candidates || info.contraCandidates);
81173
81365
  }
81366
+ function hasInferenceCandidatesOrDefault(info) {
81367
+ return !!(info.candidates || info.contraCandidates || hasTypeParameterDefault(info.typeParameter));
81368
+ }
81174
81369
  function hasOverlappingInferences(a, b) {
81175
81370
  for (var i = 0; i < a.length; i++) {
81176
81371
  if (hasInferenceCandidates(a[i]) && hasInferenceCandidates(b[i])) {
@@ -81872,7 +82067,7 @@ var ts;
81872
82067
  var indexSymbol = getIndexSymbol(getSymbolOfNode(node));
81873
82068
  if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
81874
82069
  var indexSignatureMap_1 = new ts.Map();
81875
- var _loop_30 = function (declaration) {
82070
+ var _loop_29 = function (declaration) {
81876
82071
  if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
81877
82072
  forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) {
81878
82073
  var entry = indexSignatureMap_1.get(getTypeId(type));
@@ -81887,7 +82082,7 @@ var ts;
81887
82082
  };
81888
82083
  for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
81889
82084
  var declaration = _a[_i];
81890
- _loop_30(declaration);
82085
+ _loop_29(declaration);
81891
82086
  }
81892
82087
  indexSignatureMap_1.forEach(function (entry) {
81893
82088
  if (entry.declarations.length > 1) {
@@ -82164,7 +82359,7 @@ var ts;
82164
82359
  }
82165
82360
  var symbol = getNodeLinks(node).resolvedSymbol;
82166
82361
  if (symbol) {
82167
- if (ts.some(symbol.declarations, function (d) { return isTypeDeclaration(d) && !!(d.flags & 268435456 /* NodeFlags.Deprecated */); })) {
82362
+ if (ts.some(symbol.declarations, function (d) { return ts.isTypeDeclaration(d) && !!(d.flags & 268435456 /* NodeFlags.Deprecated */); })) {
82168
82363
  addDeprecatedSuggestion(getDeprecatedSuggestionNode(node), symbol.declarations, symbol.escapedName);
82169
82364
  }
82170
82365
  if (type.flags & 32 /* TypeFlags.Enum */ && symbol.flags & 8 /* SymbolFlags.EnumMember */) {
@@ -82767,7 +82962,7 @@ var ts;
82767
82962
  return typeAsPromise.promisedTypeOfPromise = getTypeArguments(type)[0];
82768
82963
  }
82769
82964
  // primitives with a `{ then() }` won't be unwrapped/adopted.
82770
- if (allTypesAssignableToKind(type, 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) {
82965
+ if (allTypesAssignableToKind(getBaseConstraintOrType(type), 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) {
82771
82966
  return undefined;
82772
82967
  }
82773
82968
  var thenFunction = getTypeOfPropertyOfType(type, "then"); // TODO: GH#18217
@@ -82834,7 +83029,7 @@ var ts;
82834
83029
  * Determines whether a type is an object with a callable `then` member.
82835
83030
  */
82836
83031
  function isThenableType(type) {
82837
- if (allTypesAssignableToKind(type, 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) {
83032
+ if (allTypesAssignableToKind(getBaseConstraintOrType(type), 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) {
82838
83033
  // primitive types cannot be considered "thenable" since they are not objects.
82839
83034
  return false;
82840
83035
  }
@@ -82868,7 +83063,7 @@ var ts;
82868
83063
  // 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
83064
  // or is promise-like.
82870
83065
  if (baseConstraint ?
82871
- baseConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || isEmptyObjectType(baseConstraint) || isThenableType(baseConstraint) :
83066
+ baseConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || isEmptyObjectType(baseConstraint) || someType(baseConstraint, isThenableType) :
82872
83067
  maybeTypeOfKind(type, 8650752 /* TypeFlags.TypeVariable */)) {
82873
83068
  return true;
82874
83069
  }
@@ -83542,7 +83737,7 @@ var ts;
83542
83737
  }
83543
83738
  function errorUnusedLocal(declaration, name, addDiagnostic) {
83544
83739
  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;
83740
+ 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
83741
  addDiagnostic(declaration, 0 /* UnusedKind.Local */, ts.createDiagnosticForNode(node, message, name));
83547
83742
  }
83548
83743
  function isIdentifierThatStartsWithUnderscore(node) {
@@ -84972,7 +85167,16 @@ var ts;
84972
85167
  var message = allowAsyncIterables
84973
85168
  ? ts.Diagnostics.Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator
84974
85169
  : ts.Diagnostics.Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator;
84975
- return errorAndMaybeSuggestAwait(errorNode, !!getAwaitedTypeOfPromise(type), message, typeToString(type));
85170
+ var suggestAwait =
85171
+ // for (const x of Promise<...>) or [...Promise<...>]
85172
+ !!getAwaitedTypeOfPromise(type)
85173
+ // for (const x of AsyncIterable<...>)
85174
+ || (!allowAsyncIterables &&
85175
+ ts.isForOfStatement(errorNode.parent) &&
85176
+ errorNode.parent.expression === errorNode &&
85177
+ getGlobalAsyncIterableType(/** reportErrors */ false) !== emptyGenericType &&
85178
+ isTypeAssignableTo(type, getGlobalAsyncIterableType(/** reportErrors */ false)));
85179
+ return errorAndMaybeSuggestAwait(errorNode, suggestAwait, message, typeToString(type));
84976
85180
  }
84977
85181
  /**
84978
85182
  * Gets the *yield*, *return*, and *next* types from an `Iterator`-like or `AsyncIterator`-like type.
@@ -85487,7 +85691,7 @@ var ts;
85487
85691
  var propDeclaration = declaration && declaration.kind === 223 /* SyntaxKind.BinaryExpression */ ||
85488
85692
  name && name.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? declaration : undefined;
85489
85693
  var localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
85490
- var _loop_31 = function (info) {
85694
+ var _loop_30 = function (info) {
85491
85695
  var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
85492
85696
  // We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared
85493
85697
  // in the containing type, or (c) the containing type is an interface and no base interface contains both the property and
@@ -85504,7 +85708,7 @@ var ts;
85504
85708
  };
85505
85709
  for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
85506
85710
  var info = indexInfos_9[_i];
85507
- _loop_31(info);
85711
+ _loop_30(info);
85508
85712
  }
85509
85713
  }
85510
85714
  function checkIndexConstraintForIndexSignature(type, checkInfo) {
@@ -85512,7 +85716,7 @@ var ts;
85512
85716
  var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType);
85513
85717
  var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 261 /* SyntaxKind.InterfaceDeclaration */) : undefined;
85514
85718
  var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined;
85515
- var _loop_32 = function (info) {
85719
+ var _loop_31 = function (info) {
85516
85720
  if (info === checkInfo)
85517
85721
  return "continue";
85518
85722
  var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
@@ -85527,7 +85731,7 @@ var ts;
85527
85731
  };
85528
85732
  for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
85529
85733
  var info = indexInfos_10[_i];
85530
- _loop_32(info);
85734
+ _loop_31(info);
85531
85735
  }
85532
85736
  }
85533
85737
  function checkTypeNameIsReserved(name, message) {
@@ -85582,7 +85786,7 @@ var ts;
85582
85786
  }
85583
85787
  else {
85584
85788
  ts.forEach(jsdocParameters, function (_a, index) {
85585
- var name = _a.name;
85789
+ var name = _a.name, isNameFirst = _a.isNameFirst;
85586
85790
  if (excludedParameters.has(index) || ts.isIdentifier(name) && parameters.has(name.escapedText)) {
85587
85791
  return;
85588
85792
  }
@@ -85592,7 +85796,9 @@ var ts;
85592
85796
  }
85593
85797
  }
85594
85798
  else {
85595
- errorOrSuggestion(isJs, name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(name));
85799
+ if (!isNameFirst) {
85800
+ errorOrSuggestion(isJs, name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(name));
85801
+ }
85596
85802
  }
85597
85803
  });
85598
85804
  }
@@ -85847,7 +86053,7 @@ var ts;
85847
86053
  var baseTypes = baseTypeNode && getBaseTypes(type);
85848
86054
  var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
85849
86055
  var baseStaticType = getBaseConstructorTypeOfClass(type);
85850
- var _loop_33 = function (member) {
86056
+ var _loop_32 = function (member) {
85851
86057
  if (ts.hasAmbientModifier(member)) {
85852
86058
  return "continue";
85853
86059
  }
@@ -85864,7 +86070,7 @@ var ts;
85864
86070
  };
85865
86071
  for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
85866
86072
  var member = _a[_i];
85867
- _loop_33(member);
86073
+ _loop_32(member);
85868
86074
  }
85869
86075
  }
85870
86076
  /**
@@ -85952,7 +86158,7 @@ var ts;
85952
86158
  function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
85953
86159
  // 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
86160
  var issuedMemberError = false;
85955
- var _loop_34 = function (member) {
86161
+ var _loop_33 = function (member) {
85956
86162
  if (ts.isStatic(member)) {
85957
86163
  return "continue";
85958
86164
  }
@@ -85971,7 +86177,7 @@ var ts;
85971
86177
  };
85972
86178
  for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
85973
86179
  var member = _a[_i];
85974
- _loop_34(member);
86180
+ _loop_33(member);
85975
86181
  }
85976
86182
  if (!issuedMemberError) {
85977
86183
  // check again with diagnostics to generate a less-specific error
@@ -86042,7 +86248,7 @@ var ts;
86042
86248
  var _a, _b, _c, _d;
86043
86249
  // NOTE: assignability is checked in checkClassDeclaration
86044
86250
  var baseProperties = getPropertiesOfType(baseType);
86045
- var _loop_35 = function (baseProperty) {
86251
+ var _loop_34 = function (baseProperty) {
86046
86252
  var base = getTargetSymbol(baseProperty);
86047
86253
  if (base.flags & 4194304 /* SymbolFlags.Prototype */) {
86048
86254
  return "continue";
@@ -86152,8 +86358,8 @@ var ts;
86152
86358
  };
86153
86359
  basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
86154
86360
  var baseProperty = baseProperties_1[_i];
86155
- var state_11 = _loop_35(baseProperty);
86156
- switch (state_11) {
86361
+ var state_10 = _loop_34(baseProperty);
86362
+ switch (state_10) {
86157
86363
  case "continue-basePropertyCheck": continue basePropertyCheck;
86158
86364
  }
86159
86365
  }
@@ -86672,12 +86878,11 @@ var ts;
86672
86878
  }
86673
86879
  }
86674
86880
  function checkModuleAugmentationElement(node, isGlobalAugmentation) {
86675
- var _a;
86676
86881
  switch (node.kind) {
86677
86882
  case 240 /* SyntaxKind.VariableStatement */:
86678
86883
  // 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];
86884
+ for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {
86885
+ var decl = _a[_i];
86681
86886
  checkModuleAugmentationElement(decl, isGlobalAugmentation);
86682
86887
  }
86683
86888
  break;
@@ -86693,8 +86898,8 @@ var ts;
86693
86898
  case 257 /* SyntaxKind.VariableDeclaration */:
86694
86899
  var name = node.name;
86695
86900
  if (ts.isBindingPattern(name)) {
86696
- for (var _c = 0, _d = name.elements; _c < _d.length; _c++) {
86697
- var el = _d[_c];
86901
+ for (var _b = 0, _c = name.elements; _b < _c.length; _b++) {
86902
+ var el = _c[_b];
86698
86903
  // mark individual names in binding pattern
86699
86904
  checkModuleAugmentationElement(el, isGlobalAugmentation);
86700
86905
  }
@@ -86710,18 +86915,6 @@ var ts;
86710
86915
  if (isGlobalAugmentation) {
86711
86916
  return;
86712
86917
  }
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
86918
  break;
86726
86919
  }
86727
86920
  }
@@ -86823,10 +87016,11 @@ var ts;
86823
87016
  }
86824
87017
  return;
86825
87018
  }
87019
+ var targetFlags = getAllSymbolFlags(target);
86826
87020
  var excludedMeanings = (symbol.flags & (111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */) ? 111551 /* SymbolFlags.Value */ : 0) |
86827
87021
  (symbol.flags & 788968 /* SymbolFlags.Type */ ? 788968 /* SymbolFlags.Type */ : 0) |
86828
87022
  (symbol.flags & 1920 /* SymbolFlags.Namespace */ ? 1920 /* SymbolFlags.Namespace */ : 0);
86829
- if (target.flags & excludedMeanings) {
87023
+ if (targetFlags & excludedMeanings) {
86830
87024
  var message = node.kind === 278 /* SyntaxKind.ExportSpecifier */ ?
86831
87025
  ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 :
86832
87026
  ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0;
@@ -86836,7 +87030,7 @@ var ts;
86836
87030
  && !ts.isTypeOnlyImportOrExportDeclaration(node)
86837
87031
  && !(node.flags & 16777216 /* NodeFlags.Ambient */)) {
86838
87032
  var typeOnlyAlias = getTypeOnlyAliasDeclaration(symbol);
86839
- var isType = !(target.flags & 111551 /* SymbolFlags.Value */);
87033
+ var isType = !(targetFlags & 111551 /* SymbolFlags.Value */);
86840
87034
  if (isType || typeOnlyAlias) {
86841
87035
  switch (node.kind) {
86842
87036
  case 270 /* SyntaxKind.ImportClause */:
@@ -86996,14 +87190,15 @@ var ts;
86996
87190
  if (node.moduleReference.kind !== 280 /* SyntaxKind.ExternalModuleReference */) {
86997
87191
  var target = resolveAlias(getSymbolOfNode(node));
86998
87192
  if (target !== unknownSymbol) {
86999
- if (target.flags & 111551 /* SymbolFlags.Value */) {
87193
+ var targetFlags = getAllSymbolFlags(target);
87194
+ if (targetFlags & 111551 /* SymbolFlags.Value */) {
87000
87195
  // Target is a value symbol, check that it is not hidden by a local declaration with the same name
87001
87196
  var moduleName = ts.getFirstIdentifier(node.moduleReference);
87002
87197
  if (!(resolveEntityName(moduleName, 111551 /* SymbolFlags.Value */ | 1920 /* SymbolFlags.Namespace */).flags & 1920 /* SymbolFlags.Namespace */)) {
87003
87198
  error(moduleName, ts.Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, ts.declarationNameToString(moduleName));
87004
87199
  }
87005
87200
  }
87006
- if (target.flags & 788968 /* SymbolFlags.Type */) {
87201
+ if (targetFlags & 788968 /* SymbolFlags.Type */) {
87007
87202
  checkTypeNameIsReserved(node.name, ts.Diagnostics.Import_name_cannot_be_0);
87008
87203
  }
87009
87204
  }
@@ -87142,7 +87337,7 @@ var ts;
87142
87337
  markExportAsReferenced(node);
87143
87338
  }
87144
87339
  var target = symbol && (symbol.flags & 2097152 /* SymbolFlags.Alias */ ? resolveAlias(symbol) : symbol);
87145
- if (!target || target === unknownSymbol || target.flags & 111551 /* SymbolFlags.Value */) {
87340
+ if (!target || getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */) {
87146
87341
  checkExpressionCached(node.propertyName || node.name);
87147
87342
  }
87148
87343
  }
@@ -87189,7 +87384,7 @@ var ts;
87189
87384
  markAliasReferenced(sym, id);
87190
87385
  // If not a value, we're interpreting the identifier as a type export, along the lines of (`export { Id as default }`)
87191
87386
  var target = sym.flags & 2097152 /* SymbolFlags.Alias */ ? resolveAlias(sym) : sym;
87192
- if (target === unknownSymbol || target.flags & 111551 /* SymbolFlags.Value */) {
87387
+ if (getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */) {
87193
87388
  // However if it is a value, we need to check it's being used correctly
87194
87389
  checkExpressionCached(node.expression);
87195
87390
  }
@@ -87861,29 +88056,9 @@ var ts;
87861
88056
  }
87862
88057
  function isTypeDeclarationName(name) {
87863
88058
  return name.kind === 79 /* SyntaxKind.Identifier */ &&
87864
- isTypeDeclaration(name.parent) &&
88059
+ ts.isTypeDeclaration(name.parent) &&
87865
88060
  ts.getNameOfDeclaration(name.parent) === name;
87866
88061
  }
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
88062
  // True if the given identifier is part of a type reference
87888
88063
  function isTypeReferenceIdentifier(node) {
87889
88064
  while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */) {
@@ -88316,7 +88491,7 @@ var ts;
88316
88491
  var baseType = ts.firstOrUndefined(getBaseTypes(classType));
88317
88492
  return baseType ? getTypeWithThisArgument(baseType, classType.thisType) : errorType;
88318
88493
  }
88319
- if (isTypeDeclaration(node)) {
88494
+ if (ts.isTypeDeclaration(node)) {
88320
88495
  // In this case, we call getSymbolOfNode instead of getSymbolAtLocation because it is a declaration
88321
88496
  var symbol = getSymbolOfNode(node);
88322
88497
  return getDeclaredTypeOfSymbol(symbol);
@@ -88511,7 +88686,7 @@ var ts;
88511
88686
  return symbolLinks.exportsSomeValue;
88512
88687
  function isValue(s) {
88513
88688
  s = resolveSymbol(s);
88514
- return s && !!(s.flags & 111551 /* SymbolFlags.Value */);
88689
+ return s && !!(getAllSymbolFlags(s) & 111551 /* SymbolFlags.Value */);
88515
88690
  }
88516
88691
  }
88517
88692
  function isNameOfModuleOrEnumDeclaration(node) {
@@ -88564,7 +88739,7 @@ var ts;
88564
88739
  var symbol = getReferencedValueOrAliasSymbol(node);
88565
88740
  // We should only get the declaration of an alias if there isn't a local value
88566
88741
  // declaration for the symbol
88567
- if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !getTypeOnlyAliasDeclaration(symbol)) {
88742
+ if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */)) {
88568
88743
  return getDeclarationOfAliasSymbol(symbol);
88569
88744
  }
88570
88745
  }
@@ -88652,7 +88827,7 @@ var ts;
88652
88827
  case 273 /* SyntaxKind.ImportSpecifier */:
88653
88828
  case 278 /* SyntaxKind.ExportSpecifier */:
88654
88829
  var symbol = getSymbolOfNode(node);
88655
- return !!symbol && isAliasResolvedToValue(symbol) && !getTypeOnlyAliasDeclaration(symbol);
88830
+ return !!symbol && isAliasResolvedToValue(symbol) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */);
88656
88831
  case 275 /* SyntaxKind.ExportDeclaration */:
88657
88832
  var exportClause = node.exportClause;
88658
88833
  return !!exportClause && (ts.isNamespaceExport(exportClause) ||
@@ -88674,6 +88849,7 @@ var ts;
88674
88849
  return isValue && node.moduleReference && !ts.nodeIsMissing(node.moduleReference);
88675
88850
  }
88676
88851
  function isAliasResolvedToValue(symbol) {
88852
+ var _a;
88677
88853
  if (!symbol) {
88678
88854
  return false;
88679
88855
  }
@@ -88683,7 +88859,7 @@ var ts;
88683
88859
  }
88684
88860
  // const enums and modules that contain only const enums are not considered values from the emit perspective
88685
88861
  // unless 'preserveConstEnums' option is set to true
88686
- return !!(target.flags & 111551 /* SymbolFlags.Value */) &&
88862
+ return !!(((_a = getAllSymbolFlags(target)) !== null && _a !== void 0 ? _a : -1) & 111551 /* SymbolFlags.Value */) &&
88687
88863
  (ts.shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target));
88688
88864
  }
88689
88865
  function isConstEnumOrConstEnumOnlyModule(s) {
@@ -88698,7 +88874,7 @@ var ts;
88698
88874
  }
88699
88875
  var target = getSymbolLinks(symbol).aliasTarget; // TODO: GH#18217
88700
88876
  if (target && ts.getEffectiveModifierFlags(node) & 1 /* ModifierFlags.Export */ &&
88701
- target.flags & 111551 /* SymbolFlags.Value */ &&
88877
+ getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */ &&
88702
88878
  (ts.shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target))) {
88703
88879
  // An `export import ... =` of a value symbol is always considered referenced
88704
88880
  return true;
@@ -98352,8 +98528,11 @@ var ts;
98352
98528
  }
98353
98529
  return ts.visitEachChild(node, visitor, context);
98354
98530
  case 174 /* SyntaxKind.GetAccessor */:
98531
+ return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitGetAccessorDeclaration, node);
98355
98532
  case 175 /* SyntaxKind.SetAccessor */:
98533
+ return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitSetAccessorDeclaration, node);
98356
98534
  case 173 /* SyntaxKind.Constructor */:
98535
+ return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitConstructorDeclaration, node);
98357
98536
  case 260 /* SyntaxKind.ClassDeclaration */:
98358
98537
  case 228 /* SyntaxKind.ClassExpression */:
98359
98538
  return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitDefault, node);
@@ -98454,6 +98633,9 @@ var ts;
98454
98633
  return ts.setOriginalNode(ts.setTextRange(factory.createYieldExpression(
98455
98634
  /*asteriskToken*/ undefined, ts.visitNode(node.expression, visitor, ts.isExpression)), node), node);
98456
98635
  }
98636
+ function visitConstructorDeclaration(node) {
98637
+ return factory.updateConstructorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), ts.visitParameterList(node.parameters, visitor, context), transformMethodBody(node));
98638
+ }
98457
98639
  /**
98458
98640
  * Visits a MethodDeclaration node.
98459
98641
  *
@@ -98468,7 +98650,14 @@ var ts;
98468
98650
  /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context),
98469
98651
  /*type*/ undefined, ts.getFunctionFlags(node) & 2 /* FunctionFlags.Async */
98470
98652
  ? transformAsyncFunctionBody(node)
98471
- : ts.visitFunctionBody(node.body, visitor, context));
98653
+ : transformMethodBody(node));
98654
+ }
98655
+ function visitGetAccessorDeclaration(node) {
98656
+ return factory.updateGetAccessorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, ts.visitParameterList(node.parameters, visitor, context),
98657
+ /*type*/ undefined, transformMethodBody(node));
98658
+ }
98659
+ function visitSetAccessorDeclaration(node) {
98660
+ return factory.updateSetAccessorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, ts.visitParameterList(node.parameters, visitor, context), transformMethodBody(node));
98472
98661
  }
98473
98662
  /**
98474
98663
  * Visits a FunctionDeclaration node.
@@ -98582,6 +98771,42 @@ var ts;
98582
98771
  }
98583
98772
  return false;
98584
98773
  }
98774
+ function transformMethodBody(node) {
98775
+ ts.Debug.assertIsDefined(node.body);
98776
+ var savedCapturedSuperProperties = capturedSuperProperties;
98777
+ var savedHasSuperElementAccess = hasSuperElementAccess;
98778
+ capturedSuperProperties = new ts.Set();
98779
+ hasSuperElementAccess = false;
98780
+ var updated = ts.visitFunctionBody(node.body, visitor, context);
98781
+ // Minor optimization, emit `_super` helper to capture `super` access in an arrow.
98782
+ // This step isn't needed if we eventually transform this to ES5.
98783
+ var originalMethod = ts.getOriginalNode(node, ts.isFunctionLikeDeclaration);
98784
+ var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ &&
98785
+ resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */ | 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) &&
98786
+ (ts.getFunctionFlags(originalMethod) & 3 /* FunctionFlags.AsyncGenerator */) !== 3 /* FunctionFlags.AsyncGenerator */;
98787
+ if (emitSuperHelpers) {
98788
+ enableSubstitutionForAsyncMethodsWithSuper();
98789
+ if (capturedSuperProperties.size) {
98790
+ var variableStatement = createSuperAccessVariableStatement(factory, resolver, node, capturedSuperProperties);
98791
+ substitutedSuperAccessors[ts.getNodeId(variableStatement)] = true;
98792
+ var statements = updated.statements.slice();
98793
+ ts.insertStatementsAfterStandardPrologue(statements, [variableStatement]);
98794
+ updated = factory.updateBlock(updated, statements);
98795
+ }
98796
+ if (hasSuperElementAccess) {
98797
+ // Emit helpers for super element access expressions (`super[x]`).
98798
+ if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) {
98799
+ ts.addEmitHelper(updated, ts.advancedAsyncSuperHelper);
98800
+ }
98801
+ else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) {
98802
+ ts.addEmitHelper(updated, ts.asyncSuperHelper);
98803
+ }
98804
+ }
98805
+ }
98806
+ capturedSuperProperties = savedCapturedSuperProperties;
98807
+ hasSuperElementAccess = savedHasSuperElementAccess;
98808
+ return updated;
98809
+ }
98585
98810
  function transformAsyncFunctionBody(node) {
98586
98811
  resumeLexicalEnvironment();
98587
98812
  var original = ts.getOriginalNode(node, ts.isFunctionLike);
@@ -98614,7 +98839,7 @@ var ts;
98614
98839
  ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
98615
98840
  // Minor optimization, emit `_super` helper to capture `super` access in an arrow.
98616
98841
  // 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 */);
98842
+ var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */ | 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */);
98618
98843
  if (emitSuperHelpers) {
98619
98844
  enableSubstitutionForAsyncMethodsWithSuper();
98620
98845
  if (capturedSuperProperties.size) {
@@ -98627,10 +98852,10 @@ var ts;
98627
98852
  ts.setTextRange(block, node.body);
98628
98853
  if (emitSuperHelpers && hasSuperElementAccess) {
98629
98854
  // Emit helpers for super element access expressions (`super[x]`).
98630
- if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) {
98855
+ if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) {
98631
98856
  ts.addEmitHelper(block, ts.advancedAsyncSuperHelper);
98632
98857
  }
98633
- else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.AsyncMethodWithSuper */) {
98858
+ else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) {
98634
98859
  ts.addEmitHelper(block, ts.asyncSuperHelper);
98635
98860
  }
98636
98861
  }
@@ -98702,7 +98927,7 @@ var ts;
98702
98927
  // If we need to support substitutions for `super` in an async method,
98703
98928
  // we should track it here.
98704
98929
  if (enabledSubstitutions & 1 /* ES2017SubstitutionFlags.AsyncMethodsWithSuper */ && isSuperContainer(node)) {
98705
- var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.AsyncMethodWithSuper */ | 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */);
98930
+ var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */ | 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */);
98706
98931
  if (superContainerFlags !== enclosingSuperContainerFlags) {
98707
98932
  var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags;
98708
98933
  enclosingSuperContainerFlags = superContainerFlags;
@@ -98779,7 +99004,7 @@ var ts;
98779
99004
  || kind === 175 /* SyntaxKind.SetAccessor */;
98780
99005
  }
98781
99006
  function createSuperElementAccessInAsyncMethod(argumentExpression, location) {
98782
- if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) {
99007
+ if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) {
98783
99008
  return ts.setTextRange(factory.createPropertyAccessExpression(factory.createCallExpression(factory.createUniqueName("_superIndex", 16 /* GeneratedIdentifierFlags.Optimistic */ | 32 /* GeneratedIdentifierFlags.FileLevel */),
98784
99009
  /*typeArguments*/ undefined, [argumentExpression]), "value"), location);
98785
99010
  }
@@ -98794,7 +99019,7 @@ var ts;
98794
99019
  function createSuperAccessVariableStatement(factory, resolver, node, names) {
98795
99020
  // Create a variable declaration with a getter/setter (if binding) definition for each name:
98796
99021
  // const _super = Object.create(null, { x: { get: () => super.x, set: (v) => super.x = v }, ... });
98797
- var hasBinding = (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) !== 0;
99022
+ var hasBinding = (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) !== 0;
98798
99023
  var accessors = [];
98799
99024
  names.forEach(function (_, key) {
98800
99025
  var name = ts.unescapeLeadingUnderscores(key);
@@ -99287,11 +99512,22 @@ var ts;
99287
99512
  }
99288
99513
  return node;
99289
99514
  }
99290
- function convertForOfStatementHead(node, boundValue) {
99291
- var binding = ts.createForOfBindingStatement(factory, node.initializer, boundValue);
99515
+ function convertForOfStatementHead(node, boundValue, nonUserCode) {
99516
+ var value = factory.createTempVariable(hoistVariableDeclaration);
99517
+ var iteratorValueExpression = factory.createAssignment(value, boundValue);
99518
+ var iteratorValueStatement = factory.createExpressionStatement(iteratorValueExpression);
99519
+ ts.setSourceMapRange(iteratorValueStatement, node.expression);
99520
+ var exitNonUserCodeExpression = factory.createAssignment(nonUserCode, factory.createFalse());
99521
+ var exitNonUserCodeStatement = factory.createExpressionStatement(exitNonUserCodeExpression);
99522
+ ts.setSourceMapRange(exitNonUserCodeStatement, node.expression);
99523
+ var enterNonUserCodeExpression = factory.createAssignment(nonUserCode, factory.createTrue());
99524
+ var enterNonUserCodeStatement = factory.createExpressionStatement(enterNonUserCodeExpression);
99525
+ ts.setSourceMapRange(exitNonUserCodeStatement, node.expression);
99526
+ var statements = [];
99527
+ var binding = ts.createForOfBindingStatement(factory, node.initializer, value);
99528
+ statements.push(ts.visitNode(binding, visitor, ts.isStatement));
99292
99529
  var bodyLocation;
99293
99530
  var statementsLocation;
99294
- var statements = [ts.visitNode(binding, visitor, ts.isStatement)];
99295
99531
  var statement = ts.visitIterationBody(node.statement, visitor, context);
99296
99532
  if (ts.isBlock(statement)) {
99297
99533
  ts.addRange(statements, statement.statements);
@@ -99301,8 +99537,16 @@ var ts;
99301
99537
  else {
99302
99538
  statements.push(statement);
99303
99539
  }
99304
- return ts.setEmitFlags(ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), statementsLocation),
99540
+ var body = ts.setEmitFlags(ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), statementsLocation),
99305
99541
  /*multiLine*/ true), bodyLocation), 48 /* EmitFlags.NoSourceMap */ | 384 /* EmitFlags.NoTokenSourceMaps */);
99542
+ return factory.createBlock([
99543
+ iteratorValueStatement,
99544
+ exitNonUserCodeStatement,
99545
+ factory.createTryStatement(body,
99546
+ /*catchClause*/ undefined, factory.createBlock([
99547
+ enterNonUserCodeStatement
99548
+ ]))
99549
+ ]);
99306
99550
  }
99307
99551
  function createDownlevelAwait(expression) {
99308
99552
  return enclosingFunctionFlags & 1 /* FunctionFlags.Generator */
@@ -99313,6 +99557,8 @@ var ts;
99313
99557
  var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
99314
99558
  var iterator = ts.isIdentifier(expression) ? factory.getGeneratedNameForNode(expression) : factory.createTempVariable(/*recordTempVariable*/ undefined);
99315
99559
  var result = ts.isIdentifier(expression) ? factory.getGeneratedNameForNode(iterator) : factory.createTempVariable(/*recordTempVariable*/ undefined);
99560
+ var nonUserCode = factory.createTempVariable(/*recordTempVariable*/ undefined);
99561
+ var done = factory.createTempVariable(hoistVariableDeclaration);
99316
99562
  var errorRecord = factory.createUniqueName("e");
99317
99563
  var catchVariable = factory.getGeneratedNameForNode(errorRecord);
99318
99564
  var returnMethod = factory.createTempVariable(/*recordTempVariable*/ undefined);
@@ -99329,12 +99575,17 @@ var ts;
99329
99575
  callValues;
99330
99576
  var forStatement = ts.setEmitFlags(ts.setTextRange(factory.createForStatement(
99331
99577
  /*initializer*/ ts.setEmitFlags(ts.setTextRange(factory.createVariableDeclarationList([
99578
+ factory.createVariableDeclaration(nonUserCode, /*exclamationToken*/ undefined, /*type*/ undefined, factory.createTrue()),
99332
99579
  ts.setTextRange(factory.createVariableDeclaration(iterator, /*exclamationToken*/ undefined, /*type*/ undefined, initializer), node.expression),
99333
99580
  factory.createVariableDeclaration(result)
99334
99581
  ]), node.expression), 2097152 /* EmitFlags.NoHoisting */),
99335
- /*condition*/ factory.createComma(factory.createAssignment(result, createDownlevelAwait(callNext)), factory.createLogicalNot(getDone)),
99582
+ /*condition*/ factory.inlineExpressions([
99583
+ factory.createAssignment(result, createDownlevelAwait(callNext)),
99584
+ factory.createAssignment(done, getDone),
99585
+ factory.createLogicalNot(done)
99586
+ ]),
99336
99587
  /*incrementor*/ undefined,
99337
- /*statement*/ convertForOfStatementHead(node, getValue)),
99588
+ /*statement*/ convertForOfStatementHead(node, getValue, nonUserCode)),
99338
99589
  /*location*/ node), 256 /* EmitFlags.NoTokenTrailingSourceMaps */);
99339
99590
  ts.setOriginalNode(forStatement, node);
99340
99591
  return factory.createTryStatement(factory.createBlock([
@@ -99346,7 +99597,7 @@ var ts;
99346
99597
  ]), 1 /* EmitFlags.SingleLine */)), factory.createBlock([
99347
99598
  factory.createTryStatement(
99348
99599
  /*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 */)
99600
+ 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
99601
  ]),
99351
99602
  /*catchClause*/ undefined,
99352
99603
  /*finallyBlock*/ ts.setEmitFlags(factory.createBlock([
@@ -99502,7 +99753,7 @@ var ts;
99502
99753
  /*type*/ undefined, factory.updateBlock(node.body, ts.visitLexicalEnvironment(node.body.statements, visitor, context, statementOffset))), !!(hierarchyFacts & 1 /* HierarchyFacts.HasLexicalThis */)));
99503
99754
  // Minor optimization, emit `_super` helper to capture `super` access in an arrow.
99504
99755
  // 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 */);
99756
+ var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */ | 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */);
99506
99757
  if (emitSuperHelpers) {
99507
99758
  enableSubstitutionForAsyncMethodsWithSuper();
99508
99759
  var variableStatement = ts.createSuperAccessVariableStatement(factory, resolver, node, capturedSuperProperties);
@@ -99513,10 +99764,10 @@ var ts;
99513
99764
  ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
99514
99765
  var block = factory.updateBlock(node.body, statements);
99515
99766
  if (emitSuperHelpers && hasSuperElementAccess) {
99516
- if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) {
99767
+ if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) {
99517
99768
  ts.addEmitHelper(block, ts.advancedAsyncSuperHelper);
99518
99769
  }
99519
- else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.AsyncMethodWithSuper */) {
99770
+ else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) {
99520
99771
  ts.addEmitHelper(block, ts.asyncSuperHelper);
99521
99772
  }
99522
99773
  }
@@ -99645,7 +99896,7 @@ var ts;
99645
99896
  // If we need to support substitutions for `super` in an async method,
99646
99897
  // we should track it here.
99647
99898
  if (enabledSubstitutions & 1 /* ESNextSubstitutionFlags.AsyncMethodsWithSuper */ && isSuperContainer(node)) {
99648
- var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.AsyncMethodWithSuper */ | 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */);
99899
+ var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */ | 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */);
99649
99900
  if (superContainerFlags !== enclosingSuperContainerFlags) {
99650
99901
  var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags;
99651
99902
  enclosingSuperContainerFlags = superContainerFlags;
@@ -99722,7 +99973,7 @@ var ts;
99722
99973
  || kind === 175 /* SyntaxKind.SetAccessor */;
99723
99974
  }
99724
99975
  function createSuperElementAccessInAsyncMethod(argumentExpression, location) {
99725
- if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) {
99976
+ if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) {
99726
99977
  return ts.setTextRange(factory.createPropertyAccessExpression(factory.createCallExpression(factory.createIdentifier("_superIndex"),
99727
99978
  /*typeArguments*/ undefined, [argumentExpression]), "value"), location);
99728
99979
  }
@@ -101191,11 +101442,13 @@ var ts;
101191
101442
  return ts.visitEachChild(node, visitorWithUnusedExpressionResult, context);
101192
101443
  }
101193
101444
  function visitIdentifier(node) {
101194
- if (!convertedLoopState) {
101195
- return node;
101445
+ if (convertedLoopState) {
101446
+ if (resolver.isArgumentsLocalBinding(node)) {
101447
+ return convertedLoopState.argumentsName || (convertedLoopState.argumentsName = factory.createUniqueName("arguments"));
101448
+ }
101196
101449
  }
101197
- if (resolver.isArgumentsLocalBinding(node)) {
101198
- return convertedLoopState.argumentsName || (convertedLoopState.argumentsName = factory.createUniqueName("arguments"));
101450
+ if (node.hasExtendedUnicodeEscape) {
101451
+ return ts.setOriginalNode(ts.setTextRange(factory.createIdentifier(ts.unescapeLeadingUnderscores(node.escapedText)), node), node);
101199
101452
  }
101200
101453
  return node;
101201
101454
  }
@@ -105342,7 +105595,6 @@ var ts;
105342
105595
  return node;
105343
105596
  }
105344
105597
  function transformAndEmitForInStatement(node) {
105345
- // TODO(rbuckton): Source map locations
105346
105598
  if (containsYield(node)) {
105347
105599
  // [source]
105348
105600
  // for (var p in o) {
@@ -105350,34 +105602,41 @@ var ts;
105350
105602
  // }
105351
105603
  //
105352
105604
  // [intermediate]
105353
- // .local _a, _b, _i
105354
- // _a = [];
105355
- // for (_b in o) _a.push(_b);
105605
+ // .local _b, _a, _c, _i
105606
+ // _b = [];
105607
+ // _a = o;
105608
+ // for (_c in _a) _b.push(_c);
105356
105609
  // _i = 0;
105357
105610
  // .loop incrementLabel, endLoopLabel
105358
105611
  // .mark conditionLabel
105359
- // .brfalse endLoopLabel, (_i < _a.length)
105360
- // p = _a[_i];
105612
+ // .brfalse endLoopLabel, (_i < _b.length)
105613
+ // _c = _b[_i];
105614
+ // .brfalse incrementLabel, (_c in _a)
105615
+ // p = _c;
105361
105616
  // /*body*/
105362
105617
  // .mark incrementLabel
105363
- // _b++;
105618
+ // _c++;
105364
105619
  // .br conditionLabel
105365
105620
  // .endloop
105366
105621
  // .mark endLoopLabel
105367
- var keysArray = declareLocal(); // _a
105368
- var key = declareLocal(); // _b
105622
+ var obj = declareLocal(); // _a
105623
+ var keysArray = declareLocal(); // _b
105624
+ var key = declareLocal(); // _c
105369
105625
  var keysIndex = factory.createLoopVariable(); // _i
105370
105626
  var initializer = node.initializer;
105371
105627
  hoistVariableDeclaration(keysIndex);
105628
+ emitAssignment(obj, ts.visitNode(node.expression, visitor, ts.isExpression));
105372
105629
  emitAssignment(keysArray, factory.createArrayLiteralExpression());
105373
- emitStatement(factory.createForInStatement(key, ts.visitNode(node.expression, visitor, ts.isExpression), factory.createExpressionStatement(factory.createCallExpression(factory.createPropertyAccessExpression(keysArray, "push"),
105630
+ emitStatement(factory.createForInStatement(key, obj, factory.createExpressionStatement(factory.createCallExpression(factory.createPropertyAccessExpression(keysArray, "push"),
105374
105631
  /*typeArguments*/ undefined, [key]))));
105375
105632
  emitAssignment(keysIndex, factory.createNumericLiteral(0));
105376
105633
  var conditionLabel = defineLabel();
105377
105634
  var incrementLabel = defineLabel();
105378
- var endLabel = beginLoopBlock(incrementLabel);
105635
+ var endLoopLabel = beginLoopBlock(incrementLabel);
105379
105636
  markLabel(conditionLabel);
105380
- emitBreakWhenFalse(endLabel, factory.createLessThan(keysIndex, factory.createPropertyAccessExpression(keysArray, "length")));
105637
+ emitBreakWhenFalse(endLoopLabel, factory.createLessThan(keysIndex, factory.createPropertyAccessExpression(keysArray, "length")));
105638
+ emitAssignment(key, factory.createElementAccessExpression(keysArray, keysIndex));
105639
+ emitBreakWhenFalse(incrementLabel, factory.createBinaryExpression(key, 101 /* SyntaxKind.InKeyword */, obj));
105381
105640
  var variable = void 0;
105382
105641
  if (ts.isVariableDeclarationList(initializer)) {
105383
105642
  for (var _i = 0, _a = initializer.declarations; _i < _a.length; _i++) {
@@ -105390,7 +105649,7 @@ var ts;
105390
105649
  variable = ts.visitNode(initializer, visitor, ts.isExpression);
105391
105650
  ts.Debug.assert(ts.isLeftHandSideExpression(variable));
105392
105651
  }
105393
- emitAssignment(variable, factory.createElementAccessExpression(keysArray, keysIndex));
105652
+ emitAssignment(variable, key);
105394
105653
  transformAndEmitEmbeddedStatement(node.statement);
105395
105654
  markLabel(incrementLabel);
105396
105655
  emitStatement(factory.createExpressionStatement(factory.createPostfixIncrement(keysIndex)));
@@ -107231,7 +107490,7 @@ var ts;
107231
107490
  return createImportCallExpressionUMD(argument !== null && argument !== void 0 ? argument : factory.createVoidZero(), containsLexicalThis);
107232
107491
  case ts.ModuleKind.CommonJS:
107233
107492
  default:
107234
- return createImportCallExpressionCommonJS(argument, containsLexicalThis);
107493
+ return createImportCallExpressionCommonJS(argument);
107235
107494
  }
107236
107495
  }
107237
107496
  function createImportCallExpressionUMD(arg, containsLexicalThis) {
@@ -107254,7 +107513,7 @@ var ts;
107254
107513
  return factory.createConditionalExpression(
107255
107514
  /*condition*/ factory.createIdentifier("__syncRequire"),
107256
107515
  /*questionToken*/ undefined,
107257
- /*whenTrue*/ createImportCallExpressionCommonJS(arg, containsLexicalThis),
107516
+ /*whenTrue*/ createImportCallExpressionCommonJS(arg),
107258
107517
  /*colonToken*/ undefined,
107259
107518
  /*whenFalse*/ createImportCallExpressionAMD(argClone, containsLexicalThis));
107260
107519
  }
@@ -107263,7 +107522,7 @@ var ts;
107263
107522
  return factory.createComma(factory.createAssignment(temp, arg), factory.createConditionalExpression(
107264
107523
  /*condition*/ factory.createIdentifier("__syncRequire"),
107265
107524
  /*questionToken*/ undefined,
107266
- /*whenTrue*/ createImportCallExpressionCommonJS(temp, containsLexicalThis),
107525
+ /*whenTrue*/ createImportCallExpressionCommonJS(temp, /* isInlineable */ true),
107267
107526
  /*colonToken*/ undefined,
107268
107527
  /*whenFalse*/ createImportCallExpressionAMD(temp, containsLexicalThis)));
107269
107528
  }
@@ -107313,14 +107572,20 @@ var ts;
107313
107572
  }
107314
107573
  return promise;
107315
107574
  }
107316
- function createImportCallExpressionCommonJS(arg, containsLexicalThis) {
107317
- // import("./blah")
107575
+ function createImportCallExpressionCommonJS(arg, isInlineable) {
107576
+ // import(x)
107318
107577
  // emit as
107319
- // Promise.resolve().then(function () { return require(x); }) /*CommonJs Require*/
107578
+ // var _a;
107579
+ // (_a = x, Promise.resolve().then(() => require(_a)) /*CommonJs Require*/
107320
107580
  // We have to wrap require in then callback so that require is done in asynchronously
107321
107581
  // 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] : []);
107582
+ // If the arg is not inlineable, we have to evaluate it in the current scope with a temp var
107583
+ var temp = arg && !ts.isSimpleInlineableExpression(arg) && !isInlineable ? factory.createTempVariable(hoistVariableDeclaration) : undefined;
107584
+ var promiseResolveCall = factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Promise"), "resolve"),
107585
+ /*typeArguments*/ undefined,
107586
+ /*argumentsArray*/ []);
107587
+ var requireCall = factory.createCallExpression(factory.createIdentifier("require"),
107588
+ /*typeArguments*/ undefined, temp ? [temp] : arg ? [arg] : []);
107324
107589
  if (ts.getESModuleInterop(compilerOptions)) {
107325
107590
  requireCall = emitHelpers().createImportStarHelper(requireCall);
107326
107591
  }
@@ -107341,14 +107606,9 @@ var ts;
107341
107606
  /*typeParameters*/ undefined,
107342
107607
  /*parameters*/ [],
107343
107608
  /*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
107609
  }
107351
- return factory.createCallExpression(factory.createPropertyAccessExpression(promiseResolveCall, "then"), /*typeArguments*/ undefined, [func]);
107610
+ var downleveledImport = factory.createCallExpression(factory.createPropertyAccessExpression(promiseResolveCall, "then"), /*typeArguments*/ undefined, [func]);
107611
+ return temp === undefined ? downleveledImport : factory.createCommaListExpression([factory.createAssignment(temp, arg), downleveledImport]);
107352
107612
  }
107353
107613
  function getHelperExpressionForExport(node, innerExpr) {
107354
107614
  if (!ts.getESModuleInterop(compilerOptions) || ts.getEmitFlags(node) & 67108864 /* EmitFlags.NeverApplyImportHelper */) {
@@ -118341,14 +118601,16 @@ var ts;
118341
118601
  }
118342
118602
  return setReadFileCache(key, fileName);
118343
118603
  };
118344
- var getSourceFileWithCache = getSourceFile ? function (fileName, languageVersion, onError, shouldCreateNewSourceFile) {
118604
+ var getSourceFileWithCache = getSourceFile ? function (fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile) {
118345
118605
  var key = toPath(fileName);
118346
- var value = sourceFileCache.get(key);
118606
+ var impliedNodeFormat = typeof languageVersionOrOptions === "object" ? languageVersionOrOptions.impliedNodeFormat : undefined;
118607
+ var forImpliedNodeFormat = sourceFileCache.get(impliedNodeFormat);
118608
+ var value = forImpliedNodeFormat === null || forImpliedNodeFormat === void 0 ? void 0 : forImpliedNodeFormat.get(key);
118347
118609
  if (value)
118348
118610
  return value;
118349
- var sourceFile = getSourceFile(fileName, languageVersion, onError, shouldCreateNewSourceFile);
118611
+ var sourceFile = getSourceFile(fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile);
118350
118612
  if (sourceFile && (ts.isDeclarationFileName(fileName) || ts.fileExtensionIs(fileName, ".json" /* Extension.Json */))) {
118351
- sourceFileCache.set(key, sourceFile);
118613
+ sourceFileCache.set(impliedNodeFormat, (forImpliedNodeFormat || new ts.Map()).set(key, sourceFile));
118352
118614
  }
118353
118615
  return sourceFile;
118354
118616
  } : undefined;
@@ -118373,13 +118635,15 @@ var ts;
118373
118635
  var value = readFileCache.get(key);
118374
118636
  if (value !== undefined && value !== data) {
118375
118637
  readFileCache.delete(key);
118376
- sourceFileCache.delete(key);
118638
+ sourceFileCache.forEach(function (map) { return map.delete(key); });
118377
118639
  }
118378
118640
  else if (getSourceFileWithCache) {
118379
- var sourceFile = sourceFileCache.get(key);
118380
- if (sourceFile && sourceFile.text !== data) {
118381
- sourceFileCache.delete(key);
118382
- }
118641
+ sourceFileCache.forEach(function (map) {
118642
+ var sourceFile = map.get(key);
118643
+ if (sourceFile && sourceFile.text !== data) {
118644
+ map.delete(key);
118645
+ }
118646
+ });
118383
118647
  }
118384
118648
  originalWriteFile.call.apply(originalWriteFile, __spreadArray([host, fileName, data], rest, false));
118385
118649
  };
@@ -122521,10 +122785,16 @@ var ts;
122521
122785
  var oldCompilerOptions = useOldState ? oldState.compilerOptions : undefined;
122522
122786
  var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile &&
122523
122787
  !ts.compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions);
122788
+ // We can only reuse emit signatures (i.e. .d.ts signatures) if the .d.ts file is unchanged,
122789
+ // which will eg be depedent on change in options like declarationDir and outDir options are unchanged.
122790
+ // We need to look in oldState.compilerOptions, rather than oldCompilerOptions (i.e.we need to disregard useOldState) because
122791
+ // oldCompilerOptions can be undefined if there was change in say module from None to some other option
122792
+ // 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
122793
+ // but that option change does not affect d.ts file name so emitSignatures should still be reused.
122524
122794
  var canCopyEmitSignatures = compilerOptions.composite &&
122525
122795
  (oldState === null || oldState === void 0 ? void 0 : oldState.emitSignatures) &&
122526
122796
  !outFilePath &&
122527
- !ts.compilerOptionsAffectDeclarationPath(compilerOptions, oldCompilerOptions);
122797
+ !ts.compilerOptionsAffectDeclarationPath(compilerOptions, oldState.compilerOptions);
122528
122798
  if (useOldState) {
122529
122799
  // Copy old state's changed files set
122530
122800
  (_a = oldState.changedFilesSet) === null || _a === void 0 ? void 0 : _a.forEach(function (value) { return state.changedFilesSet.add(value); });
@@ -123070,7 +123340,8 @@ var ts;
123070
123340
  for (var _b = 0, _c = state.affectedFilesPendingEmit.slice(state.affectedFilesPendingEmitIndex).sort(ts.compareStringsCaseSensitive); _b < _c.length; _b++) {
123071
123341
  var path = _c[_b];
123072
123342
  if (ts.tryAddToSet(seenFiles, path)) {
123073
- (affectedFilesPendingEmit || (affectedFilesPendingEmit = [])).push([toFileId(path), state.affectedFilesPendingEmitKind.get(path)]);
123343
+ var fileId = toFileId(path), emitKind = state.affectedFilesPendingEmitKind.get(path);
123344
+ (affectedFilesPendingEmit || (affectedFilesPendingEmit = [])).push(emitKind === 1 /* BuilderFileEmit.Full */ ? fileId : [fileId]);
123074
123345
  }
123075
123346
  }
123076
123347
  }
@@ -123549,6 +123820,10 @@ var ts;
123549
123820
  { version: fileInfo.version, signature: fileInfo.signature === false ? undefined : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope, impliedFormat: fileInfo.impliedFormat };
123550
123821
  }
123551
123822
  ts.toBuilderStateFileInfo = toBuilderStateFileInfo;
123823
+ function toBuilderFileEmit(value) {
123824
+ return ts.isNumber(value) ? 1 /* BuilderFileEmit.Full */ : 0 /* BuilderFileEmit.DtsOnly */;
123825
+ }
123826
+ ts.toBuilderFileEmit = toBuilderFileEmit;
123552
123827
  function createBuilderProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
123553
123828
  var _a, _b, _c, _d;
123554
123829
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
@@ -123590,8 +123865,8 @@ var ts;
123590
123865
  exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
123591
123866
  semanticDiagnosticsPerFile: program.semanticDiagnosticsPerFile && ts.arrayToMap(program.semanticDiagnosticsPerFile, function (value) { return toFilePath(ts.isNumber(value) ? value : value[0]); }, function (value) { return ts.isNumber(value) ? ts.emptyArray : value[1]; }),
123592
123867
  hasReusableDiagnostic: true,
123593
- affectedFilesPendingEmit: ts.map(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }),
123594
- affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
123868
+ affectedFilesPendingEmit: ts.map(program.affectedFilesPendingEmit, function (value) { return toFilePath(ts.isNumber(value) ? value : value[0]); }),
123869
+ affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(ts.isNumber(value) ? value : value[0]); }, toBuilderFileEmit),
123595
123870
  affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
123596
123871
  changedFilesSet: new ts.Set(ts.map(program.changeFileSet, toFilePath)),
123597
123872
  latestChangedDtsFile: latestChangedDtsFile,
@@ -123739,7 +124014,7 @@ var ts;
123739
124014
  var isNonDirectorySeparatorRoot = rootLength > 1 || dirPath.charCodeAt(0) !== 47 /* CharacterCodes.slash */;
123740
124015
  if (isNonDirectorySeparatorRoot &&
123741
124016
  dirPath.search(/[a-zA-Z]:/) !== 0 && // Non dos style paths
123742
- pathPartForUserCheck.search(/[a-zA-z]\$\//) === 0) { // Dos style nextPart
124017
+ pathPartForUserCheck.search(/[a-zA-Z]\$\//) === 0) { // Dos style nextPart
123743
124018
  nextDirectorySeparator = dirPath.indexOf(ts.directorySeparator, nextDirectorySeparator + 1);
123744
124019
  if (nextDirectorySeparator === -1) {
123745
124020
  // ignore "//vda1cs4850/c$/folderAtRoot"
@@ -124993,7 +125268,7 @@ var ts;
124993
125268
  });
124994
125269
  // Sort by paths closest to importing file Name directory
124995
125270
  var sortedPaths = [];
124996
- var _loop_36 = function (directory) {
125271
+ var _loop_35 = function (directory) {
124997
125272
  var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
124998
125273
  var pathsInDirectory;
124999
125274
  allFileNames.forEach(function (_a, fileName) {
@@ -125017,9 +125292,9 @@ var ts;
125017
125292
  };
125018
125293
  var out_directory_1;
125019
125294
  for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
125020
- var state_12 = _loop_36(directory);
125295
+ var state_11 = _loop_35(directory);
125021
125296
  directory = out_directory_1;
125022
- if (state_12 === "break")
125297
+ if (state_11 === "break")
125023
125298
  break;
125024
125299
  }
125025
125300
  if (allFileNames.size) {
@@ -125088,7 +125363,7 @@ var ts;
125088
125363
  }
125089
125364
  function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) {
125090
125365
  for (var key in paths) {
125091
- var _loop_37 = function (patternText_1) {
125366
+ var _loop_36 = function (patternText_1) {
125092
125367
  var pattern = ts.normalizePath(patternText_1);
125093
125368
  var indexOfStar = pattern.indexOf("*");
125094
125369
  // In module resolution, if `pattern` itself has an extension, a file with that extension is looked up directly,
@@ -125155,9 +125430,9 @@ var ts;
125155
125430
  };
125156
125431
  for (var _i = 0, _a = paths[key]; _i < _a.length; _i++) {
125157
125432
  var patternText_1 = _a[_i];
125158
- var state_13 = _loop_37(patternText_1);
125159
- if (typeof state_13 === "object")
125160
- return state_13.value;
125433
+ var state_12 = _loop_36(patternText_1);
125434
+ if (typeof state_12 === "object")
125435
+ return state_12.value;
125161
125436
  }
125162
125437
  }
125163
125438
  function validateEnding(_a) {
@@ -125245,15 +125520,21 @@ var ts;
125245
125520
  return undefined;
125246
125521
  }
125247
125522
  function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions) {
125248
- var normalizedTargetPath = getPathRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName);
125249
- if (normalizedTargetPath === undefined) {
125523
+ var normalizedTargetPaths = getPathsRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName);
125524
+ if (normalizedTargetPaths === undefined) {
125525
+ return undefined;
125526
+ }
125527
+ var normalizedSourcePaths = getPathsRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName);
125528
+ var relativePaths = ts.flatMap(normalizedSourcePaths, function (sourcePath) {
125529
+ return ts.map(normalizedTargetPaths, function (targetPath) { return ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(sourcePath, targetPath, getCanonicalFileName)); });
125530
+ });
125531
+ var shortest = ts.min(relativePaths, ts.compareNumberOfDirectorySeparators);
125532
+ if (!shortest) {
125250
125533
  return undefined;
125251
125534
  }
125252
- var normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName);
125253
- var relativePath = normalizedSourcePath !== undefined ? ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(normalizedSourcePath, normalizedTargetPath, getCanonicalFileName)) : normalizedTargetPath;
125254
125535
  return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs
125255
- ? removeExtensionAndIndexPostFix(relativePath, ending, compilerOptions)
125256
- : ts.removeFileExtension(relativePath);
125536
+ ? removeExtensionAndIndexPostFix(shortest, ending, compilerOptions)
125537
+ : ts.removeFileExtension(shortest);
125257
125538
  }
125258
125539
  function tryGetModuleNameAsNodeModule(_a, _b, importingSourceFile, host, options, userPreferences, packageNameOnly, overrideMode) {
125259
125540
  var path = _a.path, isRedirect = _a.isRedirect;
@@ -125390,8 +125671,8 @@ var ts;
125390
125671
  }
125391
125672
  }
125392
125673
  }
125393
- function getPathRelativeToRootDirs(path, rootDirs, getCanonicalFileName) {
125394
- return ts.firstDefined(rootDirs, function (rootDir) {
125674
+ function getPathsRelativeToRootDirs(path, rootDirs, getCanonicalFileName) {
125675
+ return ts.mapDefined(rootDirs, function (rootDir) {
125395
125676
  var relativePath = getRelativePathIfInDirectory(path, rootDir, getCanonicalFileName);
125396
125677
  return relativePath !== undefined && isPathRelativeToParent(relativePath) ? undefined : relativePath;
125397
125678
  });
@@ -127959,8 +128240,15 @@ var ts;
127959
128240
  }
127960
128241
  if (buildInfo.program) {
127961
128242
  // If there are pending changes that are not emitted, project is out of date
128243
+ // When there are syntax errors, changeFileSet will have list of files changed (irrespective of noEmit)
128244
+ // But in case of semantic error we need special treatment.
128245
+ // Checking presence of affectedFilesPendingEmit list is fast and good way to tell if there were semantic errors and file emit was blocked
128246
+ // 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
128247
+ // 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
128248
  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))) {
128249
+ (!project.options.noEmit ?
128250
+ (_b = buildInfo.program.affectedFilesPendingEmit) === null || _b === void 0 ? void 0 : _b.length :
128251
+ ts.some(buildInfo.program.semanticDiagnosticsPerFile, ts.isArray))) {
127964
128252
  return {
127965
128253
  type: ts.UpToDateStatusType.OutOfDateBuildInfo,
127966
128254
  buildInfoFile: buildInfoPath