typescript 5.0.0-dev.20230106 → 5.0.0-dev.20230108

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsc.js CHANGED
@@ -23,7 +23,7 @@ var __export = (target, all) => {
23
23
 
24
24
  // src/compiler/corePublic.ts
25
25
  var versionMajorMinor = "5.0";
26
- var version = `${versionMajorMinor}.0-dev.20230106`;
26
+ var version = `${versionMajorMinor}.0-dev.20230108`;
27
27
 
28
28
  // src/compiler/core.ts
29
29
  var emptyArray = [];
@@ -55,22 +55,21 @@ function firstDefined(array, callback) {
55
55
  return void 0;
56
56
  }
57
57
  function firstDefinedIterator(iter, callback) {
58
- while (true) {
59
- const iterResult = iter.next();
60
- if (iterResult.done) {
61
- return void 0;
62
- }
63
- const result = callback(iterResult.value);
58
+ for (const value of iter) {
59
+ const result = callback(value);
64
60
  if (result !== void 0) {
65
61
  return result;
66
62
  }
67
63
  }
64
+ return void 0;
68
65
  }
69
66
  function reduceLeftIterator(iterator, f, initial) {
70
67
  let result = initial;
71
68
  if (iterator) {
72
- for (let step = iterator.next(), pos = 0; !step.done; step = iterator.next(), pos++) {
73
- result = f(result, step.value, pos);
69
+ let pos = 0;
70
+ for (const value of iterator) {
71
+ result = f(result, value, pos);
72
+ pos++;
74
73
  }
75
74
  }
76
75
  return result;
@@ -212,13 +211,10 @@ function map(array, f) {
212
211
  }
213
212
  return result;
214
213
  }
215
- function mapIterator(iter, mapFn) {
216
- return {
217
- next() {
218
- const iterRes = iter.next();
219
- return iterRes.done ? iterRes : { value: mapFn(iterRes.value), done: false };
220
- }
221
- };
214
+ function* mapIterator(iter, mapFn) {
215
+ for (const x of iter) {
216
+ yield mapFn(x);
217
+ }
222
218
  }
223
219
  function sameMap(array, f) {
224
220
  if (array) {
@@ -314,21 +310,13 @@ function mapDefined(array, mapFn) {
314
310
  }
315
311
  return result;
316
312
  }
317
- function mapDefinedIterator(iter, mapFn) {
318
- return {
319
- next() {
320
- while (true) {
321
- const res = iter.next();
322
- if (res.done) {
323
- return res;
324
- }
325
- const value = mapFn(res.value);
326
- if (value !== void 0) {
327
- return { value, done: false };
328
- }
329
- }
313
+ function* mapDefinedIterator(iter, mapFn) {
314
+ for (const x of iter) {
315
+ const value = mapFn(x);
316
+ if (value !== void 0) {
317
+ yield value;
330
318
  }
331
- };
319
+ }
332
320
  }
333
321
  function getOrUpdate(map2, key, callback) {
334
322
  if (map2.has(key)) {
@@ -345,7 +333,6 @@ function tryAddToSet(set, value) {
345
333
  }
346
334
  return false;
347
335
  }
348
- var emptyIterator = { next: () => ({ value: void 0, done: true }) };
349
336
  function spanMap(array, keyfn, mapfn) {
350
337
  let result;
351
338
  if (array) {
@@ -542,13 +529,6 @@ function relativeComplement(arrayA, arrayB, comparer) {
542
529
  }
543
530
  return result;
544
531
  }
545
- function sum(array, prop) {
546
- let result = 0;
547
- for (const v of array) {
548
- result += v[prop];
549
- }
550
- return result;
551
- }
552
532
  function append(to, value) {
553
533
  if (value === void 0)
554
534
  return to;
@@ -610,7 +590,7 @@ function rangeEquals(array1, array2, pos, end) {
610
590
  }
611
591
  return true;
612
592
  }
613
- function elementAt(array, offset) {
593
+ var elementAt = !!Array.prototype.at ? (array, offset) => array == null ? void 0 : array.at(offset) : (array, offset) => {
614
594
  if (array) {
615
595
  offset = toOffset(array, offset);
616
596
  if (offset < array.length) {
@@ -618,10 +598,18 @@ function elementAt(array, offset) {
618
598
  }
619
599
  }
620
600
  return void 0;
621
- }
601
+ };
622
602
  function firstOrUndefined(array) {
623
603
  return array === void 0 || array.length === 0 ? void 0 : array[0];
624
604
  }
605
+ function firstOrUndefinedIterator(iter) {
606
+ if (iter) {
607
+ for (const value of iter) {
608
+ return value;
609
+ }
610
+ }
611
+ return void 0;
612
+ }
625
613
  function first(array) {
626
614
  Debug.assert(array.length !== 0);
627
615
  return array[0];
@@ -713,17 +701,6 @@ function getOwnValues(collection) {
713
701
  }
714
702
  return values;
715
703
  }
716
- var _entries = Object.entries || ((obj) => {
717
- const keys = getOwnKeys(obj);
718
- const result = Array(keys.length);
719
- for (let i = 0; i < keys.length; i++) {
720
- result[i] = [keys[i], obj[keys[i]]];
721
- }
722
- return result;
723
- });
724
- function getEntries(obj) {
725
- return obj ? _entries(obj) : [];
726
- }
727
704
  function arrayOf(count, f) {
728
705
  const result = new Array(count);
729
706
  for (let i = 0; i < count; i++) {
@@ -733,8 +710,8 @@ function arrayOf(count, f) {
733
710
  }
734
711
  function arrayFrom(iterator, map2) {
735
712
  const result = [];
736
- for (let iterResult = iterator.next(); !iterResult.done; iterResult = iterator.next()) {
737
- result.push(map2 ? map2(iterResult.value) : iterResult.value);
713
+ for (const value of iterator) {
714
+ result.push(map2 ? map2(value) : value);
738
715
  }
739
716
  return result;
740
717
  }
@@ -886,7 +863,7 @@ function createQueue(items) {
886
863
  };
887
864
  }
888
865
  function isArray(value) {
889
- return Array.isArray ? Array.isArray(value) : value instanceof Array;
866
+ return Array.isArray(value);
890
867
  }
891
868
  function toArray(value) {
892
869
  return isArray(value) ? value : [value];
@@ -7888,8 +7865,8 @@ var textToKeywordObj = {
7888
7865
  await: 133 /* AwaitKeyword */,
7889
7866
  of: 162 /* OfKeyword */
7890
7867
  };
7891
- var textToKeyword = new Map(getEntries(textToKeywordObj));
7892
- var textToToken = new Map(getEntries({
7868
+ var textToKeyword = new Map(Object.entries(textToKeywordObj));
7869
+ var textToToken = new Map(Object.entries({
7893
7870
  ...textToKeywordObj,
7894
7871
  "{": 18 /* OpenBraceToken */,
7895
7872
  "}": 19 /* CloseBraceToken */,
@@ -11279,8 +11256,7 @@ function optionsHaveChanges(oldOptions, newOptions, optionDeclarations2) {
11279
11256
  }
11280
11257
  function forEachEntry(map2, callback) {
11281
11258
  const iterator = map2.entries();
11282
- for (let iterResult = iterator.next(); !iterResult.done; iterResult = iterator.next()) {
11283
- const [key, value] = iterResult.value;
11259
+ for (const [key, value] of iterator) {
11284
11260
  const result = callback(value, key);
11285
11261
  if (result) {
11286
11262
  return result;
@@ -11290,8 +11266,8 @@ function forEachEntry(map2, callback) {
11290
11266
  }
11291
11267
  function forEachKey(map2, callback) {
11292
11268
  const iterator = map2.keys();
11293
- for (let iterResult = iterator.next(); !iterResult.done; iterResult = iterator.next()) {
11294
- const result = callback(iterResult.value);
11269
+ for (const key of iterator) {
11270
+ const result = callback(key);
11295
11271
  if (result) {
11296
11272
  return result;
11297
11273
  }
@@ -13957,7 +13933,7 @@ function hasInvalidEscape(template) {
13957
13933
  var doubleQuoteEscapedCharsRegExp = /[\\\"\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g;
13958
13934
  var singleQuoteEscapedCharsRegExp = /[\\\'\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g;
13959
13935
  var backtickQuoteEscapedCharsRegExp = /\r\n|[\\\`\u0000-\u001f\t\v\f\b\r\u2028\u2029\u0085]/g;
13960
- var escapedCharsMap = new Map(getEntries({
13936
+ var escapedCharsMap = new Map(Object.entries({
13961
13937
  " ": "\\t",
13962
13938
  "\v": "\\v",
13963
13939
  "\f": "\\f",
@@ -14003,7 +13979,7 @@ function escapeNonAsciiString(s, quoteChar) {
14003
13979
  }
14004
13980
  var jsxDoubleQuoteEscapedCharsRegExp = /[\"\u0000-\u001f\u2028\u2029\u0085]/g;
14005
13981
  var jsxSingleQuoteEscapedCharsRegExp = /[\'\u0000-\u001f\u2028\u2029\u0085]/g;
14006
- var jsxEscapedCharsMap = new Map(getEntries({
13982
+ var jsxEscapedCharsMap = new Map(Object.entries({
14007
13983
  '"': "&quot;",
14008
13984
  "'": "&apos;"
14009
13985
  }));
@@ -25257,7 +25233,6 @@ var Parser;
25257
25233
  let currentToken;
25258
25234
  let nodeCount;
25259
25235
  let identifiers;
25260
- let privateIdentifiers;
25261
25236
  let identifierCount;
25262
25237
  let parsingContext;
25263
25238
  let notParenthesizedArrow;
@@ -25410,7 +25385,6 @@ var Parser;
25410
25385
  parseDiagnostics = [];
25411
25386
  parsingContext = 0;
25412
25387
  identifiers = /* @__PURE__ */ new Map();
25413
- privateIdentifiers = /* @__PURE__ */ new Map();
25414
25388
  identifierCount = 0;
25415
25389
  nodeCount = 0;
25416
25390
  sourceFlags = 0;
@@ -26151,16 +26125,9 @@ var Parser;
26151
26125
  parseExpected(23 /* CloseBracketToken */);
26152
26126
  return finishNode(factory2.createComputedPropertyName(expression), pos);
26153
26127
  }
26154
- function internPrivateIdentifier(text) {
26155
- let privateIdentifier = privateIdentifiers.get(text);
26156
- if (privateIdentifier === void 0) {
26157
- privateIdentifiers.set(text, privateIdentifier = text);
26158
- }
26159
- return privateIdentifier;
26160
- }
26161
26128
  function parsePrivateIdentifier() {
26162
26129
  const pos = getNodePos();
26163
- const node = factory2.createPrivateIdentifier(internPrivateIdentifier(scanner.getTokenValue()));
26130
+ const node = factory2.createPrivateIdentifier(internIdentifier(scanner.getTokenValue()));
26164
26131
  nextToken();
26165
26132
  return finishNode(node, pos);
26166
26133
  }
@@ -32323,14 +32290,14 @@ var compileOnSaveCommandLineOption = {
32323
32290
  type: "boolean",
32324
32291
  defaultValueDescription: false
32325
32292
  };
32326
- var jsxOptionMap = new Map(getEntries({
32293
+ var jsxOptionMap = new Map(Object.entries({
32327
32294
  "preserve": 1 /* Preserve */,
32328
32295
  "react-native": 3 /* ReactNative */,
32329
32296
  "react": 2 /* React */,
32330
32297
  "react-jsx": 4 /* ReactJSX */,
32331
32298
  "react-jsxdev": 5 /* ReactJSXDev */
32332
32299
  }));
32333
- var inverseJsxOptionMap = new Map(arrayFrom(mapIterator(jsxOptionMap.entries(), ([key, value]) => ["" + value, key])));
32300
+ var inverseJsxOptionMap = new Map(mapIterator(jsxOptionMap.entries(), ([key, value]) => ["" + value, key]));
32334
32301
  var libEntries = [
32335
32302
  // JavaScript only
32336
32303
  ["es5", "lib.es5.d.ts"],
@@ -32411,7 +32378,7 @@ var libMap = new Map(libEntries);
32411
32378
  var optionsForWatch = [
32412
32379
  {
32413
32380
  name: "watchFile",
32414
- type: new Map(getEntries({
32381
+ type: new Map(Object.entries({
32415
32382
  fixedpollinginterval: 0 /* FixedPollingInterval */,
32416
32383
  prioritypollinginterval: 1 /* PriorityPollingInterval */,
32417
32384
  dynamicprioritypolling: 2 /* DynamicPriorityPolling */,
@@ -32425,7 +32392,7 @@ var optionsForWatch = [
32425
32392
  },
32426
32393
  {
32427
32394
  name: "watchDirectory",
32428
- type: new Map(getEntries({
32395
+ type: new Map(Object.entries({
32429
32396
  usefsevents: 0 /* UseFsEvents */,
32430
32397
  fixedpollinginterval: 1 /* FixedPollingInterval */,
32431
32398
  dynamicprioritypolling: 2 /* DynamicPriorityPolling */,
@@ -32437,7 +32404,7 @@ var optionsForWatch = [
32437
32404
  },
32438
32405
  {
32439
32406
  name: "fallbackPolling",
32440
- type: new Map(getEntries({
32407
+ type: new Map(Object.entries({
32441
32408
  fixedinterval: 0 /* FixedInterval */,
32442
32409
  priorityinterval: 1 /* PriorityInterval */,
32443
32410
  dynamicpriority: 2 /* DynamicPriority */,
@@ -32668,7 +32635,7 @@ var commonOptionsWithBuild = [
32668
32635
  var targetOptionDeclaration = {
32669
32636
  name: "target",
32670
32637
  shortName: "t",
32671
- type: new Map(getEntries({
32638
+ type: new Map(Object.entries({
32672
32639
  es3: 0 /* ES3 */,
32673
32640
  es5: 1 /* ES5 */,
32674
32641
  es6: 2 /* ES2015 */,
@@ -32695,7 +32662,7 @@ var targetOptionDeclaration = {
32695
32662
  var moduleOptionDeclaration = {
32696
32663
  name: "module",
32697
32664
  shortName: "m",
32698
- type: new Map(getEntries({
32665
+ type: new Map(Object.entries({
32699
32666
  none: 0 /* None */,
32700
32667
  commonjs: 1 /* CommonJS */,
32701
32668
  amd: 2 /* AMD */,
@@ -32918,7 +32885,7 @@ var commandOptionsWithoutBuild = [
32918
32885
  },
32919
32886
  {
32920
32887
  name: "importsNotUsedAsValues",
32921
- type: new Map(getEntries({
32888
+ type: new Map(Object.entries({
32922
32889
  remove: 0 /* Remove */,
32923
32890
  preserve: 1 /* Preserve */,
32924
32891
  error: 2 /* Error */
@@ -33120,7 +33087,7 @@ var commandOptionsWithoutBuild = [
33120
33087
  // Module Resolution
33121
33088
  {
33122
33089
  name: "moduleResolution",
33123
- type: new Map(getEntries({
33090
+ type: new Map(Object.entries({
33124
33091
  // N.B. The first entry specifies the value shown in `tsc --init`
33125
33092
  node10: 2 /* Node10 */,
33126
33093
  node: 2 /* Node10 */,
@@ -33412,7 +33379,7 @@ var commandOptionsWithoutBuild = [
33412
33379
  },
33413
33380
  {
33414
33381
  name: "newLine",
33415
- type: new Map(getEntries({
33382
+ type: new Map(Object.entries({
33416
33383
  crlf: 0 /* CarriageReturnLineFeed */,
33417
33384
  lf: 1 /* LineFeed */
33418
33385
  })),
@@ -33656,7 +33623,7 @@ var commandOptionsWithoutBuild = [
33656
33623
  },
33657
33624
  {
33658
33625
  name: "moduleDetection",
33659
- type: new Map(getEntries({
33626
+ type: new Map(Object.entries({
33660
33627
  auto: 2 /* Auto */,
33661
33628
  legacy: 1 /* Legacy */,
33662
33629
  force: 3 /* Force */
@@ -35513,9 +35480,9 @@ function getDefaultValueForOption(option) {
35513
35480
  case "object":
35514
35481
  return {};
35515
35482
  default:
35516
- const iterResult = option.type.keys().next();
35517
- if (!iterResult.done)
35518
- return iterResult.value;
35483
+ const value = firstOrUndefinedIterator(option.type.keys());
35484
+ if (value !== void 0)
35485
+ return value;
35519
35486
  return Debug.fail("Expected 'option.type' to have entries.");
35520
35487
  }
35521
35488
  }
@@ -41652,7 +41619,7 @@ var TypeFacts = /* @__PURE__ */ ((TypeFacts3) => {
41652
41619
  TypeFacts3[TypeFacts3["AndFactsMask"] = 134209471] = "AndFactsMask";
41653
41620
  return TypeFacts3;
41654
41621
  })(TypeFacts || {});
41655
- var typeofNEFacts = new Map(getEntries({
41622
+ var typeofNEFacts = new Map(Object.entries({
41656
41623
  string: 256 /* TypeofNEString */,
41657
41624
  number: 512 /* TypeofNENumber */,
41658
41625
  bigint: 1024 /* TypeofNEBigInt */,
@@ -41683,7 +41650,7 @@ var SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
41683
41650
  return SignatureCheckMode3;
41684
41651
  })(SignatureCheckMode || {});
41685
41652
  var isNotOverloadAndNotAccessor = and(isNotOverload, isNotAccessor);
41686
- var intrinsicTypeKinds = new Map(getEntries({
41653
+ var intrinsicTypeKinds = new Map(Object.entries({
41687
41654
  Uppercase: 0 /* Uppercase */,
41688
41655
  Lowercase: 1 /* Lowercase */,
41689
41656
  Capitalize: 2 /* Capitalize */,
@@ -41774,9 +41741,9 @@ function createTypeChecker(host) {
41774
41741
  const requireSymbol = createSymbol(4 /* Property */, "require");
41775
41742
  let apparentArgumentCount;
41776
41743
  const checker = {
41777
- getNodeCount: () => sum(host.getSourceFiles(), "nodeCount"),
41778
- getIdentifierCount: () => sum(host.getSourceFiles(), "identifierCount"),
41779
- getSymbolCount: () => sum(host.getSourceFiles(), "symbolCount") + symbolCount,
41744
+ getNodeCount: () => reduceLeft(host.getSourceFiles(), (n, s) => n + s.nodeCount, 0),
41745
+ getIdentifierCount: () => reduceLeft(host.getSourceFiles(), (n, s) => n + s.identifierCount, 0),
41746
+ getSymbolCount: () => reduceLeft(host.getSourceFiles(), (n, s) => n + s.symbolCount, symbolCount),
41780
41747
  getTypeCount: () => typeCount,
41781
41748
  getInstantiationCount: () => totalInstantiationCount,
41782
41749
  getRelationCacheSizes: () => ({
@@ -52649,7 +52616,7 @@ function createTypeChecker(host) {
52649
52616
  }
52650
52617
  }
52651
52618
  }
52652
- if (!singleProp || isUnion && (propSet || checkFlags & 48 /* Partial */) && checkFlags & (1024 /* ContainsPrivate */ | 512 /* ContainsProtected */) && !(propSet && getCommonDeclarationsOfSymbols(arrayFrom(propSet.values())))) {
52619
+ if (!singleProp || isUnion && (propSet || checkFlags & 48 /* Partial */) && checkFlags & (1024 /* ContainsPrivate */ | 512 /* ContainsProtected */) && !(propSet && getCommonDeclarationsOfSymbols(propSet.values()))) {
52653
52620
  return void 0;
52654
52621
  }
52655
52622
  if (!propSet && !(checkFlags & 16 /* ReadPartial */) && !indexTypes) {
@@ -54740,7 +54707,7 @@ function createTypeChecker(host) {
54740
54707
  if (!aliasSymbol && namedUnions.length === 1 && reducedTypes.length === 0) {
54741
54708
  return namedUnions[0];
54742
54709
  }
54743
- const namedTypesCount = reduceLeft(namedUnions, (sum2, union) => sum2 + union.types.length, 0);
54710
+ const namedTypesCount = reduceLeft(namedUnions, (sum, union) => sum + union.types.length, 0);
54744
54711
  if (namedTypesCount + reducedTypes.length === typeSet.length) {
54745
54712
  for (const t of namedUnions) {
54746
54713
  insertType(reducedTypes, t);
@@ -55783,14 +55750,11 @@ function createTypeChecker(host) {
55783
55750
  const constraint = getConstraintOfTypeParameter(p);
55784
55751
  return constraint && (isGenericObjectType(constraint) || isGenericIndexType(constraint)) ? cloneTypeParameter(p) : p;
55785
55752
  }
55786
- function isTypicalNondistributiveConditional(root) {
55787
- return !root.isDistributive && isSingletonTupleType(root.node.checkType) && isSingletonTupleType(root.node.extendsType);
55753
+ function isSimpleTupleType(node) {
55754
+ return isTupleTypeNode(node) && length(node.elements) > 0 && !some(node.elements, (e) => isOptionalTypeNode(e) || isRestTypeNode(e) || isNamedTupleMember(e) && !!(e.questionToken || e.dotDotDotToken));
55788
55755
  }
55789
- function isSingletonTupleType(node) {
55790
- return isTupleTypeNode(node) && length(node.elements) === 1 && !isOptionalTypeNode(node.elements[0]) && !isRestTypeNode(node.elements[0]) && !(isNamedTupleMember(node.elements[0]) && (node.elements[0].questionToken || node.elements[0].dotDotDotToken));
55791
- }
55792
- function unwrapNondistributiveConditionalTuple(root, type) {
55793
- return isTypicalNondistributiveConditional(root) && isTupleType(type) ? getTypeArguments(type)[0] : type;
55756
+ function isDeferredType(type, checkTuples) {
55757
+ return isGenericType(type) || checkTuples && isTupleType(type) && some(getTypeArguments(type), isGenericType);
55794
55758
  }
55795
55759
  function getConditionalType(root, mapper, aliasSymbol, aliasTypeArguments) {
55796
55760
  let result;
@@ -55802,10 +55766,10 @@ function createTypeChecker(host) {
55802
55766
  result = errorType;
55803
55767
  break;
55804
55768
  }
55805
- const isUnwrapped = isTypicalNondistributiveConditional(root);
55806
- const checkType = instantiateType(unwrapNondistributiveConditionalTuple(root, getActualTypeVariable(root.checkType)), mapper);
55807
- const checkTypeInstantiable = isGenericType(checkType);
55808
- const extendsType = instantiateType(unwrapNondistributiveConditionalTuple(root, root.extendsType), mapper);
55769
+ const checkTuples = isSimpleTupleType(root.node.checkType) && isSimpleTupleType(root.node.extendsType) && length(root.node.checkType.elements) === length(root.node.extendsType.elements);
55770
+ const checkType = instantiateType(getActualTypeVariable(root.checkType), mapper);
55771
+ const checkTypeDeferred = isDeferredType(checkType, checkTuples);
55772
+ const extendsType = instantiateType(root.extendsType, mapper);
55809
55773
  if (checkType === wildcardType || extendsType === wildcardType) {
55810
55774
  return wildcardType;
55811
55775
  }
@@ -55827,16 +55791,16 @@ function createTypeChecker(host) {
55827
55791
  }
55828
55792
  }
55829
55793
  }
55830
- if (!checkTypeInstantiable) {
55794
+ if (!checkTypeDeferred) {
55831
55795
  inferTypes(context.inferences, checkType, instantiateType(extendsType, freshMapper), 512 /* NoConstraints */ | 1024 /* AlwaysStrict */);
55832
55796
  }
55833
55797
  const innerMapper = combineTypeMappers(freshMapper, context.mapper);
55834
55798
  combinedMapper = mapper ? combineTypeMappers(innerMapper, mapper) : innerMapper;
55835
55799
  }
55836
- const inferredExtendsType = combinedMapper ? instantiateType(unwrapNondistributiveConditionalTuple(root, root.extendsType), combinedMapper) : extendsType;
55837
- if (!checkTypeInstantiable && !isGenericType(inferredExtendsType)) {
55838
- if (!(inferredExtendsType.flags & 3 /* AnyOrUnknown */) && (checkType.flags & 1 /* Any */ && !isUnwrapped || !isTypeAssignableTo(getPermissiveInstantiation(checkType), getPermissiveInstantiation(inferredExtendsType)))) {
55839
- if (checkType.flags & 1 /* Any */ && !isUnwrapped) {
55800
+ const inferredExtendsType = combinedMapper ? instantiateType(root.extendsType, combinedMapper) : extendsType;
55801
+ if (!checkTypeDeferred && !isDeferredType(inferredExtendsType, checkTuples)) {
55802
+ if (!(inferredExtendsType.flags & 3 /* AnyOrUnknown */) && (checkType.flags & 1 /* Any */ || !isTypeAssignableTo(getPermissiveInstantiation(checkType), getPermissiveInstantiation(inferredExtendsType)))) {
55803
+ if (checkType.flags & 1 /* Any */) {
55840
55804
  (extraTypes || (extraTypes = [])).push(instantiateType(getTypeFromTypeNode(root.node.trueType), combinedMapper || mapper));
55841
55805
  }
55842
55806
  const falseType2 = getTypeFromTypeNode(root.node.falseType);
@@ -57202,8 +57166,8 @@ function createTypeChecker(host) {
57202
57166
  }
57203
57167
  function elaborateElementwise(iterator, source, target, relation, containingMessageChain, errorOutputContainer) {
57204
57168
  let reportedError = false;
57205
- for (let status = iterator.next(); !status.done; status = iterator.next()) {
57206
- const { errorNode: prop, innerExpression: next, nameType, errorMessage } = status.value;
57169
+ for (const value of iterator) {
57170
+ const { errorNode: prop, innerExpression: next, nameType, errorMessage } = value;
57207
57171
  let targetPropType = getBestMatchIndexedAccessTypeOrUndefined(source, target, nameType);
57208
57172
  if (!targetPropType || targetPropType.flags & 8388608 /* IndexedAccess */)
57209
57173
  continue;
@@ -57279,6 +57243,74 @@ function createTypeChecker(host) {
57279
57243
  }
57280
57244
  return reportedError;
57281
57245
  }
57246
+ function elaborateIterableOrArrayLikeTargetElementwise(iterator, source, target, relation, containingMessageChain, errorOutputContainer) {
57247
+ const tupleOrArrayLikeTargetParts = filterType(target, isArrayOrTupleLikeType);
57248
+ const nonTupleOrArrayLikeTargetParts = filterType(target, (t) => !isArrayOrTupleLikeType(t));
57249
+ const iterationType = nonTupleOrArrayLikeTargetParts !== neverType ? getIterationTypeOfIterable(
57250
+ 13 /* ForOf */,
57251
+ 0 /* Yield */,
57252
+ nonTupleOrArrayLikeTargetParts,
57253
+ /*errorNode*/
57254
+ void 0
57255
+ ) : void 0;
57256
+ let reportedError = false;
57257
+ for (let status = iterator.next(); !status.done; status = iterator.next()) {
57258
+ const { errorNode: prop, innerExpression: next, nameType, errorMessage } = status.value;
57259
+ let targetPropType = iterationType;
57260
+ const targetIndexedPropType = tupleOrArrayLikeTargetParts !== neverType ? getBestMatchIndexedAccessTypeOrUndefined(source, tupleOrArrayLikeTargetParts, nameType) : void 0;
57261
+ if (targetIndexedPropType && !(targetIndexedPropType.flags & 8388608 /* IndexedAccess */)) {
57262
+ targetPropType = iterationType ? getUnionType([iterationType, targetIndexedPropType]) : targetIndexedPropType;
57263
+ }
57264
+ if (!targetPropType)
57265
+ continue;
57266
+ let sourcePropType = getIndexedAccessTypeOrUndefined(source, nameType);
57267
+ if (!sourcePropType)
57268
+ continue;
57269
+ const propName = getPropertyNameFromIndex(
57270
+ nameType,
57271
+ /*accessNode*/
57272
+ void 0
57273
+ );
57274
+ if (!checkTypeRelatedTo(
57275
+ sourcePropType,
57276
+ targetPropType,
57277
+ relation,
57278
+ /*errorNode*/
57279
+ void 0
57280
+ )) {
57281
+ const elaborated = next && elaborateError(
57282
+ next,
57283
+ sourcePropType,
57284
+ targetPropType,
57285
+ relation,
57286
+ /*headMessage*/
57287
+ void 0,
57288
+ containingMessageChain,
57289
+ errorOutputContainer
57290
+ );
57291
+ reportedError = true;
57292
+ if (!elaborated) {
57293
+ const resultObj = errorOutputContainer || {};
57294
+ const specificSource = next ? checkExpressionForMutableLocationWithContextualType(next, sourcePropType) : sourcePropType;
57295
+ if (exactOptionalPropertyTypes && isExactOptionalPropertyMismatch(specificSource, targetPropType)) {
57296
+ const diag2 = createDiagnosticForNode(prop, Diagnostics.Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_type_of_the_target, typeToString(specificSource), typeToString(targetPropType));
57297
+ diagnostics.add(diag2);
57298
+ resultObj.errors = [diag2];
57299
+ } else {
57300
+ const targetIsOptional = !!(propName && (getPropertyOfType(tupleOrArrayLikeTargetParts, propName) || unknownSymbol).flags & 16777216 /* Optional */);
57301
+ const sourceIsOptional = !!(propName && (getPropertyOfType(source, propName) || unknownSymbol).flags & 16777216 /* Optional */);
57302
+ targetPropType = removeMissingType(targetPropType, targetIsOptional);
57303
+ sourcePropType = removeMissingType(sourcePropType, targetIsOptional && sourceIsOptional);
57304
+ const result = checkTypeRelatedTo(specificSource, targetPropType, relation, prop, errorMessage, containingMessageChain, resultObj);
57305
+ if (result && specificSource !== sourcePropType) {
57306
+ checkTypeRelatedTo(sourcePropType, targetPropType, relation, prop, errorMessage, containingMessageChain, resultObj);
57307
+ }
57308
+ }
57309
+ }
57310
+ }
57311
+ }
57312
+ return reportedError;
57313
+ }
57282
57314
  function* generateJsxAttributes(node) {
57283
57315
  if (!length(node.properties))
57284
57316
  return;
@@ -57334,13 +57366,25 @@ function createTypeChecker(host) {
57334
57366
  return result;
57335
57367
  }
57336
57368
  const moreThanOneRealChildren = length(validChildren) > 1;
57337
- const arrayLikeTargetParts = filterType(childrenTargetType, isArrayOrTupleLikeType);
57338
- const nonArrayLikeTargetParts = filterType(childrenTargetType, (t) => !isArrayOrTupleLikeType(t));
57369
+ let arrayLikeTargetParts;
57370
+ let nonArrayLikeTargetParts;
57371
+ const iterableType = getGlobalIterableType(
57372
+ /*reportErrors*/
57373
+ false
57374
+ );
57375
+ if (iterableType !== emptyGenericType) {
57376
+ const anyIterable = createIterableType(anyType);
57377
+ arrayLikeTargetParts = filterType(childrenTargetType, (t) => isTypeAssignableTo(t, anyIterable));
57378
+ nonArrayLikeTargetParts = filterType(childrenTargetType, (t) => !isTypeAssignableTo(t, anyIterable));
57379
+ } else {
57380
+ arrayLikeTargetParts = filterType(childrenTargetType, isArrayOrTupleLikeType);
57381
+ nonArrayLikeTargetParts = filterType(childrenTargetType, (t) => !isArrayOrTupleLikeType(t));
57382
+ }
57339
57383
  if (moreThanOneRealChildren) {
57340
57384
  if (arrayLikeTargetParts !== neverType) {
57341
57385
  const realSource = createTupleType(checkJsxChildren(containingElement, 0 /* Normal */));
57342
57386
  const children = generateJsxChildren(containingElement, getInvalidTextualChildDiagnostic);
57343
- result = elaborateElementwise(children, realSource, arrayLikeTargetParts, relation, containingMessageChain, errorOutputContainer) || result;
57387
+ result = elaborateIterableOrArrayLikeTargetElementwise(children, realSource, arrayLikeTargetParts, relation, containingMessageChain, errorOutputContainer) || result;
57344
57388
  } else if (!isTypeRelatedTo(getIndexedAccessType(source, childrenNameType), childrenTargetType, relation)) {
57345
57389
  result = true;
57346
57390
  const diag2 = error(
@@ -61221,9 +61265,7 @@ function createTypeChecker(host) {
61221
61265
  }
61222
61266
  }
61223
61267
  function getUnmatchedProperty(source, target, requireOptionalProperties, matchDiscriminantProperties) {
61224
- const result = getUnmatchedProperties(source, target, requireOptionalProperties, matchDiscriminantProperties).next();
61225
- if (!result.done)
61226
- return result.value;
61268
+ return firstOrUndefinedIterator(getUnmatchedProperties(source, target, requireOptionalProperties, matchDiscriminantProperties));
61227
61269
  }
61228
61270
  function tupleTypesDefinitelyUnrelated(source, target) {
61229
61271
  return !(target.target.combinedFlags & 8 /* Variadic */) && target.target.minLength > source.target.minLength || !target.target.hasRestElement && (source.target.hasRestElement || target.target.fixedLength < source.target.fixedLength);
@@ -62004,7 +62046,8 @@ function createTypeChecker(host) {
62004
62046
  if (signature) {
62005
62047
  const inferredCovariantType = inference.candidates ? getCovariantInference(inference, signature) : void 0;
62006
62048
  if (inference.contraCandidates) {
62007
- inferredType = inferredCovariantType && !(inferredCovariantType.flags & 131072 /* Never */) && some(inference.contraCandidates, (t) => isTypeSubtypeOf(inferredCovariantType, t)) ? inferredCovariantType : getContravariantInference(inference);
62049
+ const useCovariantType = inferredCovariantType && !(inferredCovariantType.flags & 131072 /* Never */) && some(inference.contraCandidates, (t) => isTypeSubtypeOf(inferredCovariantType, t)) && every(context.inferences, (other) => other === inference || getConstraintOfTypeParameter(other.typeParameter) !== inference.typeParameter || every(other.candidates, (t) => isTypeSubtypeOf(t, inferredCovariantType)));
62050
+ inferredType = useCovariantType ? inferredCovariantType : getContravariantInference(inference);
62008
62051
  } else if (inferredCovariantType) {
62009
62052
  inferredType = inferredCovariantType;
62010
62053
  } else if (context.flags & 1 /* NoDefault */) {
@@ -82262,8 +82305,7 @@ function createSourceMapGenerator(host, file, sourceRoot, sourcesDirectoryPath,
82262
82305
  const sourceIndexToNewSourceIndexMap = [];
82263
82306
  let nameIndexToNewNameIndexMap;
82264
82307
  const mappingIterator = decodeMappings(map2.mappings);
82265
- for (let iterResult = mappingIterator.next(); !iterResult.done; iterResult = mappingIterator.next()) {
82266
- const raw = iterResult.value;
82308
+ for (const raw of mappingIterator) {
82267
82309
  if (end && (raw.generatedLine > end.line || raw.generatedLine === end.line && raw.generatedCharacter > end.character)) {
82268
82310
  break;
82269
82311
  }
@@ -82481,6 +82523,9 @@ function decodeMappings(mappings) {
82481
82523
  return { value: captureMapping(hasSource, hasName), done };
82482
82524
  }
82483
82525
  return stopIterating();
82526
+ },
82527
+ [Symbol.iterator]() {
82528
+ return this;
82484
82529
  }
82485
82530
  };
82486
82531
  function captureMapping(hasSource, hasName) {
@@ -85183,10 +85228,10 @@ function transformClassFields(context) {
85183
85228
  const shouldTransformInitializersUsingDefine = useDefineForClassFields && languageVersion < 9 /* ES2022 */;
85184
85229
  const shouldTransformInitializers = shouldTransformInitializersUsingSet || shouldTransformInitializersUsingDefine;
85185
85230
  const shouldTransformPrivateElementsOrClassStaticBlocks = languageVersion < 9 /* ES2022 */;
85186
- const shouldTransformAutoAccessors = languageVersion < 99 /* ESNext */;
85231
+ const shouldTransformAutoAccessors = languageVersion < 99 /* ESNext */ ? -1 /* True */ : !useDefineForClassFields ? 3 /* Maybe */ : 0 /* False */;
85187
85232
  const shouldTransformThisInStaticInitializers = languageVersion < 9 /* ES2022 */;
85188
85233
  const shouldTransformSuperInStaticInitializers = shouldTransformThisInStaticInitializers && languageVersion >= 2 /* ES2015 */;
85189
- const shouldTransformAnything = shouldTransformInitializers || shouldTransformPrivateElementsOrClassStaticBlocks || shouldTransformAutoAccessors;
85234
+ const shouldTransformAnything = shouldTransformInitializers || shouldTransformPrivateElementsOrClassStaticBlocks || shouldTransformAutoAccessors === -1 /* True */;
85190
85235
  const previousOnSubstituteNode = context.onSubstituteNode;
85191
85236
  context.onSubstituteNode = onSubstituteNode;
85192
85237
  const previousOnEmitNode = context.onEmitNode;
@@ -85216,7 +85261,7 @@ function transformClassFields(context) {
85216
85261
  }
85217
85262
  switch (node.kind) {
85218
85263
  case 127 /* AccessorKeyword */:
85219
- return shouldTransformAutoAccessors ? void 0 : node;
85264
+ return shouldTransformAutoAccessorsInCurrentClass() ? void 0 : node;
85220
85265
  case 260 /* ClassDeclaration */:
85221
85266
  return visitClassDeclaration(node);
85222
85267
  case 228 /* ClassExpression */:
@@ -85491,7 +85536,7 @@ function transformClassFields(context) {
85491
85536
  Debug.assert(info, "Undeclared private name for property declaration.");
85492
85537
  return info.isValid ? void 0 : node;
85493
85538
  }
85494
- if (shouldTransformInitializersUsingSet && !isStatic(node)) {
85539
+ if (shouldTransformInitializersUsingSet && !isStatic(node) && currentClassLexicalEnvironment && currentClassLexicalEnvironment.facts & 16 /* WillHoistInitializersToConstructor */) {
85495
85540
  return factory2.updatePropertyDeclaration(
85496
85541
  node,
85497
85542
  visitNodes2(node.modifiers, visitor, isModifierLike),
@@ -85507,7 +85552,7 @@ function transformClassFields(context) {
85507
85552
  return visitEachChild(node, visitor, context);
85508
85553
  }
85509
85554
  function transformPublicFieldInitializer(node) {
85510
- if (shouldTransformInitializers) {
85555
+ if (shouldTransformInitializers && !isAutoAccessorPropertyDeclaration(node)) {
85511
85556
  const expr = getPropertyNameExpressionIfNeeded(
85512
85557
  node.name,
85513
85558
  /*shouldHoist*/
@@ -85538,8 +85583,11 @@ function transformClassFields(context) {
85538
85583
  Debug.assert(!hasDecorators(node), "Decorators should already have been transformed and elided.");
85539
85584
  return isPrivateIdentifierClassElementDeclaration(node) ? transformPrivateFieldInitializer(node) : transformPublicFieldInitializer(node);
85540
85585
  }
85586
+ function shouldTransformAutoAccessorsInCurrentClass() {
85587
+ return shouldTransformAutoAccessors === -1 /* True */ || shouldTransformAutoAccessors === 3 /* Maybe */ && !!currentClassLexicalEnvironment && !!(currentClassLexicalEnvironment.facts & 16 /* WillHoistInitializersToConstructor */);
85588
+ }
85541
85589
  function visitPropertyDeclaration(node) {
85542
- if (shouldTransformAutoAccessors && isAutoAccessorPropertyDeclaration(node)) {
85590
+ if (shouldTransformAutoAccessorsInCurrentClass() && isAutoAccessorPropertyDeclaration(node)) {
85543
85591
  return transformAutoAccessor(node);
85544
85592
  }
85545
85593
  return transformFieldInitializer(node);
@@ -85940,26 +85988,44 @@ function transformClassFields(context) {
85940
85988
  if (isClassDeclaration(original) && classOrConstructorParameterIsDecorated(original)) {
85941
85989
  facts |= 1 /* ClassWasDecorated */;
85942
85990
  }
85991
+ let containsPublicInstanceFields = false;
85992
+ let containsInitializedPublicInstanceFields = false;
85993
+ let containsInstancePrivateElements = false;
85994
+ let containsInstanceAutoAccessors = false;
85943
85995
  for (const member of node.members) {
85944
- if (!isStatic(member))
85945
- continue;
85946
- if (member.name && (isPrivateIdentifier(member.name) || isAutoAccessorPropertyDeclaration(member)) && shouldTransformPrivateElementsOrClassStaticBlocks) {
85947
- facts |= 2 /* NeedsClassConstructorReference */;
85948
- }
85949
- if (isPropertyDeclaration(member) || isClassStaticBlockDeclaration(member)) {
85950
- if (shouldTransformThisInStaticInitializers && member.transformFlags & 16384 /* ContainsLexicalThis */) {
85951
- facts |= 8 /* NeedsSubstitutionForThisInClassStaticField */;
85952
- if (!(facts & 1 /* ClassWasDecorated */)) {
85953
- facts |= 2 /* NeedsClassConstructorReference */;
85996
+ if (isStatic(member)) {
85997
+ if (member.name && (isPrivateIdentifier(member.name) || isAutoAccessorPropertyDeclaration(member)) && shouldTransformPrivateElementsOrClassStaticBlocks) {
85998
+ facts |= 2 /* NeedsClassConstructorReference */;
85999
+ }
86000
+ if (isPropertyDeclaration(member) || isClassStaticBlockDeclaration(member)) {
86001
+ if (shouldTransformThisInStaticInitializers && member.transformFlags & 16384 /* ContainsLexicalThis */) {
86002
+ facts |= 8 /* NeedsSubstitutionForThisInClassStaticField */;
86003
+ if (!(facts & 1 /* ClassWasDecorated */)) {
86004
+ facts |= 2 /* NeedsClassConstructorReference */;
86005
+ }
85954
86006
  }
85955
- }
85956
- if (shouldTransformSuperInStaticInitializers && member.transformFlags & 134217728 /* ContainsLexicalSuper */) {
85957
- if (!(facts & 1 /* ClassWasDecorated */)) {
85958
- facts |= 2 /* NeedsClassConstructorReference */ | 4 /* NeedsClassSuperReference */;
86007
+ if (shouldTransformSuperInStaticInitializers && member.transformFlags & 134217728 /* ContainsLexicalSuper */) {
86008
+ if (!(facts & 1 /* ClassWasDecorated */)) {
86009
+ facts |= 2 /* NeedsClassConstructorReference */ | 4 /* NeedsClassSuperReference */;
86010
+ }
85959
86011
  }
85960
86012
  }
86013
+ } else if (!hasAbstractModifier(getOriginalNode(member))) {
86014
+ if (isAutoAccessorPropertyDeclaration(member)) {
86015
+ containsInstanceAutoAccessors = true;
86016
+ containsInstancePrivateElements || (containsInstancePrivateElements = isPrivateIdentifierClassElementDeclaration(member));
86017
+ } else if (isPrivateIdentifierClassElementDeclaration(member)) {
86018
+ containsInstancePrivateElements = true;
86019
+ } else if (isPropertyDeclaration(member)) {
86020
+ containsPublicInstanceFields = true;
86021
+ containsInitializedPublicInstanceFields || (containsInitializedPublicInstanceFields = !!member.initializer);
86022
+ }
85961
86023
  }
85962
86024
  }
86025
+ const willHoistInitializersToConstructor = shouldTransformInitializersUsingDefine && containsPublicInstanceFields || shouldTransformInitializersUsingSet && containsInitializedPublicInstanceFields || shouldTransformPrivateElementsOrClassStaticBlocks && containsInstancePrivateElements || shouldTransformPrivateElementsOrClassStaticBlocks && containsInstanceAutoAccessors && shouldTransformAutoAccessors === -1 /* True */;
86026
+ if (willHoistInitializersToConstructor) {
86027
+ facts |= 16 /* WillHoistInitializersToConstructor */;
86028
+ }
85963
86029
  return facts;
85964
86030
  }
85965
86031
  function visitExpressionWithTypeArgumentsInHeritageClause(node) {
@@ -86235,15 +86301,9 @@ function transformClassFields(context) {
86235
86301
  )
86236
86302
  );
86237
86303
  }
86238
- function isClassElementThatRequiresConstructorStatement(member) {
86239
- if (isStatic(member) || hasAbstractModifier(getOriginalNode(member))) {
86240
- return false;
86241
- }
86242
- return shouldTransformInitializersUsingDefine && isPropertyDeclaration(member) || shouldTransformInitializersUsingSet && isInitializedProperty(member) || shouldTransformPrivateElementsOrClassStaticBlocks && isPrivateIdentifierClassElementDeclaration(member) || shouldTransformPrivateElementsOrClassStaticBlocks && shouldTransformAutoAccessors && isAutoAccessorPropertyDeclaration(member);
86243
- }
86244
86304
  function transformConstructor(constructor, container) {
86245
86305
  constructor = visitNode(constructor, visitor, isConstructorDeclaration);
86246
- if (!some(container.members, isClassElementThatRequiresConstructorStatement)) {
86306
+ if (!currentClassLexicalEnvironment || !(currentClassLexicalEnvironment.facts & 16 /* WillHoistInitializersToConstructor */)) {
86247
86307
  return constructor;
86248
86308
  }
86249
86309
  const extendsClauseElement = getEffectiveBaseTypeNode(container);
@@ -90312,7 +90372,7 @@ function transformJsx(context) {
90312
90372
  void 0,
90313
90373
  factory2.createVariableDeclarationList([
90314
90374
  factory2.createVariableDeclaration(
90315
- factory2.createObjectBindingPattern(map(arrayFrom(importSpecifiersMap.values()), (s) => factory2.createBindingElement(
90375
+ factory2.createObjectBindingPattern(arrayFrom(importSpecifiersMap.values(), (s) => factory2.createBindingElement(
90316
90376
  /*dotdotdot*/
90317
90377
  void 0,
90318
90378
  s.propertyName,
@@ -90723,7 +90783,7 @@ function transformJsx(context) {
90723
90783
  return node.dotDotDotToken ? factory2.createSpreadElement(expression) : expression;
90724
90784
  }
90725
90785
  }
90726
- var entities = new Map(getEntries({
90786
+ var entities = new Map(Object.entries({
90727
90787
  quot: 34,
90728
90788
  amp: 38,
90729
90789
  apos: 39,
@@ -100327,7 +100387,7 @@ function transformDeclarations(context) {
100327
100387
  updated.exportedModulesFromDeclarationEmit = exportedModulesFromDeclarationEmit;
100328
100388
  return updated;
100329
100389
  function getLibReferences() {
100330
- return map(arrayFrom(libs2.keys()), (lib) => ({ fileName: lib, pos: -1, end: -1 }));
100390
+ return arrayFrom(libs2.keys(), (lib) => ({ fileName: lib, pos: -1, end: -1 }));
100331
100391
  }
100332
100392
  function getFileReferencesForUsedTypeReferences() {
100333
100393
  return necessaryTypeReferences ? mapDefined(arrayFrom(necessaryTypeReferences.keys()), getFileReferenceForSpecifierModeTuple) : [];
@@ -102885,6 +102945,8 @@ function createPrinter(printerOptions = {}, handlers = {}) {
102885
102945
  let tempFlags;
102886
102946
  let reservedNamesStack;
102887
102947
  let reservedNames;
102948
+ let reservedPrivateNamesStack;
102949
+ let reservedPrivateNames;
102888
102950
  let preserveSourceNewlines = printerOptions.preserveSourceNewlines;
102889
102951
  let nextListElementPos;
102890
102952
  let writer;
@@ -103178,6 +103240,9 @@ function createPrinter(printerOptions = {}, handlers = {}) {
103178
103240
  tempFlagsStack = [];
103179
103241
  tempFlags = TempFlags.Auto;
103180
103242
  reservedNamesStack = [];
103243
+ reservedNames = void 0;
103244
+ reservedPrivateNamesStack = [];
103245
+ reservedPrivateNames = void 0;
103181
103246
  currentSourceFile = void 0;
103182
103247
  currentLineMap = void 0;
103183
103248
  detachedCommentsInfo = void 0;
@@ -103921,9 +103986,13 @@ function createPrinter(printerOptions = {}, handlers = {}) {
103921
103986
  }
103922
103987
  }
103923
103988
  function emitComputedPropertyName(node) {
103989
+ const savedPrivateNameTempFlags = privateNameTempFlags;
103990
+ const savedReservedMemberNames = reservedPrivateNames;
103991
+ popPrivateNameGenerationScope();
103924
103992
  writePunctuation("[");
103925
103993
  emitExpression(node.expression, parenthesizer.parenthesizeExpressionOfComputedPropertyName);
103926
103994
  writePunctuation("]");
103995
+ pushPrivateNameGenerationScope(savedPrivateNameTempFlags, savedReservedMemberNames);
103927
103996
  }
103928
103997
  function emitTypeParameter(node) {
103929
103998
  emitModifiers(node, node.modifiers);
@@ -104103,10 +104172,16 @@ function createPrinter(printerOptions = {}, handlers = {}) {
104103
104172
  emitTypeArguments(node, node.typeArguments);
104104
104173
  }
104105
104174
  function emitTypeLiteral(node) {
104175
+ pushPrivateNameGenerationScope(
104176
+ TempFlags.Auto,
104177
+ /*newReservedMemberNames*/
104178
+ void 0
104179
+ );
104106
104180
  writePunctuation("{");
104107
104181
  const flags = getEmitFlags(node) & 1 /* SingleLine */ ? 768 /* SingleLineTypeLiteralMembers */ : 32897 /* MultiLineTypeLiteralMembers */;
104108
104182
  emitList(node, node.members, flags | 524288 /* NoSpaceIfEmpty */);
104109
104183
  writePunctuation("}");
104184
+ popPrivateNameGenerationScope();
104110
104185
  }
104111
104186
  function emitArrayType(node) {
104112
104187
  emit(node.elementType, parenthesizer.parenthesizeNonArrayTypeOfPostfixType);
@@ -104286,6 +104361,11 @@ function createPrinter(printerOptions = {}, handlers = {}) {
104286
104361
  emitExpressionList(node, elements, 8914 /* ArrayLiteralExpressionElements */ | preferNewLine, parenthesizer.parenthesizeExpressionForDisallowedComma);
104287
104362
  }
104288
104363
  function emitObjectLiteralExpression(node) {
104364
+ pushPrivateNameGenerationScope(
104365
+ TempFlags.Auto,
104366
+ /*newReservedMemberNames*/
104367
+ void 0
104368
+ );
104289
104369
  forEach(node.properties, generateMemberNames);
104290
104370
  const indentedFlag = getEmitFlags(node) & 131072 /* Indented */;
104291
104371
  if (indentedFlag) {
@@ -104297,6 +104377,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
104297
104377
  if (indentedFlag) {
104298
104378
  decreaseIndent();
104299
104379
  }
104380
+ popPrivateNameGenerationScope();
104300
104381
  }
104301
104382
  function emitPropertyAccessExpression(node) {
104302
104383
  emitExpression(node.expression, parenthesizer.parenthesizeLeftSideOfAccess);
@@ -105036,6 +105117,11 @@ function createPrinter(printerOptions = {}, handlers = {}) {
105036
105117
  emitClassDeclarationOrExpression(node);
105037
105118
  }
105038
105119
  function emitClassDeclarationOrExpression(node) {
105120
+ pushPrivateNameGenerationScope(
105121
+ TempFlags.Auto,
105122
+ /*newReservedMemberNames*/
105123
+ void 0
105124
+ );
105039
105125
  forEach(node.members, generateMemberNames);
105040
105126
  emitDecoratorsAndModifiers(node, node.modifiers);
105041
105127
  writeKeyword("class");
@@ -105056,8 +105142,14 @@ function createPrinter(printerOptions = {}, handlers = {}) {
105056
105142
  if (indentedFlag) {
105057
105143
  decreaseIndent();
105058
105144
  }
105145
+ popPrivateNameGenerationScope();
105059
105146
  }
105060
105147
  function emitInterfaceDeclaration(node) {
105148
+ pushPrivateNameGenerationScope(
105149
+ TempFlags.Auto,
105150
+ /*newReservedMemberNames*/
105151
+ void 0
105152
+ );
105061
105153
  emitModifiers(node, node.modifiers);
105062
105154
  writeKeyword("interface");
105063
105155
  writeSpace();
@@ -105068,6 +105160,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
105068
105160
  writePunctuation("{");
105069
105161
  emitList(node, node.members, 129 /* InterfaceMembers */);
105070
105162
  writePunctuation("}");
105163
+ popPrivateNameGenerationScope();
105071
105164
  }
105072
105165
  function emitTypeAliasDeclaration(node) {
105073
105166
  emitModifiers(node, node.modifiers);
@@ -106445,8 +106538,6 @@ function createPrinter(printerOptions = {}, handlers = {}) {
106445
106538
  }
106446
106539
  tempFlagsStack.push(tempFlags);
106447
106540
  tempFlags = TempFlags.Auto;
106448
- privateNameTempFlagsStack.push(privateNameTempFlags);
106449
- privateNameTempFlags = TempFlags.Auto;
106450
106541
  formattedNameTempFlagsStack.push(formattedNameTempFlags);
106451
106542
  formattedNameTempFlags = void 0;
106452
106543
  reservedNamesStack.push(reservedNames);
@@ -106456,7 +106547,6 @@ function createPrinter(printerOptions = {}, handlers = {}) {
106456
106547
  return;
106457
106548
  }
106458
106549
  tempFlags = tempFlagsStack.pop();
106459
- privateNameTempFlags = privateNameTempFlagsStack.pop();
106460
106550
  formattedNameTempFlags = formattedNameTempFlagsStack.pop();
106461
106551
  reservedNames = reservedNamesStack.pop();
106462
106552
  }
@@ -106466,6 +106556,22 @@ function createPrinter(printerOptions = {}, handlers = {}) {
106466
106556
  }
106467
106557
  reservedNames.add(name);
106468
106558
  }
106559
+ function pushPrivateNameGenerationScope(newPrivateNameTempFlags, newReservedMemberNames) {
106560
+ privateNameTempFlagsStack.push(privateNameTempFlags);
106561
+ privateNameTempFlags = newPrivateNameTempFlags;
106562
+ reservedPrivateNamesStack.push(reservedNames);
106563
+ reservedPrivateNames = newReservedMemberNames;
106564
+ }
106565
+ function popPrivateNameGenerationScope() {
106566
+ privateNameTempFlags = privateNameTempFlagsStack.pop();
106567
+ reservedPrivateNames = reservedPrivateNamesStack.pop();
106568
+ }
106569
+ function reservePrivateNameInNestedScopes(name) {
106570
+ if (!reservedPrivateNames || reservedPrivateNames === lastOrUndefined(reservedPrivateNamesStack)) {
106571
+ reservedPrivateNames = /* @__PURE__ */ new Set();
106572
+ }
106573
+ reservedPrivateNames.add(name);
106574
+ }
106469
106575
  function generateNames(node) {
106470
106576
  if (!node)
106471
106577
  return;
@@ -106587,10 +106693,13 @@ function createPrinter(printerOptions = {}, handlers = {}) {
106587
106693
  const nodeId = getNodeId(node);
106588
106694
  return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = generateNameForNode(node, privateName, flags != null ? flags : 0 /* None */, formatGeneratedNamePart(prefix, generateName), formatGeneratedNamePart(suffix)));
106589
106695
  }
106590
- function isUniqueName(name) {
106591
- return isFileLevelUniqueName2(name) && !generatedNames.has(name) && !(reservedNames && reservedNames.has(name));
106696
+ function isUniqueName(name, privateName) {
106697
+ return isFileLevelUniqueName2(name, privateName) && !isReservedName(name, privateName) && !generatedNames.has(name);
106698
+ }
106699
+ function isReservedName(name, privateName) {
106700
+ return privateName ? !!(reservedPrivateNames == null ? void 0 : reservedPrivateNames.has(name)) : !!(reservedNames == null ? void 0 : reservedNames.has(name));
106592
106701
  }
106593
- function isFileLevelUniqueName2(name) {
106702
+ function isFileLevelUniqueName2(name, _isPrivate) {
106594
106703
  return currentSourceFile ? isFileLevelUniqueName(currentSourceFile, name, hasGlobalName) : true;
106595
106704
  }
106596
106705
  function isUniqueLocalName(name, container) {
@@ -106638,9 +106747,11 @@ function createPrinter(printerOptions = {}, handlers = {}) {
106638
106747
  if (flags && !(tempFlags2 & flags)) {
106639
106748
  const name = flags === TempFlags._i ? "_i" : "_n";
106640
106749
  const fullName = formatGeneratedName(privateName, prefix, name, suffix);
106641
- if (isUniqueName(fullName)) {
106750
+ if (isUniqueName(fullName, privateName)) {
106642
106751
  tempFlags2 |= flags;
106643
- if (reservedInNestedScopes) {
106752
+ if (privateName) {
106753
+ reservePrivateNameInNestedScopes(fullName);
106754
+ } else if (reservedInNestedScopes) {
106644
106755
  reserveNameInNestedScopes(fullName);
106645
106756
  }
106646
106757
  setTempFlags(key, tempFlags2);
@@ -106653,8 +106764,10 @@ function createPrinter(printerOptions = {}, handlers = {}) {
106653
106764
  if (count !== 8 && count !== 13) {
106654
106765
  const name = count < 26 ? "_" + String.fromCharCode(97 /* a */ + count) : "_" + (count - 26);
106655
106766
  const fullName = formatGeneratedName(privateName, prefix, name, suffix);
106656
- if (isUniqueName(fullName)) {
106657
- if (reservedInNestedScopes) {
106767
+ if (isUniqueName(fullName, privateName)) {
106768
+ if (privateName) {
106769
+ reservePrivateNameInNestedScopes(fullName);
106770
+ } else if (reservedInNestedScopes) {
106658
106771
  reserveNameInNestedScopes(fullName);
106659
106772
  }
106660
106773
  setTempFlags(key, tempFlags2);
@@ -106672,8 +106785,10 @@ function createPrinter(printerOptions = {}, handlers = {}) {
106672
106785
  }
106673
106786
  if (optimistic) {
106674
106787
  const fullName = formatGeneratedName(privateName, prefix, baseName, suffix);
106675
- if (checkFn(fullName)) {
106676
- if (scoped) {
106788
+ if (checkFn(fullName, privateName)) {
106789
+ if (privateName) {
106790
+ reservePrivateNameInNestedScopes(fullName);
106791
+ } else if (scoped) {
106677
106792
  reserveNameInNestedScopes(fullName);
106678
106793
  } else {
106679
106794
  generatedNames.add(fullName);
@@ -106687,8 +106802,10 @@ function createPrinter(printerOptions = {}, handlers = {}) {
106687
106802
  let i = 1;
106688
106803
  while (true) {
106689
106804
  const fullName = formatGeneratedName(privateName, prefix, baseName + i, suffix);
106690
- if (checkFn(fullName)) {
106691
- if (scoped) {
106805
+ if (checkFn(fullName, privateName)) {
106806
+ if (privateName) {
106807
+ reservePrivateNameInNestedScopes(fullName);
106808
+ } else if (scoped) {
106692
106809
  reserveNameInNestedScopes(fullName);
106693
106810
  } else {
106694
106811
  generatedNames.add(fullName);
@@ -111925,9 +112042,8 @@ var BuilderState;
111925
112042
  seenMap.add(path);
111926
112043
  const references = state.referencedMap.getValues(path);
111927
112044
  if (references) {
111928
- const iterator = references.keys();
111929
- for (let iterResult = iterator.next(); !iterResult.done; iterResult = iterator.next()) {
111930
- queue.push(iterResult.value);
112045
+ for (const key of references.keys()) {
112046
+ queue.push(key);
111931
112047
  }
111932
112048
  }
111933
112049
  }
@@ -113993,7 +114109,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
113993
114109
  return (_a2 = resolution.failedLookupLocations) == null ? void 0 : _a2.some((location) => isInvalidatedFailedLookup(resolutionHost.toPath(location)));
113994
114110
  }
113995
114111
  function isInvalidatedFailedLookup(locationPath) {
113996
- return (failedLookupChecks == null ? void 0 : failedLookupChecks.has(locationPath)) || firstDefinedIterator((startsWithPathChecks == null ? void 0 : startsWithPathChecks.keys()) || emptyIterator, (fileOrDirectoryPath) => startsWith(locationPath, fileOrDirectoryPath) ? true : void 0) || firstDefinedIterator((isInDirectoryChecks == null ? void 0 : isInDirectoryChecks.keys()) || emptyIterator, (fileOrDirectoryPath) => isInDirectoryPath(fileOrDirectoryPath, locationPath) ? true : void 0);
114112
+ return (failedLookupChecks == null ? void 0 : failedLookupChecks.has(locationPath)) || firstDefinedIterator((startsWithPathChecks == null ? void 0 : startsWithPathChecks.keys()) || [], (fileOrDirectoryPath) => startsWith(locationPath, fileOrDirectoryPath) ? true : void 0) || firstDefinedIterator((isInDirectoryChecks == null ? void 0 : isInDirectoryChecks.keys()) || [], (fileOrDirectoryPath) => isInDirectoryPath(fileOrDirectoryPath, locationPath) ? true : void 0);
113997
114113
  }
113998
114114
  function canInvalidatedFailedLookupResolutionWithAffectingLocation(resolution) {
113999
114115
  var _a2;
@@ -115251,7 +115367,7 @@ function createWatchProgram(host) {
115251
115367
  if (wildcardDirectories) {
115252
115368
  updateWatchingWildcardDirectories(
115253
115369
  watchedWildcardDirectories || (watchedWildcardDirectories = /* @__PURE__ */ new Map()),
115254
- new Map(getEntries(wildcardDirectories)),
115370
+ new Map(Object.entries(wildcardDirectories)),
115255
115371
  watchWildcardDirectory
115256
115372
  );
115257
115373
  } else if (watchedWildcardDirectories) {
@@ -115345,7 +115461,7 @@ function createWatchProgram(host) {
115345
115461
  if ((_b = commandLine.parsedCommandLine) == null ? void 0 : _b.wildcardDirectories) {
115346
115462
  updateWatchingWildcardDirectories(
115347
115463
  commandLine.watchedDirectories || (commandLine.watchedDirectories = /* @__PURE__ */ new Map()),
115348
- new Map(getEntries((_c = commandLine.parsedCommandLine) == null ? void 0 : _c.wildcardDirectories)),
115464
+ new Map(Object.entries((_c = commandLine.parsedCommandLine) == null ? void 0 : _c.wildcardDirectories)),
115349
115465
  (directory, flags) => {
115350
115466
  var _a3;
115351
115467
  return watchDirectory(
@@ -117041,7 +117157,7 @@ function watchWildCardDirectories(state, resolved, resolvedPath, parsed) {
117041
117157
  return;
117042
117158
  updateWatchingWildcardDirectories(
117043
117159
  getOrCreateValueMapFromConfigFileMap(state.allWatchedWildcardDirectories, resolvedPath),
117044
- new Map(getEntries(parsed.wildcardDirectories)),
117160
+ new Map(Object.entries(parsed.wildcardDirectories)),
117045
117161
  (dir, flags) => state.watchDirectory(
117046
117162
  dir,
117047
117163
  (fileOrDirectory) => {
@@ -117608,7 +117724,7 @@ function generateOptionOutput(sys2, option, rightAlignOfLeft, leftAlignOfRight)
117608
117724
  option3.type.forEach((value, name2) => {
117609
117725
  (inverted[value] || (inverted[value] = [])).push(name2);
117610
117726
  });
117611
- return getEntries(inverted).map(([, synonyms]) => synonyms.join("/")).join(", ");
117727
+ return Object.entries(inverted).map(([, synonyms]) => synonyms.join("/")).join(", ");
117612
117728
  }
117613
117729
  return possibleValues;
117614
117730
  }
@@ -118337,11 +118453,11 @@ function reportStatistics(sys2, programOrConfig, solutionPerformance) {
118337
118453
  reportCountStatistic("Files", program.getSourceFiles().length);
118338
118454
  const lineCounts = countLines(program);
118339
118455
  if (compilerOptions.extendedDiagnostics) {
118340
- for (const key of arrayFrom(lineCounts.keys())) {
118341
- reportCountStatistic("Lines of " + key, lineCounts.get(key));
118456
+ for (const [key, value] of lineCounts.entries()) {
118457
+ reportCountStatistic("Lines of " + key, value);
118342
118458
  }
118343
118459
  } else {
118344
- reportCountStatistic("Lines", reduceLeftIterator(lineCounts.values(), (sum2, count) => sum2 + count, 0));
118460
+ reportCountStatistic("Lines", reduceLeftIterator(lineCounts.values(), (sum, count) => sum + count, 0));
118345
118461
  }
118346
118462
  reportCountStatistic("Identifiers", program.getIdentifierCount());
118347
118463
  reportCountStatistic("Symbols", program.getSymbolCount());