@typescript-deploys/pr-build 5.9.0-pr-61399-3 → 5.9.0-pr-61359-4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/_tsc.js CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.9";
21
- var version = `${versionMajorMinor}.0-insiders.20250311`;
21
+ var version = `${versionMajorMinor}.0-insiders.20250320`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -635,7 +635,7 @@ function binarySearchKey(array, key, keySelector, keyComparer, offset) {
635
635
  while (low <= high) {
636
636
  const middle = low + (high - low >> 1);
637
637
  const midKey = keySelector(array[middle], middle);
638
- switch (Math.sign(keyComparer(midKey, key))) {
638
+ switch (keyComparer(midKey, key)) {
639
639
  case -1 /* LessThan */:
640
640
  low = middle + 1;
641
641
  break;
@@ -1735,8 +1735,8 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
1735
1735
  // for use with vscode-js-debug's new customDescriptionGenerator in launch.json
1736
1736
  __tsDebuggerDisplay: {
1737
1737
  value() {
1738
- const typeHeader = this.flags & 67245055 /* Intrinsic */ ? `IntrinsicType ${this.intrinsicName}${this.debugIntrinsicName ? ` (${this.debugIntrinsicName})` : ""}` : this.flags & 12 /* Nullable */ ? "NullableType" : this.flags & 3072 /* StringOrNumberLiteral */ ? `LiteralType ${JSON.stringify(this.value)}` : this.flags & 8192 /* BigIntLiteral */ ? `LiteralType ${this.value.negative ? "-" : ""}${this.value.base10Value}n` : this.flags & 16384 /* UniqueESSymbol */ ? "UniqueESSymbolType" : this.flags & 65536 /* Enum */ ? "EnumType" : this.flags & 1048576 /* Union */ ? "UnionType" : this.flags & 2097152 /* Intersection */ ? "IntersectionType" : this.flags & 4194304 /* Index */ ? "IndexType" : this.flags & 8388608 /* IndexedAccess */ ? "IndexedAccessType" : this.flags & 16777216 /* Conditional */ ? "ConditionalType" : this.flags & 33554432 /* Substitution */ ? "SubstitutionType" : this.flags & 262144 /* TypeParameter */ ? "TypeParameter" : this.flags & 524288 /* Object */ ? this.objectFlags & 3 /* ClassOrInterface */ ? "InterfaceType" : this.objectFlags & 4 /* Reference */ ? "TypeReference" : this.objectFlags & 8 /* Tuple */ ? "TupleType" : this.objectFlags & 16 /* Anonymous */ ? "AnonymousType" : this.objectFlags & 32 /* Mapped */ ? "MappedType" : this.objectFlags & 1024 /* ReverseMapped */ ? "ReverseMappedType" : this.objectFlags & 256 /* EvolvingArray */ ? "EvolvingArrayType" : "ObjectType" : "Type";
1739
- const remainingObjectFlags = this.flags & 524288 /* Object */ ? this.objectFlags & ~142607679 /* ObjectTypeKindMask */ : 0;
1738
+ const typeHeader = this.flags & 67359327 /* Intrinsic */ ? `IntrinsicType ${this.intrinsicName}${this.debugIntrinsicName ? ` (${this.debugIntrinsicName})` : ""}` : this.flags & 98304 /* Nullable */ ? "NullableType" : this.flags & 384 /* StringOrNumberLiteral */ ? `LiteralType ${JSON.stringify(this.value)}` : this.flags & 2048 /* BigIntLiteral */ ? `LiteralType ${this.value.negative ? "-" : ""}${this.value.base10Value}n` : this.flags & 8192 /* UniqueESSymbol */ ? "UniqueESSymbolType" : this.flags & 32 /* Enum */ ? "EnumType" : this.flags & 1048576 /* Union */ ? "UnionType" : this.flags & 2097152 /* Intersection */ ? "IntersectionType" : this.flags & 4194304 /* Index */ ? "IndexType" : this.flags & 8388608 /* IndexedAccess */ ? "IndexedAccessType" : this.flags & 16777216 /* Conditional */ ? "ConditionalType" : this.flags & 33554432 /* Substitution */ ? "SubstitutionType" : this.flags & 262144 /* TypeParameter */ ? "TypeParameter" : this.flags & 524288 /* Object */ ? this.objectFlags & 3 /* ClassOrInterface */ ? "InterfaceType" : this.objectFlags & 4 /* Reference */ ? "TypeReference" : this.objectFlags & 8 /* Tuple */ ? "TupleType" : this.objectFlags & 16 /* Anonymous */ ? "AnonymousType" : this.objectFlags & 32 /* Mapped */ ? "MappedType" : this.objectFlags & 1024 /* ReverseMapped */ ? "ReverseMappedType" : this.objectFlags & 256 /* EvolvingArray */ ? "EvolvingArrayType" : "ObjectType" : "Type";
1739
+ const remainingObjectFlags = this.flags & 524288 /* Object */ ? this.objectFlags & ~1343 /* ObjectTypeKindMask */ : 0;
1740
1740
  return `${typeHeader}${this.symbol ? ` '${symbolName(this.symbol)}'` : ""}${remainingObjectFlags ? ` (${formatObjectFlags(remainingObjectFlags)})` : ""}`;
1741
1741
  }
1742
1742
  },
@@ -2819,7 +2819,7 @@ var tracingEnabled;
2819
2819
  const objectFlags = type.objectFlags;
2820
2820
  const symbol = type.aliasSymbol ?? type.symbol;
2821
2821
  let display;
2822
- if (objectFlags & 16 /* Anonymous */ | type.flags & 15360 /* Literal */) {
2822
+ if (objectFlags & 16 /* Anonymous */ | type.flags & 2944 /* Literal */) {
2823
2823
  try {
2824
2824
  display = (_a = type.checker) == null ? void 0 : _a.typeToString(type);
2825
2825
  } catch {
@@ -3570,21 +3570,21 @@ var NodeCheckFlags = /* @__PURE__ */ ((NodeCheckFlags3) => {
3570
3570
  var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
3571
3571
  TypeFlags2[TypeFlags2["Any"] = 1] = "Any";
3572
3572
  TypeFlags2[TypeFlags2["Unknown"] = 2] = "Unknown";
3573
- TypeFlags2[TypeFlags2["Undefined"] = 4] = "Undefined";
3574
- TypeFlags2[TypeFlags2["Null"] = 8] = "Null";
3575
- TypeFlags2[TypeFlags2["Void"] = 16] = "Void";
3576
- TypeFlags2[TypeFlags2["String"] = 32] = "String";
3577
- TypeFlags2[TypeFlags2["Number"] = 64] = "Number";
3578
- TypeFlags2[TypeFlags2["BigInt"] = 128] = "BigInt";
3579
- TypeFlags2[TypeFlags2["Boolean"] = 256] = "Boolean";
3580
- TypeFlags2[TypeFlags2["ESSymbol"] = 512] = "ESSymbol";
3581
- TypeFlags2[TypeFlags2["StringLiteral"] = 1024] = "StringLiteral";
3582
- TypeFlags2[TypeFlags2["NumberLiteral"] = 2048] = "NumberLiteral";
3583
- TypeFlags2[TypeFlags2["BooleanLiteral"] = 4096] = "BooleanLiteral";
3584
- TypeFlags2[TypeFlags2["BigIntLiteral"] = 8192] = "BigIntLiteral";
3585
- TypeFlags2[TypeFlags2["UniqueESSymbol"] = 16384] = "UniqueESSymbol";
3586
- TypeFlags2[TypeFlags2["EnumLiteral"] = 32768] = "EnumLiteral";
3587
- TypeFlags2[TypeFlags2["Enum"] = 65536] = "Enum";
3573
+ TypeFlags2[TypeFlags2["String"] = 4] = "String";
3574
+ TypeFlags2[TypeFlags2["Number"] = 8] = "Number";
3575
+ TypeFlags2[TypeFlags2["Boolean"] = 16] = "Boolean";
3576
+ TypeFlags2[TypeFlags2["Enum"] = 32] = "Enum";
3577
+ TypeFlags2[TypeFlags2["BigInt"] = 64] = "BigInt";
3578
+ TypeFlags2[TypeFlags2["StringLiteral"] = 128] = "StringLiteral";
3579
+ TypeFlags2[TypeFlags2["NumberLiteral"] = 256] = "NumberLiteral";
3580
+ TypeFlags2[TypeFlags2["BooleanLiteral"] = 512] = "BooleanLiteral";
3581
+ TypeFlags2[TypeFlags2["EnumLiteral"] = 1024] = "EnumLiteral";
3582
+ TypeFlags2[TypeFlags2["BigIntLiteral"] = 2048] = "BigIntLiteral";
3583
+ TypeFlags2[TypeFlags2["ESSymbol"] = 4096] = "ESSymbol";
3584
+ TypeFlags2[TypeFlags2["UniqueESSymbol"] = 8192] = "UniqueESSymbol";
3585
+ TypeFlags2[TypeFlags2["Void"] = 16384] = "Void";
3586
+ TypeFlags2[TypeFlags2["Undefined"] = 32768] = "Undefined";
3587
+ TypeFlags2[TypeFlags2["Null"] = 65536] = "Null";
3588
3588
  TypeFlags2[TypeFlags2["Never"] = 131072] = "Never";
3589
3589
  TypeFlags2[TypeFlags2["TypeParameter"] = 262144] = "TypeParameter";
3590
3590
  TypeFlags2[TypeFlags2["Object"] = 524288] = "Object";
@@ -3600,25 +3600,25 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
3600
3600
  TypeFlags2[TypeFlags2["Reserved1"] = 536870912] = "Reserved1";
3601
3601
  TypeFlags2[TypeFlags2["Reserved2"] = 1073741824] = "Reserved2";
3602
3602
  TypeFlags2[TypeFlags2["AnyOrUnknown"] = 3] = "AnyOrUnknown";
3603
- TypeFlags2[TypeFlags2["Nullable"] = 12] = "Nullable";
3604
- TypeFlags2[TypeFlags2["Literal"] = 15360] = "Literal";
3605
- TypeFlags2[TypeFlags2["Unit"] = 97292] = "Unit";
3606
- TypeFlags2[TypeFlags2["Freshable"] = 80896] = "Freshable";
3607
- TypeFlags2[TypeFlags2["StringOrNumberLiteral"] = 3072] = "StringOrNumberLiteral";
3608
- TypeFlags2[TypeFlags2["StringOrNumberLiteralOrUnique"] = 19456] = "StringOrNumberLiteralOrUnique";
3609
- TypeFlags2[TypeFlags2["DefinitelyFalsy"] = 15388] = "DefinitelyFalsy";
3610
- TypeFlags2[TypeFlags2["PossiblyFalsy"] = 15868] = "PossiblyFalsy";
3611
- TypeFlags2[TypeFlags2["Intrinsic"] = 67245055] = "Intrinsic";
3612
- TypeFlags2[TypeFlags2["StringLike"] = 402654240] = "StringLike";
3613
- TypeFlags2[TypeFlags2["NumberLike"] = 67648] = "NumberLike";
3614
- TypeFlags2[TypeFlags2["BigIntLike"] = 8320] = "BigIntLike";
3615
- TypeFlags2[TypeFlags2["BooleanLike"] = 4352] = "BooleanLike";
3616
- TypeFlags2[TypeFlags2["EnumLike"] = 98304] = "EnumLike";
3617
- TypeFlags2[TypeFlags2["ESSymbolLike"] = 16896] = "ESSymbolLike";
3618
- TypeFlags2[TypeFlags2["VoidLike"] = 20] = "VoidLike";
3603
+ TypeFlags2[TypeFlags2["Nullable"] = 98304] = "Nullable";
3604
+ TypeFlags2[TypeFlags2["Literal"] = 2944] = "Literal";
3605
+ TypeFlags2[TypeFlags2["Unit"] = 109472] = "Unit";
3606
+ TypeFlags2[TypeFlags2["Freshable"] = 2976] = "Freshable";
3607
+ TypeFlags2[TypeFlags2["StringOrNumberLiteral"] = 384] = "StringOrNumberLiteral";
3608
+ TypeFlags2[TypeFlags2["StringOrNumberLiteralOrUnique"] = 8576] = "StringOrNumberLiteralOrUnique";
3609
+ TypeFlags2[TypeFlags2["DefinitelyFalsy"] = 117632] = "DefinitelyFalsy";
3610
+ TypeFlags2[TypeFlags2["PossiblyFalsy"] = 117724] = "PossiblyFalsy";
3611
+ TypeFlags2[TypeFlags2["Intrinsic"] = 67359327] = "Intrinsic";
3612
+ TypeFlags2[TypeFlags2["StringLike"] = 402653316] = "StringLike";
3613
+ TypeFlags2[TypeFlags2["NumberLike"] = 296] = "NumberLike";
3614
+ TypeFlags2[TypeFlags2["BigIntLike"] = 2112] = "BigIntLike";
3615
+ TypeFlags2[TypeFlags2["BooleanLike"] = 528] = "BooleanLike";
3616
+ TypeFlags2[TypeFlags2["EnumLike"] = 1056] = "EnumLike";
3617
+ TypeFlags2[TypeFlags2["ESSymbolLike"] = 12288] = "ESSymbolLike";
3618
+ TypeFlags2[TypeFlags2["VoidLike"] = 49152] = "VoidLike";
3619
3619
  TypeFlags2[TypeFlags2["Primitive"] = 402784252] = "Primitive";
3620
- TypeFlags2[TypeFlags2["DefinitelyNonNullable"] = 470417376] = "DefinitelyNonNullable";
3621
- TypeFlags2[TypeFlags2["DisjointDomains"] = 469860348] = "DisjointDomains";
3620
+ TypeFlags2[TypeFlags2["DefinitelyNonNullable"] = 470302716] = "DefinitelyNonNullable";
3621
+ TypeFlags2[TypeFlags2["DisjointDomains"] = 469892092] = "DisjointDomains";
3622
3622
  TypeFlags2[TypeFlags2["UnionOrIntersection"] = 3145728] = "UnionOrIntersection";
3623
3623
  TypeFlags2[TypeFlags2["StructuredType"] = 3670016] = "StructuredType";
3624
3624
  TypeFlags2[TypeFlags2["TypeVariable"] = 8650752] = "TypeVariable";
@@ -3626,10 +3626,10 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
3626
3626
  TypeFlags2[TypeFlags2["InstantiablePrimitive"] = 406847488] = "InstantiablePrimitive";
3627
3627
  TypeFlags2[TypeFlags2["Instantiable"] = 465829888] = "Instantiable";
3628
3628
  TypeFlags2[TypeFlags2["StructuredOrInstantiable"] = 469499904] = "StructuredOrInstantiable";
3629
- TypeFlags2[TypeFlags2["ObjectFlagsType"] = 3801101] = "ObjectFlagsType";
3629
+ TypeFlags2[TypeFlags2["ObjectFlagsType"] = 3899393] = "ObjectFlagsType";
3630
3630
  TypeFlags2[TypeFlags2["Simplifiable"] = 25165824] = "Simplifiable";
3631
- TypeFlags2[TypeFlags2["Singleton"] = 67240959] = "Singleton";
3632
- TypeFlags2[TypeFlags2["Narrowable"] = 536707043] = "Narrowable";
3631
+ TypeFlags2[TypeFlags2["Singleton"] = 67358815] = "Singleton";
3632
+ TypeFlags2[TypeFlags2["Narrowable"] = 536624127] = "Narrowable";
3633
3633
  TypeFlags2[TypeFlags2["IncludesMask"] = 473694207] = "IncludesMask";
3634
3634
  TypeFlags2[TypeFlags2["IncludesMissingType"] = 262144 /* TypeParameter */] = "IncludesMissingType";
3635
3635
  TypeFlags2[TypeFlags2["IncludesNonWideningType"] = 4194304 /* Index */] = "IncludesNonWideningType";
@@ -3638,7 +3638,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
3638
3638
  TypeFlags2[TypeFlags2["IncludesInstantiable"] = 33554432 /* Substitution */] = "IncludesInstantiable";
3639
3639
  TypeFlags2[TypeFlags2["IncludesConstrainedTypeVariable"] = 536870912 /* Reserved1 */] = "IncludesConstrainedTypeVariable";
3640
3640
  TypeFlags2[TypeFlags2["IncludesError"] = 1073741824 /* Reserved2 */] = "IncludesError";
3641
- TypeFlags2[TypeFlags2["NotPrimitiveUnion"] = 36306963] = "NotPrimitiveUnion";
3641
+ TypeFlags2[TypeFlags2["NotPrimitiveUnion"] = 36323331] = "NotPrimitiveUnion";
3642
3642
  return TypeFlags2;
3643
3643
  })(TypeFlags || {});
3644
3644
  var ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
@@ -3668,11 +3668,11 @@ var ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
3668
3668
  ObjectFlags3[ObjectFlags3["RequiresWidening"] = 196608] = "RequiresWidening";
3669
3669
  ObjectFlags3[ObjectFlags3["PropagatingFlags"] = 458752] = "PropagatingFlags";
3670
3670
  ObjectFlags3[ObjectFlags3["InstantiatedMapped"] = 96] = "InstantiatedMapped";
3671
+ ObjectFlags3[ObjectFlags3["ObjectTypeKindMask"] = 1343] = "ObjectTypeKindMask";
3671
3672
  ObjectFlags3[ObjectFlags3["ContainsSpread"] = 2097152] = "ContainsSpread";
3672
3673
  ObjectFlags3[ObjectFlags3["ObjectRestType"] = 4194304] = "ObjectRestType";
3673
3674
  ObjectFlags3[ObjectFlags3["InstantiationExpressionType"] = 8388608] = "InstantiationExpressionType";
3674
3675
  ObjectFlags3[ObjectFlags3["SingleSignatureType"] = 134217728] = "SingleSignatureType";
3675
- ObjectFlags3[ObjectFlags3["ObjectTypeKindMask"] = 142607679] = "ObjectTypeKindMask";
3676
3676
  ObjectFlags3[ObjectFlags3["IsClassInstanceClone"] = 16777216] = "IsClassInstanceClone";
3677
3677
  ObjectFlags3[ObjectFlags3["IdenticalBaseTypeCalculated"] = 33554432] = "IdenticalBaseTypeCalculated";
3678
3678
  ObjectFlags3[ObjectFlags3["IdenticalBaseTypeExists"] = 67108864] = "IdenticalBaseTypeExists";
@@ -3680,6 +3680,7 @@ var ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
3680
3680
  ObjectFlags3[ObjectFlags3["IsGenericObjectType"] = 4194304] = "IsGenericObjectType";
3681
3681
  ObjectFlags3[ObjectFlags3["IsGenericIndexType"] = 8388608] = "IsGenericIndexType";
3682
3682
  ObjectFlags3[ObjectFlags3["IsGenericType"] = 12582912] = "IsGenericType";
3683
+ ObjectFlags3[ObjectFlags3["IsNarrowingType"] = 16777216] = "IsNarrowingType";
3683
3684
  ObjectFlags3[ObjectFlags3["ContainsIntersections"] = 16777216] = "ContainsIntersections";
3684
3685
  ObjectFlags3[ObjectFlags3["IsUnknownLikeUnionComputed"] = 33554432] = "IsUnknownLikeUnionComputed";
3685
3686
  ObjectFlags3[ObjectFlags3["IsUnknownLikeUnion"] = 67108864] = "IsUnknownLikeUnion";
@@ -17456,7 +17457,7 @@ function getClassLikeDeclarationOfSymbol(symbol) {
17456
17457
  return (_a = symbol.declarations) == null ? void 0 : _a.find(isClassLike);
17457
17458
  }
17458
17459
  function getObjectFlags(type) {
17459
- return type.flags & 3801101 /* ObjectFlagsType */ ? type.objectFlags : 0;
17460
+ return type.flags & 3899393 /* ObjectFlagsType */ ? type.objectFlags : 0;
17460
17461
  }
17461
17462
  function isUMDExportSymbol(symbol) {
17462
17463
  return !!symbol && !!symbol.declarations && !!symbol.declarations[0] && isNamespaceExportDeclaration(symbol.declarations[0]);
@@ -19248,13 +19249,13 @@ function intrinsicTagNameToString(node) {
19248
19249
  return isIdentifier(node) ? idText(node) : getTextOfJsxNamespacedName(node);
19249
19250
  }
19250
19251
  function isTypeUsableAsPropertyName(type) {
19251
- return !!(type.flags & 19456 /* StringOrNumberLiteralOrUnique */);
19252
+ return !!(type.flags & 8576 /* StringOrNumberLiteralOrUnique */);
19252
19253
  }
19253
19254
  function getPropertyNameFromType(type) {
19254
- if (type.flags & 16384 /* UniqueESSymbol */) {
19255
+ if (type.flags & 8192 /* UniqueESSymbol */) {
19255
19256
  return type.escapedName;
19256
19257
  }
19257
- if (type.flags & (1024 /* StringLiteral */ | 2048 /* NumberLiteral */)) {
19258
+ if (type.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */)) {
19258
19259
  return escapeLeadingUnderscores("" + type.value);
19259
19260
  }
19260
19261
  return Debug.fail();
@@ -44902,6 +44903,8 @@ function getContainerFlags(node) {
44902
44903
  case 185 /* ConstructorType */:
44903
44904
  case 175 /* ClassStaticBlockDeclaration */:
44904
44905
  return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */;
44906
+ case 351 /* JSDocImportTag */:
44907
+ return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */;
44905
44908
  case 218 /* FunctionExpression */:
44906
44909
  case 219 /* ArrowFunction */:
44907
44910
  return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 16 /* IsFunctionExpression */;
@@ -46163,7 +46166,6 @@ function createTypeChecker(host) {
46163
46166
  };
46164
46167
  var cancellationToken;
46165
46168
  var scanner;
46166
- var fileIndexMap = new Map(host.getSourceFiles().map((file, i) => [file, i]));
46167
46169
  var Symbol13 = objectAllocator.getSymbolConstructor();
46168
46170
  var Type7 = objectAllocator.getTypeConstructor();
46169
46171
  var Signature5 = objectAllocator.getSignatureConstructor();
@@ -46745,10 +46747,10 @@ function createTypeChecker(host) {
46745
46747
  var nonInferrableAnyType = createIntrinsicType(1 /* Any */, "any", 65536 /* ContainsWideningType */, "non-inferrable");
46746
46748
  var intrinsicMarkerType = createIntrinsicType(1 /* Any */, "intrinsic");
46747
46749
  var unknownType = createIntrinsicType(2 /* Unknown */, "unknown");
46748
- var undefinedType = createIntrinsicType(4 /* Undefined */, "undefined");
46749
- var undefinedWideningType = strictNullChecks ? undefinedType : createIntrinsicType(4 /* Undefined */, "undefined", 65536 /* ContainsWideningType */, "widening");
46750
+ var undefinedType = createIntrinsicType(32768 /* Undefined */, "undefined");
46751
+ var undefinedWideningType = strictNullChecks ? undefinedType : createIntrinsicType(32768 /* Undefined */, "undefined", 65536 /* ContainsWideningType */, "widening");
46750
46752
  var missingType = createIntrinsicType(
46751
- 4 /* Undefined */,
46753
+ 32768 /* Undefined */,
46752
46754
  "undefined",
46753
46755
  /*objectFlags*/
46754
46756
  void 0,
@@ -46756,33 +46758,33 @@ function createTypeChecker(host) {
46756
46758
  );
46757
46759
  var undefinedOrMissingType = exactOptionalPropertyTypes ? missingType : undefinedType;
46758
46760
  var optionalType = createIntrinsicType(
46759
- 4 /* Undefined */,
46761
+ 32768 /* Undefined */,
46760
46762
  "undefined",
46761
46763
  /*objectFlags*/
46762
46764
  void 0,
46763
46765
  "optional"
46764
46766
  );
46765
- var nullType = createIntrinsicType(8 /* Null */, "null");
46766
- var nullWideningType = strictNullChecks ? nullType : createIntrinsicType(8 /* Null */, "null", 65536 /* ContainsWideningType */, "widening");
46767
- var stringType = createIntrinsicType(32 /* String */, "string");
46768
- var numberType = createIntrinsicType(64 /* Number */, "number");
46769
- var bigintType = createIntrinsicType(128 /* BigInt */, "bigint");
46767
+ var nullType = createIntrinsicType(65536 /* Null */, "null");
46768
+ var nullWideningType = strictNullChecks ? nullType : createIntrinsicType(65536 /* Null */, "null", 65536 /* ContainsWideningType */, "widening");
46769
+ var stringType = createIntrinsicType(4 /* String */, "string");
46770
+ var numberType = createIntrinsicType(8 /* Number */, "number");
46771
+ var bigintType = createIntrinsicType(64 /* BigInt */, "bigint");
46770
46772
  var falseType = createIntrinsicType(
46771
- 4096 /* BooleanLiteral */,
46773
+ 512 /* BooleanLiteral */,
46772
46774
  "false",
46773
46775
  /*objectFlags*/
46774
46776
  void 0,
46775
46777
  "fresh"
46776
46778
  );
46777
- var regularFalseType = createIntrinsicType(4096 /* BooleanLiteral */, "false");
46779
+ var regularFalseType = createIntrinsicType(512 /* BooleanLiteral */, "false");
46778
46780
  var trueType = createIntrinsicType(
46779
- 4096 /* BooleanLiteral */,
46781
+ 512 /* BooleanLiteral */,
46780
46782
  "true",
46781
46783
  /*objectFlags*/
46782
46784
  void 0,
46783
46785
  "fresh"
46784
46786
  );
46785
- var regularTrueType = createIntrinsicType(4096 /* BooleanLiteral */, "true");
46787
+ var regularTrueType = createIntrinsicType(512 /* BooleanLiteral */, "true");
46786
46788
  trueType.regularType = regularTrueType;
46787
46789
  trueType.freshType = trueType;
46788
46790
  regularTrueType.regularType = regularTrueType;
@@ -46792,8 +46794,8 @@ function createTypeChecker(host) {
46792
46794
  regularFalseType.regularType = regularFalseType;
46793
46795
  regularFalseType.freshType = falseType;
46794
46796
  var booleanType = getUnionType([regularFalseType, regularTrueType]);
46795
- var esSymbolType = createIntrinsicType(512 /* ESSymbol */, "symbol");
46796
- var voidType = createIntrinsicType(16 /* Void */, "void");
46797
+ var esSymbolType = createIntrinsicType(4096 /* ESSymbol */, "symbol");
46798
+ var voidType = createIntrinsicType(16384 /* Void */, "void");
46797
46799
  var neverType = createIntrinsicType(131072 /* Never */, "never");
46798
46800
  var silentNeverType = createIntrinsicType(131072 /* Never */, "never", 262144 /* NonInferrableType */, "silent");
46799
46801
  var implicitNeverType = createIntrinsicType(
@@ -47177,6 +47179,7 @@ function createTypeChecker(host) {
47177
47179
  [".jsx", ".jsx"],
47178
47180
  [".json", ".json"]
47179
47181
  ];
47182
+ var narrowableReturnTypeCache = /* @__PURE__ */ new Map();
47180
47183
  initializeTypeChecker();
47181
47184
  return checker;
47182
47185
  function isDefinitelyReferenceToGlobalSymbolObject(node) {
@@ -48080,7 +48083,7 @@ function createTypeChecker(host) {
48080
48083
  const type = getDeclaredTypeOfSymbol(symbol);
48081
48084
  return !!(type.flags & 1048576 /* Union */) && allTypesAssignableToKind(
48082
48085
  type,
48083
- 3072 /* StringOrNumberLiteral */,
48086
+ 384 /* StringOrNumberLiteral */,
48084
48087
  /*strict*/
48085
48088
  true
48086
48089
  );
@@ -49787,7 +49790,7 @@ function createTypeChecker(host) {
49787
49790
  return type;
49788
49791
  }
49789
49792
  function createTypeofType() {
49790
- return getUnionType(map([...typeofNEFacts.keys()].sort(), getStringLiteralType));
49793
+ return getUnionType(arrayFrom(typeofNEFacts.keys(), getStringLiteralType));
49791
49794
  }
49792
49795
  function createTypeParameter(symbol) {
49793
49796
  return createTypeWithSymbol(262144 /* TypeParameter */, symbol);
@@ -50407,10 +50410,11 @@ function createTypeChecker(host) {
50407
50410
  serializeExistingTypeNode(context, typeNode, addUndefined) {
50408
50411
  return serializeExistingTypeNode(context, typeNode, !!addUndefined);
50409
50412
  },
50410
- serializeReturnTypeForSignature(syntacticContext, signatureDeclaration) {
50413
+ serializeReturnTypeForSignature(syntacticContext, signatureDeclaration, symbol) {
50411
50414
  const context = syntacticContext;
50412
50415
  const signature = getSignatureFromDeclaration(signatureDeclaration);
50413
- const returnType = context.enclosingSymbolTypes.get(getSymbolId(getSymbolOfDeclaration(signatureDeclaration))) ?? instantiateType(getReturnTypeOfSignature(signature), context.mapper);
50416
+ symbol ?? (symbol = getSymbolOfDeclaration(signatureDeclaration));
50417
+ const returnType = context.enclosingSymbolTypes.get(getSymbolId(symbol)) ?? instantiateType(getReturnTypeOfSignature(signature), context.mapper);
50414
50418
  return serializeInferredReturnTypeForSignature(context, signature, returnType);
50415
50419
  },
50416
50420
  serializeTypeOfExpression(syntacticContext, expr) {
@@ -50424,7 +50428,7 @@ function createTypeChecker(host) {
50424
50428
  symbol ?? (symbol = getSymbolOfDeclaration(declaration));
50425
50429
  let type = (_a = context.enclosingSymbolTypes) == null ? void 0 : _a.get(getSymbolId(symbol));
50426
50430
  if (type === void 0) {
50427
- type = symbol && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* Signature */)) ? instantiateType(getWidenedLiteralType(getTypeOfSymbol(symbol)), context.mapper) : errorType;
50431
+ type = symbol.flags & 98304 /* Accessor */ && declaration.kind === 178 /* SetAccessor */ ? instantiateType(getWriteTypeOfSymbol(symbol), context.mapper) : symbol && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* Signature */)) ? instantiateType(getWidenedLiteralType(getTypeOfSymbol(symbol)), context.mapper) : errorType;
50428
50432
  }
50429
50433
  const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration, context.enclosingDeclaration);
50430
50434
  if (addUndefinedForParameter) {
@@ -50608,7 +50612,7 @@ function createTypeChecker(host) {
50608
50612
  if (name && isComputedPropertyName(name)) return name;
50609
50613
  }
50610
50614
  const nameType = getSymbolLinks(symbol).nameType;
50611
- if (nameType && nameType.flags & (32768 /* EnumLiteral */ | 16384 /* UniqueESSymbol */)) {
50615
+ if (nameType && nameType.flags & (1024 /* EnumLiteral */ | 8192 /* UniqueESSymbol */)) {
50612
50616
  context.enclosingDeclaration = nameType.symbol.valueDeclaration;
50613
50617
  return factory.createComputedPropertyName(symbolToExpression(nameType.symbol, context, meaning));
50614
50618
  }
@@ -50716,23 +50720,23 @@ function createTypeChecker(host) {
50716
50720
  if (type.flags & 2 /* Unknown */) {
50717
50721
  return factory.createKeywordTypeNode(159 /* UnknownKeyword */);
50718
50722
  }
50719
- if (type.flags & 32 /* String */) {
50723
+ if (type.flags & 4 /* String */) {
50720
50724
  context.approximateLength += 6;
50721
50725
  return factory.createKeywordTypeNode(154 /* StringKeyword */);
50722
50726
  }
50723
- if (type.flags & 64 /* Number */) {
50727
+ if (type.flags & 8 /* Number */) {
50724
50728
  context.approximateLength += 6;
50725
50729
  return factory.createKeywordTypeNode(150 /* NumberKeyword */);
50726
50730
  }
50727
- if (type.flags & 128 /* BigInt */) {
50731
+ if (type.flags & 64 /* BigInt */) {
50728
50732
  context.approximateLength += 6;
50729
50733
  return factory.createKeywordTypeNode(163 /* BigIntKeyword */);
50730
50734
  }
50731
- if (type.flags & 256 /* Boolean */ && !type.aliasSymbol) {
50735
+ if (type.flags & 16 /* Boolean */ && !type.aliasSymbol) {
50732
50736
  context.approximateLength += 7;
50733
50737
  return factory.createKeywordTypeNode(136 /* BooleanKeyword */);
50734
50738
  }
50735
- if (type.flags & 98304 /* EnumLike */) {
50739
+ if (type.flags & 1056 /* EnumLike */) {
50736
50740
  if (type.symbol.flags & 8 /* EnumMember */) {
50737
50741
  const parentSymbol = getParentOfSymbol(type.symbol);
50738
50742
  const parentName = symbolToTypeNode(parentSymbol, context, 788968 /* Type */);
@@ -50761,24 +50765,24 @@ function createTypeChecker(host) {
50761
50765
  }
50762
50766
  return symbolToTypeNode(type.symbol, context, 788968 /* Type */);
50763
50767
  }
50764
- if (type.flags & 1024 /* StringLiteral */) {
50768
+ if (type.flags & 128 /* StringLiteral */) {
50765
50769
  context.approximateLength += type.value.length + 2;
50766
50770
  return factory.createLiteralTypeNode(setEmitFlags(factory.createStringLiteral(type.value, !!(context.flags & 268435456 /* UseSingleQuotesForStringLiteralType */)), 16777216 /* NoAsciiEscaping */));
50767
50771
  }
50768
- if (type.flags & 2048 /* NumberLiteral */) {
50772
+ if (type.flags & 256 /* NumberLiteral */) {
50769
50773
  const value = type.value;
50770
50774
  context.approximateLength += ("" + value).length;
50771
50775
  return factory.createLiteralTypeNode(value < 0 ? factory.createPrefixUnaryExpression(41 /* MinusToken */, factory.createNumericLiteral(-value)) : factory.createNumericLiteral(value));
50772
50776
  }
50773
- if (type.flags & 8192 /* BigIntLiteral */) {
50777
+ if (type.flags & 2048 /* BigIntLiteral */) {
50774
50778
  context.approximateLength += pseudoBigIntToString(type.value).length + 1;
50775
50779
  return factory.createLiteralTypeNode(factory.createBigIntLiteral(type.value));
50776
50780
  }
50777
- if (type.flags & 4096 /* BooleanLiteral */) {
50781
+ if (type.flags & 512 /* BooleanLiteral */) {
50778
50782
  context.approximateLength += type.intrinsicName.length;
50779
50783
  return factory.createLiteralTypeNode(type.intrinsicName === "true" ? factory.createTrue() : factory.createFalse());
50780
50784
  }
50781
- if (type.flags & 16384 /* UniqueESSymbol */) {
50785
+ if (type.flags & 8192 /* UniqueESSymbol */) {
50782
50786
  if (!(context.flags & 1048576 /* AllowUniqueESSymbolType */)) {
50783
50787
  if (isValueSymbolAccessible(type.symbol, context.enclosingDeclaration)) {
50784
50788
  context.approximateLength += 6;
@@ -50791,15 +50795,15 @@ function createTypeChecker(host) {
50791
50795
  context.approximateLength += 13;
50792
50796
  return factory.createTypeOperatorNode(158 /* UniqueKeyword */, factory.createKeywordTypeNode(155 /* SymbolKeyword */));
50793
50797
  }
50794
- if (type.flags & 16 /* Void */) {
50798
+ if (type.flags & 16384 /* Void */) {
50795
50799
  context.approximateLength += 4;
50796
50800
  return factory.createKeywordTypeNode(116 /* VoidKeyword */);
50797
50801
  }
50798
- if (type.flags & 4 /* Undefined */) {
50802
+ if (type.flags & 32768 /* Undefined */) {
50799
50803
  context.approximateLength += 9;
50800
50804
  return factory.createKeywordTypeNode(157 /* UndefinedKeyword */);
50801
50805
  }
50802
- if (type.flags & 8 /* Null */) {
50806
+ if (type.flags & 65536 /* Null */) {
50803
50807
  context.approximateLength += 4;
50804
50808
  return factory.createLiteralTypeNode(factory.createNull());
50805
50809
  }
@@ -50807,7 +50811,7 @@ function createTypeChecker(host) {
50807
50811
  context.approximateLength += 5;
50808
50812
  return factory.createKeywordTypeNode(146 /* NeverKeyword */);
50809
50813
  }
50810
- if (type.flags & 512 /* ESSymbol */) {
50814
+ if (type.flags & 4096 /* ESSymbol */) {
50811
50815
  context.approximateLength += 6;
50812
50816
  return factory.createKeywordTypeNode(155 /* SymbolKeyword */);
50813
50817
  }
@@ -51573,12 +51577,13 @@ function createTypeChecker(host) {
51573
51577
  if (propertySymbol.flags & 98304 /* Accessor */) {
51574
51578
  const writeType = getWriteTypeOfSymbol(propertySymbol);
51575
51579
  if (propertyType !== writeType && !isErrorType(propertyType) && !isErrorType(writeType)) {
51580
+ const symbolMapper = getSymbolLinks(propertySymbol).mapper;
51576
51581
  const getterDeclaration = getDeclarationOfKind(propertySymbol, 177 /* GetAccessor */);
51577
51582
  const getterSignature = getSignatureFromDeclaration(getterDeclaration);
51578
51583
  typeElements.push(
51579
51584
  setCommentRange2(
51580
51585
  context,
51581
- signatureToSignatureDeclarationHelper(getterSignature, 177 /* GetAccessor */, context, { name: propertyName }),
51586
+ signatureToSignatureDeclarationHelper(symbolMapper ? instantiateSignature(getterSignature, symbolMapper) : getterSignature, 177 /* GetAccessor */, context, { name: propertyName }),
51582
51587
  getterDeclaration
51583
51588
  )
51584
51589
  );
@@ -51587,7 +51592,7 @@ function createTypeChecker(host) {
51587
51592
  typeElements.push(
51588
51593
  setCommentRange2(
51589
51594
  context,
51590
- signatureToSignatureDeclarationHelper(setterSignature, 178 /* SetAccessor */, context, { name: propertyName }),
51595
+ signatureToSignatureDeclarationHelper(symbolMapper ? instantiateSignature(setterSignature, symbolMapper) : setterSignature, 178 /* SetAccessor */, context, { name: propertyName }),
51591
51596
  setterDeclaration
51592
51597
  )
51593
51598
  );
@@ -51596,7 +51601,7 @@ function createTypeChecker(host) {
51596
51601
  }
51597
51602
  const optionalToken = propertySymbol.flags & 16777216 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0;
51598
51603
  if (propertySymbol.flags & (16 /* Function */ | 8192 /* Method */) && !getPropertiesOfObjectType(propertyType).length && !isReadonlySymbol(propertySymbol)) {
51599
- const signatures = getSignaturesOfType(filterType(propertyType, (t) => !(t.flags & 4 /* Undefined */)), 0 /* Call */);
51604
+ const signatures = getSignaturesOfType(filterType(propertyType, (t) => !(t.flags & 32768 /* Undefined */)), 0 /* Call */);
51600
51605
  for (const signature of signatures) {
51601
51606
  const methodDeclaration = signatureToSignatureDeclarationHelper(signature, 173 /* MethodSignature */, context, { name: propertyName, questionToken: optionalToken });
51602
51607
  typeElements.push(preserveCommentsOn(methodDeclaration, signature.declaration || propertySymbol.valueDeclaration));
@@ -52636,11 +52641,11 @@ function createTypeChecker(host) {
52636
52641
  }
52637
52642
  if (isComputedPropertyName(name)) {
52638
52643
  const type = checkExpression(name.expression);
52639
- return !!(type.flags & 402654240 /* StringLike */);
52644
+ return !!(type.flags & 402653316 /* StringLike */);
52640
52645
  }
52641
52646
  if (isElementAccessExpression(name)) {
52642
52647
  const type = checkExpression(name.argumentExpression);
52643
- return !!(type.flags & 402654240 /* StringLike */);
52648
+ return !!(type.flags & 402653316 /* StringLike */);
52644
52649
  }
52645
52650
  return isStringLiteral(name);
52646
52651
  }
@@ -52666,7 +52671,7 @@ function createTypeChecker(host) {
52666
52671
  function getPropertyNameNodeForSymbolFromNameType(symbol, context, singleQuote, stringNamed, isMethod) {
52667
52672
  const nameType = getSymbolLinks(symbol).nameType;
52668
52673
  if (nameType) {
52669
- if (nameType.flags & 3072 /* StringOrNumberLiteral */) {
52674
+ if (nameType.flags & 384 /* StringOrNumberLiteral */) {
52670
52675
  const name = "" + nameType.value;
52671
52676
  if (!isIdentifierText(name, getEmitScriptTarget(compilerOptions)) && (stringNamed || !isNumericLiteralName(name))) {
52672
52677
  return factory.createStringLiteral(name, !!singleQuote);
@@ -52676,7 +52681,7 @@ function createTypeChecker(host) {
52676
52681
  }
52677
52682
  return createPropertyNameNodeForIdentifierOrLiteral(name, getEmitScriptTarget(compilerOptions), singleQuote, stringNamed, isMethod);
52678
52683
  }
52679
- if (nameType.flags & 16384 /* UniqueESSymbol */) {
52684
+ if (nameType.flags & 8192 /* UniqueESSymbol */) {
52680
52685
  return factory.createComputedPropertyName(symbolToExpression(nameType.symbol, context, 111551 /* Value */));
52681
52686
  }
52682
52687
  }
@@ -52718,7 +52723,7 @@ function createTypeChecker(host) {
52718
52723
  return enclosingDeclaration;
52719
52724
  }
52720
52725
  function serializeInferredTypeForDeclaration(symbol, context, type) {
52721
- if (type.flags & 16384 /* UniqueESSymbol */ && type.symbol === symbol && (!context.enclosingDeclaration || some(symbol.declarations, (d) => getSourceFileOfNode(d) === context.enclosingFile))) {
52726
+ if (type.flags & 8192 /* UniqueESSymbol */ && type.symbol === symbol && (!context.enclosingDeclaration || some(symbol.declarations, (d) => getSourceFileOfNode(d) === context.enclosingFile))) {
52722
52727
  context.flags |= 1048576 /* AllowUniqueESSymbolType */;
52723
52728
  }
52724
52729
  const result = typeToTypeNodeHelper(type, context);
@@ -52730,13 +52735,13 @@ function createTypeChecker(host) {
52730
52735
  const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration, context.enclosingDeclaration);
52731
52736
  const decl = declaration ?? symbol.valueDeclaration ?? getDeclarationWithTypeAnnotation(symbol) ?? ((_a = symbol.declarations) == null ? void 0 : _a[0]);
52732
52737
  if (decl) {
52738
+ const restore = addSymbolTypeToContext(context, symbol, type);
52733
52739
  if (isAccessor(decl)) {
52734
52740
  result = syntacticNodeBuilder.serializeTypeOfAccessor(decl, symbol, context);
52735
52741
  } else if (hasInferredType(decl) && !nodeIsSynthesized(decl) && !(getObjectFlags(type) & 196608 /* RequiresWidening */)) {
52736
- const restore = addSymbolTypeToContext(context, symbol, type);
52737
52742
  result = syntacticNodeBuilder.serializeTypeOfDeclaration(decl, symbol, context);
52738
- restore();
52739
52743
  }
52744
+ restore();
52740
52745
  }
52741
52746
  if (!result) {
52742
52747
  if (addUndefinedForParameter) {
@@ -52951,7 +52956,7 @@ function createTypeChecker(host) {
52951
52956
  }
52952
52957
  function serializeExistingTypeNode(context, typeNode, addUndefined) {
52953
52958
  const type = getTypeFromTypeNode2(context, typeNode);
52954
- if (addUndefined && !someType(type, (t) => !!(t.flags & 4 /* Undefined */)) && canReuseTypeNode(context, typeNode)) {
52959
+ if (addUndefined && !someType(type, (t) => !!(t.flags & 32768 /* Undefined */)) && canReuseTypeNode(context, typeNode)) {
52955
52960
  const clone = syntacticNodeBuilder.tryReuseExistingTypeNode(context, typeNode);
52956
52961
  if (clone) {
52957
52962
  return factory.createUnionTypeNode([clone, factory.createKeywordTypeNode(157 /* UndefinedKeyword */)]);
@@ -54490,9 +54495,9 @@ function createTypeChecker(host) {
54490
54495
  for (let i = 0; i < types.length; i++) {
54491
54496
  const t = types[i];
54492
54497
  flags |= t.flags;
54493
- if (!(t.flags & 12 /* Nullable */)) {
54494
- if (t.flags & (4096 /* BooleanLiteral */ | 98304 /* EnumLike */)) {
54495
- const baseType = t.flags & 4096 /* BooleanLiteral */ ? booleanType : getBaseTypeOfEnumLikeType(t);
54498
+ if (!(t.flags & 98304 /* Nullable */)) {
54499
+ if (t.flags & (512 /* BooleanLiteral */ | 1056 /* EnumLike */)) {
54500
+ const baseType = t.flags & 512 /* BooleanLiteral */ ? booleanType : getBaseTypeOfEnumLikeType(t);
54496
54501
  if (baseType.flags & 1048576 /* Union */) {
54497
54502
  const count = baseType.types.length;
54498
54503
  if (i + count <= types.length && getRegularTypeOfLiteralType(types[i + count - 1]) === getRegularTypeOfLiteralType(baseType.types[count - 1])) {
@@ -54505,8 +54510,8 @@ function createTypeChecker(host) {
54505
54510
  result.push(t);
54506
54511
  }
54507
54512
  }
54508
- if (flags & 8 /* Null */) result.push(nullType);
54509
- if (flags & 4 /* Undefined */) result.push(undefinedType);
54513
+ if (flags & 65536 /* Null */) result.push(nullType);
54514
+ if (flags & 32768 /* Undefined */) result.push(undefinedType);
54510
54515
  return result || types;
54511
54516
  }
54512
54517
  function visibilityToString(flags) {
@@ -54536,7 +54541,7 @@ function createTypeChecker(host) {
54536
54541
  function getNameOfSymbolFromNameType(symbol, context) {
54537
54542
  const nameType = getSymbolLinks(symbol).nameType;
54538
54543
  if (nameType) {
54539
- if (nameType.flags & 3072 /* StringOrNumberLiteral */) {
54544
+ if (nameType.flags & 384 /* StringOrNumberLiteral */) {
54540
54545
  const name = "" + nameType.value;
54541
54546
  if (!isIdentifierText(name, getEmitScriptTarget(compilerOptions)) && !isNumericLiteralName(name)) {
54542
54547
  return `"${escapeString(name, 34 /* doubleQuote */)}"`;
@@ -54546,7 +54551,7 @@ function createTypeChecker(host) {
54546
54551
  }
54547
54552
  return name;
54548
54553
  }
54549
- if (nameType.flags & 16384 /* UniqueESSymbol */) {
54554
+ if (nameType.flags & 8192 /* UniqueESSymbol */) {
54550
54555
  return `[${getNameOfSymbolAsWritten(nameType.symbol, context)}]`;
54551
54556
  }
54552
54557
  }
@@ -54571,7 +54576,7 @@ function createTypeChecker(host) {
54571
54576
  }
54572
54577
  if (isComputedPropertyName(name2) && !(getCheckFlags(symbol) & 4096 /* Late */)) {
54573
54578
  const nameType = getSymbolLinks(symbol).nameType;
54574
- if (nameType && nameType.flags & 3072 /* StringOrNumberLiteral */) {
54579
+ if (nameType && nameType.flags & 384 /* StringOrNumberLiteral */) {
54575
54580
  const result = getNameOfSymbolFromNameType(symbol, context);
54576
54581
  if (result !== void 0) {
54577
54582
  return result;
@@ -54852,7 +54857,7 @@ function createTypeChecker(host) {
54852
54857
  );
54853
54858
  }
54854
54859
  function getRestType(source, properties, symbol) {
54855
- source = filterType(source, (t) => !(t.flags & 12 /* Nullable */));
54860
+ source = filterType(source, (t) => !(t.flags & 98304 /* Nullable */));
54856
54861
  if (source.flags & 131072 /* Never */) {
54857
54862
  return emptyObjectType;
54858
54863
  }
@@ -54863,7 +54868,7 @@ function createTypeChecker(host) {
54863
54868
  const spreadableProperties = [];
54864
54869
  const unspreadableToRestKeys = [];
54865
54870
  for (const prop of getPropertiesOfType(source)) {
54866
- const literalTypeFromProperty = getLiteralTypeFromProperty(prop, 19456 /* StringOrNumberLiteralOrUnique */);
54871
+ const literalTypeFromProperty = getLiteralTypeFromProperty(prop, 8576 /* StringOrNumberLiteralOrUnique */);
54867
54872
  if (!isTypeAssignableTo(literalTypeFromProperty, omitKeyType) && !(getDeclarationModifierFlagsFromSymbol(prop) & (2 /* Private */ | 4 /* Protected */)) && isSpreadableProperty(prop)) {
54868
54873
  spreadableProperties.push(prop);
54869
54874
  } else {
@@ -54896,7 +54901,7 @@ function createTypeChecker(host) {
54896
54901
  return result;
54897
54902
  }
54898
54903
  function isGenericTypeWithUndefinedConstraint(type) {
54899
- return !!(type.flags & 465829888 /* Instantiable */) && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 4 /* Undefined */);
54904
+ return !!(type.flags & 465829888 /* Instantiable */) && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 32768 /* Undefined */);
54900
54905
  }
54901
54906
  function getNonUndefinedType(type) {
54902
54907
  const typeOrConstraint = someType(type, isGenericTypeWithUndefinedConstraint) ? mapType(type, (t) => t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOrType(t) : t) : type;
@@ -54950,7 +54955,7 @@ function createTypeChecker(host) {
54950
54955
  }
54951
54956
  function getLiteralPropertyNameText(name) {
54952
54957
  const type = getLiteralTypeFromPropertyName(name);
54953
- return type.flags & (1024 /* StringLiteral */ | 2048 /* NumberLiteral */) ? "" + type.value : void 0;
54958
+ return type.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */) ? "" + type.value : void 0;
54954
54959
  }
54955
54960
  function getTypeForBindingElement(declaration) {
54956
54961
  const checkMode = declaration.dotDotDotToken ? 32 /* RestBindingElement */ : 0 /* Normal */;
@@ -55290,7 +55295,7 @@ function createTypeChecker(host) {
55290
55295
  definedInConstructor = true;
55291
55296
  }
55292
55297
  }
55293
- const sourceTypes = some(constructorTypes, (t) => !!(t.flags & ~12 /* Nullable */)) ? constructorTypes : types;
55298
+ const sourceTypes = some(constructorTypes, (t) => !!(t.flags & ~98304 /* Nullable */)) ? constructorTypes : types;
55294
55299
  type = getUnionType(sourceTypes);
55295
55300
  }
55296
55301
  }
@@ -55300,7 +55305,7 @@ function createTypeChecker(host) {
55300
55305
  false,
55301
55306
  definedInMethod && !definedInConstructor
55302
55307
  ));
55303
- if (symbol.valueDeclaration && isInJSFile(symbol.valueDeclaration) && filterType(widened, (t) => !!(t.flags & ~12 /* Nullable */)) === neverType) {
55308
+ if (symbol.valueDeclaration && isInJSFile(symbol.valueDeclaration) && filterType(widened, (t) => !!(t.flags & ~98304 /* Nullable */)) === neverType) {
55304
55309
  reportImplicitAny(symbol.valueDeclaration, anyType);
55305
55310
  return anyType;
55306
55311
  }
@@ -55598,13 +55603,13 @@ function createTypeChecker(host) {
55598
55603
  }
55599
55604
  function widenTypeForVariableLikeDeclaration(type, declaration, reportErrors2) {
55600
55605
  if (type) {
55601
- if (type.flags & 512 /* ESSymbol */ && isGlobalSymbolConstructor(declaration.parent)) {
55606
+ if (type.flags & 4096 /* ESSymbol */ && isGlobalSymbolConstructor(declaration.parent)) {
55602
55607
  type = getESSymbolLikeTypeForNode(declaration);
55603
55608
  }
55604
55609
  if (reportErrors2) {
55605
55610
  reportErrorsFromWidening(declaration, type);
55606
55611
  }
55607
- if (type.flags & 16384 /* UniqueESSymbol */ && (isBindingElement(declaration) || !tryGetTypeFromEffectiveTypeNode(declaration)) && type.symbol !== getSymbolOfDeclaration(declaration)) {
55612
+ if (type.flags & 8192 /* UniqueESSymbol */ && (isBindingElement(declaration) || !tryGetTypeFromEffectiveTypeNode(declaration)) && type.symbol !== getSymbolOfDeclaration(declaration)) {
55608
55613
  type = esSymbolType;
55609
55614
  }
55610
55615
  return getWidenedType(type);
@@ -56441,7 +56446,7 @@ function createTypeChecker(host) {
56441
56446
  return links.declaredType;
56442
56447
  }
56443
56448
  function getBaseTypeOfEnumLikeType(type) {
56444
- return type.flags & 98304 /* EnumLike */ && type.symbol.flags & 8 /* EnumMember */ ? getDeclaredTypeOfSymbol(getParentOfSymbol(type.symbol)) : type;
56449
+ return type.flags & 1056 /* EnumLike */ && type.symbol.flags & 8 /* EnumMember */ ? getDeclaredTypeOfSymbol(getParentOfSymbol(type.symbol)) : type;
56445
56450
  }
56446
56451
  function getDeclaredTypeOfEnum(symbol) {
56447
56452
  const links = getSymbolLinks(symbol);
@@ -56472,7 +56477,7 @@ function createTypeChecker(host) {
56472
56477
  void 0
56473
56478
  ) : createComputedEnumType(symbol);
56474
56479
  if (enumType.flags & 1048576 /* Union */) {
56475
- enumType.flags |= 32768 /* EnumLiteral */;
56480
+ enumType.flags |= 1024 /* EnumLiteral */;
56476
56481
  enumType.symbol = symbol;
56477
56482
  }
56478
56483
  links.declaredType = enumType;
@@ -56480,8 +56485,8 @@ function createTypeChecker(host) {
56480
56485
  return links.declaredType;
56481
56486
  }
56482
56487
  function createComputedEnumType(symbol) {
56483
- const regularType = createTypeWithSymbol(65536 /* Enum */, symbol);
56484
- const freshType = createTypeWithSymbol(65536 /* Enum */, symbol);
56488
+ const regularType = createTypeWithSymbol(32 /* Enum */, symbol);
56489
+ const freshType = createTypeWithSymbol(32 /* Enum */, symbol);
56485
56490
  regularType.regularType = regularType;
56486
56491
  regularType.freshType = freshType;
56487
56492
  freshType.regularType = regularType;
@@ -56683,7 +56688,7 @@ function createTypeChecker(host) {
56683
56688
  const earlySymbol = earlySymbols && earlySymbols.get(memberName);
56684
56689
  if (!(parent.flags & 32 /* Class */) && lateSymbol.flags & getExcludedSymbolFlags(symbolFlags)) {
56685
56690
  const declarations = earlySymbol ? concatenate(earlySymbol.declarations, lateSymbol.declarations) : lateSymbol.declarations;
56686
- const name = !(type.flags & 16384 /* UniqueESSymbol */) && unescapeLeadingUnderscores(memberName) || declarationNameToString(declName);
56691
+ const name = !(type.flags & 8192 /* UniqueESSymbol */) && unescapeLeadingUnderscores(memberName) || declarationNameToString(declName);
56687
56692
  forEach(declarations, (declaration) => error(getNameOfDeclaration(declaration) || declaration, Diagnostics.Property_0_was_also_declared_here, name));
56688
56693
  error(declName || decl, Diagnostics.Duplicate_property_0, name);
56689
56694
  lateSymbol = createSymbol(0 /* None */, memberName, 4096 /* Late */);
@@ -57378,7 +57383,7 @@ function createTypeChecker(host) {
57378
57383
  if (baseConstructorIndexInfo) {
57379
57384
  indexInfos = append(indexInfos, baseConstructorIndexInfo);
57380
57385
  }
57381
- if (symbol.flags & 384 /* Enum */ && (getDeclaredTypeOfSymbol(symbol).flags & 65536 /* Enum */ || some(type.properties, (prop) => !!(getTypeOfSymbol(prop).flags & 67648 /* NumberLike */)))) {
57386
+ if (symbol.flags & 384 /* Enum */ && (getDeclaredTypeOfSymbol(symbol).flags & 32 /* Enum */ || some(type.properties, (prop) => !!(getTypeOfSymbol(prop).flags & 296 /* NumberLike */)))) {
57382
57387
  indexInfos = append(indexInfos, enumNumberIndexInfo);
57383
57388
  }
57384
57389
  }
@@ -57439,7 +57444,7 @@ function createTypeChecker(host) {
57439
57444
  const limitedConstraint = getLimitedConstraint(type);
57440
57445
  for (const prop of getPropertiesOfType(type.source)) {
57441
57446
  if (limitedConstraint) {
57442
- const propertyNameType = getLiteralTypeFromProperty(prop, 19456 /* StringOrNumberLiteralOrUnique */);
57447
+ const propertyNameType = getLiteralTypeFromProperty(prop, 8576 /* StringOrNumberLiteralOrUnique */);
57443
57448
  if (!isTypeAssignableTo(propertyNameType, limitedConstraint)) {
57444
57449
  continue;
57445
57450
  }
@@ -57492,7 +57497,7 @@ function createTypeChecker(host) {
57492
57497
  }
57493
57498
  if (type.flags & 2097152 /* Intersection */) {
57494
57499
  const types = type.types;
57495
- if (types.length === 2 && !!(types[0].flags & (32 /* String */ | 64 /* Number */ | 128 /* BigInt */)) && types[1] === emptyTypeLiteralType) {
57500
+ if (types.length === 2 && !!(types[0].flags & (4 /* String */ | 8 /* Number */ | 64 /* BigInt */)) && types[1] === emptyTypeLiteralType) {
57496
57501
  return type;
57497
57502
  }
57498
57503
  return getIntersectionType(sameMap(type.types, getLowerBoundOfKeyType));
@@ -57510,7 +57515,7 @@ function createTypeChecker(host) {
57510
57515
  cb(stringType);
57511
57516
  } else {
57512
57517
  for (const info of getIndexInfosOfType(type)) {
57513
- if (!stringsOnly || info.keyType.flags & (32 /* String */ | 134217728 /* TemplateLiteral */)) {
57518
+ if (!stringsOnly || info.keyType.flags & (4 /* String */ | 134217728 /* TemplateLiteral */)) {
57514
57519
  cb(info.keyType);
57515
57520
  }
57516
57521
  }
@@ -57528,7 +57533,7 @@ function createTypeChecker(host) {
57528
57533
  const templateType = getTemplateTypeFromMappedType(mappedType);
57529
57534
  const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
57530
57535
  const templateModifiers = getMappedTypeModifiers(type);
57531
- const include = 19456 /* StringOrNumberLiteralOrUnique */;
57536
+ const include = 8576 /* StringOrNumberLiteralOrUnique */;
57532
57537
  if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
57533
57538
  forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(
57534
57539
  modifiersType,
@@ -57568,8 +57573,8 @@ function createTypeChecker(host) {
57568
57573
  }
57569
57574
  members.set(propName, prop);
57570
57575
  }
57571
- } else if (isValidIndexKeyType(propNameType) || propNameType.flags & (1 /* Any */ | 65536 /* Enum */)) {
57572
- const indexKeyType = propNameType.flags & (1 /* Any */ | 32 /* String */) ? stringType : propNameType.flags & (64 /* Number */ | 65536 /* Enum */) ? numberType : propNameType;
57576
+ } else if (isValidIndexKeyType(propNameType) || propNameType.flags & (1 /* Any */ | 32 /* Enum */)) {
57577
+ const indexKeyType = propNameType.flags & (1 /* Any */ | 4 /* String */) ? stringType : propNameType.flags & (8 /* Number */ | 32 /* Enum */) ? numberType : propNameType;
57573
57578
  const propType = instantiateType(templateType, appendTypeMapping(type.mapper, typeParameter, keyType));
57574
57579
  const modifiersIndexInfo = getApplicableIndexInfo(modifiersType, propNameType);
57575
57580
  const isReadonly = !!(templateModifiers & 1 /* IncludeReadonly */ || !(templateModifiers & 2 /* ExcludeReadonly */) && (modifiersIndexInfo == null ? void 0 : modifiersIndexInfo.isReadonly));
@@ -57594,7 +57599,7 @@ function createTypeChecker(host) {
57594
57599
  const templateType = getTemplateTypeFromMappedType(mappedType.target || mappedType);
57595
57600
  const mapper = appendTypeMapping(mappedType.mapper, getTypeParameterFromMappedType(mappedType), symbol.links.keyType);
57596
57601
  const propType = instantiateType(templateType, mapper);
57597
- let type = strictNullChecks && symbol.flags & 16777216 /* Optional */ && !maybeTypeOfKind(propType, 4 /* Undefined */ | 16 /* Void */) ? getOptionalType(
57602
+ let type = strictNullChecks && symbol.flags & 16777216 /* Optional */ && !maybeTypeOfKind(propType, 32768 /* Undefined */ | 16384 /* Void */) ? getOptionalType(
57598
57603
  propType,
57599
57604
  /*isProperty*/
57600
57605
  true
@@ -57888,14 +57893,14 @@ function createTypeChecker(host) {
57888
57893
  constraints = append(constraints, t);
57889
57894
  }
57890
57895
  }
57891
- } else if (t.flags & 469860348 /* DisjointDomains */ || isEmptyAnonymousObjectType(t)) {
57896
+ } else if (t.flags & 469892092 /* DisjointDomains */ || isEmptyAnonymousObjectType(t)) {
57892
57897
  hasDisjointDomainType = true;
57893
57898
  }
57894
57899
  }
57895
57900
  if (constraints && (targetIsUnion || hasDisjointDomainType)) {
57896
57901
  if (hasDisjointDomainType) {
57897
57902
  for (const t of types) {
57898
- if (t.flags & 469860348 /* DisjointDomains */ || isEmptyAnonymousObjectType(t)) {
57903
+ if (t.flags & 469892092 /* DisjointDomains */ || isEmptyAnonymousObjectType(t)) {
57899
57904
  constraints = append(constraints, t);
57900
57905
  }
57901
57906
  }
@@ -58096,7 +58101,7 @@ function createTypeChecker(host) {
58096
58101
  function getApparentType(type) {
58097
58102
  const t = type.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(type) || unknownType : type;
58098
58103
  const objectFlags = getObjectFlags(t);
58099
- return objectFlags & 32 /* Mapped */ ? getApparentTypeOfMappedType(t) : objectFlags & 4 /* Reference */ && t !== type ? getTypeWithThisArgument(t, type) : t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t, type) : t.flags & 402654240 /* StringLike */ ? globalStringType : t.flags & 67648 /* NumberLike */ ? globalNumberType : t.flags & 8320 /* BigIntLike */ ? getGlobalBigIntType() : t.flags & 4352 /* BooleanLike */ ? globalBooleanType : t.flags & 16896 /* ESSymbolLike */ ? getGlobalESSymbolType() : t.flags & 67108864 /* NonPrimitive */ ? emptyObjectType : t.flags & 4194304 /* Index */ ? stringNumberSymbolType : t.flags & 2 /* Unknown */ && !strictNullChecks ? emptyObjectType : t;
58104
+ return objectFlags & 32 /* Mapped */ ? getApparentTypeOfMappedType(t) : objectFlags & 4 /* Reference */ && t !== type ? getTypeWithThisArgument(t, type) : t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t, type) : t.flags & 402653316 /* StringLike */ ? globalStringType : t.flags & 296 /* NumberLike */ ? globalNumberType : t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType() : t.flags & 528 /* BooleanLike */ ? globalBooleanType : t.flags & 12288 /* ESSymbolLike */ ? getGlobalESSymbolType() : t.flags & 67108864 /* NonPrimitive */ ? emptyObjectType : t.flags & 4194304 /* Index */ ? stringNumberSymbolType : t.flags & 2 /* Unknown */ && !strictNullChecks ? emptyObjectType : t;
58100
58105
  }
58101
58106
  function getReducedApparentType(type) {
58102
58107
  return getReducedType(getApparentType(getReducedType(type)));
@@ -58448,7 +58453,7 @@ function createTypeChecker(host) {
58448
58453
  )) : applicableInfo ? applicableInfo : stringIndexInfo && isApplicableIndexType(keyType, stringType) ? stringIndexInfo : void 0;
58449
58454
  }
58450
58455
  function isApplicableIndexType(source, target) {
58451
- return isTypeAssignableTo(source, target) || target === stringType && isTypeAssignableTo(source, numberType) || target === numberType && (source === numericStringType || !!(source.flags & 1024 /* StringLiteral */) && isNumericLiteralName(source.value));
58456
+ return isTypeAssignableTo(source, target) || target === stringType && isTypeAssignableTo(source, numberType) || target === numberType && (source === numericStringType || !!(source.flags & 128 /* StringLiteral */) && isNumericLiteralName(source.value));
58452
58457
  }
58453
58458
  function getIndexInfosOfStructuredType(type) {
58454
58459
  if (type.flags & 3670016 /* StructuredType */) {
@@ -58777,7 +58782,7 @@ function createTypeChecker(host) {
58777
58782
  }
58778
58783
  if (type || jsdocPredicate) {
58779
58784
  signature.resolvedTypePredicate = type && isTypePredicateNode(type) ? createTypePredicateFromTypePredicateNode(type, signature) : jsdocPredicate || noTypePredicate;
58780
- } else if (signature.declaration && isFunctionLikeDeclaration(signature.declaration) && (!signature.resolvedReturnType || signature.resolvedReturnType.flags & 256 /* Boolean */) && getParameterCount(signature) > 0) {
58785
+ } else if (signature.declaration && isFunctionLikeDeclaration(signature.declaration) && (!signature.resolvedReturnType || signature.resolvedReturnType.flags & 16 /* Boolean */) && getParameterCount(signature) > 0) {
58781
58786
  const { declaration } = signature;
58782
58787
  signature.resolvedTypePredicate = noTypePredicate;
58783
58788
  signature.resolvedTypePredicate = getTypePredicateFromBody(declaration) || noTypePredicate;
@@ -59062,7 +59067,7 @@ function createTypeChecker(host) {
59062
59067
  return emptyArray;
59063
59068
  }
59064
59069
  function isValidIndexKeyType(type) {
59065
- return !!(type.flags & (32 /* String */ | 64 /* Number */ | 512 /* ESSymbol */)) || isPatternLiteralType(type) || !!(type.flags & 2097152 /* Intersection */) && !isGenericType(type) && some(type.types, isValidIndexKeyType);
59070
+ return !!(type.flags & (4 /* String */ | 8 /* Number */ | 4096 /* ESSymbol */)) || isPatternLiteralType(type) || !!(type.flags & 2097152 /* Intersection */) && !isGenericType(type) && some(type.types, isValidIndexKeyType);
59066
59071
  }
59067
59072
  function getConstraintDeclaration(type) {
59068
59073
  return mapDefined(filter(type.symbol && type.symbol.declarations, isTypeParameterDeclaration), getEffectiveConstraintOfTypeParameter)[0];
@@ -59438,11 +59443,14 @@ function createTypeChecker(host) {
59438
59443
  function isNoInferType(type) {
59439
59444
  return !!(type.flags & 33554432 /* Substitution */ && type.constraint.flags & 2 /* Unknown */);
59440
59445
  }
59441
- function getSubstitutionType(baseType, constraint) {
59442
- return constraint.flags & 3 /* AnyOrUnknown */ || constraint === baseType || baseType.flags & 1 /* Any */ ? baseType : getOrCreateSubstitutionType(baseType, constraint);
59446
+ function isNarrowingSubstitutionType(type) {
59447
+ return !!(type.flags & 33554432 /* Substitution */ && type.objectFlags & 16777216 /* IsNarrowingType */);
59443
59448
  }
59444
- function getOrCreateSubstitutionType(baseType, constraint) {
59445
- const id = `${getTypeId(baseType)}>${getTypeId(constraint)}`;
59449
+ function getSubstitutionType(baseType, constraint, isNarrowed) {
59450
+ return constraint.flags & 3 /* AnyOrUnknown */ || constraint === baseType || baseType.flags & 1 /* Any */ ? baseType : getOrCreateSubstitutionType(baseType, constraint, isNarrowed);
59451
+ }
59452
+ function getOrCreateSubstitutionType(baseType, constraint, isNarrowed) {
59453
+ const id = `${getTypeId(baseType)}>${getTypeId(constraint)}${isNarrowed ? ">N" : ""}`;
59446
59454
  const cached = substitutionTypes.get(id);
59447
59455
  if (cached) {
59448
59456
  return cached;
@@ -59450,6 +59458,9 @@ function createTypeChecker(host) {
59450
59458
  const result = createType(33554432 /* Substitution */);
59451
59459
  result.baseType = baseType;
59452
59460
  result.constraint = constraint;
59461
+ if (isNarrowed) {
59462
+ result.objectFlags |= 16777216 /* IsNarrowingType */;
59463
+ }
59453
59464
  substitutionTypes.set(id, result);
59454
59465
  return result;
59455
59466
  }
@@ -59563,7 +59574,7 @@ function createTypeChecker(host) {
59563
59574
  }
59564
59575
  function getTypeFromJSDocNullableTypeNode(node) {
59565
59576
  const type = getTypeFromTypeNode(node.type);
59566
- return strictNullChecks ? getNullableType(type, 8 /* Null */) : type;
59577
+ return strictNullChecks ? getNullableType(type, 65536 /* Null */) : type;
59567
59578
  }
59568
59579
  function getTypeFromTypeReference(node) {
59569
59580
  const links = getNodeLinks(node);
@@ -60336,10 +60347,10 @@ function createTypeChecker(host) {
60336
60347
  return type.id;
60337
60348
  }
60338
60349
  function containsType(types, type) {
60339
- return binarySearch(types, type, identity, compareTypes) >= 0;
60350
+ return binarySearch(types, type, getTypeId, compareValues) >= 0;
60340
60351
  }
60341
60352
  function insertType(types, type) {
60342
- const index = binarySearch(types, type, identity, compareTypes);
60353
+ const index = binarySearch(types, type, getTypeId, compareValues);
60343
60354
  if (index < 0) {
60344
60355
  types.splice(~index, 0, type);
60345
60356
  return true;
@@ -60354,10 +60365,11 @@ function createTypeChecker(host) {
60354
60365
  if (flags & 2097152 /* Intersection */ && getObjectFlags(type) & 67108864 /* IsConstrainedTypeVariable */) includes |= 536870912 /* IncludesConstrainedTypeVariable */;
60355
60366
  if (type === wildcardType) includes |= 8388608 /* IncludesWildcard */;
60356
60367
  if (isErrorType(type)) includes |= 1073741824 /* IncludesError */;
60357
- if (!strictNullChecks && flags & 12 /* Nullable */) {
60368
+ if (!strictNullChecks && flags & 98304 /* Nullable */) {
60358
60369
  if (!(getObjectFlags(type) & 65536 /* ContainsWideningType */)) includes |= 4194304 /* IncludesNonWideningType */;
60359
60370
  } else {
60360
- const index = binarySearch(typeSet, type, identity, compareTypes);
60371
+ const len = typeSet.length;
60372
+ const index = len && type.id > typeSet[len - 1].id ? ~len : binarySearch(typeSet, type, getTypeId, compareValues);
60361
60373
  if (index < 0) {
60362
60374
  typeSet.splice(~index, 0, type);
60363
60375
  }
@@ -60435,7 +60447,7 @@ function createTypeChecker(host) {
60435
60447
  i--;
60436
60448
  const t = types[i];
60437
60449
  const flags = t.flags;
60438
- const remove = flags & (1024 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) && includes & 32 /* String */ || flags & 2048 /* NumberLiteral */ && includes & 64 /* Number */ || flags & 8192 /* BigIntLiteral */ && includes & 128 /* BigInt */ || flags & 16384 /* UniqueESSymbol */ && includes & 512 /* ESSymbol */ || reduceVoidUndefined && flags & 4 /* Undefined */ && includes & 16 /* Void */ || isFreshLiteralType(t) && containsType(types, t.regularType);
60450
+ const remove = flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) && includes & 4 /* String */ || flags & 256 /* NumberLiteral */ && includes & 8 /* Number */ || flags & 2048 /* BigIntLiteral */ && includes & 64 /* BigInt */ || flags & 8192 /* UniqueESSymbol */ && includes & 4096 /* ESSymbol */ || reduceVoidUndefined && flags & 32768 /* Undefined */ && includes & 16384 /* Void */ || isFreshLiteralType(t) && containsType(types, t.regularType);
60439
60451
  if (remove) {
60440
60452
  orderedRemoveItemAt(types, i);
60441
60453
  }
@@ -60448,7 +60460,7 @@ function createTypeChecker(host) {
60448
60460
  while (i > 0) {
60449
60461
  i--;
60450
60462
  const t = types[i];
60451
- if (t.flags & 1024 /* StringLiteral */ && some(templates, (template) => isTypeMatchedByTemplateLiteralOrStringMapping(t, template))) {
60463
+ if (t.flags & 128 /* StringLiteral */ && some(templates, (template) => isTypeMatchedByTemplateLiteralOrStringMapping(t, template))) {
60452
60464
  orderedRemoveItemAt(types, i);
60453
60465
  }
60454
60466
  }
@@ -60546,15 +60558,15 @@ function createTypeChecker(host) {
60546
60558
  if (includes & 3 /* AnyOrUnknown */) {
60547
60559
  return includes & 1 /* Any */ ? includes & 8388608 /* IncludesWildcard */ ? wildcardType : includes & 1073741824 /* IncludesError */ ? errorType : anyType : unknownType;
60548
60560
  }
60549
- if (includes & 4 /* Undefined */) {
60561
+ if (includes & 32768 /* Undefined */) {
60550
60562
  if (typeSet.length >= 2 && typeSet[0] === undefinedType && typeSet[1] === missingType) {
60551
60563
  orderedRemoveItemAt(typeSet, 1);
60552
60564
  }
60553
60565
  }
60554
- if (includes & (65536 /* Enum */ | 15360 /* Literal */ | 16384 /* UniqueESSymbol */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) || includes & 16 /* Void */ && includes & 4 /* Undefined */) {
60566
+ if (includes & (32 /* Enum */ | 2944 /* Literal */ | 8192 /* UniqueESSymbol */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) || includes & 16384 /* Void */ && includes & 32768 /* Undefined */) {
60555
60567
  removeRedundantLiteralTypes(typeSet, includes, !!(unionReduction & 2 /* Subtype */));
60556
60568
  }
60557
- if (includes & 1024 /* StringLiteral */ && includes & (134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */)) {
60569
+ if (includes & 128 /* StringLiteral */ && includes & (134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */)) {
60558
60570
  removeStringLiteralsMatchedByTemplateLiterals(typeSet);
60559
60571
  }
60560
60572
  if (includes & 536870912 /* IncludesConstrainedTypeVariable */) {
@@ -60567,7 +60579,7 @@ function createTypeChecker(host) {
60567
60579
  }
60568
60580
  }
60569
60581
  if (typeSet.length === 0) {
60570
- return includes & 8 /* Null */ ? includes & 4194304 /* IncludesNonWideningType */ ? nullType : nullWideningType : includes & 4 /* Undefined */ ? includes & 4194304 /* IncludesNonWideningType */ ? undefinedType : undefinedWideningType : neverType;
60582
+ return includes & 65536 /* Null */ ? includes & 4194304 /* IncludesNonWideningType */ ? nullType : nullWideningType : includes & 32768 /* Undefined */ ? includes & 4194304 /* IncludesNonWideningType */ ? undefinedType : undefinedWideningType : neverType;
60571
60583
  }
60572
60584
  }
60573
60585
  if (!origin && includes & 1048576 /* Union */) {
@@ -60590,7 +60602,7 @@ function createTypeChecker(host) {
60590
60602
  origin = createOriginUnionOrIntersectionType(1048576 /* Union */, reducedTypes);
60591
60603
  }
60592
60604
  }
60593
- const objectFlags = (includes & 36306963 /* NotPrimitiveUnion */ ? 0 : 32768 /* PrimitiveUnion */) | (includes & 2097152 /* Intersection */ ? 16777216 /* ContainsIntersections */ : 0);
60605
+ const objectFlags = (includes & 36323331 /* NotPrimitiveUnion */ ? 0 : 32768 /* PrimitiveUnion */) | (includes & 2097152 /* Intersection */ ? 16777216 /* ContainsIntersections */ : 0);
60594
60606
  return getUnionTypeFromSortedList(typeSet, objectFlags, aliasSymbol, aliasTypeArguments, origin);
60595
60607
  }
60596
60608
  function getUnionOrIntersectionTypePredicate(signatures, kind) {
@@ -60635,14 +60647,14 @@ function createTypeChecker(host) {
60635
60647
  type.objectFlags = precomputedObjectFlags | getPropagatingFlagsOfTypes(
60636
60648
  types,
60637
60649
  /*excludeKinds*/
60638
- 12 /* Nullable */
60650
+ 98304 /* Nullable */
60639
60651
  );
60640
60652
  type.types = types;
60641
60653
  type.origin = origin;
60642
60654
  type.aliasSymbol = aliasSymbol;
60643
60655
  type.aliasTypeArguments = aliasTypeArguments;
60644
- if (types.length === 2 && types[0].flags & 4096 /* BooleanLiteral */ && types[1].flags & 4096 /* BooleanLiteral */) {
60645
- type.flags |= 256 /* Boolean */;
60656
+ if (types.length === 2 && types[0].flags & 512 /* BooleanLiteral */ && types[1].flags & 512 /* BooleanLiteral */) {
60657
+ type.flags |= 16 /* Boolean */;
60646
60658
  type.intrinsicName = "boolean";
60647
60659
  }
60648
60660
  unionTypes.set(id, type);
@@ -60671,13 +60683,13 @@ function createTypeChecker(host) {
60671
60683
  if (flags & 3 /* AnyOrUnknown */) {
60672
60684
  if (type === wildcardType) includes |= 8388608 /* IncludesWildcard */;
60673
60685
  if (isErrorType(type)) includes |= 1073741824 /* IncludesError */;
60674
- } else if (strictNullChecks || !(flags & 12 /* Nullable */)) {
60686
+ } else if (strictNullChecks || !(flags & 98304 /* Nullable */)) {
60675
60687
  if (type === missingType) {
60676
60688
  includes |= 262144 /* IncludesMissingType */;
60677
60689
  type = undefinedType;
60678
60690
  }
60679
60691
  if (!typeSet.has(type.id.toString())) {
60680
- if (type.flags & 97292 /* Unit */ && includes & 97292 /* Unit */) {
60692
+ if (type.flags & 109472 /* Unit */ && includes & 109472 /* Unit */) {
60681
60693
  includes |= 67108864 /* NonPrimitive */;
60682
60694
  }
60683
60695
  typeSet.set(type.id.toString(), type);
@@ -60698,7 +60710,7 @@ function createTypeChecker(host) {
60698
60710
  while (i > 0) {
60699
60711
  i--;
60700
60712
  const t = types[i];
60701
- const remove = t.flags & 32 /* String */ && includes & (1024 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) || t.flags & 64 /* Number */ && includes & 2048 /* NumberLiteral */ || t.flags & 128 /* BigInt */ && includes & 8192 /* BigIntLiteral */ || t.flags & 512 /* ESSymbol */ && includes & 16384 /* UniqueESSymbol */ || t.flags & 16 /* Void */ && includes & 4 /* Undefined */ || isEmptyAnonymousObjectType(t) && includes & 470417376 /* DefinitelyNonNullable */;
60713
+ const remove = t.flags & 4 /* String */ && includes & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) || t.flags & 8 /* Number */ && includes & 256 /* NumberLiteral */ || t.flags & 64 /* BigInt */ && includes & 2048 /* BigIntLiteral */ || t.flags & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */ || t.flags & 16384 /* Void */ && includes & 32768 /* Undefined */ || isEmptyAnonymousObjectType(t) && includes & 470302716 /* DefinitelyNonNullable */;
60702
60714
  if (remove) {
60703
60715
  orderedRemoveItemAt(types, i);
60704
60716
  }
@@ -60713,7 +60725,7 @@ function createTypeChecker(host) {
60713
60725
  if (type === undefinedType) {
60714
60726
  return containsType(u.types, missingType);
60715
60727
  }
60716
- const primitive = type.flags & 1024 /* StringLiteral */ ? stringType : type.flags & (65536 /* Enum */ | 2048 /* NumberLiteral */) ? numberType : type.flags & 8192 /* BigIntLiteral */ ? bigintType : type.flags & 16384 /* UniqueESSymbol */ ? esSymbolType : void 0;
60728
+ const primitive = type.flags & 128 /* StringLiteral */ ? stringType : type.flags & (32 /* Enum */ | 256 /* NumberLiteral */) ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 8192 /* UniqueESSymbol */ ? esSymbolType : void 0;
60717
60729
  if (!primitive || !containsType(u.types, primitive)) {
60718
60730
  return false;
60719
60731
  }
@@ -60723,7 +60735,7 @@ function createTypeChecker(host) {
60723
60735
  }
60724
60736
  function extractRedundantTemplateLiterals(types) {
60725
60737
  let i = types.length;
60726
- const literals = filter(types, (t) => !!(t.flags & 1024 /* StringLiteral */));
60738
+ const literals = filter(types, (t) => !!(t.flags & 128 /* StringLiteral */));
60727
60739
  while (i > 0) {
60728
60740
  i--;
60729
60741
  const t = types[i];
@@ -60789,7 +60801,7 @@ function createTypeChecker(host) {
60789
60801
  result.objectFlags = objectFlags | getPropagatingFlagsOfTypes(
60790
60802
  types,
60791
60803
  /*excludeKinds*/
60792
- 12 /* Nullable */
60804
+ 98304 /* Nullable */
60793
60805
  );
60794
60806
  result.types = types;
60795
60807
  result.aliasSymbol = aliasSymbol;
@@ -60804,19 +60816,19 @@ function createTypeChecker(host) {
60804
60816
  if (includes & 131072 /* Never */) {
60805
60817
  return contains(typeSet, silentNeverType) ? silentNeverType : neverType;
60806
60818
  }
60807
- if (strictNullChecks && includes & 12 /* Nullable */ && includes & (524288 /* Object */ | 67108864 /* NonPrimitive */ | 16777216 /* IncludesEmptyObject */) || includes & 67108864 /* NonPrimitive */ && includes & (469860348 /* DisjointDomains */ & ~67108864 /* NonPrimitive */) || includes & 402654240 /* StringLike */ && includes & (469860348 /* DisjointDomains */ & ~402654240 /* StringLike */) || includes & 67648 /* NumberLike */ && includes & (469860348 /* DisjointDomains */ & ~67648 /* NumberLike */) || includes & 8320 /* BigIntLike */ && includes & (469860348 /* DisjointDomains */ & ~8320 /* BigIntLike */) || includes & 16896 /* ESSymbolLike */ && includes & (469860348 /* DisjointDomains */ & ~16896 /* ESSymbolLike */) || includes & 20 /* VoidLike */ && includes & (469860348 /* DisjointDomains */ & ~20 /* VoidLike */)) {
60819
+ if (strictNullChecks && includes & 98304 /* Nullable */ && includes & (524288 /* Object */ | 67108864 /* NonPrimitive */ | 16777216 /* IncludesEmptyObject */) || includes & 67108864 /* NonPrimitive */ && includes & (469892092 /* DisjointDomains */ & ~67108864 /* NonPrimitive */) || includes & 402653316 /* StringLike */ && includes & (469892092 /* DisjointDomains */ & ~402653316 /* StringLike */) || includes & 296 /* NumberLike */ && includes & (469892092 /* DisjointDomains */ & ~296 /* NumberLike */) || includes & 2112 /* BigIntLike */ && includes & (469892092 /* DisjointDomains */ & ~2112 /* BigIntLike */) || includes & 12288 /* ESSymbolLike */ && includes & (469892092 /* DisjointDomains */ & ~12288 /* ESSymbolLike */) || includes & 49152 /* VoidLike */ && includes & (469892092 /* DisjointDomains */ & ~49152 /* VoidLike */)) {
60808
60820
  return neverType;
60809
60821
  }
60810
- if (includes & (134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) && includes & 1024 /* StringLiteral */ && extractRedundantTemplateLiterals(typeSet)) {
60822
+ if (includes & (134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) && includes & 128 /* StringLiteral */ && extractRedundantTemplateLiterals(typeSet)) {
60811
60823
  return neverType;
60812
60824
  }
60813
60825
  if (includes & 1 /* Any */) {
60814
60826
  return includes & 8388608 /* IncludesWildcard */ ? wildcardType : includes & 1073741824 /* IncludesError */ ? errorType : anyType;
60815
60827
  }
60816
- if (!strictNullChecks && includes & 12 /* Nullable */) {
60817
- return includes & 16777216 /* IncludesEmptyObject */ ? neverType : includes & 4 /* Undefined */ ? undefinedType : nullType;
60828
+ if (!strictNullChecks && includes & 98304 /* Nullable */) {
60829
+ return includes & 16777216 /* IncludesEmptyObject */ ? neverType : includes & 32768 /* Undefined */ ? undefinedType : nullType;
60818
60830
  }
60819
- if (includes & 32 /* String */ && includes & (1024 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) || includes & 64 /* Number */ && includes & 2048 /* NumberLiteral */ || includes & 128 /* BigInt */ && includes & 8192 /* BigIntLiteral */ || includes & 512 /* ESSymbol */ && includes & 16384 /* UniqueESSymbol */ || includes & 16 /* Void */ && includes & 4 /* Undefined */ || includes & 16777216 /* IncludesEmptyObject */ && includes & 470417376 /* DefinitelyNonNullable */) {
60831
+ if (includes & 4 /* String */ && includes & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) || includes & 8 /* Number */ && includes & 256 /* NumberLiteral */ || includes & 64 /* BigInt */ && includes & 2048 /* BigIntLiteral */ || includes & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */ || includes & 16384 /* Void */ && includes & 32768 /* Undefined */ || includes & 16777216 /* IncludesEmptyObject */ && includes & 470302716 /* DefinitelyNonNullable */) {
60820
60832
  if (!(flags & 1 /* NoSupertypeReduction */)) removeRedundantSupertypes(typeSet, includes);
60821
60833
  }
60822
60834
  if (includes & 262144 /* IncludesMissingType */) {
@@ -60853,12 +60865,12 @@ function createTypeChecker(host) {
60853
60865
  if (includes & 1048576 /* Union */) {
60854
60866
  if (intersectUnionsOfPrimitiveTypes(typeSet)) {
60855
60867
  result = getIntersectionType(typeSet, flags, aliasSymbol, aliasTypeArguments);
60856
- } else if (every(typeSet, (t) => !!(t.flags & 1048576 /* Union */ && t.types[0].flags & 4 /* Undefined */))) {
60868
+ } else if (every(typeSet, (t) => !!(t.flags & 1048576 /* Union */ && t.types[0].flags & 32768 /* Undefined */))) {
60857
60869
  const containedUndefinedType = some(typeSet, containsMissingType) ? missingType : undefinedType;
60858
- removeFromEach(typeSet, 4 /* Undefined */);
60870
+ removeFromEach(typeSet, 32768 /* Undefined */);
60859
60871
  result = getUnionType([getIntersectionType(typeSet, flags), containedUndefinedType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
60860
- } else if (every(typeSet, (t) => !!(t.flags & 1048576 /* Union */ && (t.types[0].flags & 8 /* Null */ || t.types[1].flags & 8 /* Null */)))) {
60861
- removeFromEach(typeSet, 8 /* Null */);
60872
+ } else if (every(typeSet, (t) => !!(t.flags & 1048576 /* Union */ && (t.types[0].flags & 65536 /* Null */ || t.types[1].flags & 65536 /* Null */)))) {
60873
+ removeFromEach(typeSet, 65536 /* Null */);
60862
60874
  result = getUnionType([getIntersectionType(typeSet, flags), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
60863
60875
  } else if (typeSet.length >= 3 && types.length > 2) {
60864
60876
  const middle = Math.floor(typeSet.length / 2);
@@ -60923,7 +60935,7 @@ function createTypeChecker(host) {
60923
60935
  const types = map(node.types, getTypeFromTypeNode);
60924
60936
  const emptyIndex = types.length === 2 ? types.indexOf(emptyTypeLiteralType) : -1;
60925
60937
  const t = emptyIndex >= 0 ? types[1 - emptyIndex] : unknownType;
60926
- const noSupertypeReduction = !!(t.flags & (32 /* String */ | 64 /* Number */ | 128 /* BigInt */) || t.flags & 134217728 /* TemplateLiteral */ && isPatternLiteralType(t));
60938
+ const noSupertypeReduction = !!(t.flags & (4 /* String */ | 8 /* Number */ | 64 /* BigInt */) || t.flags & 134217728 /* TemplateLiteral */ && isPatternLiteralType(t));
60927
60939
  links.resolvedType = getIntersectionType(types, noSupertypeReduction ? 1 /* NoSupertypeReduction */ : 0, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol));
60928
60940
  }
60929
60941
  return links.resolvedType;
@@ -60957,11 +60969,11 @@ function createTypeChecker(host) {
60957
60969
  forEachType(constraintType, addMemberForKeyType);
60958
60970
  } else if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
60959
60971
  const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
60960
- forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 19456 /* StringOrNumberLiteralOrUnique */, !!(indexFlags & 1 /* StringsOnly */), addMemberForKeyType);
60972
+ forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */, !!(indexFlags & 1 /* StringsOnly */), addMemberForKeyType);
60961
60973
  } else {
60962
60974
  forEachType(getLowerBoundOfKeyType(constraintType), addMemberForKeyType);
60963
60975
  }
60964
- const result = indexFlags & 2 /* NoIndexSignatures */ ? filterType(getUnionType(keyTypes), (t) => !(t.flags & (1 /* Any */ | 32 /* String */))) : getUnionType(keyTypes);
60976
+ const result = indexFlags & 2 /* NoIndexSignatures */ ? filterType(getUnionType(keyTypes), (t) => !(t.flags & (1 /* Any */ | 4 /* String */))) : getUnionType(keyTypes);
60965
60977
  if (result.flags & 1048576 /* Union */ && constraintType.flags & 1048576 /* Union */ && getTypeListId(result.types) === getTypeListId(constraintType.types)) {
60966
60978
  return constraintType;
60967
60979
  }
@@ -61016,7 +61028,7 @@ function createTypeChecker(host) {
61016
61028
  function getLiteralTypeFromProperties(type, include, includeOrigin) {
61017
61029
  const origin = includeOrigin && (getObjectFlags(type) & (3 /* ClassOrInterface */ | 4 /* Reference */) || type.aliasSymbol) ? createOriginIndexType(type) : void 0;
61018
61030
  const propertyTypes = map(getPropertiesOfType(type), (prop) => getLiteralTypeFromProperty(prop, include));
61019
- const indexKeyTypes = map(getIndexInfosOfType(type), (info) => info !== enumNumberIndexInfo && isKeyTypeIncluded(info.keyType, include) ? info.keyType === stringType && include & 64 /* Number */ ? stringOrNumberType : info.keyType : neverType);
61031
+ const indexKeyTypes = map(getIndexInfosOfType(type), (info) => info !== enumNumberIndexInfo && isKeyTypeIncluded(info.keyType, include) ? info.keyType === stringType && include & 8 /* Number */ ? stringOrNumberType : info.keyType : neverType);
61020
61032
  return getUnionType(
61021
61033
  concatenate(propertyTypes, indexKeyTypes),
61022
61034
  1 /* Literal */,
@@ -61032,7 +61044,7 @@ function createTypeChecker(host) {
61032
61044
  }
61033
61045
  function getIndexType(type, indexFlags = 0 /* None */) {
61034
61046
  type = getReducedType(type);
61035
- return isNoInferType(type) ? getNoInferType(getIndexType(type.baseType, indexFlags)) : shouldDeferIndexType(type, indexFlags) ? getIndexTypeForGenericType(type, indexFlags) : type.flags & 1048576 /* Union */ ? getIntersectionType(map(type.types, (t) => getIndexType(t, indexFlags))) : type.flags & 2097152 /* Intersection */ ? getUnionType(map(type.types, (t) => getIndexType(t, indexFlags))) : getObjectFlags(type) & 32 /* Mapped */ ? getIndexTypeForMappedType(type, indexFlags) : type === wildcardType ? wildcardType : type.flags & 2 /* Unknown */ ? neverType : type.flags & (1 /* Any */ | 131072 /* Never */) ? stringNumberSymbolType : getLiteralTypeFromProperties(type, (indexFlags & 2 /* NoIndexSignatures */ ? 1024 /* StringLiteral */ : 402654240 /* StringLike */) | (indexFlags & 1 /* StringsOnly */ ? 0 : 67648 /* NumberLike */ | 16896 /* ESSymbolLike */), indexFlags === 0 /* None */);
61047
+ return isNoInferType(type) ? getNoInferType(getIndexType(type.baseType, indexFlags)) : shouldDeferIndexType(type, indexFlags) ? getIndexTypeForGenericType(type, indexFlags) : type.flags & 1048576 /* Union */ ? getIntersectionType(map(type.types, (t) => getIndexType(t, indexFlags))) : type.flags & 2097152 /* Intersection */ ? getUnionType(map(type.types, (t) => getIndexType(t, indexFlags))) : getObjectFlags(type) & 32 /* Mapped */ ? getIndexTypeForMappedType(type, indexFlags) : type === wildcardType ? wildcardType : type.flags & 2 /* Unknown */ ? neverType : type.flags & (1 /* Any */ | 131072 /* Never */) ? stringNumberSymbolType : getLiteralTypeFromProperties(type, (indexFlags & 2 /* NoIndexSignatures */ ? 128 /* StringLiteral */ : 402653316 /* StringLike */) | (indexFlags & 1 /* StringsOnly */ ? 0 : 296 /* NumberLike */ | 12288 /* ESSymbolLike */), indexFlags === 0 /* None */);
61036
61048
  }
61037
61049
  function getExtractStringType(type) {
61038
61050
  const extractTypeAlias = getGlobalExtractSymbol();
@@ -61090,7 +61102,7 @@ function createTypeChecker(host) {
61090
61102
  }
61091
61103
  newTexts.push(text);
61092
61104
  if (every(newTexts, (t) => t === "")) {
61093
- if (every(newTypes, (t) => !!(t.flags & 32 /* String */))) {
61105
+ if (every(newTypes, (t) => !!(t.flags & 4 /* String */))) {
61094
61106
  return stringType;
61095
61107
  }
61096
61108
  if (newTypes.length === 1 && isPatternLiteralType(newTypes[0])) {
@@ -61106,7 +61118,7 @@ function createTypeChecker(host) {
61106
61118
  function addSpans(texts2, types2) {
61107
61119
  for (let i = 0; i < types2.length; i++) {
61108
61120
  const t = types2[i];
61109
- if (t.flags & (15360 /* Literal */ | 8 /* Null */ | 4 /* Undefined */)) {
61121
+ if (t.flags & (2944 /* Literal */ | 65536 /* Null */ | 32768 /* Undefined */)) {
61110
61122
  text += getTemplateStringForType(t) || "";
61111
61123
  text += texts2[i + 1];
61112
61124
  } else if (t.flags & 134217728 /* TemplateLiteral */) {
@@ -61125,7 +61137,7 @@ function createTypeChecker(host) {
61125
61137
  }
61126
61138
  }
61127
61139
  function getTemplateStringForType(type) {
61128
- return type.flags & 1024 /* StringLiteral */ ? type.value : type.flags & 2048 /* NumberLiteral */ ? "" + type.value : type.flags & 8192 /* BigIntLiteral */ ? pseudoBigIntToString(type.value) : type.flags & (4096 /* BooleanLiteral */ | 12 /* Nullable */) ? type.intrinsicName : void 0;
61140
+ return type.flags & 128 /* StringLiteral */ ? type.value : type.flags & 256 /* NumberLiteral */ ? "" + type.value : type.flags & 2048 /* BigIntLiteral */ ? pseudoBigIntToString(type.value) : type.flags & (512 /* BooleanLiteral */ | 98304 /* Nullable */) ? type.intrinsicName : void 0;
61129
61141
  }
61130
61142
  function createTemplateLiteralType(texts, types) {
61131
61143
  const type = createType(134217728 /* TemplateLiteral */);
@@ -61134,9 +61146,9 @@ function createTypeChecker(host) {
61134
61146
  return type;
61135
61147
  }
61136
61148
  function getStringMappingType(symbol, type) {
61137
- return type.flags & (1048576 /* Union */ | 131072 /* Never */) ? mapType(type, (t) => getStringMappingType(symbol, t)) : type.flags & 1024 /* StringLiteral */ ? getStringLiteralType(applyStringMapping(symbol, type.value)) : type.flags & 134217728 /* TemplateLiteral */ ? getTemplateLiteralType(...applyTemplateStringMapping(symbol, type.texts, type.types)) : (
61149
+ return type.flags & (1048576 /* Union */ | 131072 /* Never */) ? mapType(type, (t) => getStringMappingType(symbol, t)) : type.flags & 128 /* StringLiteral */ ? getStringLiteralType(applyStringMapping(symbol, type.value)) : type.flags & 134217728 /* TemplateLiteral */ ? getTemplateLiteralType(...applyTemplateStringMapping(symbol, type.texts, type.types)) : (
61138
61150
  // Mapping<Mapping<T>> === Mapping<T>
61139
- type.flags & 268435456 /* StringMapping */ && symbol === type.symbol ? type : type.flags & (1 /* Any */ | 32 /* String */ | 268435456 /* StringMapping */) || isGenericIndexType(type) ? getStringMappingTypeForGenericType(symbol, type) : (
61151
+ type.flags & 268435456 /* StringMapping */ && symbol === type.symbol ? type : type.flags & (1 /* Any */ | 4 /* String */ | 268435456 /* StringMapping */) || isGenericIndexType(type) ? getStringMappingTypeForGenericType(symbol, type) : (
61140
61152
  // This handles Mapping<`${number}`> and Mapping<`${bigint}`>
61141
61153
  isPatternLiteralPlaceholderType(type) ? getStringMappingTypeForGenericType(symbol, getTemplateLiteralType(["", ""], [type])) : type
61142
61154
  )
@@ -61274,7 +61286,7 @@ function createTypeChecker(host) {
61274
61286
  }
61275
61287
  }
61276
61288
  }
61277
- if (!(indexType.flags & 12 /* Nullable */) && isTypeAssignableToKind(indexType, 402654240 /* StringLike */ | 67648 /* NumberLike */ | 16896 /* ESSymbolLike */)) {
61289
+ if (!(indexType.flags & 98304 /* Nullable */) && isTypeAssignableToKind(indexType, 402653316 /* StringLike */ | 296 /* NumberLike */ | 12288 /* ESSymbolLike */)) {
61278
61290
  if (objectType.flags & (1 /* Any */ | 131072 /* Never */)) {
61279
61291
  return objectType;
61280
61292
  }
@@ -61290,13 +61302,13 @@ function createTypeChecker(host) {
61290
61302
  }
61291
61303
  return void 0;
61292
61304
  }
61293
- if (accessNode && indexInfo.keyType === stringType && !isTypeAssignableToKind(indexType, 32 /* String */ | 64 /* Number */)) {
61305
+ if (accessNode && indexInfo.keyType === stringType && !isTypeAssignableToKind(indexType, 4 /* String */ | 8 /* Number */)) {
61294
61306
  const indexNode = getIndexNodeForAccessExpression(accessNode);
61295
61307
  error(indexNode, Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType));
61296
61308
  return accessFlags & 1 /* IncludeUndefined */ ? getUnionType([indexInfo.type, missingType]) : indexInfo.type;
61297
61309
  }
61298
61310
  errorIfWritingToReadonlyIndex(indexInfo);
61299
- if (accessFlags & 1 /* IncludeUndefined */ && !(objectType.symbol && objectType.symbol.flags & (256 /* RegularEnum */ | 128 /* ConstEnum */) && (indexType.symbol && indexType.flags & 32768 /* EnumLiteral */ && getParentOfSymbol(indexType.symbol) === objectType.symbol))) {
61311
+ if (accessFlags & 1 /* IncludeUndefined */ && !(objectType.symbol && objectType.symbol.flags & (256 /* RegularEnum */ | 128 /* ConstEnum */) && (indexType.symbol && indexType.flags & 1024 /* EnumLiteral */ && getParentOfSymbol(indexType.symbol) === objectType.symbol))) {
61300
61312
  return getUnionType([indexInfo.type, missingType]);
61301
61313
  }
61302
61314
  return indexInfo.type;
@@ -61309,10 +61321,10 @@ function createTypeChecker(host) {
61309
61321
  }
61310
61322
  if (accessExpression && !isConstEnumObjectType(objectType)) {
61311
61323
  if (isObjectLiteralType(objectType)) {
61312
- if (noImplicitAny && indexType.flags & (1024 /* StringLiteral */ | 2048 /* NumberLiteral */)) {
61324
+ if (noImplicitAny && indexType.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */)) {
61313
61325
  diagnostics.add(createDiagnosticForNode(accessExpression, Diagnostics.Property_0_does_not_exist_on_type_1, indexType.value, typeToString(objectType)));
61314
61326
  return undefinedType;
61315
- } else if (indexType.flags & (64 /* Number */ | 32 /* String */)) {
61327
+ } else if (indexType.flags & (8 /* Number */ | 4 /* String */)) {
61316
61328
  const types = map(objectType.properties, (property) => {
61317
61329
  return getTypeOfSymbol(property);
61318
61330
  });
@@ -61339,7 +61351,7 @@ function createTypeChecker(host) {
61339
61351
  error(accessExpression, Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_Did_you_mean_to_call_1, typeToString(objectType), suggestion2);
61340
61352
  } else {
61341
61353
  let errorInfo;
61342
- if (indexType.flags & 32768 /* EnumLiteral */) {
61354
+ if (indexType.flags & 1024 /* EnumLiteral */) {
61343
61355
  errorInfo = chainDiagnosticMessages(
61344
61356
  /*details*/
61345
61357
  void 0,
@@ -61347,7 +61359,7 @@ function createTypeChecker(host) {
61347
61359
  "[" + typeToString(indexType) + "]",
61348
61360
  typeToString(objectType)
61349
61361
  );
61350
- } else if (indexType.flags & 16384 /* UniqueESSymbol */) {
61362
+ } else if (indexType.flags & 8192 /* UniqueESSymbol */) {
61351
61363
  const symbolName2 = getFullyQualifiedName(indexType.symbol, accessExpression);
61352
61364
  errorInfo = chainDiagnosticMessages(
61353
61365
  /*details*/
@@ -61356,7 +61368,7 @@ function createTypeChecker(host) {
61356
61368
  "[" + symbolName2 + "]",
61357
61369
  typeToString(objectType)
61358
61370
  );
61359
- } else if (indexType.flags & 1024 /* StringLiteral */) {
61371
+ } else if (indexType.flags & 128 /* StringLiteral */) {
61360
61372
  errorInfo = chainDiagnosticMessages(
61361
61373
  /*details*/
61362
61374
  void 0,
@@ -61364,7 +61376,7 @@ function createTypeChecker(host) {
61364
61376
  indexType.value,
61365
61377
  typeToString(objectType)
61366
61378
  );
61367
- } else if (indexType.flags & 2048 /* NumberLiteral */) {
61379
+ } else if (indexType.flags & 256 /* NumberLiteral */) {
61368
61380
  errorInfo = chainDiagnosticMessages(
61369
61381
  /*details*/
61370
61382
  void 0,
@@ -61372,7 +61384,7 @@ function createTypeChecker(host) {
61372
61384
  indexType.value,
61373
61385
  typeToString(objectType)
61374
61386
  );
61375
- } else if (indexType.flags & (64 /* Number */ | 32 /* String */)) {
61387
+ } else if (indexType.flags & (8 /* Number */ | 4 /* String */)) {
61376
61388
  errorInfo = chainDiagnosticMessages(
61377
61389
  /*details*/
61378
61390
  void 0,
@@ -61403,9 +61415,9 @@ function createTypeChecker(host) {
61403
61415
  }
61404
61416
  if (accessNode) {
61405
61417
  const indexNode = getIndexNodeForAccessExpression(accessNode);
61406
- if (indexNode.kind !== 10 /* BigIntLiteral */ && indexType.flags & (1024 /* StringLiteral */ | 2048 /* NumberLiteral */)) {
61418
+ if (indexNode.kind !== 10 /* BigIntLiteral */ && indexType.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */)) {
61407
61419
  error(indexNode, Diagnostics.Property_0_does_not_exist_on_type_1, "" + indexType.value, typeToString(objectType));
61408
- } else if (indexType.flags & (32 /* String */ | 64 /* Number */)) {
61420
+ } else if (indexType.flags & (4 /* String */ | 8 /* Number */)) {
61409
61421
  error(indexNode, Diagnostics.Type_0_has_no_matching_index_signature_for_type_1, typeToString(objectType), typeToString(indexType));
61410
61422
  } else {
61411
61423
  const typeString = indexNode.kind === 10 /* BigIntLiteral */ ? "bigint" : typeToString(indexType);
@@ -61429,7 +61441,7 @@ function createTypeChecker(host) {
61429
61441
  if (type.flags & 2097152 /* Intersection */) {
61430
61442
  let seenPlaceholder = false;
61431
61443
  for (const t of type.types) {
61432
- if (t.flags & (15360 /* Literal */ | 12 /* Nullable */) || isPatternLiteralPlaceholderType(t)) {
61444
+ if (t.flags & (2944 /* Literal */ | 98304 /* Nullable */) || isPatternLiteralPlaceholderType(t)) {
61433
61445
  seenPlaceholder = true;
61434
61446
  } else if (!(t.flags & 524288 /* Object */)) {
61435
61447
  return false;
@@ -61437,7 +61449,7 @@ function createTypeChecker(host) {
61437
61449
  }
61438
61450
  return seenPlaceholder;
61439
61451
  }
61440
- return !!(type.flags & (1 /* Any */ | 32 /* String */ | 64 /* Number */ | 128 /* BigInt */)) || isPatternLiteralType(type);
61452
+ return !!(type.flags & (1 /* Any */ | 4 /* String */ | 8 /* Number */ | 64 /* BigInt */)) || isPatternLiteralType(type);
61441
61453
  }
61442
61454
  function isPatternLiteralType(type) {
61443
61455
  return !!(type.flags & 134217728 /* TemplateLiteral */) && every(type.types, isPatternLiteralPlaceholderType) || !!(type.flags & 268435456 /* StringMapping */) && isPatternLiteralPlaceholderType(type.type);
@@ -61502,10 +61514,10 @@ function createTypeChecker(host) {
61502
61514
  return type[cache] = distributedOverObject;
61503
61515
  }
61504
61516
  }
61505
- if (isGenericTupleType(objectType) && indexType.flags & 67648 /* NumberLike */) {
61517
+ if (isGenericTupleType(objectType) && indexType.flags & 296 /* NumberLike */) {
61506
61518
  const elementType = getElementTypeOfSliceOfTupleType(
61507
61519
  objectType,
61508
- indexType.flags & 64 /* Number */ ? 0 : objectType.target.fixedLength,
61520
+ indexType.flags & 8 /* Number */ ? 0 : objectType.target.fixedLength,
61509
61521
  /*endSkipCount*/
61510
61522
  0,
61511
61523
  writing
@@ -61558,14 +61570,14 @@ function createTypeChecker(host) {
61558
61570
  }
61559
61571
  function couldAccessOptionalProperty(objectType, indexType) {
61560
61572
  const indexConstraint = getBaseConstraintOfType(indexType);
61561
- return !!indexConstraint && some(getPropertiesOfType(objectType), (p) => !!(p.flags & 16777216 /* Optional */) && isTypeAssignableTo(getLiteralTypeFromProperty(p, 19456 /* StringOrNumberLiteralOrUnique */), indexConstraint));
61573
+ return !!indexConstraint && some(getPropertiesOfType(objectType), (p) => !!(p.flags & 16777216 /* Optional */) && isTypeAssignableTo(getLiteralTypeFromProperty(p, 8576 /* StringOrNumberLiteralOrUnique */), indexConstraint));
61562
61574
  }
61563
61575
  function getIndexedAccessType(objectType, indexType, accessFlags = 0 /* None */, accessNode, aliasSymbol, aliasTypeArguments) {
61564
61576
  return getIndexedAccessTypeOrUndefined(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments) || (accessNode ? errorType : unknownType);
61565
61577
  }
61566
61578
  function indexTypeLessThan(indexType, limit) {
61567
61579
  return everyType(indexType, (t) => {
61568
- if (t.flags & 3072 /* StringOrNumberLiteral */) {
61580
+ if (t.flags & 384 /* StringOrNumberLiteral */) {
61569
61581
  const propName = getPropertyNameFromType(t);
61570
61582
  if (isNumericLiteralName(propName)) {
61571
61583
  const index = +propName;
@@ -61580,7 +61592,7 @@ function createTypeChecker(host) {
61580
61592
  return wildcardType;
61581
61593
  }
61582
61594
  objectType = getReducedType(objectType);
61583
- if (isStringIndexSignatureOnlyType(objectType) && !(indexType.flags & 12 /* Nullable */) && isTypeAssignableToKind(indexType, 32 /* String */ | 64 /* Number */)) {
61595
+ if (isStringIndexSignatureOnlyType(objectType) && !(indexType.flags & 98304 /* Nullable */) && isTypeAssignableToKind(indexType, 4 /* String */ | 8 /* Number */)) {
61584
61596
  indexType = stringType;
61585
61597
  }
61586
61598
  if (compilerOptions.noUncheckedIndexedAccess && accessFlags & 32 /* ExpressionPosition */) accessFlags |= 1 /* IncludeUndefined */;
@@ -61597,7 +61609,7 @@ function createTypeChecker(host) {
61597
61609
  return type;
61598
61610
  }
61599
61611
  const apparentObjectType = getReducedApparentType(objectType);
61600
- if (indexType.flags & 1048576 /* Union */ && !(indexType.flags & 256 /* Boolean */)) {
61612
+ if (indexType.flags & 1048576 /* Union */ && !(indexType.flags & 16 /* Boolean */)) {
61601
61613
  const propTypes = [];
61602
61614
  let wasMissingProp = false;
61603
61615
  for (const t of indexType.types) {
@@ -61654,7 +61666,7 @@ function createTypeChecker(host) {
61654
61666
  function isDeferredType(type, checkTuples) {
61655
61667
  return isGenericType(type) || checkTuples && isTupleType(type) && some(getElementTypes(type), isGenericType);
61656
61668
  }
61657
- function getConditionalType(root, mapper, forConstraint, aliasSymbol, aliasTypeArguments) {
61669
+ function getConditionalType(root, mapper, forConstraint, aliasSymbol, aliasTypeArguments, forNarrowing) {
61658
61670
  let result;
61659
61671
  let extraTypes;
61660
61672
  let tailCount = 0;
@@ -61671,10 +61683,11 @@ function createTypeChecker(host) {
61671
61683
  if (checkType === wildcardType || extendsType === wildcardType) {
61672
61684
  return wildcardType;
61673
61685
  }
61686
+ const effectiveCheckType = forNarrowing && isNarrowingSubstitutionType(checkType) ? checkType.constraint : checkType;
61674
61687
  const checkTypeNode = skipTypeParentheses(root.node.checkType);
61675
61688
  const extendsTypeNode = skipTypeParentheses(root.node.extendsType);
61676
61689
  const checkTuples = isSimpleTupleType(checkTypeNode) && isSimpleTupleType(extendsTypeNode) && length(checkTypeNode.elements) === length(extendsTypeNode.elements);
61677
- const checkTypeDeferred = isDeferredType(checkType, checkTuples);
61690
+ const checkTypeDeferred = isDeferredType(effectiveCheckType, checkTuples);
61678
61691
  let combinedMapper;
61679
61692
  if (root.inferTypeParameters) {
61680
61693
  const context = createInferenceContext(
@@ -61693,8 +61706,8 @@ function createTypeChecker(host) {
61693
61706
  }
61694
61707
  const inferredExtendsType = combinedMapper ? instantiateType(root.extendsType, combinedMapper) : extendsType;
61695
61708
  if (!checkTypeDeferred && !isDeferredType(inferredExtendsType, checkTuples)) {
61696
- if (!(inferredExtendsType.flags & 3 /* AnyOrUnknown */) && (checkType.flags & 1 /* Any */ || !isTypeAssignableTo(getPermissiveInstantiation(checkType), getPermissiveInstantiation(inferredExtendsType)))) {
61697
- if (checkType.flags & 1 /* Any */ || forConstraint && !(inferredExtendsType.flags & 131072 /* Never */) && someType(getPermissiveInstantiation(inferredExtendsType), (t) => isTypeAssignableTo(t, getPermissiveInstantiation(checkType)))) {
61709
+ if (!(inferredExtendsType.flags & 3 /* AnyOrUnknown */) && (effectiveCheckType.flags & 1 /* Any */ || !isTypeAssignableTo(getPermissiveInstantiation(effectiveCheckType), getPermissiveInstantiation(inferredExtendsType)))) {
61710
+ if (effectiveCheckType.flags & 1 /* Any */ || forConstraint && !(inferredExtendsType.flags & 131072 /* Never */) && someType(getPermissiveInstantiation(inferredExtendsType), (t) => isTypeAssignableTo(t, getPermissiveInstantiation(effectiveCheckType)))) {
61698
61711
  (extraTypes || (extraTypes = [])).push(instantiateType(getTypeFromTypeNode(root.node.trueType), combinedMapper || mapper));
61699
61712
  }
61700
61713
  const falseType2 = getTypeFromTypeNode(root.node.falseType);
@@ -61711,7 +61724,7 @@ function createTypeChecker(host) {
61711
61724
  result = instantiateType(falseType2, mapper);
61712
61725
  break;
61713
61726
  }
61714
- if (inferredExtendsType.flags & 3 /* AnyOrUnknown */ || isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(inferredExtendsType))) {
61727
+ if (inferredExtendsType.flags & 3 /* AnyOrUnknown */ || isTypeAssignableTo(getRestrictiveInstantiation(effectiveCheckType), getRestrictiveInstantiation(inferredExtendsType))) {
61715
61728
  const trueType2 = getTypeFromTypeNode(root.node.trueType);
61716
61729
  const trueMapper = combinedMapper || mapper;
61717
61730
  if (canTailRecurse(trueType2, trueMapper)) {
@@ -61930,7 +61943,7 @@ function createTypeChecker(host) {
61930
61943
  return !!(type.flags & 524288 /* Object */) && !isGenericMappedType(type);
61931
61944
  }
61932
61945
  function isEmptyObjectTypeOrSpreadsIntoEmptyObject(type) {
61933
- return isEmptyObjectType(type) || !!(type.flags & (8 /* Null */ | 4 /* Undefined */ | 4352 /* BooleanLike */ | 67648 /* NumberLike */ | 8320 /* BigIntLike */ | 402654240 /* StringLike */ | 98304 /* EnumLike */ | 67108864 /* NonPrimitive */ | 4194304 /* Index */));
61946
+ return isEmptyObjectType(type) || !!(type.flags & (65536 /* Null */ | 32768 /* Undefined */ | 528 /* BooleanLike */ | 296 /* NumberLike */ | 2112 /* BigIntLike */ | 402653316 /* StringLike */ | 1056 /* EnumLike */ | 67108864 /* NonPrimitive */ | 4194304 /* Index */));
61934
61947
  }
61935
61948
  function tryMergeUnionOfObjectTypeAndEmptyObject(type, readonly) {
61936
61949
  if (!(type.flags & 1048576 /* Union */)) {
@@ -61993,7 +62006,7 @@ function createTypeChecker(host) {
61993
62006
  if (right.flags & 1048576 /* Union */) {
61994
62007
  return checkCrossProductUnion([left, right]) ? mapType(right, (t) => getSpreadType(left, t, symbol, objectFlags, readonly)) : errorType;
61995
62008
  }
61996
- if (right.flags & (4352 /* BooleanLike */ | 67648 /* NumberLike */ | 8320 /* BigIntLike */ | 402654240 /* StringLike */ | 98304 /* EnumLike */ | 67108864 /* NonPrimitive */ | 4194304 /* Index */)) {
62009
+ if (right.flags & (528 /* BooleanLike */ | 296 /* NumberLike */ | 2112 /* BigIntLike */ | 402653316 /* StringLike */ | 1056 /* EnumLike */ | 67108864 /* NonPrimitive */ | 4194304 /* Index */)) {
61997
62010
  return left;
61998
62011
  }
61999
62012
  if (isGenericObjectType(left) || isGenericObjectType(right)) {
@@ -62075,7 +62088,7 @@ function createTypeChecker(host) {
62075
62088
  return type;
62076
62089
  }
62077
62090
  function getFreshTypeOfLiteralType(type) {
62078
- if (type.flags & 80896 /* Freshable */) {
62091
+ if (type.flags & 2976 /* Freshable */) {
62079
62092
  if (!type.freshType) {
62080
62093
  const freshType = createLiteralType(type.flags, type.value, type.symbol, type);
62081
62094
  freshType.freshType = freshType;
@@ -62086,28 +62099,28 @@ function createTypeChecker(host) {
62086
62099
  return type;
62087
62100
  }
62088
62101
  function getRegularTypeOfLiteralType(type) {
62089
- return type.flags & 80896 /* Freshable */ ? type.regularType : type.flags & 1048576 /* Union */ ? type.regularType || (type.regularType = mapType(type, getRegularTypeOfLiteralType)) : type;
62102
+ return type.flags & 2976 /* Freshable */ ? type.regularType : type.flags & 1048576 /* Union */ ? type.regularType || (type.regularType = mapType(type, getRegularTypeOfLiteralType)) : type;
62090
62103
  }
62091
62104
  function isFreshLiteralType(type) {
62092
- return !!(type.flags & 80896 /* Freshable */) && type.freshType === type;
62105
+ return !!(type.flags & 2976 /* Freshable */) && type.freshType === type;
62093
62106
  }
62094
62107
  function getStringLiteralType(value) {
62095
62108
  let type;
62096
- return stringLiteralTypes.get(value) || (stringLiteralTypes.set(value, type = createLiteralType(1024 /* StringLiteral */, value)), type);
62109
+ return stringLiteralTypes.get(value) || (stringLiteralTypes.set(value, type = createLiteralType(128 /* StringLiteral */, value)), type);
62097
62110
  }
62098
62111
  function getNumberLiteralType(value) {
62099
62112
  let type;
62100
- return numberLiteralTypes.get(value) || (numberLiteralTypes.set(value, type = createLiteralType(2048 /* NumberLiteral */, value)), type);
62113
+ return numberLiteralTypes.get(value) || (numberLiteralTypes.set(value, type = createLiteralType(256 /* NumberLiteral */, value)), type);
62101
62114
  }
62102
62115
  function getBigIntLiteralType(value) {
62103
62116
  let type;
62104
62117
  const key = pseudoBigIntToString(value);
62105
- return bigIntLiteralTypes.get(key) || (bigIntLiteralTypes.set(key, type = createLiteralType(8192 /* BigIntLiteral */, value)), type);
62118
+ return bigIntLiteralTypes.get(key) || (bigIntLiteralTypes.set(key, type = createLiteralType(2048 /* BigIntLiteral */, value)), type);
62106
62119
  }
62107
62120
  function getEnumLiteralType(value, enumId, symbol) {
62108
62121
  let type;
62109
62122
  const key = `${enumId}${typeof value === "string" ? "@" : "#"}${value}`;
62110
- const flags = 32768 /* EnumLiteral */ | (typeof value === "string" ? 1024 /* StringLiteral */ : 2048 /* NumberLiteral */);
62123
+ const flags = 1024 /* EnumLiteral */ | (typeof value === "string" ? 128 /* StringLiteral */ : 256 /* NumberLiteral */);
62111
62124
  return enumLiteralTypes.get(key) || (enumLiteralTypes.set(key, type = createLiteralType(flags, value, symbol)), type);
62112
62125
  }
62113
62126
  function getTypeFromLiteralTypeNode(node) {
@@ -62121,7 +62134,7 @@ function createTypeChecker(host) {
62121
62134
  return links.resolvedType;
62122
62135
  }
62123
62136
  function createUniqueESSymbolType(symbol) {
62124
- const type = createTypeWithSymbol(16384 /* UniqueESSymbol */, symbol);
62137
+ const type = createTypeWithSymbol(8192 /* UniqueESSymbol */, symbol);
62125
62138
  type.escapedName = `__@${type.symbol.escapedName}@${getSymbolId(type.symbol)}`;
62126
62139
  return type;
62127
62140
  }
@@ -62509,7 +62522,7 @@ function createTypeChecker(host) {
62509
62522
  result = target.objectFlags & 4 /* Reference */ ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments) : target.objectFlags & 32 /* Mapped */ ? instantiateMappedType(target, newMapper, newAliasSymbol, newAliasTypeArguments) : instantiateAnonymousType(target, newMapper, newAliasSymbol, newAliasTypeArguments);
62510
62523
  target.instantiations.set(id, result);
62511
62524
  const resultObjectFlags = getObjectFlags(result);
62512
- if (result.flags & 3801101 /* ObjectFlagsType */ && !(resultObjectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
62525
+ if (result.flags & 3899393 /* ObjectFlagsType */ && !(resultObjectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
62513
62526
  const resultCouldContainTypeVariables = some(typeArguments, couldContainTypeVariables);
62514
62527
  if (!(getObjectFlags(result) & 524288 /* CouldContainTypeVariablesComputed */)) {
62515
62528
  if (resultObjectFlags & (32 /* Mapped */ | 16 /* Anonymous */ | 4 /* Reference */)) {
@@ -62638,7 +62651,7 @@ function createTypeChecker(host) {
62638
62651
  const templateMapper = appendTypeMapping(mapper, getTypeParameterFromMappedType(type), key);
62639
62652
  const propType = instantiateType(getTemplateTypeFromMappedType(type.target || type), templateMapper);
62640
62653
  const modifiers = getMappedTypeModifiers(type);
62641
- return strictNullChecks && modifiers & 4 /* IncludeOptional */ && !maybeTypeOfKind(propType, 4 /* Undefined */ | 16 /* Void */) ? getOptionalType(
62654
+ return strictNullChecks && modifiers & 4 /* IncludeOptional */ && !maybeTypeOfKind(propType, 32768 /* Undefined */ | 16384 /* Void */) ? getOptionalType(
62642
62655
  propType,
62643
62656
  /*isProperty*/
62644
62657
  true
@@ -62677,8 +62690,44 @@ function createTypeChecker(host) {
62677
62690
  if (!result) {
62678
62691
  const newMapper = createTypeMapper(root.outerTypeParameters, typeArguments);
62679
62692
  const checkType = root.checkType;
62680
- const distributionType = root.isDistributive ? getReducedType(getMappedType(checkType, newMapper)) : void 0;
62681
- result = distributionType && checkType !== distributionType && distributionType.flags & (1048576 /* Union */ | 131072 /* Never */) ? mapTypeWithAlias(distributionType, (t) => getConditionalType(root, prependTypeMapping(checkType, t, newMapper), forConstraint), aliasSymbol, aliasTypeArguments) : getConditionalType(root, newMapper, forConstraint, aliasSymbol, aliasTypeArguments);
62693
+ let distributionType = root.isDistributive ? getReducedType(getMappedType(checkType, newMapper)) : void 0;
62694
+ let narrowingBaseType;
62695
+ const forNarrowing = distributionType && isNarrowingSubstitutionType(distributionType) && isNarrowableConditionalType(
62696
+ type,
62697
+ /*hadNonPrimitiveExtendsType*/
62698
+ [],
62699
+ mapper
62700
+ );
62701
+ if (forNarrowing) {
62702
+ narrowingBaseType = distributionType.baseType;
62703
+ distributionType = getReducedType(distributionType.constraint);
62704
+ }
62705
+ if (distributionType && checkType !== distributionType && distributionType.flags & (1048576 /* Union */ | 131072 /* Never */)) {
62706
+ if (narrowingBaseType) {
62707
+ result = mapTypeToIntersection(
62708
+ distributionType,
62709
+ (t) => getConditionalType(
62710
+ root,
62711
+ prependTypeMapping(checkType, getSubstitutionType(
62712
+ narrowingBaseType,
62713
+ t,
62714
+ /*isNarrowed*/
62715
+ true
62716
+ ), newMapper),
62717
+ forConstraint,
62718
+ /*aliasSymbol*/
62719
+ void 0,
62720
+ /*aliasTypeArguments*/
62721
+ void 0,
62722
+ forNarrowing
62723
+ )
62724
+ );
62725
+ } else {
62726
+ result = mapTypeWithAlias(distributionType, (t) => getConditionalType(root, prependTypeMapping(checkType, t, newMapper), forConstraint), aliasSymbol, aliasTypeArguments);
62727
+ }
62728
+ } else {
62729
+ result = getConditionalType(root, newMapper, forConstraint, aliasSymbol, aliasTypeArguments, forNarrowing);
62730
+ }
62682
62731
  root.instantiations.set(id, result);
62683
62732
  }
62684
62733
  return result;
@@ -63185,7 +63234,7 @@ function createTypeChecker(host) {
63185
63234
  createDiagnosticForNode(
63186
63235
  targetNode,
63187
63236
  Diagnostics.The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1,
63188
- propertyName && !(nameType.flags & 16384 /* UniqueESSymbol */) ? unescapeLeadingUnderscores(propertyName) : typeToString(nameType),
63237
+ propertyName && !(nameType.flags & 8192 /* UniqueESSymbol */) ? unescapeLeadingUnderscores(propertyName) : typeToString(nameType),
63189
63238
  typeToString(target)
63190
63239
  )
63191
63240
  );
@@ -63428,7 +63477,7 @@ function createTypeChecker(host) {
63428
63477
  if (!length(node.properties)) return;
63429
63478
  for (const prop of node.properties) {
63430
63479
  if (isSpreadAssignment(prop)) continue;
63431
- const type = getLiteralTypeFromProperty(getSymbolOfDeclaration(prop), 19456 /* StringOrNumberLiteralOrUnique */);
63480
+ const type = getLiteralTypeFromProperty(getSymbolOfDeclaration(prop), 8576 /* StringOrNumberLiteralOrUnique */);
63432
63481
  if (!type || type.flags & 131072 /* Never */) {
63433
63482
  continue;
63434
63483
  }
@@ -63478,7 +63527,7 @@ function createTypeChecker(host) {
63478
63527
  }
63479
63528
  return false;
63480
63529
  }
63481
- function compareSignaturesRelated(source, target, checkMode, reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes2, reportUnreliableMarkers) {
63530
+ function compareSignaturesRelated(source, target, checkMode, reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) {
63482
63531
  if (source === target) {
63483
63532
  return -1 /* True */;
63484
63533
  }
@@ -63503,7 +63552,7 @@ function createTypeChecker(host) {
63503
63552
  target,
63504
63553
  /*inferenceContext*/
63505
63554
  void 0,
63506
- compareTypes2
63555
+ compareTypes
63507
63556
  );
63508
63557
  }
63509
63558
  const sourceCount = getParameterCount(source);
@@ -63519,12 +63568,12 @@ function createTypeChecker(host) {
63519
63568
  if (sourceThisType && sourceThisType !== voidType) {
63520
63569
  const targetThisType = getThisTypeOfSignature(target);
63521
63570
  if (targetThisType) {
63522
- const related = !strictVariance && compareTypes2(
63571
+ const related = !strictVariance && compareTypes(
63523
63572
  sourceThisType,
63524
63573
  targetThisType,
63525
63574
  /*reportErrors*/
63526
63575
  false
63527
- ) || compareTypes2(targetThisType, sourceThisType, reportErrors2);
63576
+ ) || compareTypes(targetThisType, sourceThisType, reportErrors2);
63528
63577
  if (!related) {
63529
63578
  if (reportErrors2) {
63530
63579
  errorReporter(Diagnostics.The_this_types_of_each_signature_are_incompatible);
@@ -63543,13 +63592,13 @@ function createTypeChecker(host) {
63543
63592
  const sourceSig = checkMode & 3 /* Callback */ || isInstantiatedGenericParameter(source, i) ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
63544
63593
  const targetSig = checkMode & 3 /* Callback */ || isInstantiatedGenericParameter(target, i) ? void 0 : getSingleCallSignature(getNonNullableType(targetType));
63545
63594
  const callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) && getTypeFacts(sourceType, 50331648 /* IsUndefinedOrNull */) === getTypeFacts(targetType, 50331648 /* IsUndefinedOrNull */);
63546
- let related = callbacks ? compareSignaturesRelated(targetSig, sourceSig, checkMode & 8 /* StrictArity */ | (strictVariance ? 2 /* StrictCallback */ : 1 /* BivariantCallback */), reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes2, reportUnreliableMarkers) : !(checkMode & 3 /* Callback */) && !strictVariance && compareTypes2(
63595
+ let related = callbacks ? compareSignaturesRelated(targetSig, sourceSig, checkMode & 8 /* StrictArity */ | (strictVariance ? 2 /* StrictCallback */ : 1 /* BivariantCallback */), reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) : !(checkMode & 3 /* Callback */) && !strictVariance && compareTypes(
63547
63596
  sourceType,
63548
63597
  targetType,
63549
63598
  /*reportErrors*/
63550
63599
  false
63551
- ) || compareTypes2(targetType, sourceType, reportErrors2);
63552
- if (related && checkMode & 8 /* StrictArity */ && i >= getMinArgumentCount(source) && i < getMinArgumentCount(target) && compareTypes2(
63600
+ ) || compareTypes(targetType, sourceType, reportErrors2);
63601
+ if (related && checkMode & 8 /* StrictArity */ && i >= getMinArgumentCount(source) && i < getMinArgumentCount(target) && compareTypes(
63553
63602
  sourceType,
63554
63603
  targetType,
63555
63604
  /*reportErrors*/
@@ -63576,7 +63625,7 @@ function createTypeChecker(host) {
63576
63625
  if (targetTypePredicate) {
63577
63626
  const sourceTypePredicate = getTypePredicateOfSignature(source);
63578
63627
  if (sourceTypePredicate) {
63579
- result &= compareTypePredicateRelatedTo(sourceTypePredicate, targetTypePredicate, reportErrors2, errorReporter, compareTypes2);
63628
+ result &= compareTypePredicateRelatedTo(sourceTypePredicate, targetTypePredicate, reportErrors2, errorReporter, compareTypes);
63580
63629
  } else if (isIdentifierTypePredicate(targetTypePredicate) || isThisTypePredicate(targetTypePredicate)) {
63581
63630
  if (reportErrors2) {
63582
63631
  errorReporter(Diagnostics.Signature_0_must_be_a_type_predicate, signatureToString(source));
@@ -63584,12 +63633,12 @@ function createTypeChecker(host) {
63584
63633
  return 0 /* False */;
63585
63634
  }
63586
63635
  } else {
63587
- result &= checkMode & 1 /* BivariantCallback */ && compareTypes2(
63636
+ result &= checkMode & 1 /* BivariantCallback */ && compareTypes(
63588
63637
  targetReturnType,
63589
63638
  sourceReturnType,
63590
63639
  /*reportErrors*/
63591
63640
  false
63592
- ) || compareTypes2(sourceReturnType, targetReturnType, reportErrors2);
63641
+ ) || compareTypes(sourceReturnType, targetReturnType, reportErrors2);
63593
63642
  if (!result && reportErrors2 && incompatibleErrorReporter) {
63594
63643
  incompatibleErrorReporter(sourceReturnType, targetReturnType);
63595
63644
  }
@@ -63597,7 +63646,7 @@ function createTypeChecker(host) {
63597
63646
  }
63598
63647
  return result;
63599
63648
  }
63600
- function compareTypePredicateRelatedTo(source, target, reportErrors2, errorReporter, compareTypes2) {
63649
+ function compareTypePredicateRelatedTo(source, target, reportErrors2, errorReporter, compareTypes) {
63601
63650
  if (source.kind !== target.kind) {
63602
63651
  if (reportErrors2) {
63603
63652
  errorReporter(Diagnostics.A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard);
@@ -63614,7 +63663,7 @@ function createTypeChecker(host) {
63614
63663
  return 0 /* False */;
63615
63664
  }
63616
63665
  }
63617
- const related = source.type === target.type ? -1 /* True */ : source.type && target.type ? compareTypes2(source.type, target.type, reportErrors2) : 0 /* False */;
63666
+ const related = source.type === target.type ? -1 /* True */ : source.type && target.type ? compareTypes(source.type, target.type, reportErrors2) : 0 /* False */;
63618
63667
  if (related === 0 /* False */ && reportErrors2) {
63619
63668
  errorReporter(Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target));
63620
63669
  }
@@ -63648,18 +63697,18 @@ function createTypeChecker(host) {
63648
63697
  if (strictNullChecks && type.flags & 1048576 /* Union */) {
63649
63698
  if (!(type.objectFlags & 33554432 /* IsUnknownLikeUnionComputed */)) {
63650
63699
  const types = type.types;
63651
- type.objectFlags |= 33554432 /* IsUnknownLikeUnionComputed */ | (types.length >= 3 && types[0].flags & 4 /* Undefined */ && types[1].flags & 8 /* Null */ && some(types, isEmptyAnonymousObjectType) ? 67108864 /* IsUnknownLikeUnion */ : 0);
63700
+ type.objectFlags |= 33554432 /* IsUnknownLikeUnionComputed */ | (types.length >= 3 && types[0].flags & 32768 /* Undefined */ && types[1].flags & 65536 /* Null */ && some(types, isEmptyAnonymousObjectType) ? 67108864 /* IsUnknownLikeUnion */ : 0);
63652
63701
  }
63653
63702
  return !!(type.objectFlags & 67108864 /* IsUnknownLikeUnion */);
63654
63703
  }
63655
63704
  return false;
63656
63705
  }
63657
63706
  function containsUndefinedType(type) {
63658
- return !!((type.flags & 1048576 /* Union */ ? type.types[0] : type).flags & 4 /* Undefined */);
63707
+ return !!((type.flags & 1048576 /* Union */ ? type.types[0] : type).flags & 32768 /* Undefined */);
63659
63708
  }
63660
63709
  function containsNonMissingUndefinedType(type) {
63661
63710
  const candidate = type.flags & 1048576 /* Union */ ? type.types[0] : type;
63662
- return !!(candidate.flags & 4 /* Undefined */) && candidate !== missingType;
63711
+ return !!(candidate.flags & 32768 /* Undefined */) && candidate !== missingType;
63663
63712
  }
63664
63713
  function isStringIndexSignatureOnlyType(type) {
63665
63714
  return type.flags & 524288 /* Object */ && !isGenericMappedType(type) && getPropertiesOfType(type).length === 0 && getIndexInfosOfType(type).length === 1 && !!getIndexInfoOfType(type, stringType) || type.flags & 3145728 /* UnionOrIntersection */ && every(type.types, isStringIndexSignatureOnlyType) || false;
@@ -63730,25 +63779,25 @@ function createTypeChecker(host) {
63730
63779
  if (t & 1 /* Any */ || s & 131072 /* Never */ || source === wildcardType) return true;
63731
63780
  if (t & 2 /* Unknown */ && !(relation === strictSubtypeRelation && s & 1 /* Any */)) return true;
63732
63781
  if (t & 131072 /* Never */) return false;
63733
- if (s & 402654240 /* StringLike */ && t & 32 /* String */) return true;
63734
- if (s & 1024 /* StringLiteral */ && s & 32768 /* EnumLiteral */ && t & 1024 /* StringLiteral */ && !(t & 32768 /* EnumLiteral */) && source.value === target.value) return true;
63735
- if (s & 67648 /* NumberLike */ && t & 64 /* Number */) return true;
63736
- if (s & 2048 /* NumberLiteral */ && s & 32768 /* EnumLiteral */ && t & 2048 /* NumberLiteral */ && !(t & 32768 /* EnumLiteral */) && source.value === target.value) return true;
63737
- if (s & 8320 /* BigIntLike */ && t & 128 /* BigInt */) return true;
63738
- if (s & 4352 /* BooleanLike */ && t & 256 /* Boolean */) return true;
63739
- if (s & 16896 /* ESSymbolLike */ && t & 512 /* ESSymbol */) return true;
63740
- if (s & 65536 /* Enum */ && t & 65536 /* Enum */ && source.symbol.escapedName === target.symbol.escapedName && isEnumTypeRelatedTo(source.symbol, target.symbol, errorReporter)) return true;
63741
- if (s & 32768 /* EnumLiteral */ && t & 32768 /* EnumLiteral */) {
63782
+ if (s & 402653316 /* StringLike */ && t & 4 /* String */) return true;
63783
+ if (s & 128 /* StringLiteral */ && s & 1024 /* EnumLiteral */ && t & 128 /* StringLiteral */ && !(t & 1024 /* EnumLiteral */) && source.value === target.value) return true;
63784
+ if (s & 296 /* NumberLike */ && t & 8 /* Number */) return true;
63785
+ if (s & 256 /* NumberLiteral */ && s & 1024 /* EnumLiteral */ && t & 256 /* NumberLiteral */ && !(t & 1024 /* EnumLiteral */) && source.value === target.value) return true;
63786
+ if (s & 2112 /* BigIntLike */ && t & 64 /* BigInt */) return true;
63787
+ if (s & 528 /* BooleanLike */ && t & 16 /* Boolean */) return true;
63788
+ if (s & 12288 /* ESSymbolLike */ && t & 4096 /* ESSymbol */) return true;
63789
+ if (s & 32 /* Enum */ && t & 32 /* Enum */ && source.symbol.escapedName === target.symbol.escapedName && isEnumTypeRelatedTo(source.symbol, target.symbol, errorReporter)) return true;
63790
+ if (s & 1024 /* EnumLiteral */ && t & 1024 /* EnumLiteral */) {
63742
63791
  if (s & 1048576 /* Union */ && t & 1048576 /* Union */ && isEnumTypeRelatedTo(source.symbol, target.symbol, errorReporter)) return true;
63743
- if (s & 15360 /* Literal */ && t & 15360 /* Literal */ && source.value === target.value && isEnumTypeRelatedTo(source.symbol, target.symbol, errorReporter)) return true;
63792
+ if (s & 2944 /* Literal */ && t & 2944 /* Literal */ && source.value === target.value && isEnumTypeRelatedTo(source.symbol, target.symbol, errorReporter)) return true;
63744
63793
  }
63745
- if (s & 4 /* Undefined */ && (!strictNullChecks && !(t & 3145728 /* UnionOrIntersection */) || t & (4 /* Undefined */ | 16 /* Void */))) return true;
63746
- if (s & 8 /* Null */ && (!strictNullChecks && !(t & 3145728 /* UnionOrIntersection */) || t & 8 /* Null */)) return true;
63794
+ if (s & 32768 /* Undefined */ && (!strictNullChecks && !(t & 3145728 /* UnionOrIntersection */) || t & (32768 /* Undefined */ | 16384 /* Void */))) return true;
63795
+ if (s & 65536 /* Null */ && (!strictNullChecks && !(t & 3145728 /* UnionOrIntersection */) || t & 65536 /* Null */)) return true;
63747
63796
  if (s & 524288 /* Object */ && t & 67108864 /* NonPrimitive */ && !(relation === strictSubtypeRelation && isEmptyAnonymousObjectType(source) && !(getObjectFlags(source) & 8192 /* FreshLiteral */))) return true;
63748
63797
  if (relation === assignableRelation || relation === comparableRelation) {
63749
63798
  if (s & 1 /* Any */) return true;
63750
- if (s & 64 /* Number */ && (t & 65536 /* Enum */ || t & 2048 /* NumberLiteral */ && t & 32768 /* EnumLiteral */)) return true;
63751
- if (s & 2048 /* NumberLiteral */ && !(s & 32768 /* EnumLiteral */) && (t & 65536 /* Enum */ || t & 2048 /* NumberLiteral */ && t & 32768 /* EnumLiteral */ && source.value === target.value)) return true;
63799
+ if (s & 8 /* Number */ && (t & 32 /* Enum */ || t & 256 /* NumberLiteral */ && t & 1024 /* EnumLiteral */)) return true;
63800
+ if (s & 256 /* NumberLiteral */ && !(s & 1024 /* EnumLiteral */) && (t & 32 /* Enum */ || t & 256 /* NumberLiteral */ && t & 1024 /* EnumLiteral */ && source.value === target.value)) return true;
63752
63801
  if (isUnknownLikeUnionType(target)) return true;
63753
63802
  }
63754
63803
  return false;
@@ -63769,7 +63818,7 @@ function createTypeChecker(host) {
63769
63818
  }
63770
63819
  } else if (!((source.flags | target.flags) & (3145728 /* UnionOrIntersection */ | 8388608 /* IndexedAccess */ | 16777216 /* Conditional */ | 33554432 /* Substitution */))) {
63771
63820
  if (source.flags !== target.flags) return false;
63772
- if (source.flags & 67240959 /* Singleton */) return true;
63821
+ if (source.flags & 67358815 /* Singleton */) return true;
63773
63822
  }
63774
63823
  if (source.flags & 524288 /* Object */ && target.flags & 524288 /* Object */) {
63775
63824
  const related = relation.get(getRelationKey(
@@ -63821,10 +63870,12 @@ function createTypeChecker(host) {
63821
63870
  function shouldNormalizeIntersection(type) {
63822
63871
  let hasInstantiable = false;
63823
63872
  let hasNullableOrEmpty = false;
63873
+ let hasSubstitution = false;
63824
63874
  for (const t of type.types) {
63825
63875
  hasInstantiable || (hasInstantiable = !!(t.flags & 465829888 /* Instantiable */));
63826
- hasNullableOrEmpty || (hasNullableOrEmpty = !!(t.flags & 12 /* Nullable */) || isEmptyAnonymousObjectType(t));
63827
- if (hasInstantiable && hasNullableOrEmpty) return true;
63876
+ hasNullableOrEmpty || (hasNullableOrEmpty = !!(t.flags & 98304 /* Nullable */) || isEmptyAnonymousObjectType(t));
63877
+ hasSubstitution || (hasSubstitution = isNarrowingSubstitutionType(t));
63878
+ if (hasInstantiable && hasNullableOrEmpty || hasSubstitution) return true;
63828
63879
  }
63829
63880
  return false;
63830
63881
  }
@@ -64093,7 +64144,7 @@ function createTypeChecker(host) {
64093
64144
  } else if (exactOptionalPropertyTypes && getExactOptionalUnassignableProperties(source2, target2).length) {
64094
64145
  message = Diagnostics.Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties;
64095
64146
  } else {
64096
- if (source2.flags & 1024 /* StringLiteral */ && target2.flags & 1048576 /* Union */) {
64147
+ if (source2.flags & 128 /* StringLiteral */ && target2.flags & 1048576 /* Union */) {
64097
64148
  const suggestedType = getSuggestedTypeForNonexistentStringLiteralType(source2, target2);
64098
64149
  if (suggestedType) {
64099
64150
  reportError(Diagnostics.Type_0_is_not_assignable_to_type_1_Did_you_mean_2, generalizedSourceType, targetType, typeToString(suggestedType));
@@ -64162,7 +64213,7 @@ function createTypeChecker(host) {
64162
64213
  if (source2 === target2) return -1 /* True */;
64163
64214
  if (relation === identityRelation) {
64164
64215
  if (source2.flags !== target2.flags) return 0 /* False */;
64165
- if (source2.flags & 67240959 /* Singleton */) return -1 /* True */;
64216
+ if (source2.flags & 67358815 /* Singleton */) return -1 /* True */;
64166
64217
  traceUnionsOrIntersectionsTooLarge(source2, target2);
64167
64218
  return recursiveTypeRelatedTo(
64168
64219
  source2,
@@ -64176,10 +64227,10 @@ function createTypeChecker(host) {
64176
64227
  if (source2.flags & 262144 /* TypeParameter */ && getConstraintOfType(source2) === target2) {
64177
64228
  return -1 /* True */;
64178
64229
  }
64179
- if (source2.flags & 470417376 /* DefinitelyNonNullable */ && target2.flags & 1048576 /* Union */) {
64230
+ if (source2.flags & 470302716 /* DefinitelyNonNullable */ && target2.flags & 1048576 /* Union */) {
64180
64231
  const types = target2.types;
64181
- const candidate = types.length === 2 && types[0].flags & 12 /* Nullable */ ? types[1] : types.length === 3 && types[0].flags & 12 /* Nullable */ && types[1].flags & 12 /* Nullable */ ? types[2] : void 0;
64182
- if (candidate && !(candidate.flags & 12 /* Nullable */)) {
64232
+ const candidate = types.length === 2 && types[0].flags & 98304 /* Nullable */ ? types[1] : types.length === 3 && types[0].flags & 98304 /* Nullable */ && types[1].flags & 98304 /* Nullable */ ? types[2] : void 0;
64233
+ if (candidate && !(candidate.flags & 98304 /* Nullable */)) {
64183
64234
  target2 = getNormalizedType(
64184
64235
  candidate,
64185
64236
  /*writing*/
@@ -64481,9 +64532,9 @@ function createTypeChecker(host) {
64481
64532
  if (containsType(targetTypes, source2)) {
64482
64533
  return -1 /* True */;
64483
64534
  }
64484
- if (relation !== comparableRelation && getObjectFlags(target2) & 32768 /* PrimitiveUnion */ && !(source2.flags & 32768 /* EnumLiteral */) && (source2.flags & (1024 /* StringLiteral */ | 4096 /* BooleanLiteral */ | 8192 /* BigIntLiteral */) || (relation === subtypeRelation || relation === strictSubtypeRelation) && source2.flags & 2048 /* NumberLiteral */)) {
64535
+ if (relation !== comparableRelation && getObjectFlags(target2) & 32768 /* PrimitiveUnion */ && !(source2.flags & 1024 /* EnumLiteral */) && (source2.flags & (128 /* StringLiteral */ | 512 /* BooleanLiteral */ | 2048 /* BigIntLiteral */) || (relation === subtypeRelation || relation === strictSubtypeRelation) && source2.flags & 256 /* NumberLiteral */)) {
64485
64536
  const alternateForm = source2 === source2.regularType ? source2.freshType : source2.regularType;
64486
- const primitive = source2.flags & 1024 /* StringLiteral */ ? stringType : source2.flags & 2048 /* NumberLiteral */ ? numberType : source2.flags & 8192 /* BigIntLiteral */ ? bigintType : void 0;
64537
+ const primitive = source2.flags & 128 /* StringLiteral */ ? stringType : source2.flags & 256 /* NumberLiteral */ ? numberType : source2.flags & 2048 /* BigIntLiteral */ ? bigintType : void 0;
64487
64538
  return primitive && containsType(targetTypes, primitive) || alternateForm && containsType(targetTypes, alternateForm) ? -1 /* True */ : 0 /* False */;
64488
64539
  }
64489
64540
  const match = getMatchingUnionConstituentForType(target2, source2);
@@ -64578,8 +64629,8 @@ function createTypeChecker(host) {
64578
64629
  return 0 /* False */;
64579
64630
  }
64580
64631
  function getUndefinedStrippedTargetIfNeeded(source2, target2) {
64581
- if (source2.flags & 1048576 /* Union */ && target2.flags & 1048576 /* Union */ && !(source2.types[0].flags & 4 /* Undefined */) && target2.types[0].flags & 4 /* Undefined */) {
64582
- return extractTypesOfKind(target2, ~4 /* Undefined */);
64632
+ if (source2.flags & 1048576 /* Union */ && target2.flags & 1048576 /* Union */ && !(source2.types[0].flags & 32768 /* Undefined */) && target2.types[0].flags & 32768 /* Undefined */) {
64633
+ return extractTypesOfKind(target2, ~32768 /* Undefined */);
64583
64634
  }
64584
64635
  return target2;
64585
64636
  }
@@ -64921,7 +64972,7 @@ function createTypeChecker(host) {
64921
64972
  const mappedKeys = [];
64922
64973
  forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(
64923
64974
  modifiersType,
64924
- 19456 /* StringOrNumberLiteralOrUnique */,
64975
+ 8576 /* StringOrNumberLiteralOrUnique */,
64925
64976
  /*stringsOnly*/
64926
64977
  false,
64927
64978
  (t) => void mappedKeys.push(instantiateType(nameType, appendTypeMapping(targetType.mapper, getTypeParameterFromMappedType(targetType), t)))
@@ -65180,7 +65231,7 @@ function createTypeChecker(host) {
65180
65231
  if (includeOptional ? !(filteredByApplicability.flags & 131072 /* Never */) : isRelatedTo(targetKeys, sourceKeys, 3 /* Both */)) {
65181
65232
  const templateType2 = getTemplateTypeFromMappedType(target2);
65182
65233
  const typeParameter = getTypeParameterFromMappedType(target2);
65183
- const nonNullComponent = extractTypesOfKind(templateType2, ~12 /* Nullable */);
65234
+ const nonNullComponent = extractTypesOfKind(templateType2, ~98304 /* Nullable */);
65184
65235
  if (!keysRemapped && nonNullComponent.flags & 8388608 /* IndexedAccess */ && nonNullComponent.indexType === typeParameter) {
65185
65236
  if (result2 = isRelatedTo(source2, nonNullComponent.objectType, 2 /* Target */, reportErrors2)) {
65186
65237
  return result2;
@@ -65841,7 +65892,7 @@ function createTypeChecker(host) {
65841
65892
  for (const sourceProp of excludeProperties(getPropertiesOfType(source2), excludedProperties)) {
65842
65893
  if (!getPropertyOfObjectType(target2, sourceProp.escapedName)) {
65843
65894
  const sourceType = getTypeOfSymbol(sourceProp);
65844
- if (!(sourceType.flags & 4 /* Undefined */)) {
65895
+ if (!(sourceType.flags & 32768 /* Undefined */)) {
65845
65896
  if (reportErrors2) {
65846
65897
  reportError(Diagnostics.Property_0_does_not_exist_on_type_1, symbolToString(sourceProp), typeToString(target2));
65847
65898
  }
@@ -66069,9 +66120,9 @@ function createTypeChecker(host) {
66069
66120
  if (isIgnoredJsxProperty(source2, prop)) {
66070
66121
  continue;
66071
66122
  }
66072
- if (isApplicableIndexType(getLiteralTypeFromProperty(prop, 19456 /* StringOrNumberLiteralOrUnique */), keyType)) {
66123
+ if (isApplicableIndexType(getLiteralTypeFromProperty(prop, 8576 /* StringOrNumberLiteralOrUnique */), keyType)) {
66073
66124
  const propType = getNonMissingTypeOfSymbol(prop);
66074
- const type = exactOptionalPropertyTypes || propType.flags & 4 /* Undefined */ || keyType === numberType || !(prop.flags & 16777216 /* Optional */) ? propType : getTypeWithFacts(propType, 524288 /* NEUndefined */);
66125
+ const type = exactOptionalPropertyTypes || propType.flags & 32768 /* Undefined */ || keyType === numberType || !(prop.flags & 16777216 /* Optional */) ? propType : getTypeWithFacts(propType, 524288 /* NEUndefined */);
66075
66126
  const related = isRelatedTo(
66076
66127
  type,
66077
66128
  targetInfo.type,
@@ -66185,7 +66236,7 @@ function createTypeChecker(host) {
66185
66236
  }
66186
66237
  }
66187
66238
  function typeCouldHaveTopLevelSingletonTypes(type) {
66188
- if (type.flags & 256 /* Boolean */) {
66239
+ if (type.flags & 16 /* Boolean */) {
66189
66240
  return false;
66190
66241
  }
66191
66242
  if (type.flags & 3145728 /* UnionOrIntersection */) {
@@ -66204,7 +66255,7 @@ function createTypeChecker(host) {
66204
66255
  return getPropertiesOfType(target).filter((targetProp) => isExactOptionalPropertyMismatch(getTypeOfPropertyOfType(source, targetProp.escapedName), getTypeOfSymbol(targetProp)));
66205
66256
  }
66206
66257
  function isExactOptionalPropertyMismatch(source, target) {
66207
- return !!source && !!target && maybeTypeOfKind(source, 4 /* Undefined */) && !!containsMissingType(target);
66258
+ return !!source && !!target && maybeTypeOfKind(source, 32768 /* Undefined */) && !!containsMissingType(target);
66208
66259
  }
66209
66260
  function getExactOptionalProperties(type) {
66210
66261
  return getPropertiesOfType(type).filter((targetProp) => containsMissingType(getTypeOfSymbol(targetProp)));
@@ -66330,7 +66381,7 @@ function createTypeChecker(host) {
66330
66381
  }
66331
66382
  function hasCovariantVoidArgument(typeArguments, variances) {
66332
66383
  for (let i = 0; i < variances.length; i++) {
66333
- if ((variances[i] & 7 /* VarianceMask */) === 1 /* Covariant */ && typeArguments[i].flags & 16 /* Void */) {
66384
+ if ((variances[i] & 7 /* VarianceMask */) === 1 /* Covariant */ && typeArguments[i].flags & 16384 /* Void */) {
66334
66385
  return true;
66335
66386
  }
66336
66387
  }
@@ -66487,7 +66538,7 @@ function createTypeChecker(host) {
66487
66538
  function isPropertyIdenticalTo(sourceProp, targetProp) {
66488
66539
  return compareProperties(sourceProp, targetProp, compareTypesIdentical) !== 0 /* False */;
66489
66540
  }
66490
- function compareProperties(sourceProp, targetProp, compareTypes2) {
66541
+ function compareProperties(sourceProp, targetProp, compareTypes) {
66491
66542
  if (sourceProp === targetProp) {
66492
66543
  return -1 /* True */;
66493
66544
  }
@@ -66508,7 +66559,7 @@ function createTypeChecker(host) {
66508
66559
  if (isReadonlySymbol(sourceProp) !== isReadonlySymbol(targetProp)) {
66509
66560
  return 0 /* False */;
66510
66561
  }
66511
- return compareTypes2(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp));
66562
+ return compareTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp));
66512
66563
  }
66513
66564
  function isMatchingSignature(source, target, partialMatch) {
66514
66565
  const sourceParameterCount = getParameterCount(source);
@@ -66525,7 +66576,7 @@ function createTypeChecker(host) {
66525
66576
  }
66526
66577
  return false;
66527
66578
  }
66528
- function compareSignaturesIdentical(source, target, partialMatch, ignoreThisTypes, ignoreReturnTypes, compareTypes2) {
66579
+ function compareSignaturesIdentical(source, target, partialMatch, ignoreThisTypes, ignoreReturnTypes, compareTypes) {
66529
66580
  if (source === target) {
66530
66581
  return -1 /* True */;
66531
66582
  }
@@ -66540,7 +66591,7 @@ function createTypeChecker(host) {
66540
66591
  for (let i = 0; i < target.typeParameters.length; i++) {
66541
66592
  const s = source.typeParameters[i];
66542
66593
  const t = target.typeParameters[i];
66543
- if (!(s === t || compareTypes2(instantiateType(getConstraintFromTypeParameter(s), mapper) || unknownType, getConstraintFromTypeParameter(t) || unknownType) && compareTypes2(instantiateType(getDefaultFromTypeParameter(s), mapper) || unknownType, getDefaultFromTypeParameter(t) || unknownType))) {
66594
+ if (!(s === t || compareTypes(instantiateType(getConstraintFromTypeParameter(s), mapper) || unknownType, getConstraintFromTypeParameter(t) || unknownType) && compareTypes(instantiateType(getDefaultFromTypeParameter(s), mapper) || unknownType, getDefaultFromTypeParameter(t) || unknownType))) {
66544
66595
  return 0 /* False */;
66545
66596
  }
66546
66597
  }
@@ -66557,7 +66608,7 @@ function createTypeChecker(host) {
66557
66608
  if (sourceThisType) {
66558
66609
  const targetThisType = getThisTypeOfSignature(target);
66559
66610
  if (targetThisType) {
66560
- const related = compareTypes2(sourceThisType, targetThisType);
66611
+ const related = compareTypes(sourceThisType, targetThisType);
66561
66612
  if (!related) {
66562
66613
  return 0 /* False */;
66563
66614
  }
@@ -66569,7 +66620,7 @@ function createTypeChecker(host) {
66569
66620
  for (let i = 0; i < targetLen; i++) {
66570
66621
  const s = getTypeAtPosition(source, i);
66571
66622
  const t = getTypeAtPosition(target, i);
66572
- const related = compareTypes2(t, s);
66623
+ const related = compareTypes(t, s);
66573
66624
  if (!related) {
66574
66625
  return 0 /* False */;
66575
66626
  }
@@ -66578,12 +66629,12 @@ function createTypeChecker(host) {
66578
66629
  if (!ignoreReturnTypes) {
66579
66630
  const sourceTypePredicate = getTypePredicateOfSignature(source);
66580
66631
  const targetTypePredicate = getTypePredicateOfSignature(target);
66581
- result &= sourceTypePredicate || targetTypePredicate ? compareTypePredicatesIdentical(sourceTypePredicate, targetTypePredicate, compareTypes2) : compareTypes2(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target));
66632
+ result &= sourceTypePredicate || targetTypePredicate ? compareTypePredicatesIdentical(sourceTypePredicate, targetTypePredicate, compareTypes) : compareTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target));
66582
66633
  }
66583
66634
  return result;
66584
66635
  }
66585
- function compareTypePredicatesIdentical(source, target, compareTypes2) {
66586
- return !(source && target && typePredicateKindsMatch(source, target)) ? 0 /* False */ : source.type === target.type ? -1 /* True */ : source.type && target.type ? compareTypes2(source.type, target.type) : 0 /* False */;
66636
+ function compareTypePredicatesIdentical(source, target, compareTypes) {
66637
+ return !(source && target && typePredicateKindsMatch(source, target)) ? 0 /* False */ : source.type === target.type ? -1 /* True */ : source.type && target.type ? compareTypes(source.type, target.type) : 0 /* False */;
66587
66638
  }
66588
66639
  function literalTypesWithSameBaseType(types) {
66589
66640
  let commonBaseType;
@@ -66605,9 +66656,9 @@ function createTypeChecker(host) {
66605
66656
  if (types.length === 1) {
66606
66657
  return types[0];
66607
66658
  }
66608
- const primaryTypes = strictNullChecks ? sameMap(types, (t) => filterType(t, (u) => !(u.flags & 12 /* Nullable */))) : types;
66659
+ const primaryTypes = strictNullChecks ? sameMap(types, (t) => filterType(t, (u) => !(u.flags & 98304 /* Nullable */))) : types;
66609
66660
  const superTypeOrUnion = literalTypesWithSameBaseType(primaryTypes) ? getUnionType(primaryTypes) : reduceLeft(primaryTypes, (s, t) => isTypeSubtypeOf(s, t) ? t : s);
66610
- return primaryTypes === types ? superTypeOrUnion : getNullableType(superTypeOrUnion, getCombinedTypeFlags(types) & 12 /* Nullable */);
66661
+ return primaryTypes === types ? superTypeOrUnion : getNullableType(superTypeOrUnion, getCombinedTypeFlags(types) & 98304 /* Nullable */);
66611
66662
  }
66612
66663
  function getCommonSubtype(types) {
66613
66664
  return reduceLeft(types, (s, t) => isTypeSubtypeOf(t, s) ? t : s);
@@ -66628,10 +66679,10 @@ function createTypeChecker(host) {
66628
66679
  return isArrayType(type) ? getTypeArguments(type)[0] : void 0;
66629
66680
  }
66630
66681
  function isArrayLikeType(type) {
66631
- return isArrayType(type) || !(type.flags & 12 /* Nullable */) && isTypeAssignableTo(type, anyReadonlyArrayType);
66682
+ return isArrayType(type) || !(type.flags & 98304 /* Nullable */) && isTypeAssignableTo(type, anyReadonlyArrayType);
66632
66683
  }
66633
66684
  function isMutableArrayLikeType(type) {
66634
- return isMutableArrayOrTuple(type) || !(type.flags & (1 /* Any */ | 12 /* Nullable */)) && isTypeAssignableTo(type, anyArrayType);
66685
+ return isMutableArrayOrTuple(type) || !(type.flags & (1 /* Any */ | 98304 /* Nullable */)) && isTypeAssignableTo(type, anyArrayType);
66635
66686
  }
66636
66687
  function getSingleBaseForNonAugmentingSubtype(type) {
66637
66688
  if (!(getObjectFlags(type) & 4 /* Reference */) || !(getObjectFlags(type.target) & 3 /* ClassOrInterface */)) {
@@ -66671,7 +66722,7 @@ function createTypeChecker(host) {
66671
66722
  }
66672
66723
  function isTupleLikeType(type) {
66673
66724
  let lengthType;
66674
- return isTupleType(type) || !!getPropertyOfType(type, "0") || isArrayLikeType(type) && !!(lengthType = getTypeOfPropertyOfType(type, "length")) && everyType(lengthType, (t) => !!(t.flags & 2048 /* NumberLiteral */));
66725
+ return isTupleType(type) || !!getPropertyOfType(type, "0") || isArrayLikeType(type) && !!(lengthType = getTypeOfPropertyOfType(type, "length")) && everyType(lengthType, (t) => !!(t.flags & 256 /* NumberLiteral */));
66675
66726
  }
66676
66727
  function isArrayOrTupleLikeType(type) {
66677
66728
  return isArrayLikeType(type) || isTupleLikeType(type);
@@ -66687,10 +66738,10 @@ function createTypeChecker(host) {
66687
66738
  return void 0;
66688
66739
  }
66689
66740
  function isNeitherUnitTypeNorNever(type) {
66690
- return !(type.flags & (97292 /* Unit */ | 131072 /* Never */));
66741
+ return !(type.flags & (109472 /* Unit */ | 131072 /* Never */));
66691
66742
  }
66692
66743
  function isUnitType(type) {
66693
- return !!(type.flags & 97292 /* Unit */);
66744
+ return !!(type.flags & 109472 /* Unit */);
66694
66745
  }
66695
66746
  function isUnitLikeType(type) {
66696
66747
  const t = getBaseConstraintOrType(type);
@@ -66700,23 +66751,23 @@ function createTypeChecker(host) {
66700
66751
  return type.flags & 2097152 /* Intersection */ ? find(type.types, isUnitType) || type : type;
66701
66752
  }
66702
66753
  function isLiteralType(type) {
66703
- return type.flags & 256 /* Boolean */ ? true : type.flags & 1048576 /* Union */ ? type.flags & 32768 /* EnumLiteral */ ? true : every(type.types, isUnitType) : isUnitType(type);
66754
+ return type.flags & 16 /* Boolean */ ? true : type.flags & 1048576 /* Union */ ? type.flags & 1024 /* EnumLiteral */ ? true : every(type.types, isUnitType) : isUnitType(type);
66704
66755
  }
66705
66756
  function getBaseTypeOfLiteralType(type) {
66706
- return type.flags & 98304 /* EnumLike */ ? getBaseTypeOfEnumLikeType(type) : type.flags & (1024 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ? stringType : type.flags & 2048 /* NumberLiteral */ ? numberType : type.flags & 8192 /* BigIntLiteral */ ? bigintType : type.flags & 4096 /* BooleanLiteral */ ? booleanType : type.flags & 1048576 /* Union */ ? getBaseTypeOfLiteralTypeUnion(type) : type;
66757
+ return type.flags & 1056 /* EnumLike */ ? getBaseTypeOfEnumLikeType(type) : type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ? stringType : type.flags & 256 /* NumberLiteral */ ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 512 /* BooleanLiteral */ ? booleanType : type.flags & 1048576 /* Union */ ? getBaseTypeOfLiteralTypeUnion(type) : type;
66707
66758
  }
66708
66759
  function getBaseTypeOfLiteralTypeUnion(type) {
66709
66760
  const key = `B${getTypeId(type)}`;
66710
66761
  return getCachedType(key) ?? setCachedType(key, mapType(type, getBaseTypeOfLiteralType));
66711
66762
  }
66712
66763
  function getBaseTypeOfLiteralTypeForComparison(type) {
66713
- return type.flags & (1024 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ? stringType : type.flags & (2048 /* NumberLiteral */ | 65536 /* Enum */) ? numberType : type.flags & 8192 /* BigIntLiteral */ ? bigintType : type.flags & 4096 /* BooleanLiteral */ ? booleanType : type.flags & 1048576 /* Union */ ? mapType(type, getBaseTypeOfLiteralTypeForComparison) : type;
66764
+ return type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ? stringType : type.flags & (256 /* NumberLiteral */ | 32 /* Enum */) ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 512 /* BooleanLiteral */ ? booleanType : type.flags & 1048576 /* Union */ ? mapType(type, getBaseTypeOfLiteralTypeForComparison) : type;
66714
66765
  }
66715
66766
  function getWidenedLiteralType(type) {
66716
- return type.flags & 98304 /* EnumLike */ && isFreshLiteralType(type) ? getBaseTypeOfEnumLikeType(type) : type.flags & 1024 /* StringLiteral */ && isFreshLiteralType(type) ? stringType : type.flags & 2048 /* NumberLiteral */ && isFreshLiteralType(type) ? numberType : type.flags & 8192 /* BigIntLiteral */ && isFreshLiteralType(type) ? bigintType : type.flags & 4096 /* BooleanLiteral */ && isFreshLiteralType(type) ? booleanType : type.flags & 1048576 /* Union */ ? mapType(type, getWidenedLiteralType) : type;
66767
+ return type.flags & 1056 /* EnumLike */ && isFreshLiteralType(type) ? getBaseTypeOfEnumLikeType(type) : type.flags & 128 /* StringLiteral */ && isFreshLiteralType(type) ? stringType : type.flags & 256 /* NumberLiteral */ && isFreshLiteralType(type) ? numberType : type.flags & 2048 /* BigIntLiteral */ && isFreshLiteralType(type) ? bigintType : type.flags & 512 /* BooleanLiteral */ && isFreshLiteralType(type) ? booleanType : type.flags & 1048576 /* Union */ ? mapType(type, getWidenedLiteralType) : type;
66717
66768
  }
66718
66769
  function getWidenedUniqueESSymbolType(type) {
66719
- return type.flags & 16384 /* UniqueESSymbol */ ? esSymbolType : type.flags & 1048576 /* Union */ ? mapType(type, getWidenedUniqueESSymbolType) : type;
66770
+ return type.flags & 8192 /* UniqueESSymbol */ ? esSymbolType : type.flags & 1048576 /* Union */ ? mapType(type, getWidenedUniqueESSymbolType) : type;
66720
66771
  }
66721
66772
  function getWidenedLiteralLikeTypeForContextualType(type, contextualType) {
66722
66773
  if (!isLiteralOfContextualType(type, contextualType)) {
@@ -66793,11 +66844,11 @@ function createTypeChecker(host) {
66793
66844
  return mapType(type, getDefinitelyFalsyPartOfType);
66794
66845
  }
66795
66846
  function getDefinitelyFalsyPartOfType(type) {
66796
- return type.flags & 32 /* String */ ? emptyStringType : type.flags & 64 /* Number */ ? zeroType : type.flags & 128 /* BigInt */ ? zeroBigIntType : type === regularFalseType || type === falseType || type.flags & (16 /* Void */ | 4 /* Undefined */ | 8 /* Null */ | 3 /* AnyOrUnknown */) || type.flags & 1024 /* StringLiteral */ && type.value === "" || type.flags & 2048 /* NumberLiteral */ && type.value === 0 || type.flags & 8192 /* BigIntLiteral */ && isZeroBigInt(type) ? type : neverType;
66847
+ return type.flags & 4 /* String */ ? emptyStringType : type.flags & 8 /* Number */ ? zeroType : type.flags & 64 /* BigInt */ ? zeroBigIntType : type === regularFalseType || type === falseType || type.flags & (16384 /* Void */ | 32768 /* Undefined */ | 65536 /* Null */ | 3 /* AnyOrUnknown */) || type.flags & 128 /* StringLiteral */ && type.value === "" || type.flags & 256 /* NumberLiteral */ && type.value === 0 || type.flags & 2048 /* BigIntLiteral */ && isZeroBigInt(type) ? type : neverType;
66797
66848
  }
66798
66849
  function getNullableType(type, flags) {
66799
- const missing = flags & ~type.flags & (4 /* Undefined */ | 8 /* Null */);
66800
- return missing === 0 ? type : missing === 4 /* Undefined */ ? getUnionType([type, undefinedType]) : missing === 8 /* Null */ ? getUnionType([type, nullType]) : getUnionType([type, undefinedType, nullType]);
66850
+ const missing = flags & ~type.flags & (32768 /* Undefined */ | 65536 /* Null */);
66851
+ return missing === 0 ? type : missing === 32768 /* Undefined */ ? getUnionType([type, undefinedType]) : missing === 65536 /* Null */ ? getUnionType([type, nullType]) : getUnionType([type, undefinedType, nullType]);
66801
66852
  }
66802
66853
  function getOptionalType(type, isProperty = false) {
66803
66854
  Debug.assert(strictNullChecks);
@@ -66840,7 +66891,7 @@ function createTypeChecker(host) {
66840
66891
  return exactOptionalPropertyTypes ? removeType(type, missingType) : getTypeWithFacts(type, 524288 /* NEUndefined */);
66841
66892
  }
66842
66893
  function isCoercibleUnderDoubleEquals(source, target) {
66843
- return (source.flags & (64 /* Number */ | 32 /* String */ | 4096 /* BooleanLiteral */)) !== 0 && (target.flags & (64 /* Number */ | 32 /* String */ | 256 /* Boolean */)) !== 0;
66894
+ return (source.flags & (8 /* Number */ | 4 /* String */ | 512 /* BooleanLiteral */)) !== 0 && (target.flags & (8 /* Number */ | 4 /* String */ | 16 /* Boolean */)) !== 0;
66844
66895
  }
66845
66896
  function isObjectTypeWithInferableIndex(type) {
66846
66897
  const objectFlags = getObjectFlags(type);
@@ -66973,7 +67024,7 @@ function createTypeChecker(host) {
66973
67024
  return type.widened;
66974
67025
  }
66975
67026
  let result;
66976
- if (type.flags & (1 /* Any */ | 12 /* Nullable */)) {
67027
+ if (type.flags & (1 /* Any */ | 98304 /* Nullable */)) {
66977
67028
  result = anyType;
66978
67029
  } else if (isObjectLiteralType(type)) {
66979
67030
  result = getWidenedTypeOfObjectLiteral(type, context);
@@ -66985,7 +67036,7 @@ function createTypeChecker(host) {
66985
67036
  void 0,
66986
67037
  type.types
66987
67038
  );
66988
- const widenedTypes = sameMap(type.types, (t) => t.flags & 12 /* Nullable */ ? t : getWidenedTypeWithContext(t, unionContext));
67039
+ const widenedTypes = sameMap(type.types, (t) => t.flags & 98304 /* Nullable */ ? t : getWidenedTypeWithContext(t, unionContext));
66989
67040
  result = getUnionType(widenedTypes, some(widenedTypes, isEmptyObjectType) ? 2 /* Subtype */ : 1 /* Literal */);
66990
67041
  } else if (type.flags & 2097152 /* Intersection */) {
66991
67042
  result = getIntersectionType(sameMap(type.types, getWidenedType));
@@ -67185,18 +67236,18 @@ function createTypeChecker(host) {
67185
67236
  callback(getReturnTypeOfSignature(source), targetReturnType);
67186
67237
  }
67187
67238
  }
67188
- function createInferenceContext(typeParameters, signature, flags, compareTypes2) {
67189
- return createInferenceContextWorker(typeParameters.map(createInferenceInfo), signature, flags, compareTypes2 || compareTypesAssignable);
67239
+ function createInferenceContext(typeParameters, signature, flags, compareTypes) {
67240
+ return createInferenceContextWorker(typeParameters.map(createInferenceInfo), signature, flags, compareTypes || compareTypesAssignable);
67190
67241
  }
67191
67242
  function cloneInferenceContext(context, extraFlags = 0) {
67192
67243
  return context && createInferenceContextWorker(map(context.inferences, cloneInferenceInfo), context.signature, context.flags | extraFlags, context.compareTypes);
67193
67244
  }
67194
- function createInferenceContextWorker(inferences, signature, flags, compareTypes2) {
67245
+ function createInferenceContextWorker(inferences, signature, flags, compareTypes) {
67195
67246
  const context = {
67196
67247
  inferences,
67197
67248
  signature,
67198
67249
  flags,
67199
- compareTypes: compareTypes2,
67250
+ compareTypes,
67200
67251
  mapper: reportUnmeasurableMapper,
67201
67252
  // initialize to a noop mapper so the context object is available, but the underlying object shape is right upon construction
67202
67253
  nonFixingMapper: reportUnmeasurableMapper
@@ -67283,8 +67334,8 @@ function createTypeChecker(host) {
67283
67334
  if (objectFlags & 524288 /* CouldContainTypeVariablesComputed */) {
67284
67335
  return !!(objectFlags & 1048576 /* CouldContainTypeVariables */);
67285
67336
  }
67286
- const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 134217728 /* SingleSignatureType */ && !!length(type.outerTypeParameters) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 32768 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
67287
- if (type.flags & 3801101 /* ObjectFlagsType */) {
67337
+ const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 134217728 /* SingleSignatureType */ && !!length(type.outerTypeParameters) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
67338
+ if (type.flags & 3899393 /* ObjectFlagsType */) {
67288
67339
  type.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (result ? 1048576 /* CouldContainTypeVariables */ : 0);
67289
67340
  }
67290
67341
  return result;
@@ -67306,7 +67357,7 @@ function createTypeChecker(host) {
67306
67357
  function createEmptyObjectTypeFromStringLiteral(type) {
67307
67358
  const members = createSymbolTable();
67308
67359
  forEachType(type, (t) => {
67309
- if (!(t.flags & 1024 /* StringLiteral */)) {
67360
+ if (!(t.flags & 128 /* StringLiteral */)) {
67310
67361
  return;
67311
67362
  }
67312
67363
  const name = escapeLeadingUnderscores(t.value);
@@ -67318,7 +67369,7 @@ function createTypeChecker(host) {
67318
67369
  }
67319
67370
  members.set(name, literalProp);
67320
67371
  });
67321
- const indexInfos = type.flags & 32 /* String */ ? [createIndexInfo(
67372
+ const indexInfos = type.flags & 4 /* String */ ? [createIndexInfo(
67322
67373
  stringType,
67323
67374
  emptyObjectType,
67324
67375
  /*isReadonly*/
@@ -67420,7 +67471,7 @@ function createTypeChecker(host) {
67420
67471
  yield targetProp;
67421
67472
  } else if (matchDiscriminantProperties) {
67422
67473
  const targetType = getTypeOfSymbol(targetProp);
67423
- if (targetType.flags & 97292 /* Unit */) {
67474
+ if (targetType.flags & 109472 /* Unit */) {
67424
67475
  const sourceType = getTypeOfSymbol(sourceProp);
67425
67476
  if (!(sourceType.flags & 1 /* Any */ || getRegularTypeOfLiteralType(sourceType) === getRegularTypeOfLiteralType(targetType))) {
67426
67477
  yield targetProp;
@@ -67483,7 +67534,7 @@ function createTypeChecker(host) {
67483
67534
  if (target.flags & 1 /* Any */) {
67484
67535
  return true;
67485
67536
  }
67486
- if (target.flags & (32 /* String */ | 134217728 /* TemplateLiteral */)) {
67537
+ if (target.flags & (4 /* String */ | 134217728 /* TemplateLiteral */)) {
67487
67538
  return isTypeAssignableTo(source, target);
67488
67539
  }
67489
67540
  if (target.flags & 268435456 /* StringMapping */) {
@@ -67501,20 +67552,20 @@ function createTypeChecker(host) {
67501
67552
  if (target.flags & 2097152 /* Intersection */) {
67502
67553
  return every(target.types, (t) => t === emptyTypeLiteralType || isValidTypeForTemplateLiteralPlaceholder(source, t));
67503
67554
  }
67504
- if (target.flags & 32 /* String */ || isTypeAssignableTo(source, target)) {
67555
+ if (target.flags & 4 /* String */ || isTypeAssignableTo(source, target)) {
67505
67556
  return true;
67506
67557
  }
67507
- if (source.flags & 1024 /* StringLiteral */) {
67558
+ if (source.flags & 128 /* StringLiteral */) {
67508
67559
  const value = source.value;
67509
- return !!(target.flags & 64 /* Number */ && isValidNumberString(
67560
+ return !!(target.flags & 8 /* Number */ && isValidNumberString(
67510
67561
  value,
67511
67562
  /*roundTripOnly*/
67512
67563
  false
67513
- ) || target.flags & 128 /* BigInt */ && isValidBigIntString(
67564
+ ) || target.flags & 64 /* BigInt */ && isValidBigIntString(
67514
67565
  value,
67515
67566
  /*roundTripOnly*/
67516
67567
  false
67517
- ) || target.flags & (4096 /* BooleanLiteral */ | 12 /* Nullable */) && value === target.intrinsicName || target.flags & 268435456 /* StringMapping */ && isMemberOfStringMapping(source, target) || target.flags & 134217728 /* TemplateLiteral */ && isTypeMatchedByTemplateLiteralType(source, target));
67568
+ ) || target.flags & (512 /* BooleanLiteral */ | 98304 /* Nullable */) && value === target.intrinsicName || target.flags & 268435456 /* StringMapping */ && isMemberOfStringMapping(source, target) || target.flags & 134217728 /* TemplateLiteral */ && isTypeMatchedByTemplateLiteralType(source, target));
67518
67569
  }
67519
67570
  if (source.flags & 134217728 /* TemplateLiteral */) {
67520
67571
  const texts = source.texts;
@@ -67523,7 +67574,7 @@ function createTypeChecker(host) {
67523
67574
  return false;
67524
67575
  }
67525
67576
  function inferTypesFromTemplateLiteralType(source, target) {
67526
- return source.flags & 1024 /* StringLiteral */ ? inferFromLiteralPartsToTemplateLiteral([source.value], emptyArray, target) : source.flags & 134217728 /* TemplateLiteral */ ? arrayIsEqualTo(source.texts, target.texts) ? map(source.types, (s, i) => {
67577
+ return source.flags & 128 /* StringLiteral */ ? inferFromLiteralPartsToTemplateLiteral([source.value], emptyArray, target) : source.flags & 134217728 /* TemplateLiteral */ ? arrayIsEqualTo(source.texts, target.texts) ? map(source.types, (s, i) => {
67527
67578
  return isTypeAssignableTo(getBaseConstraintOrType(s), getBaseConstraintOrType(target.types[i])) ? s : getStringLikeTypeForType(s);
67528
67579
  }) : inferFromLiteralPartsToTemplateLiteral(source.texts, source.types, target) : void 0;
67529
67580
  }
@@ -67532,7 +67583,7 @@ function createTypeChecker(host) {
67532
67583
  return !!inferences && every(inferences, (r, i) => isValidTypeForTemplateLiteralPlaceholder(r, target.types[i]));
67533
67584
  }
67534
67585
  function getStringLikeTypeForType(type) {
67535
- return type.flags & (1 /* Any */ | 402654240 /* StringLike */) ? type : getTemplateLiteralType(["", ""], [type]);
67586
+ return type.flags & (1 /* Any */ | 402653316 /* StringLike */) ? type : getTemplateLiteralType(["", ""], [type]);
67536
67587
  }
67537
67588
  function inferFromLiteralPartsToTemplateLiteral(sourceTexts, sourceTypes, target) {
67538
67589
  const lastSourceIndex = sourceTexts.length - 1;
@@ -67727,7 +67778,7 @@ function createTypeChecker(host) {
67727
67778
  inferFromTypeArguments(getTypeArguments(source), getTypeArguments(target), getVariances(source.target));
67728
67779
  } else if (source.flags & 4194304 /* Index */ && target.flags & 4194304 /* Index */) {
67729
67780
  inferFromContravariantTypes(source.type, target.type);
67730
- } else if ((isLiteralType(source) || source.flags & 32 /* String */) && target.flags & 4194304 /* Index */) {
67781
+ } else if ((isLiteralType(source) || source.flags & 4 /* String */) && target.flags & 4194304 /* Index */) {
67731
67782
  const empty = createEmptyObjectTypeFromStringLiteral(source);
67732
67783
  inferFromContravariantTypesWithPriority(empty, target.type, 256 /* LiteralKeyof */);
67733
67784
  } else if (source.flags & 8388608 /* IndexedAccess */ && target.flags & 8388608 /* IndexedAccess */) {
@@ -67982,29 +68033,29 @@ function createTypeChecker(host) {
67982
68033
  for (let i = 0; i < types.length; i++) {
67983
68034
  const source2 = matches ? matches[i] : neverType;
67984
68035
  const target2 = types[i];
67985
- if (source2.flags & 1024 /* StringLiteral */ && target2.flags & 8650752 /* TypeVariable */) {
68036
+ if (source2.flags & 128 /* StringLiteral */ && target2.flags & 8650752 /* TypeVariable */) {
67986
68037
  const inferenceContext = getInferenceInfoForType(target2);
67987
68038
  const constraint = inferenceContext ? getBaseConstraintOfType(inferenceContext.typeParameter) : void 0;
67988
68039
  if (constraint && !isTypeAny(constraint)) {
67989
68040
  const constraintTypes = constraint.flags & 1048576 /* Union */ ? constraint.types : [constraint];
67990
68041
  let allTypeFlags = reduceLeft(constraintTypes, (flags, t) => flags | t.flags, 0);
67991
- if (!(allTypeFlags & 32 /* String */)) {
68042
+ if (!(allTypeFlags & 4 /* String */)) {
67992
68043
  const str = source2.value;
67993
- if (allTypeFlags & 67648 /* NumberLike */ && !isValidNumberString(
68044
+ if (allTypeFlags & 296 /* NumberLike */ && !isValidNumberString(
67994
68045
  str,
67995
68046
  /*roundTripOnly*/
67996
68047
  true
67997
68048
  )) {
67998
- allTypeFlags &= ~67648 /* NumberLike */;
68049
+ allTypeFlags &= ~296 /* NumberLike */;
67999
68050
  }
68000
- if (allTypeFlags & 8320 /* BigIntLike */ && !isValidBigIntString(
68051
+ if (allTypeFlags & 2112 /* BigIntLike */ && !isValidBigIntString(
68001
68052
  str,
68002
68053
  /*roundTripOnly*/
68003
68054
  true
68004
68055
  )) {
68005
- allTypeFlags &= ~8320 /* BigIntLike */;
68056
+ allTypeFlags &= ~2112 /* BigIntLike */;
68006
68057
  }
68007
- const matchingType = reduceLeft(constraintTypes, (left, right) => !(right.flags & allTypeFlags) ? left : left.flags & 32 /* String */ ? left : right.flags & 32 /* String */ ? source2 : left.flags & 134217728 /* TemplateLiteral */ ? left : right.flags & 134217728 /* TemplateLiteral */ && isTypeMatchedByTemplateLiteralType(source2, right) ? source2 : left.flags & 268435456 /* StringMapping */ ? left : right.flags & 268435456 /* StringMapping */ && str === applyStringMapping(right.symbol, str) ? source2 : left.flags & 1024 /* StringLiteral */ ? left : right.flags & 1024 /* StringLiteral */ && right.value === str ? right : left.flags & 64 /* Number */ ? left : right.flags & 64 /* Number */ ? getNumberLiteralType(+str) : left.flags & 65536 /* Enum */ ? left : right.flags & 65536 /* Enum */ ? getNumberLiteralType(+str) : left.flags & 2048 /* NumberLiteral */ ? left : right.flags & 2048 /* NumberLiteral */ && right.value === +str ? right : left.flags & 128 /* BigInt */ ? left : right.flags & 128 /* BigInt */ ? parseBigIntLiteralType(str) : left.flags & 8192 /* BigIntLiteral */ ? left : right.flags & 8192 /* BigIntLiteral */ && pseudoBigIntToString(right.value) === str ? right : left.flags & 256 /* Boolean */ ? left : right.flags & 256 /* Boolean */ ? str === "true" ? trueType : str === "false" ? falseType : booleanType : left.flags & 4096 /* BooleanLiteral */ ? left : right.flags & 4096 /* BooleanLiteral */ && right.intrinsicName === str ? right : left.flags & 4 /* Undefined */ ? left : right.flags & 4 /* Undefined */ && right.intrinsicName === str ? right : left.flags & 8 /* Null */ ? left : right.flags & 8 /* Null */ && right.intrinsicName === str ? right : left, neverType);
68058
+ const matchingType = reduceLeft(constraintTypes, (left, right) => !(right.flags & allTypeFlags) ? left : left.flags & 4 /* String */ ? left : right.flags & 4 /* String */ ? source2 : left.flags & 134217728 /* TemplateLiteral */ ? left : right.flags & 134217728 /* TemplateLiteral */ && isTypeMatchedByTemplateLiteralType(source2, right) ? source2 : left.flags & 268435456 /* StringMapping */ ? left : right.flags & 268435456 /* StringMapping */ && str === applyStringMapping(right.symbol, str) ? source2 : left.flags & 128 /* StringLiteral */ ? left : right.flags & 128 /* StringLiteral */ && right.value === str ? right : left.flags & 8 /* Number */ ? left : right.flags & 8 /* Number */ ? getNumberLiteralType(+str) : left.flags & 32 /* Enum */ ? left : right.flags & 32 /* Enum */ ? getNumberLiteralType(+str) : left.flags & 256 /* NumberLiteral */ ? left : right.flags & 256 /* NumberLiteral */ && right.value === +str ? right : left.flags & 64 /* BigInt */ ? left : right.flags & 64 /* BigInt */ ? parseBigIntLiteralType(str) : left.flags & 2048 /* BigIntLiteral */ ? left : right.flags & 2048 /* BigIntLiteral */ && pseudoBigIntToString(right.value) === str ? right : left.flags & 16 /* Boolean */ ? left : right.flags & 16 /* Boolean */ ? str === "true" ? trueType : str === "false" ? falseType : booleanType : left.flags & 512 /* BooleanLiteral */ ? left : right.flags & 512 /* BooleanLiteral */ && right.intrinsicName === str ? right : left.flags & 32768 /* Undefined */ ? left : right.flags & 32768 /* Undefined */ && right.intrinsicName === str ? right : left.flags & 65536 /* Null */ ? left : right.flags & 65536 /* Null */ && right.intrinsicName === str ? right : left, neverType);
68008
68059
  if (!(matchingType.flags & 131072 /* Never */)) {
68009
68060
  inferFromTypes(matchingType, target2);
68010
68061
  continue;
@@ -68164,7 +68215,7 @@ function createTypeChecker(host) {
68164
68215
  for (const targetInfo of indexInfos) {
68165
68216
  const propTypes = [];
68166
68217
  for (const prop of getPropertiesOfType(source)) {
68167
- if (isApplicableIndexType(getLiteralTypeFromProperty(prop, 19456 /* StringOrNumberLiteralOrUnique */), targetInfo.keyType)) {
68218
+ if (isApplicableIndexType(getLiteralTypeFromProperty(prop, 8576 /* StringOrNumberLiteralOrUnique */), targetInfo.keyType)) {
68168
68219
  const propType = getTypeOfSymbol(prop);
68169
68220
  propTypes.push(prop.flags & 16777216 /* Optional */ ? removeMissingOrUndefinedType(propType) : propType);
68170
68221
  }
@@ -68188,7 +68239,7 @@ function createTypeChecker(host) {
68188
68239
  }
68189
68240
  }
68190
68241
  function isTypeOrBaseIdenticalTo(s, t) {
68191
- return t === missingType ? s === t : isTypeIdenticalTo(s, t) || !!(t.flags & 32 /* String */ && s.flags & 1024 /* StringLiteral */ || t.flags & 64 /* Number */ && s.flags & 2048 /* NumberLiteral */);
68242
+ return t === missingType ? s === t : isTypeIdenticalTo(s, t) || !!(t.flags & 4 /* String */ && s.flags & 128 /* StringLiteral */ || t.flags & 8 /* Number */ && s.flags & 256 /* NumberLiteral */);
68192
68243
  }
68193
68244
  function isTypeCloselyMatchedBy(s, t) {
68194
68245
  return !!(s.flags & 524288 /* Object */ && t.flags & 524288 /* Object */ && s.symbol && s.symbol === t.symbol || s.aliasSymbol && s.aliasTypeArguments && s.aliasSymbol === t.aliasSymbol);
@@ -68440,7 +68491,7 @@ function createTypeChecker(host) {
68440
68491
  return void 0;
68441
68492
  }
68442
68493
  function tryGetNameFromType(type) {
68443
- return type.flags & 16384 /* UniqueESSymbol */ ? type.escapedName : type.flags & 3072 /* StringOrNumberLiteral */ ? escapeLeadingUnderscores("" + type.value) : void 0;
68494
+ return type.flags & 8192 /* UniqueESSymbol */ ? type.escapedName : type.flags & 384 /* StringOrNumberLiteral */ ? escapeLeadingUnderscores("" + type.value) : void 0;
68444
68495
  }
68445
68496
  function tryGetElementAccessExpressionName(node) {
68446
68497
  return isStringOrNumericLiteralLike(node.argumentExpression) ? escapeLeadingUnderscores(node.argumentExpression.text) : isEntityNameExpression(node.argumentExpression) ? tryGetNameFromEntityNameExpression(node.argumentExpression) : void 0;
@@ -68619,7 +68670,7 @@ function createTypeChecker(host) {
68619
68670
  }
68620
68671
  function getAssignmentReducedTypeWorker(declaredType, assignedType) {
68621
68672
  const filteredType = filterType(declaredType, (t) => typeMaybeAssignableTo(assignedType, t));
68622
- const reducedType = assignedType.flags & 4096 /* BooleanLiteral */ && isFreshLiteralType(assignedType) ? mapType(filteredType, getFreshTypeOfLiteralType) : filteredType;
68673
+ const reducedType = assignedType.flags & 512 /* BooleanLiteral */ && isFreshLiteralType(assignedType) ? mapType(filteredType, getFreshTypeOfLiteralType) : filteredType;
68623
68674
  return isTypeAssignableTo(assignedType, reducedType) ? reducedType : declaredType;
68624
68675
  }
68625
68676
  function isFunctionObjectType(type) {
@@ -68640,31 +68691,31 @@ function createTypeChecker(host) {
68640
68691
  type = getBaseConstraintOfType(type) || unknownType;
68641
68692
  }
68642
68693
  const flags = type.flags;
68643
- if (flags & (32 /* String */ | 268435456 /* StringMapping */)) {
68694
+ if (flags & (4 /* String */ | 268435456 /* StringMapping */)) {
68644
68695
  return strictNullChecks ? 16317953 /* StringStrictFacts */ : 16776705 /* StringFacts */;
68645
68696
  }
68646
- if (flags & (1024 /* StringLiteral */ | 134217728 /* TemplateLiteral */)) {
68647
- const isEmpty = flags & 1024 /* StringLiteral */ && type.value === "";
68697
+ if (flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */)) {
68698
+ const isEmpty = flags & 128 /* StringLiteral */ && type.value === "";
68648
68699
  return strictNullChecks ? isEmpty ? 12123649 /* EmptyStringStrictFacts */ : 7929345 /* NonEmptyStringStrictFacts */ : isEmpty ? 12582401 /* EmptyStringFacts */ : 16776705 /* NonEmptyStringFacts */;
68649
68700
  }
68650
- if (flags & (64 /* Number */ | 65536 /* Enum */)) {
68701
+ if (flags & (8 /* Number */ | 32 /* Enum */)) {
68651
68702
  return strictNullChecks ? 16317698 /* NumberStrictFacts */ : 16776450 /* NumberFacts */;
68652
68703
  }
68653
- if (flags & 2048 /* NumberLiteral */) {
68704
+ if (flags & 256 /* NumberLiteral */) {
68654
68705
  const isZero = type.value === 0;
68655
68706
  return strictNullChecks ? isZero ? 12123394 /* ZeroNumberStrictFacts */ : 7929090 /* NonZeroNumberStrictFacts */ : isZero ? 12582146 /* ZeroNumberFacts */ : 16776450 /* NonZeroNumberFacts */;
68656
68707
  }
68657
- if (flags & 128 /* BigInt */) {
68708
+ if (flags & 64 /* BigInt */) {
68658
68709
  return strictNullChecks ? 16317188 /* BigIntStrictFacts */ : 16775940 /* BigIntFacts */;
68659
68710
  }
68660
- if (flags & 8192 /* BigIntLiteral */) {
68711
+ if (flags & 2048 /* BigIntLiteral */) {
68661
68712
  const isZero = isZeroBigInt(type);
68662
68713
  return strictNullChecks ? isZero ? 12122884 /* ZeroBigIntStrictFacts */ : 7928580 /* NonZeroBigIntStrictFacts */ : isZero ? 12581636 /* ZeroBigIntFacts */ : 16775940 /* NonZeroBigIntFacts */;
68663
68714
  }
68664
- if (flags & 256 /* Boolean */) {
68715
+ if (flags & 16 /* Boolean */) {
68665
68716
  return strictNullChecks ? 16316168 /* BooleanStrictFacts */ : 16774920 /* BooleanFacts */;
68666
68717
  }
68667
- if (flags & 4352 /* BooleanLike */) {
68718
+ if (flags & 528 /* BooleanLike */) {
68668
68719
  return strictNullChecks ? type === falseType || type === regularFalseType ? 12121864 /* FalseStrictFacts */ : 7927560 /* TrueStrictFacts */ : type === falseType || type === regularFalseType ? 12580616 /* FalseFacts */ : 16774920 /* TrueFacts */;
68669
68720
  }
68670
68721
  if (flags & 524288 /* Object */) {
@@ -68674,16 +68725,16 @@ function createTypeChecker(host) {
68674
68725
  }
68675
68726
  return getObjectFlags(type) & 16 /* Anonymous */ && isEmptyObjectType(type) ? strictNullChecks ? 83427327 /* EmptyObjectStrictFacts */ : 83886079 /* EmptyObjectFacts */ : isFunctionObjectType(type) ? strictNullChecks ? 7880640 /* FunctionStrictFacts */ : 16728e3 /* FunctionFacts */ : strictNullChecks ? 7888800 /* ObjectStrictFacts */ : 16736160 /* ObjectFacts */;
68676
68727
  }
68677
- if (flags & 16 /* Void */) {
68728
+ if (flags & 16384 /* Void */) {
68678
68729
  return 9830144 /* VoidFacts */;
68679
68730
  }
68680
- if (flags & 4 /* Undefined */) {
68731
+ if (flags & 32768 /* Undefined */) {
68681
68732
  return 26607360 /* UndefinedFacts */;
68682
68733
  }
68683
- if (flags & 8 /* Null */) {
68734
+ if (flags & 65536 /* Null */) {
68684
68735
  return 42917664 /* NullFacts */;
68685
68736
  }
68686
- if (flags & 16896 /* ESSymbolLike */) {
68737
+ if (flags & 12288 /* ESSymbolLike */) {
68687
68738
  return strictNullChecks ? 7925520 /* SymbolStrictFacts */ : 16772880 /* SymbolFacts */;
68688
68739
  }
68689
68740
  if (flags & 67108864 /* NonPrimitive */) {
@@ -68906,7 +68957,7 @@ function createTypeChecker(host) {
68906
68957
  }
68907
68958
  return true;
68908
68959
  }
68909
- if (source.flags & 98304 /* EnumLike */ && getBaseTypeOfEnumLikeType(source) === target) {
68960
+ if (source.flags & 1056 /* EnumLike */ && getBaseTypeOfEnumLikeType(source) === target) {
68910
68961
  return true;
68911
68962
  }
68912
68963
  return containsType(target.types, source);
@@ -68984,6 +69035,18 @@ function createTypeChecker(host) {
68984
69035
  }
68985
69036
  return changed ? mappedTypes && getUnionType(mappedTypes, noReductions ? 0 /* None */ : 1 /* Literal */) : type;
68986
69037
  }
69038
+ function mapTypeToIntersection(type, mapper) {
69039
+ if (type.flags & 131072 /* Never */) {
69040
+ return type;
69041
+ }
69042
+ if (!(type.flags & 1048576 /* Union */)) {
69043
+ return mapper(type);
69044
+ }
69045
+ const origin = type.origin;
69046
+ const types = origin && origin.flags & 1048576 /* Union */ ? origin.types : type.types;
69047
+ const mappedTypes = types.map((t) => t.flags & 1048576 /* Union */ ? mapTypeToIntersection(t, mapper) : mapper(t));
69048
+ return getIntersectionType(mappedTypes);
69049
+ }
68987
69050
  function mapTypeWithAlias(type, mapper, aliasSymbol, aliasTypeArguments) {
68988
69051
  return type.flags & 1048576 /* Union */ && aliasSymbol ? getUnionType(map(type.types, mapper), 1 /* Literal */, aliasSymbol, aliasTypeArguments) : mapType(type, mapper);
68989
69052
  }
@@ -68991,8 +69054,8 @@ function createTypeChecker(host) {
68991
69054
  return filterType(type, (t) => (t.flags & kind) !== 0);
68992
69055
  }
68993
69056
  function replacePrimitivesWithLiterals(typeWithPrimitives, typeWithLiterals) {
68994
- if (maybeTypeOfKind(typeWithPrimitives, 32 /* String */ | 134217728 /* TemplateLiteral */ | 64 /* Number */ | 128 /* BigInt */) && maybeTypeOfKind(typeWithLiterals, 1024 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */ | 2048 /* NumberLiteral */ | 8192 /* BigIntLiteral */)) {
68995
- return mapType(typeWithPrimitives, (t) => t.flags & 32 /* String */ ? extractTypesOfKind(typeWithLiterals, 32 /* String */ | 1024 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) : isPatternLiteralType(t) && !maybeTypeOfKind(typeWithLiterals, 32 /* String */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ? extractTypesOfKind(typeWithLiterals, 1024 /* StringLiteral */) : t.flags & 64 /* Number */ ? extractTypesOfKind(typeWithLiterals, 64 /* Number */ | 2048 /* NumberLiteral */) : t.flags & 128 /* BigInt */ ? extractTypesOfKind(typeWithLiterals, 128 /* BigInt */ | 8192 /* BigIntLiteral */) : t);
69057
+ if (maybeTypeOfKind(typeWithPrimitives, 4 /* String */ | 134217728 /* TemplateLiteral */ | 8 /* Number */ | 64 /* BigInt */) && maybeTypeOfKind(typeWithLiterals, 128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */ | 256 /* NumberLiteral */ | 2048 /* BigIntLiteral */)) {
69058
+ return mapType(typeWithPrimitives, (t) => t.flags & 4 /* String */ ? extractTypesOfKind(typeWithLiterals, 4 /* String */ | 128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) : isPatternLiteralType(t) && !maybeTypeOfKind(typeWithLiterals, 4 /* String */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ? extractTypesOfKind(typeWithLiterals, 128 /* StringLiteral */) : t.flags & 8 /* Number */ ? extractTypesOfKind(typeWithLiterals, 8 /* Number */ | 256 /* NumberLiteral */) : t.flags & 64 /* BigInt */ ? extractTypesOfKind(typeWithLiterals, 64 /* BigInt */ | 2048 /* BigIntLiteral */) : t);
68996
69059
  }
68997
69060
  return typeWithPrimitives;
68998
69061
  }
@@ -69047,7 +69110,7 @@ function createTypeChecker(host) {
69047
69110
  const root = getReferenceRoot(node);
69048
69111
  const parent = root.parent;
69049
69112
  const isLengthPushOrUnshift = isPropertyAccessExpression(parent) && (parent.name.escapedText === "length" || parent.parent.kind === 213 /* CallExpression */ && isIdentifier(parent.name) && isPushOrUnshiftIdentifier(parent.name));
69050
- const isElementAssignment = parent.kind === 212 /* ElementAccessExpression */ && parent.expression === root && parent.parent.kind === 226 /* BinaryExpression */ && parent.parent.operatorToken.kind === 64 /* EqualsToken */ && parent.parent.left === parent && !isAssignmentTarget(parent.parent) && isTypeAssignableToKind(getTypeOfExpression(parent.argumentExpression), 67648 /* NumberLike */);
69113
+ const isElementAssignment = parent.kind === 212 /* ElementAccessExpression */ && parent.expression === root && parent.parent.kind === 226 /* BinaryExpression */ && parent.parent.operatorToken.kind === 64 /* EqualsToken */ && parent.parent.left === parent && !isAssignmentTarget(parent.parent) && isTypeAssignableToKind(getTypeOfExpression(parent.argumentExpression), 296 /* NumberLike */);
69051
69114
  return isLengthPushOrUnshift || isElementAssignment;
69052
69115
  }
69053
69116
  function isDeclarationWithExplicitTypeAnnotation(node) {
@@ -69535,7 +69598,7 @@ function createTypeChecker(host) {
69535
69598
  }
69536
69599
  } else {
69537
69600
  const indexType = getContextFreeTypeOfExpression(node.left.argumentExpression);
69538
- if (isTypeAssignableToKind(indexType, 67648 /* NumberLike */)) {
69601
+ if (isTypeAssignableToKind(indexType, 296 /* NumberLike */)) {
69539
69602
  evolvedType2 = addEvolvingArrayElementType(evolvedType2, node.right);
69540
69603
  }
69541
69604
  }
@@ -69573,9 +69636,9 @@ function createTypeChecker(host) {
69573
69636
  } else {
69574
69637
  if (strictNullChecks) {
69575
69638
  if (optionalChainContainsReference(expr, reference)) {
69576
- type = narrowTypeBySwitchOptionalChainContainment(type, flow.node, (t) => !(t.flags & (4 /* Undefined */ | 131072 /* Never */)));
69639
+ type = narrowTypeBySwitchOptionalChainContainment(type, flow.node, (t) => !(t.flags & (32768 /* Undefined */ | 131072 /* Never */)));
69577
69640
  } else if (expr.kind === 221 /* TypeOfExpression */ && optionalChainContainsReference(expr.expression, reference)) {
69578
- type = narrowTypeBySwitchOptionalChainContainment(type, flow.node, (t) => !(t.flags & 131072 /* Never */ || t.flags & 1024 /* StringLiteral */ && t.value === "undefined"));
69641
+ type = narrowTypeBySwitchOptionalChainContainment(type, flow.node, (t) => !(t.flags & 131072 /* Never */ || t.flags & 128 /* StringLiteral */ && t.value === "undefined"));
69579
69642
  }
69580
69643
  }
69581
69644
  const access = getDiscriminantPropertyAccess(expr, type);
@@ -69749,7 +69812,7 @@ function createTypeChecker(host) {
69749
69812
  return type;
69750
69813
  }
69751
69814
  const optionalChain = isOptionalChain(access);
69752
- const removeNullable = strictNullChecks && (optionalChain || isNonNullAccess(access)) && maybeTypeOfKind(type, 12 /* Nullable */);
69815
+ const removeNullable = strictNullChecks && (optionalChain || isNonNullAccess(access)) && maybeTypeOfKind(type, 98304 /* Nullable */);
69753
69816
  let propType = getTypeOfPropertyOfType(removeNullable ? getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */) : type, propName);
69754
69817
  if (!propType) {
69755
69818
  return type;
@@ -69971,7 +70034,7 @@ function createTypeChecker(host) {
69971
70034
  }
69972
70035
  function narrowTypeByOptionalChainContainment(type, operator, value, assumeTrue) {
69973
70036
  const equalsOperator = operator === 35 /* EqualsEqualsToken */ || operator === 37 /* EqualsEqualsEqualsToken */;
69974
- const nullableFlags = operator === 35 /* EqualsEqualsToken */ || operator === 36 /* ExclamationEqualsToken */ ? 12 /* Nullable */ : 4 /* Undefined */;
70037
+ const nullableFlags = operator === 35 /* EqualsEqualsToken */ || operator === 36 /* ExclamationEqualsToken */ ? 98304 /* Nullable */ : 32768 /* Undefined */;
69975
70038
  const valueType = getTypeOfExpression(value);
69976
70039
  const removeNullable = equalsOperator !== assumeTrue && everyType(valueType, (t) => !!(t.flags & nullableFlags)) || equalsOperator === assumeTrue && everyType(valueType, (t) => !(t.flags & (3 /* AnyOrUnknown */ | nullableFlags)));
69977
70040
  return removeNullable ? getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */) : type;
@@ -69985,11 +70048,11 @@ function createTypeChecker(host) {
69985
70048
  }
69986
70049
  const valueType = getTypeOfExpression(value);
69987
70050
  const doubleEquals = operator === 35 /* EqualsEqualsToken */ || operator === 36 /* ExclamationEqualsToken */;
69988
- if (valueType.flags & 12 /* Nullable */) {
70051
+ if (valueType.flags & 98304 /* Nullable */) {
69989
70052
  if (!strictNullChecks) {
69990
70053
  return type;
69991
70054
  }
69992
- const facts = doubleEquals ? assumeTrue ? 262144 /* EQUndefinedOrNull */ : 2097152 /* NEUndefinedOrNull */ : valueType.flags & 8 /* Null */ ? assumeTrue ? 131072 /* EQNull */ : 1048576 /* NENull */ : assumeTrue ? 65536 /* EQUndefined */ : 524288 /* NEUndefined */;
70055
+ const facts = doubleEquals ? assumeTrue ? 262144 /* EQUndefinedOrNull */ : 2097152 /* NEUndefinedOrNull */ : valueType.flags & 65536 /* Null */ ? assumeTrue ? 131072 /* EQNull */ : 1048576 /* NENull */ : assumeTrue ? 65536 /* EQUndefined */ : 524288 /* NEUndefined */;
69993
70056
  return getAdjustedTypeWithFacts(type, facts);
69994
70057
  }
69995
70058
  if (assumeTrue) {
@@ -70064,7 +70127,7 @@ function createTypeChecker(host) {
70064
70127
  if (!hasDefaultClause) {
70065
70128
  return caseType;
70066
70129
  }
70067
- const defaultType = filterType(type, (t) => !(isUnitLikeType(t) && contains(switchTypes, t.flags & 4 /* Undefined */ ? undefinedType : getRegularTypeOfLiteralType(extractUnitType(t)))));
70130
+ const defaultType = filterType(type, (t) => !(isUnitLikeType(t) && contains(switchTypes, t.flags & 32768 /* Undefined */ ? undefinedType : getRegularTypeOfLiteralType(extractUnitType(t)))));
70068
70131
  return caseType.flags & 131072 /* Never */ ? defaultType : getUnionType([caseType, defaultType]);
70069
70132
  }
70070
70133
  function narrowTypeByTypeName(type, typeName) {
@@ -70555,10 +70618,10 @@ function createTypeChecker(host) {
70555
70618
  return parent.kind === 211 /* PropertyAccessExpression */ || parent.kind === 166 /* QualifiedName */ || parent.kind === 213 /* CallExpression */ && parent.expression === node || parent.kind === 214 /* NewExpression */ && parent.expression === node || parent.kind === 212 /* ElementAccessExpression */ && parent.expression === node && !(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression)));
70556
70619
  }
70557
70620
  function isGenericTypeWithUnionConstraint(type) {
70558
- return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithUnionConstraint) : !!(type.flags & 465829888 /* Instantiable */ && getBaseConstraintOrType(type).flags & (12 /* Nullable */ | 1048576 /* Union */));
70621
+ return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithUnionConstraint) : !!(type.flags & 465829888 /* Instantiable */ && getBaseConstraintOrType(type).flags & (98304 /* Nullable */ | 1048576 /* Union */));
70559
70622
  }
70560
70623
  function isGenericTypeWithoutNullableConstraint(type) {
70561
- return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithoutNullableConstraint) : !!(type.flags & 465829888 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 12 /* Nullable */));
70624
+ return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithoutNullableConstraint) : !!(type.flags & 465829888 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */));
70562
70625
  }
70563
70626
  function hasContextualTypeWithNoGenericTypes(node, checkMode) {
70564
70627
  const contextualType = (isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node)) && !((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode & 32 /* RestBindingElement */ ? getContextualType(node, 8 /* SkipBindingPatterns */) : getContextualType(
@@ -70568,11 +70631,11 @@ function createTypeChecker(host) {
70568
70631
  ));
70569
70632
  return contextualType && !isGenericType(contextualType);
70570
70633
  }
70571
- function getNarrowableTypeForReference(type, reference, checkMode) {
70634
+ function getNarrowableTypeForReference(type, reference, checkMode, forReturnTypeNarrowing) {
70572
70635
  if (isNoInferType(type)) {
70573
70636
  type = type.baseType;
70574
70637
  }
70575
- const substituteConstraints = !(checkMode && checkMode & 2 /* Inferential */) && someType(type, isGenericTypeWithUnionConstraint) && (isConstraintPosition(type, reference) || hasContextualTypeWithNoGenericTypes(reference, checkMode));
70638
+ const substituteConstraints = !(checkMode && checkMode & 2 /* Inferential */) && someType(type, isGenericTypeWithUnionConstraint) && (forReturnTypeNarrowing || isConstraintPosition(type, reference) || hasContextualTypeWithNoGenericTypes(reference, checkMode));
70576
70639
  return substituteConstraints ? mapType(type, getBaseConstraintOrType) : type;
70577
70640
  }
70578
70641
  function isExportOrExportExpression(location) {
@@ -71117,7 +71180,7 @@ function createTypeChecker(host) {
71117
71180
  flowContainer = getControlFlowContainer(flowContainer);
71118
71181
  }
71119
71182
  const isNeverInitialized = immediateDeclaration && isVariableDeclaration(immediateDeclaration) && !immediateDeclaration.initializer && !immediateDeclaration.exclamationToken && isMutableLocalVariableDeclaration(immediateDeclaration) && !isSymbolAssignedDefinitely(symbol);
71120
- const assumeInitialized = isParameter2 || isAlias || isOuterVariable && !isNeverInitialized || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* AnyOrUnknown */ | 16 /* Void */)) !== 0 || isInTypeQuery(node) || isInAmbientOrTypeNode(node) || node.parent.kind === 281 /* ExportSpecifier */) || node.parent.kind === 235 /* NonNullExpression */ || declaration.kind === 260 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 33554432 /* Ambient */;
71183
+ const assumeInitialized = isParameter2 || isAlias || isOuterVariable && !isNeverInitialized || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */)) !== 0 || isInTypeQuery(node) || isInAmbientOrTypeNode(node) || node.parent.kind === 281 /* ExportSpecifier */) || node.parent.kind === 235 /* NonNullExpression */ || declaration.kind === 260 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 33554432 /* Ambient */;
71121
71184
  const initialType = isAutomaticTypeInNonNull ? undefinedType : assumeInitialized ? isParameter2 ? removeOptionalityFromDeclaredType(type, declaration) : type : typeIsAutomatic ? undefinedType : getOptionalType(type);
71122
71185
  const flowType = isAutomaticTypeInNonNull ? getNonNullableType(getFlowTypeOfReference(node, type, initialType, flowContainer)) : getFlowTypeOfReference(node, type, initialType, flowContainer);
71123
71186
  if (!isEvolvingArrayOperationTarget(node) && (type === autoType || type === autoArrayType)) {
@@ -71699,9 +71762,16 @@ function createTypeChecker(host) {
71699
71762
  function getContextualTypeForReturnExpression(node, contextFlags) {
71700
71763
  const func = getContainingFunction(node);
71701
71764
  if (func) {
71765
+ const functionFlags = getFunctionFlags(func);
71766
+ const links = getNodeLinks(node);
71767
+ if (links.contextualReturnType) {
71768
+ if (functionFlags & 2 /* Async */) {
71769
+ return getUnionType([links.contextualReturnType, createPromiseLikeType(links.contextualReturnType)]);
71770
+ }
71771
+ return links.contextualReturnType;
71772
+ }
71702
71773
  let contextualReturnType = getContextualReturnType(func, contextFlags);
71703
71774
  if (contextualReturnType) {
71704
- const functionFlags = getFunctionFlags(func);
71705
71775
  if (functionFlags & 1 /* Generator */) {
71706
71776
  const isAsyncGenerator = (functionFlags & 2 /* Async */) !== 0;
71707
71777
  if (contextualReturnType.flags & 1048576 /* Union */) {
@@ -71805,7 +71875,7 @@ function createTypeChecker(host) {
71805
71875
  const functionFlags = getFunctionFlags(functionDecl);
71806
71876
  if (functionFlags & 1 /* Generator */) {
71807
71877
  return filterType(returnType2, (t) => {
71808
- return !!(t.flags & (3 /* AnyOrUnknown */ | 16 /* Void */ | 58982400 /* InstantiableNonPrimitive */)) || checkGeneratorInstantiationAssignabilityToReturnType(
71878
+ return !!(t.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */ | 58982400 /* InstantiableNonPrimitive */)) || checkGeneratorInstantiationAssignabilityToReturnType(
71809
71879
  t,
71810
71880
  functionFlags,
71811
71881
  /*errorNode*/
@@ -71815,7 +71885,7 @@ function createTypeChecker(host) {
71815
71885
  }
71816
71886
  if (functionFlags & 2 /* Async */) {
71817
71887
  return filterType(returnType2, (t) => {
71818
- return !!(t.flags & (3 /* AnyOrUnknown */ | 16 /* Void */ | 58982400 /* InstantiableNonPrimitive */)) || !!getAwaitedTypeOfPromise(t);
71888
+ return !!(t.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */ | 58982400 /* InstantiableNonPrimitive */)) || !!getAwaitedTypeOfPromise(t);
71819
71889
  });
71820
71890
  }
71821
71891
  return returnType2;
@@ -72399,6 +72469,13 @@ function createTypeChecker(host) {
72399
72469
  if (index >= 0) {
72400
72470
  return contextualTypes[index];
72401
72471
  }
72472
+ const links = getNodeLinks(node);
72473
+ if (links.contextualReturnType) {
72474
+ if (node.flags & 65536 /* AwaitContext */) {
72475
+ return getUnionType([links.contextualReturnType, createPromiseLikeType(links.contextualReturnType)]);
72476
+ }
72477
+ return links.contextualReturnType;
72478
+ }
72402
72479
  const { parent } = node;
72403
72480
  switch (parent.kind) {
72404
72481
  case 260 /* VariableDeclaration */:
@@ -72574,7 +72651,7 @@ function createTypeChecker(host) {
72574
72651
  return getOrCreateTypeFromSignature(fakeSignature);
72575
72652
  }
72576
72653
  const tagType = checkExpressionCached(context.tagName);
72577
- if (tagType.flags & 1024 /* StringLiteral */) {
72654
+ if (tagType.flags & 128 /* StringLiteral */) {
72578
72655
  const result = getIntrinsicAttributesTypeFromStringLiteralType(tagType, context);
72579
72656
  if (!result) {
72580
72657
  return errorType;
@@ -72946,7 +73023,7 @@ function createTypeChecker(host) {
72946
73023
  }
72947
73024
  }
72948
73025
  function isNumericComputedName(name) {
72949
- return isTypeAssignableToKind(checkComputedPropertyName(name), 67648 /* NumberLike */);
73026
+ return isTypeAssignableToKind(checkComputedPropertyName(name), 296 /* NumberLike */);
72950
73027
  }
72951
73028
  function checkComputedPropertyName(node) {
72952
73029
  const links = getNodeLinks(node.expression);
@@ -72964,7 +73041,7 @@ function createTypeChecker(host) {
72964
73041
  getNodeLinks(node.parent.parent).flags |= 32768 /* BlockScopedBindingInLoop */;
72965
73042
  }
72966
73043
  }
72967
- if (links.resolvedType.flags & 12 /* Nullable */ || !isTypeAssignableToKind(links.resolvedType, 402654240 /* StringLike */ | 67648 /* NumberLike */ | 16896 /* ESSymbolLike */) && !isTypeAssignableTo(links.resolvedType, stringNumberSymbolType)) {
73044
+ if (links.resolvedType.flags & 98304 /* Nullable */ || !isTypeAssignableToKind(links.resolvedType, 402653316 /* StringLike */ | 296 /* NumberLike */ | 12288 /* ESSymbolLike */) && !isTypeAssignableTo(links.resolvedType, stringNumberSymbolType)) {
72968
73045
  error(node, Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any);
72969
73046
  }
72970
73047
  }
@@ -72978,7 +73055,7 @@ function createTypeChecker(host) {
72978
73055
  function isSymbolWithSymbolName(symbol) {
72979
73056
  var _a;
72980
73057
  const firstDecl = (_a = symbol.declarations) == null ? void 0 : _a[0];
72981
- return isKnownSymbol(symbol) || firstDecl && isNamedDeclaration(firstDecl) && isComputedPropertyName(firstDecl.name) && isTypeAssignableToKind(checkComputedPropertyName(firstDecl.name), 512 /* ESSymbol */);
73058
+ return isKnownSymbol(symbol) || firstDecl && isNamedDeclaration(firstDecl) && isComputedPropertyName(firstDecl.name) && isTypeAssignableToKind(checkComputedPropertyName(firstDecl.name), 4096 /* ESSymbol */);
72982
73059
  }
72983
73060
  function isSymbolWithComputedName(symbol) {
72984
73061
  var _a;
@@ -73134,7 +73211,7 @@ function createTypeChecker(host) {
73134
73211
  Debug.assert(memberDecl.kind === 177 /* GetAccessor */ || memberDecl.kind === 178 /* SetAccessor */);
73135
73212
  checkNodeDeferred(memberDecl);
73136
73213
  }
73137
- if (computedNameType && !(computedNameType.flags & 19456 /* StringOrNumberLiteralOrUnique */)) {
73214
+ if (computedNameType && !(computedNameType.flags & 8576 /* StringOrNumberLiteralOrUnique */)) {
73138
73215
  if (isTypeAssignableTo(computedNameType, stringNumberSymbolType)) {
73139
73216
  if (isTypeAssignableTo(computedNameType, numberType)) {
73140
73217
  hasComputedNumberProperty = true;
@@ -73547,9 +73624,9 @@ function createTypeChecker(host) {
73547
73624
  return getNameFromJsxElementAttributesContainer(JsxNames.ElementChildrenAttributeNameContainer, jsxNamespace);
73548
73625
  }
73549
73626
  function getUninstantiatedJsxSignaturesOfType(elementType, caller) {
73550
- if (elementType.flags & 32 /* String */) {
73627
+ if (elementType.flags & 4 /* String */) {
73551
73628
  return [anySignature];
73552
- } else if (elementType.flags & 1024 /* StringLiteral */) {
73629
+ } else if (elementType.flags & 128 /* StringLiteral */) {
73553
73630
  const intrinsicType = getIntrinsicAttributesTypeFromStringLiteralType(elementType, caller);
73554
73631
  if (!intrinsicType) {
73555
73632
  error(caller, Diagnostics.Property_0_does_not_exist_on_type_1, elementType.value, "JSX." + JsxNames.IntrinsicElements);
@@ -73931,7 +74008,7 @@ function createTypeChecker(host) {
73931
74008
  if (facts & 50331648 /* IsUndefinedOrNull */) {
73932
74009
  reportError(node, facts);
73933
74010
  const t = getNonNullableType(type);
73934
- return t.flags & (12 /* Nullable */ | 131072 /* Never */) ? errorType : t;
74011
+ return t.flags & (98304 /* Nullable */ | 131072 /* Never */) ? errorType : t;
73935
74012
  }
73936
74013
  return type;
73937
74014
  }
@@ -73940,7 +74017,7 @@ function createTypeChecker(host) {
73940
74017
  }
73941
74018
  function checkNonNullNonVoidType(type, node) {
73942
74019
  const nonNullType = checkNonNullType(type, node);
73943
- if (nonNullType.flags & 16 /* Void */) {
74020
+ if (nonNullType.flags & 16384 /* Void */) {
73944
74021
  if (isEntityNameExpression(node)) {
73945
74022
  const nodeText = entityNameToString(node);
73946
74023
  if (isIdentifier(node) && nodeText === "undefined") {
@@ -74487,7 +74564,7 @@ function createTypeChecker(host) {
74487
74564
  return suggestion;
74488
74565
  }
74489
74566
  function getSuggestedTypeForNonexistentStringLiteralType(source, target) {
74490
- const candidates = target.types.filter((type) => !!(type.flags & 1024 /* StringLiteral */));
74567
+ const candidates = target.types.filter((type) => !!(type.flags & 128 /* StringLiteral */));
74491
74568
  return getSpellingSuggestion(source.value, candidates, (type) => type.value);
74492
74569
  }
74493
74570
  function getSpellingSuggestionForName(name, symbols, meaning) {
@@ -74719,10 +74796,10 @@ function createTypeChecker(host) {
74719
74796
  return findIndex(args, isSpreadArgument);
74720
74797
  }
74721
74798
  function acceptsVoid(t) {
74722
- return !!(t.flags & 16 /* Void */);
74799
+ return !!(t.flags & 16384 /* Void */);
74723
74800
  }
74724
74801
  function acceptsVoidUndefinedUnknownOrAny(t) {
74725
- return !!(t.flags & (16 /* Void */ | 4 /* Undefined */ | 2 /* Unknown */ | 1 /* Any */));
74802
+ return !!(t.flags & (16384 /* Void */ | 32768 /* Undefined */ | 2 /* Unknown */ | 1 /* Any */));
74726
74803
  }
74727
74804
  function hasCorrectArity(node, args, signature, signatureHelpTrailingComma = false) {
74728
74805
  if (isJsxOpeningFragment(node)) return true;
@@ -74821,8 +74898,8 @@ function createTypeChecker(host) {
74821
74898
  }
74822
74899
  return void 0;
74823
74900
  }
74824
- function instantiateSignatureInContextOf(signature, contextualSignature, inferenceContext, compareTypes2) {
74825
- const context = createInferenceContext(getTypeParametersForMapper(signature), signature, 0 /* None */, compareTypes2);
74901
+ function instantiateSignatureInContextOf(signature, contextualSignature, inferenceContext, compareTypes) {
74902
+ const context = createInferenceContext(getTypeParametersForMapper(signature), signature, 0 /* None */, compareTypes);
74826
74903
  const restType = getEffectiveRestType(contextualSignature);
74827
74904
  const mapper = inferenceContext && (restType && restType.flags & 262144 /* TypeParameter */ ? inferenceContext.nonFixingMapper : inferenceContext.mapper);
74828
74905
  const sourceSignature = mapper ? instantiateSignature(contextualSignature, mapper) : contextualSignature;
@@ -76557,10 +76634,10 @@ function createTypeChecker(host) {
76557
76634
  return resolveExternalModuleTypeByLiteral(node.arguments[0]);
76558
76635
  }
76559
76636
  const returnType = getReturnTypeOfSignature(signature);
76560
- if (returnType.flags & 16896 /* ESSymbolLike */ && isSymbolOrSymbolForCall(node)) {
76637
+ if (returnType.flags & 12288 /* ESSymbolLike */ && isSymbolOrSymbolForCall(node)) {
76561
76638
  return getESSymbolLikeTypeForNode(walkUpParenthesizedExpressions(node.parent));
76562
76639
  }
76563
- if (node.kind === 213 /* CallExpression */ && !node.questionDotToken && node.parent.kind === 244 /* ExpressionStatement */ && returnType.flags & 16 /* Void */ && getTypePredicateOfSignature(signature)) {
76640
+ if (node.kind === 213 /* CallExpression */ && !node.questionDotToken && node.parent.kind === 244 /* ExpressionStatement */ && returnType.flags & 16384 /* Void */ && getTypePredicateOfSignature(signature)) {
76564
76641
  if (!isDottedName(node.expression)) {
76565
76642
  error(node.expression, Diagnostics.Assertions_require_the_call_target_to_be_an_identifier_or_qualified_name);
76566
76643
  } else if (!getEffectsSignature(node)) {
@@ -76650,7 +76727,7 @@ function createTypeChecker(host) {
76650
76727
  for (let i = 2; i < node.arguments.length; ++i) {
76651
76728
  checkExpressionCached(node.arguments[i]);
76652
76729
  }
76653
- if (specifierType.flags & 4 /* Undefined */ || specifierType.flags & 8 /* Null */ || !isTypeAssignableTo(specifierType, stringType)) {
76730
+ if (specifierType.flags & 32768 /* Undefined */ || specifierType.flags & 65536 /* Null */ || !isTypeAssignableTo(specifierType, stringType)) {
76654
76731
  error(specifier, Diagnostics.Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0, typeToString(specifierType));
76655
76732
  }
76656
76733
  if (optionsType) {
@@ -76659,7 +76736,7 @@ function createTypeChecker(host) {
76659
76736
  true
76660
76737
  );
76661
76738
  if (importCallOptionsType !== emptyObjectType) {
76662
- checkTypeAssignableTo(optionsType, getNullableType(importCallOptionsType, 4 /* Undefined */), node.arguments[1]);
76739
+ checkTypeAssignableTo(optionsType, getNullableType(importCallOptionsType, 32768 /* Undefined */), node.arguments[1]);
76663
76740
  }
76664
76741
  }
76665
76742
  const moduleSymbol = resolveExternalModuleName(node, specifier);
@@ -76783,8 +76860,8 @@ function createTypeChecker(host) {
76783
76860
  grammarErrorOnNode(node, Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead);
76784
76861
  }
76785
76862
  if (compilerOptions.erasableSyntaxOnly) {
76786
- const start = node.type.pos - "<".length;
76787
- const end = skipTrivia(file.text, node.type.end) + ">".length;
76863
+ const start = skipTrivia(file.text, node.pos);
76864
+ const end = node.expression.pos;
76788
76865
  diagnostics.add(createFileDiagnostic(file, start, end - start, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled));
76789
76866
  }
76790
76867
  }
@@ -77705,7 +77782,7 @@ function createTypeChecker(host) {
77705
77782
  /*contextFlags*/
77706
77783
  void 0
77707
77784
  );
77708
- const returnType2 = contextualReturnType && (unwrapReturnType(contextualReturnType, functionFlags) || voidType).flags & 4 /* Undefined */ ? undefinedType : voidType;
77785
+ const returnType2 = contextualReturnType && (unwrapReturnType(contextualReturnType, functionFlags) || voidType).flags & 32768 /* Undefined */ ? undefinedType : voidType;
77709
77786
  return functionFlags & 2 /* Async */ ? createPromiseReturnType(func, returnType2) : (
77710
77787
  // Async function
77711
77788
  returnType2
@@ -77951,10 +78028,10 @@ function createTypeChecker(host) {
77951
78028
  true
77952
78029
  );
77953
78030
  const returnType = checkExpressionCached(expr);
77954
- if (!(returnType.flags & 256 /* Boolean */)) return void 0;
78031
+ if (!(returnType.flags & 16 /* Boolean */)) return void 0;
77955
78032
  return forEach(func.parameters, (param, i) => {
77956
78033
  const initType = getTypeOfSymbol(param.symbol);
77957
- if (!initType || initType.flags & 256 /* Boolean */ || !isIdentifier(param.name) || isSymbolAssigned(param.symbol) || isRestParameter(param)) {
78034
+ if (!initType || initType.flags & 16 /* Boolean */ || !isIdentifier(param.name) || isSymbolAssigned(param.symbol) || isRestParameter(param)) {
77958
78035
  return;
77959
78036
  }
77960
78037
  const trueType2 = checkIfExpressionRefinesParameter(func, expr, param, initType);
@@ -77984,7 +78061,7 @@ function createTypeChecker(host) {
77984
78061
  function checkAllCodePathsInNonVoidFunctionReturnOrThrowDiagnostics() {
77985
78062
  const functionFlags = getFunctionFlags(func);
77986
78063
  const type = returnType && unwrapReturnType(returnType, functionFlags);
77987
- if (type && (maybeTypeOfKind(type, 16 /* Void */) || type.flags & (1 /* Any */ | 4 /* Undefined */))) {
78064
+ if (type && (maybeTypeOfKind(type, 16384 /* Void */) || type.flags & (1 /* Any */ | 32768 /* Undefined */))) {
77988
78065
  return;
77989
78066
  }
77990
78067
  if (func.kind === 173 /* MethodSignature */ || nodeIsMissing(func.body) || func.body.kind !== 241 /* Block */ || !functionHasImplicitReturn(func)) {
@@ -78356,11 +78433,11 @@ function createTypeChecker(host) {
78356
78433
  case 41 /* MinusToken */:
78357
78434
  case 55 /* TildeToken */:
78358
78435
  checkNonNullType(operandType, node.operand);
78359
- if (maybeTypeOfKindConsideringBaseConstraint(operandType, 16896 /* ESSymbolLike */)) {
78436
+ if (maybeTypeOfKindConsideringBaseConstraint(operandType, 12288 /* ESSymbolLike */)) {
78360
78437
  error(node.operand, Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, tokenToString(node.operator));
78361
78438
  }
78362
78439
  if (node.operator === 40 /* PlusToken */) {
78363
- if (maybeTypeOfKindConsideringBaseConstraint(operandType, 8320 /* BigIntLike */)) {
78440
+ if (maybeTypeOfKindConsideringBaseConstraint(operandType, 2112 /* BigIntLike */)) {
78364
78441
  error(node.operand, Diagnostics.Operator_0_cannot_be_applied_to_type_1, tokenToString(node.operator), typeToString(getBaseTypeOfLiteralType(operandType)));
78365
78442
  }
78366
78443
  return numberType;
@@ -78404,8 +78481,8 @@ function createTypeChecker(host) {
78404
78481
  return getUnaryResultType(operandType);
78405
78482
  }
78406
78483
  function getUnaryResultType(operandType) {
78407
- if (maybeTypeOfKind(operandType, 8320 /* BigIntLike */)) {
78408
- return isTypeAssignableToKind(operandType, 3 /* AnyOrUnknown */) || maybeTypeOfKind(operandType, 67648 /* NumberLike */) ? numberOrBigIntType : bigintType;
78484
+ if (maybeTypeOfKind(operandType, 2112 /* BigIntLike */)) {
78485
+ return isTypeAssignableToKind(operandType, 3 /* AnyOrUnknown */) || maybeTypeOfKind(operandType, 296 /* NumberLike */) ? numberOrBigIntType : bigintType;
78409
78486
  }
78410
78487
  return numberType;
78411
78488
  }
@@ -78434,10 +78511,10 @@ function createTypeChecker(host) {
78434
78511
  if (source.flags & kind) {
78435
78512
  return true;
78436
78513
  }
78437
- if (strict && source.flags & (3 /* AnyOrUnknown */ | 16 /* Void */ | 4 /* Undefined */ | 8 /* Null */)) {
78514
+ if (strict && source.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */ | 32768 /* Undefined */ | 65536 /* Null */)) {
78438
78515
  return false;
78439
78516
  }
78440
- return !!(kind & 67648 /* NumberLike */) && isTypeAssignableTo(source, numberType) || !!(kind & 8320 /* BigIntLike */) && isTypeAssignableTo(source, bigintType) || !!(kind & 402654240 /* StringLike */) && isTypeAssignableTo(source, stringType) || !!(kind & 4352 /* BooleanLike */) && isTypeAssignableTo(source, booleanType) || !!(kind & 16 /* Void */) && isTypeAssignableTo(source, voidType) || !!(kind & 131072 /* Never */) && isTypeAssignableTo(source, neverType) || !!(kind & 8 /* Null */) && isTypeAssignableTo(source, nullType) || !!(kind & 4 /* Undefined */) && isTypeAssignableTo(source, undefinedType) || !!(kind & 512 /* ESSymbol */) && isTypeAssignableTo(source, esSymbolType) || !!(kind & 67108864 /* NonPrimitive */) && isTypeAssignableTo(source, nonPrimitiveType);
78517
+ return !!(kind & 296 /* NumberLike */) && isTypeAssignableTo(source, numberType) || !!(kind & 2112 /* BigIntLike */) && isTypeAssignableTo(source, bigintType) || !!(kind & 402653316 /* StringLike */) && isTypeAssignableTo(source, stringType) || !!(kind & 528 /* BooleanLike */) && isTypeAssignableTo(source, booleanType) || !!(kind & 16384 /* Void */) && isTypeAssignableTo(source, voidType) || !!(kind & 131072 /* Never */) && isTypeAssignableTo(source, neverType) || !!(kind & 65536 /* Null */) && isTypeAssignableTo(source, nullType) || !!(kind & 32768 /* Undefined */) && isTypeAssignableTo(source, undefinedType) || !!(kind & 4096 /* ESSymbol */) && isTypeAssignableTo(source, esSymbolType) || !!(kind & 67108864 /* NonPrimitive */) && isTypeAssignableTo(source, nonPrimitiveType);
78441
78518
  }
78442
78519
  function allTypesAssignableToKind(source, kind, strict) {
78443
78520
  return source.flags & 1048576 /* Union */ ? every(source.types, (subType) => allTypesAssignableToKind(subType, kind, strict)) : isTypeAssignableToKind(source, kind, strict);
@@ -78710,7 +78787,7 @@ function createTypeChecker(host) {
78710
78787
  }
78711
78788
  }
78712
78789
  function isTypeEqualityComparableTo(source, target) {
78713
- return (target.flags & 12 /* Nullable */) !== 0 || isTypeComparableTo(source, target);
78790
+ return (target.flags & 98304 /* Nullable */) !== 0 || isTypeComparableTo(source, target);
78714
78791
  }
78715
78792
  function createCheckBinaryExpression() {
78716
78793
  const trampoline = createBinaryExpressionTrampoline(onEnter, onLeft, onOperator, onRight, onExit, foldState);
@@ -78961,7 +79038,7 @@ function createTypeChecker(host) {
78961
79038
  leftType = checkNonNullType(leftType, left);
78962
79039
  rightType = checkNonNullType(rightType, right);
78963
79040
  let suggestedOperator;
78964
- if (leftType.flags & 4352 /* BooleanLike */ && rightType.flags & 4352 /* BooleanLike */ && (suggestedOperator = getSuggestedBooleanOperator(operatorToken.kind)) !== void 0) {
79041
+ if (leftType.flags & 528 /* BooleanLike */ && rightType.flags & 528 /* BooleanLike */ && (suggestedOperator = getSuggestedBooleanOperator(operatorToken.kind)) !== void 0) {
78965
79042
  error(errorNode || operatorToken, Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, tokenToString(operatorToken.kind), tokenToString(suggestedOperator));
78966
79043
  return numberType;
78967
79044
  } else {
@@ -78981,7 +79058,7 @@ function createTypeChecker(host) {
78981
79058
  );
78982
79059
  let resultType2;
78983
79060
  if (isTypeAssignableToKind(leftType, 3 /* AnyOrUnknown */) && isTypeAssignableToKind(rightType, 3 /* AnyOrUnknown */) || // Or, if neither could be bigint, implicit coercion results in a number result
78984
- !(maybeTypeOfKind(leftType, 8320 /* BigIntLike */) || maybeTypeOfKind(rightType, 8320 /* BigIntLike */))) {
79061
+ !(maybeTypeOfKind(leftType, 2112 /* BigIntLike */) || maybeTypeOfKind(rightType, 2112 /* BigIntLike */))) {
78985
79062
  resultType2 = numberType;
78986
79063
  } else if (bothAreBigIntLike(leftType, rightType)) {
78987
79064
  switch (operator) {
@@ -79033,43 +79110,43 @@ function createTypeChecker(host) {
79033
79110
  if (leftType === silentNeverType || rightType === silentNeverType) {
79034
79111
  return silentNeverType;
79035
79112
  }
79036
- if (!isTypeAssignableToKind(leftType, 402654240 /* StringLike */) && !isTypeAssignableToKind(rightType, 402654240 /* StringLike */)) {
79113
+ if (!isTypeAssignableToKind(leftType, 402653316 /* StringLike */) && !isTypeAssignableToKind(rightType, 402653316 /* StringLike */)) {
79037
79114
  leftType = checkNonNullType(leftType, left);
79038
79115
  rightType = checkNonNullType(rightType, right);
79039
79116
  }
79040
79117
  let resultType;
79041
79118
  if (isTypeAssignableToKind(
79042
79119
  leftType,
79043
- 67648 /* NumberLike */,
79120
+ 296 /* NumberLike */,
79044
79121
  /*strict*/
79045
79122
  true
79046
79123
  ) && isTypeAssignableToKind(
79047
79124
  rightType,
79048
- 67648 /* NumberLike */,
79125
+ 296 /* NumberLike */,
79049
79126
  /*strict*/
79050
79127
  true
79051
79128
  )) {
79052
79129
  resultType = numberType;
79053
79130
  } else if (isTypeAssignableToKind(
79054
79131
  leftType,
79055
- 8320 /* BigIntLike */,
79132
+ 2112 /* BigIntLike */,
79056
79133
  /*strict*/
79057
79134
  true
79058
79135
  ) && isTypeAssignableToKind(
79059
79136
  rightType,
79060
- 8320 /* BigIntLike */,
79137
+ 2112 /* BigIntLike */,
79061
79138
  /*strict*/
79062
79139
  true
79063
79140
  )) {
79064
79141
  resultType = bigintType;
79065
79142
  } else if (isTypeAssignableToKind(
79066
79143
  leftType,
79067
- 402654240 /* StringLike */,
79144
+ 402653316 /* StringLike */,
79068
79145
  /*strict*/
79069
79146
  true
79070
79147
  ) || isTypeAssignableToKind(
79071
79148
  rightType,
79072
- 402654240 /* StringLike */,
79149
+ 402653316 /* StringLike */,
79073
79150
  /*strict*/
79074
79151
  true
79075
79152
  )) {
@@ -79081,7 +79158,7 @@ function createTypeChecker(host) {
79081
79158
  return resultType;
79082
79159
  }
79083
79160
  if (!resultType) {
79084
- const closeEnoughKind = 67648 /* NumberLike */ | 8320 /* BigIntLike */ | 402654240 /* StringLike */ | 3 /* AnyOrUnknown */;
79161
+ const closeEnoughKind = 296 /* NumberLike */ | 2112 /* BigIntLike */ | 402653316 /* StringLike */ | 3 /* AnyOrUnknown */;
79085
79162
  reportOperatorError(
79086
79163
  (left2, right2) => isTypeAssignableToKind(left2, closeEnoughKind) && isTypeAssignableToKind(right2, closeEnoughKind)
79087
79164
  );
@@ -79178,7 +79255,7 @@ function createTypeChecker(host) {
79178
79255
  return Debug.fail();
79179
79256
  }
79180
79257
  function bothAreBigIntLike(left2, right2) {
79181
- return isTypeAssignableToKind(left2, 8320 /* BigIntLike */) && isTypeAssignableToKind(right2, 8320 /* BigIntLike */);
79258
+ return isTypeAssignableToKind(left2, 2112 /* BigIntLike */) && isTypeAssignableToKind(right2, 2112 /* BigIntLike */);
79182
79259
  }
79183
79260
  function checkAssignmentDeclaration(kind, rightType2) {
79184
79261
  if (kind === 2 /* ModuleExports */) {
@@ -79208,7 +79285,7 @@ function createTypeChecker(host) {
79208
79285
  (isAccessExpression(node.right) || isIdentifier(node.right) && node.right.escapedText === "eval");
79209
79286
  }
79210
79287
  function checkForDisallowedESSymbolOperand(operator2) {
79211
- const offendingSymbolOperand = maybeTypeOfKindConsideringBaseConstraint(leftType, 16896 /* ESSymbolLike */) ? left : maybeTypeOfKindConsideringBaseConstraint(rightType, 16896 /* ESSymbolLike */) ? right : void 0;
79288
+ const offendingSymbolOperand = maybeTypeOfKindConsideringBaseConstraint(leftType, 12288 /* ESSymbolLike */) ? left : maybeTypeOfKindConsideringBaseConstraint(rightType, 12288 /* ESSymbolLike */) ? right : void 0;
79212
79289
  if (offendingSymbolOperand) {
79213
79290
  error(offendingSymbolOperand, Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, tokenToString(operator2));
79214
79291
  return false;
@@ -79247,7 +79324,7 @@ function createTypeChecker(host) {
79247
79324
  }
79248
79325
  if (checkReferenceExpression(left, Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access, Diagnostics.The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access)) {
79249
79326
  let headMessage;
79250
- if (exactOptionalPropertyTypes && isPropertyAccessExpression(left) && maybeTypeOfKind(valueType, 4 /* Undefined */)) {
79327
+ if (exactOptionalPropertyTypes && isPropertyAccessExpression(left) && maybeTypeOfKind(valueType, 32768 /* Undefined */)) {
79251
79328
  const target = getTypeOfPropertyOfType(getTypeOfExpression(left.expression), left.name.escapedText);
79252
79329
  if (isExactOptionalPropertyMismatch(valueType, target)) {
79253
79330
  headMessage = Diagnostics.Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_type_of_the_target;
@@ -79436,7 +79513,7 @@ function createTypeChecker(host) {
79436
79513
  const types = [];
79437
79514
  for (const span of node.templateSpans) {
79438
79515
  const type = checkExpression(span.expression);
79439
- if (maybeTypeOfKindConsideringBaseConstraint(type, 16896 /* ESSymbolLike */)) {
79516
+ if (maybeTypeOfKindConsideringBaseConstraint(type, 12288 /* ESSymbolLike */)) {
79440
79517
  error(span.expression, Diagnostics.Implicit_conversion_of_a_symbol_to_a_string_will_fail_at_runtime_Consider_wrapping_this_expression_in_String);
79441
79518
  }
79442
79519
  texts.push(span.literal.text);
@@ -79456,7 +79533,7 @@ function createTypeChecker(host) {
79456
79533
  return stringType;
79457
79534
  }
79458
79535
  function isTemplateLiteralContextualType(type) {
79459
- return !!(type.flags & (1024 /* StringLiteral */ | 134217728 /* TemplateLiteral */) || type.flags & 58982400 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402654240 /* StringLike */));
79536
+ return !!(type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */) || type.flags & 58982400 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316 /* StringLike */));
79460
79537
  }
79461
79538
  function getContextNode(node) {
79462
79539
  if (isJsxAttributes(node) && !isJsxSelfClosingElement(node.parent)) {
@@ -79477,7 +79554,7 @@ function createTypeChecker(host) {
79477
79554
  if (inferenceContext && inferenceContext.intraExpressionInferenceSites) {
79478
79555
  inferenceContext.intraExpressionInferenceSites = void 0;
79479
79556
  }
79480
- const result = maybeTypeOfKind(type, 15360 /* Literal */) && isLiteralOfContextualType(type, instantiateContextualType(
79557
+ const result = maybeTypeOfKind(type, 2944 /* Literal */) && isLiteralOfContextualType(type, instantiateContextualType(
79481
79558
  contextualType,
79482
79559
  node,
79483
79560
  /*contextFlags*/
@@ -79621,9 +79698,9 @@ function createTypeChecker(host) {
79621
79698
  }
79622
79699
  if (contextualType.flags & 58982400 /* InstantiableNonPrimitive */) {
79623
79700
  const constraint = getBaseConstraintOfType(contextualType) || unknownType;
79624
- return maybeTypeOfKind(constraint, 32 /* String */) && maybeTypeOfKind(candidateType, 1024 /* StringLiteral */) || maybeTypeOfKind(constraint, 64 /* Number */) && maybeTypeOfKind(candidateType, 2048 /* NumberLiteral */) || maybeTypeOfKind(constraint, 128 /* BigInt */) && maybeTypeOfKind(candidateType, 8192 /* BigIntLiteral */) || maybeTypeOfKind(constraint, 512 /* ESSymbol */) && maybeTypeOfKind(candidateType, 16384 /* UniqueESSymbol */) || isLiteralOfContextualType(candidateType, constraint);
79701
+ return maybeTypeOfKind(constraint, 4 /* String */) && maybeTypeOfKind(candidateType, 128 /* StringLiteral */) || maybeTypeOfKind(constraint, 8 /* Number */) && maybeTypeOfKind(candidateType, 256 /* NumberLiteral */) || maybeTypeOfKind(constraint, 64 /* BigInt */) && maybeTypeOfKind(candidateType, 2048 /* BigIntLiteral */) || maybeTypeOfKind(constraint, 4096 /* ESSymbol */) && maybeTypeOfKind(candidateType, 8192 /* UniqueESSymbol */) || isLiteralOfContextualType(candidateType, constraint);
79625
79702
  }
79626
- return !!(contextualType.flags & (1024 /* StringLiteral */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) && maybeTypeOfKind(candidateType, 1024 /* StringLiteral */) || contextualType.flags & 2048 /* NumberLiteral */ && maybeTypeOfKind(candidateType, 2048 /* NumberLiteral */) || contextualType.flags & 8192 /* BigIntLiteral */ && maybeTypeOfKind(candidateType, 8192 /* BigIntLiteral */) || contextualType.flags & 4096 /* BooleanLiteral */ && maybeTypeOfKind(candidateType, 4096 /* BooleanLiteral */) || contextualType.flags & 16384 /* UniqueESSymbol */ && maybeTypeOfKind(candidateType, 16384 /* UniqueESSymbol */));
79703
+ return !!(contextualType.flags & (128 /* StringLiteral */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) && maybeTypeOfKind(candidateType, 128 /* StringLiteral */) || contextualType.flags & 256 /* NumberLiteral */ && maybeTypeOfKind(candidateType, 256 /* NumberLiteral */) || contextualType.flags & 2048 /* BigIntLiteral */ && maybeTypeOfKind(candidateType, 2048 /* BigIntLiteral */) || contextualType.flags & 512 /* BooleanLiteral */ && maybeTypeOfKind(candidateType, 512 /* BooleanLiteral */) || contextualType.flags & 8192 /* UniqueESSymbol */ && maybeTypeOfKind(candidateType, 8192 /* UniqueESSymbol */));
79627
79704
  }
79628
79705
  return false;
79629
79706
  }
@@ -82484,7 +82561,7 @@ function createTypeChecker(host) {
82484
82561
  return;
82485
82562
  }
82486
82563
  const type = location === condExpr2 ? condType : checkExpression(location);
82487
- if (type.flags & 32768 /* EnumLiteral */ && isPropertyAccessExpression(location) && (getNodeLinks(location.expression).resolvedSymbol ?? unknownSymbol).flags & 384 /* Enum */) {
82564
+ if (type.flags & 1024 /* EnumLiteral */ && isPropertyAccessExpression(location) && (getNodeLinks(location.expression).resolvedSymbol ?? unknownSymbol).flags & 384 /* Enum */) {
82488
82565
  error(location, Diagnostics.This_condition_will_always_return_0, !!type.value ? "true" : "false");
82489
82566
  return;
82490
82567
  }
@@ -82576,7 +82653,7 @@ function createTypeChecker(host) {
82576
82653
  checkSourceElement(node.statement);
82577
82654
  }
82578
82655
  function checkTruthinessOfType(type, node) {
82579
- if (type.flags & 16 /* Void */) {
82656
+ if (type.flags & 16384 /* Void */) {
82580
82657
  error(node, Diagnostics.An_expression_of_type_void_cannot_be_tested_for_truthiness);
82581
82658
  } else {
82582
82659
  const semantics = getSyntacticTruthySemantics(node);
@@ -82764,11 +82841,11 @@ function createTypeChecker(host) {
82764
82841
  if (use & 4 /* AllowsStringInputFlag */) {
82765
82842
  if (arrayType.flags & 1048576 /* Union */) {
82766
82843
  const arrayTypes = inputType.types;
82767
- const filteredTypes = filter(arrayTypes, (t) => !(t.flags & 402654240 /* StringLike */));
82844
+ const filteredTypes = filter(arrayTypes, (t) => !(t.flags & 402653316 /* StringLike */));
82768
82845
  if (filteredTypes !== arrayTypes) {
82769
82846
  arrayType = getUnionType(filteredTypes, 2 /* Subtype */);
82770
82847
  }
82771
- } else if (arrayType.flags & 402654240 /* StringLike */) {
82848
+ } else if (arrayType.flags & 402653316 /* StringLike */) {
82772
82849
  arrayType = neverType;
82773
82850
  }
82774
82851
  hasStringConstituent = arrayType !== inputType;
@@ -82793,7 +82870,7 @@ function createTypeChecker(host) {
82793
82870
  }
82794
82871
  const arrayElementType = getIndexTypeOfType(arrayType, numberType);
82795
82872
  if (hasStringConstituent && arrayElementType) {
82796
- if (arrayElementType.flags & 402654240 /* StringLike */ && !compilerOptions.noUncheckedIndexedAccess) {
82873
+ if (arrayElementType.flags & 402653316 /* StringLike */ && !compilerOptions.noUncheckedIndexedAccess) {
82797
82874
  return stringType;
82798
82875
  }
82799
82876
  return getUnionType(possibleOutOfBounds ? [arrayElementType, stringType, undefinedType] : [arrayElementType, stringType], 2 /* Subtype */);
@@ -82844,7 +82921,7 @@ function createTypeChecker(host) {
82844
82921
  return iterationTypes && iterationTypes[getIterationTypesKeyFromIterationTypeKind(typeKind)];
82845
82922
  }
82846
82923
  function createIterationTypes(yieldType = neverType, returnType = neverType, nextType = unknownType) {
82847
- if (yieldType.flags & 67245055 /* Intrinsic */ && returnType.flags & (1 /* Any */ | 131072 /* Never */ | 2 /* Unknown */ | 16 /* Void */ | 4 /* Undefined */) && nextType.flags & (1 /* Any */ | 131072 /* Never */ | 2 /* Unknown */ | 16 /* Void */ | 4 /* Undefined */)) {
82924
+ if (yieldType.flags & 67359327 /* Intrinsic */ && returnType.flags & (1 /* Any */ | 131072 /* Never */ | 2 /* Unknown */ | 16384 /* Void */ | 32768 /* Undefined */) && nextType.flags & (1 /* Any */ | 131072 /* Never */ | 2 /* Unknown */ | 16384 /* Void */ | 32768 /* Undefined */)) {
82848
82925
  const id = getTypeListId([yieldType, returnType, nextType]);
82849
82926
  let iterationTypes = iterationTypesCache.get(id);
82850
82927
  if (!iterationTypes) {
@@ -83340,7 +83417,7 @@ function createTypeChecker(host) {
83340
83417
  }
83341
83418
  function isUnwrappedReturnTypeUndefinedVoidOrAny(func, returnType) {
83342
83419
  const type = unwrapReturnType(returnType, getFunctionFlags(func));
83343
- return !!(type && (maybeTypeOfKind(type, 16 /* Void */) || type.flags & (1 /* Any */ | 4 /* Undefined */)));
83420
+ return !!(type && (maybeTypeOfKind(type, 16384 /* Void */) || type.flags & (1 /* Any */ | 32768 /* Undefined */)));
83344
83421
  }
83345
83422
  function checkReturnStatement(node) {
83346
83423
  if (checkGrammarStatementInAmbientContext(node)) {
@@ -83413,7 +83490,374 @@ function createTypeChecker(host) {
83413
83490
  ) : exprType;
83414
83491
  const effectiveExpr = expr && getEffectiveCheckNode(expr);
83415
83492
  const errorNode = inReturnStatement && !inConditionalExpression ? node : effectiveExpr;
83416
- checkTypeAssignableToAndOptionallyElaborate(unwrappedExprType, unwrappedReturnType, errorNode, effectiveExpr);
83493
+ if (!(unwrappedReturnType.flags & (8388608 /* IndexedAccess */ | 16777216 /* Conditional */)) || !couldContainTypeVariables(unwrappedReturnType)) {
83494
+ checkTypeAssignableToAndOptionallyElaborate(unwrappedExprType, unwrappedReturnType, errorNode, effectiveExpr);
83495
+ return;
83496
+ }
83497
+ if (checkTypeAssignableTo(
83498
+ unwrappedExprType,
83499
+ unwrappedReturnType,
83500
+ /*errorNode*/
83501
+ void 0
83502
+ )) {
83503
+ return;
83504
+ }
83505
+ let narrowPosition = node;
83506
+ let narrowFlowNode = inReturnStatement && node.flowNode;
83507
+ if (expr && isConditionalExpression(expr.parent)) {
83508
+ narrowFlowNode = expr.parent.whenTrue === expr ? expr.parent.flowNodeWhenTrue : expr.parent.flowNodeWhenFalse;
83509
+ narrowPosition = expr;
83510
+ }
83511
+ if (!narrowFlowNode) {
83512
+ checkTypeAssignableToAndOptionallyElaborate(unwrappedExprType, unwrappedReturnType, errorNode, effectiveExpr);
83513
+ return;
83514
+ }
83515
+ const allTypeParameters = appendTypeParameters(getOuterTypeParameters(
83516
+ container,
83517
+ /*includeThisTypes*/
83518
+ false
83519
+ ), getEffectiveTypeParameterDeclarations(container));
83520
+ const narrowableTypeParameters = allTypeParameters && getNarrowableTypeParameters(allTypeParameters);
83521
+ if (!narrowableTypeParameters || !narrowableTypeParameters.length || !isNarrowableReturnType(unwrappedReturnType)) {
83522
+ checkTypeAssignableToAndOptionallyElaborate(unwrappedExprType, unwrappedReturnType, errorNode, effectiveExpr);
83523
+ return;
83524
+ }
83525
+ const narrowedTypeParameters = [];
83526
+ const narrowedTypes = [];
83527
+ for (const [typeParam, symbol, narrowReference] of narrowableTypeParameters) {
83528
+ resetNodeId(narrowReference);
83529
+ let baseReference = narrowReference;
83530
+ while (isAccessExpression(baseReference)) {
83531
+ baseReference = baseReference.expression;
83532
+ }
83533
+ getNodeLinks(baseReference).resolvedSymbol = symbol;
83534
+ setParent(narrowReference, narrowPosition.parent);
83535
+ narrowReference.flowNode = narrowFlowNode;
83536
+ const initialType = getNarrowableTypeForReference(
83537
+ typeParam,
83538
+ narrowReference,
83539
+ /*checkMode*/
83540
+ void 0,
83541
+ /*forReturnTypeNarrowing*/
83542
+ true
83543
+ );
83544
+ if (initialType === typeParam) {
83545
+ continue;
83546
+ }
83547
+ const flowType = getFlowTypeOfReference(narrowReference, initialType);
83548
+ const exprType2 = getTypeFromFlowType(flowType);
83549
+ if (exprType2.flags & 3 /* AnyOrUnknown */ || isErrorType(exprType2) || exprType2 === typeParam || exprType2 === mapType(typeParam, getBaseConstraintOrType)) {
83550
+ continue;
83551
+ }
83552
+ const narrowedType = getSubstitutionType(
83553
+ typeParam,
83554
+ exprType2,
83555
+ /*isNarrowed*/
83556
+ true
83557
+ );
83558
+ narrowedTypeParameters.push(typeParam);
83559
+ narrowedTypes.push(narrowedType);
83560
+ }
83561
+ const narrowMapper = createTypeMapper(narrowedTypeParameters, narrowedTypes);
83562
+ const narrowedReturnType = instantiateType(
83563
+ unwrappedReturnType,
83564
+ narrowMapper
83565
+ );
83566
+ if (expr) {
83567
+ const links = getNodeLinks(expr);
83568
+ if (!links.contextualReturnType) {
83569
+ links.contextualReturnType = narrowedReturnType;
83570
+ }
83571
+ }
83572
+ const narrowedExprType = expr ? checkExpression(expr) : undefinedType;
83573
+ const narrowedUnwrappedExprType = functionFlags & 2 /* Async */ ? checkAwaitedType(
83574
+ narrowedExprType,
83575
+ /*withAlias*/
83576
+ false,
83577
+ node,
83578
+ Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member
83579
+ ) : narrowedExprType;
83580
+ checkTypeAssignableToAndOptionallyElaborate(narrowedUnwrappedExprType, narrowedReturnType, errorNode, effectiveExpr);
83581
+ }
83582
+ function resetNodeId(node) {
83583
+ node.id = void 0;
83584
+ forEachChildRecursively(node, resetNodeId);
83585
+ }
83586
+ function getNarrowableTypeParameters(candidates) {
83587
+ const narrowableParams = [];
83588
+ for (const typeParam of candidates) {
83589
+ const constraint = getConstraintOfTypeParameter(typeParam);
83590
+ if (!constraint || !(constraint.flags & 1048576 /* Union */)) continue;
83591
+ if (typeParam.symbol && typeParam.symbol.declarations && typeParam.symbol.declarations.length === 1) {
83592
+ const declaration = typeParam.symbol.declarations[0];
83593
+ const container = isJSDocTemplateTag(declaration.parent) ? getJSDocHost(declaration.parent) : declaration.parent;
83594
+ if (!isFunctionLike(container)) continue;
83595
+ let paramReference;
83596
+ let referencePath;
83597
+ let hasInvalidReference = false;
83598
+ for (const paramDecl of container.parameters) {
83599
+ const typeNode = getEffectiveTypeAnnotationNode(paramDecl);
83600
+ if (!typeNode) continue;
83601
+ const result = getValidTypeParameterReference(typeNode, typeParam, []);
83602
+ if (!result) {
83603
+ hasInvalidReference = true;
83604
+ break;
83605
+ }
83606
+ if (isArray(result)) {
83607
+ if (referencePath) {
83608
+ hasInvalidReference = true;
83609
+ break;
83610
+ }
83611
+ referencePath = result;
83612
+ paramReference = paramDecl;
83613
+ }
83614
+ }
83615
+ if (!hasInvalidReference && referencePath && validateOptionality(paramReference, constraint, referencePath)) {
83616
+ const symbolAndReference = constructNarrowableReference(paramReference, referencePath);
83617
+ if (symbolAndReference) {
83618
+ if (symbolAndReference[0] && symbolAndReference[0] !== unknownSymbol) {
83619
+ narrowableParams.push([typeParam, symbolAndReference[0], symbolAndReference[1]]);
83620
+ }
83621
+ }
83622
+ }
83623
+ }
83624
+ }
83625
+ return narrowableParams;
83626
+ function isReferenceToTypeParameter(typeParam, node) {
83627
+ return getTypeFromTypeReference(node) === typeParam;
83628
+ }
83629
+ function isTypeParameterReferenced(typeParam, node) {
83630
+ return isReferenced(node);
83631
+ function isReferenced(node2) {
83632
+ if (isTypeReferenceNode(node2)) {
83633
+ return isReferenceToTypeParameter(typeParam, node2) || some(node2.typeArguments, isReferenced);
83634
+ }
83635
+ if (isTypeQueryNode(node2)) {
83636
+ return isTypeParameterPossiblyReferenced(typeParam, node2);
83637
+ }
83638
+ return !!forEachChild(node2, isReferenced);
83639
+ }
83640
+ }
83641
+ function getValidTypeParameterReference(typeNode, typeParam, path) {
83642
+ var _a;
83643
+ switch (typeNode.kind) {
83644
+ case 183 /* TypeReference */:
83645
+ const type = getTypeFromTypeReference(typeNode);
83646
+ if (type === typeParam) {
83647
+ return path;
83648
+ }
83649
+ const typeArgs = typeNode.typeArguments;
83650
+ const typeArgsReferencingT = typeArgs == null ? void 0 : typeArgs.filter((node) => isTypeParameterReferenced(typeParam, node));
83651
+ if (!typeArgsReferencingT || typeArgsReferencingT.length === 0) return true;
83652
+ if (typeArgsReferencingT && typeArgsReferencingT.length > 1) return false;
83653
+ const typeArg = typeArgsReferencingT[0];
83654
+ if (!(typeArg.kind & 183 /* TypeReference */)) return false;
83655
+ if (!type.symbol || !type.symbol.declarations || type.symbol.declarations.length !== 1) return false;
83656
+ const typeDeclaration = type.symbol.declarations[0];
83657
+ let aliasDeclaration;
83658
+ if (isTypeLiteralNode(typeDeclaration)) {
83659
+ aliasDeclaration = walkUpParenthesizedTypes(typeDeclaration.parent);
83660
+ if (!isTypeAliasDeclaration(aliasDeclaration)) return false;
83661
+ } else if (isInterfaceDeclaration(typeDeclaration)) {
83662
+ aliasDeclaration = typeDeclaration;
83663
+ } else {
83664
+ return false;
83665
+ }
83666
+ const typeArgIndex = typeArgs.findIndex((arg) => arg === typeArg);
83667
+ const matchingTypeParamDecl = (_a = aliasDeclaration.typeParameters) == null ? void 0 : _a[typeArgIndex];
83668
+ if (!matchingTypeParamDecl) return false;
83669
+ const matchingTypeParam = getDeclaredTypeOfTypeParameter(matchingTypeParamDecl.symbol);
83670
+ return getValidTypeParameterReference(typeDeclaration, matchingTypeParam, path);
83671
+ case 264 /* InterfaceDeclaration */:
83672
+ const extendsTypes = flatMap(typeNode.heritageClauses, (clause) => clause.types);
83673
+ const relevantExtendsTypes = extendsTypes.filter((node) => isTypeParameterReferenced(typeParam, node));
83674
+ if (relevantExtendsTypes && relevantExtendsTypes.length > 1) {
83675
+ return false;
83676
+ }
83677
+ const result = getValidTypeParameterReferenceFromTypeElements(typeNode.members, typeParam, path);
83678
+ if (relevantExtendsTypes && relevantExtendsTypes.length === 1) {
83679
+ if (result !== true) {
83680
+ return false;
83681
+ }
83682
+ return getValidTypeParameterReference(relevantExtendsTypes[0], typeParam, path);
83683
+ }
83684
+ return result;
83685
+ case 187 /* TypeLiteral */:
83686
+ return getValidTypeParameterReferenceFromTypeElements(typeNode.members, typeParam, path);
83687
+ case 193 /* IntersectionType */:
83688
+ let validPath;
83689
+ for (const type2 of typeNode.types) {
83690
+ const result2 = getValidTypeParameterReference(type2, typeParam, path);
83691
+ if (!result2) {
83692
+ return false;
83693
+ }
83694
+ if (isArray(result2)) {
83695
+ if (validPath) {
83696
+ return false;
83697
+ }
83698
+ validPath = result2;
83699
+ }
83700
+ }
83701
+ return validPath ?? true;
83702
+ default:
83703
+ return !isTypeParameterReferenced(typeParam, typeNode);
83704
+ }
83705
+ }
83706
+ function getValidTypeParameterReferenceFromTypeElements(members, typeParam, path) {
83707
+ let validPath;
83708
+ for (const member of members) {
83709
+ if (!isTypeParameterReferenced(typeParam, member)) {
83710
+ continue;
83711
+ }
83712
+ if (!isPropertySignature(member)) {
83713
+ return false;
83714
+ }
83715
+ if (!isIdentifier(member.name) && !isStringLiteral(member.name)) {
83716
+ return false;
83717
+ }
83718
+ const result = getValidTypeParameterReference(member.type, typeParam, [...path, member]);
83719
+ if (!result) {
83720
+ return false;
83721
+ }
83722
+ if (isArray(result)) {
83723
+ if (validPath) {
83724
+ return false;
83725
+ }
83726
+ validPath = result;
83727
+ }
83728
+ }
83729
+ return validPath ?? true;
83730
+ }
83731
+ function validateOptionality(paramDecl, constraint, path) {
83732
+ for (let i = 0; i < path.length - 1; i++) {
83733
+ if (path[i].questionToken) {
83734
+ return false;
83735
+ }
83736
+ }
83737
+ const paramIsOptional = !!paramDecl.questionToken || isJSDocOptionalParameter(paramDecl);
83738
+ if (paramIsOptional && path.length > 0) {
83739
+ return false;
83740
+ }
83741
+ const isOptional = paramIsOptional || path.length > 0 && path[path.length - 1].questionToken;
83742
+ if (isOptional && strictNullChecks && !containsUndefinedType(constraint)) {
83743
+ return false;
83744
+ }
83745
+ return true;
83746
+ }
83747
+ function constructNarrowableReference(paramDecl, path) {
83748
+ let currentName = paramDecl.name;
83749
+ let i = 0;
83750
+ for (; i < path.length; i++) {
83751
+ if (isIdentifier(currentName)) {
83752
+ break;
83753
+ } else if (isObjectBindingPattern(currentName)) {
83754
+ const name = path[i].name;
83755
+ let nameText;
83756
+ if (isIdentifier(name)) nameText = name.escapedText;
83757
+ else {
83758
+ const rawText = getLiteralPropertyNameText(name);
83759
+ if (rawText) nameText = escapeLeadingUnderscores(rawText);
83760
+ }
83761
+ const element = currentName.elements.find((element2) => {
83762
+ const propertyName = getDestructuringPropertyName(element2);
83763
+ const propertyNameText = propertyName && escapeLeadingUnderscores(propertyName);
83764
+ return nameText && propertyNameText && nameText === propertyNameText;
83765
+ });
83766
+ if (!element) {
83767
+ return void 0;
83768
+ }
83769
+ currentName = element.name;
83770
+ } else {
83771
+ return void 0;
83772
+ }
83773
+ }
83774
+ if (!isIdentifier(currentName)) {
83775
+ return void 0;
83776
+ }
83777
+ let result = factory.cloneNode(currentName);
83778
+ const initialSymbol = getSymbolOfDeclaration(currentName.parent);
83779
+ for (let j = i; j < path.length; j++) {
83780
+ result = addName(result, path[j].name);
83781
+ }
83782
+ return [initialSymbol, result];
83783
+ }
83784
+ function addName(exp, name) {
83785
+ name = factory.cloneNode(name);
83786
+ if (isIdentifier(name)) {
83787
+ const accessExp = factory.createPropertyAccessExpression(exp, name);
83788
+ setParent(name, accessExp);
83789
+ setParent(exp, accessExp);
83790
+ return accessExp;
83791
+ } else {
83792
+ const accessExp = factory.createElementAccessExpression(exp, name);
83793
+ setParent(name, accessExp);
83794
+ setParent(exp, accessExp);
83795
+ return accessExp;
83796
+ }
83797
+ }
83798
+ }
83799
+ function isNarrowableReturnType(returnType) {
83800
+ return isConditionalType(returnType) ? isNarrowableConditionalType(
83801
+ returnType,
83802
+ /*hadNonPrimitiveExtendsType*/
83803
+ []
83804
+ ) : !!(returnType.indexType.flags & 262144 /* TypeParameter */);
83805
+ }
83806
+ function isNarrowableConditionalType(type, hadNonPrimitiveExtendsType, mapper) {
83807
+ const typeArguments = mapper && map(type.root.outerTypeParameters, (t) => {
83808
+ const mapped = getMappedType(t, mapper);
83809
+ if (isNarrowingSubstitutionType(mapped)) {
83810
+ return mapped.baseType;
83811
+ }
83812
+ return mapped;
83813
+ });
83814
+ const id = `${type.id}:${getTypeListId(typeArguments)}:${getTypeListId(hadNonPrimitiveExtendsType)}`;
83815
+ let result = narrowableReturnTypeCache.get(id);
83816
+ if (result === void 0) {
83817
+ const nonNarrowingMapper = type.root.outerTypeParameters && typeArguments && createTypeMapper(type.root.outerTypeParameters, typeArguments);
83818
+ const instantiatedType = instantiateType(type, nonNarrowingMapper);
83819
+ result = isConditionalType(instantiatedType) && isNarrowableConditionalTypeWorker(instantiatedType, hadNonPrimitiveExtendsType);
83820
+ narrowableReturnTypeCache.set(id, result);
83821
+ }
83822
+ return result;
83823
+ }
83824
+ function isNarrowableConditionalTypeWorker(type, hadNonPrimitiveExtendsType) {
83825
+ if (!type.root.isDistributive) {
83826
+ return false;
83827
+ }
83828
+ if (type.root.inferTypeParameters) {
83829
+ return false;
83830
+ }
83831
+ if (!(type.checkType.flags & 262144 /* TypeParameter */)) {
83832
+ return false;
83833
+ }
83834
+ const constraintType = getConstraintOfTypeParameter(type.checkType);
83835
+ if (!constraintType || !(constraintType.flags & 1048576 /* Union */)) {
83836
+ return false;
83837
+ }
83838
+ if (!everyType(type.extendsType, (extendsType) => some(
83839
+ constraintType.types,
83840
+ (constraintType2) => isTypeAssignableTo(constraintType2, extendsType)
83841
+ ))) {
83842
+ return false;
83843
+ }
83844
+ const hasNonPrimitive = someType(type.extendsType, (type2) => (type2.flags & 402784252 /* Primitive */) === 0);
83845
+ if (hasNonPrimitive && hadNonPrimitiveExtendsType.includes(type.checkType)) {
83846
+ return false;
83847
+ }
83848
+ if (hasNonPrimitive) {
83849
+ hadNonPrimitiveExtendsType = hadNonPrimitiveExtendsType.slice();
83850
+ hadNonPrimitiveExtendsType.push(type.checkType);
83851
+ }
83852
+ const trueType2 = getTrueTypeFromConditionalType(type);
83853
+ const isValidTrueType = isConditionalType(trueType2) ? isNarrowableConditionalType(trueType2, hadNonPrimitiveExtendsType) : true;
83854
+ if (!isValidTrueType) return false;
83855
+ const falseType2 = getFalseTypeFromConditionalType(type);
83856
+ const isValidFalseType = isConditionalType(falseType2) ? isNarrowableConditionalType(falseType2, hadNonPrimitiveExtendsType) : falseType2 === neverType;
83857
+ return isValidFalseType;
83858
+ }
83859
+ function isConditionalType(type) {
83860
+ return !!(type.flags & 16777216 /* Conditional */);
83417
83861
  }
83418
83862
  function checkWithStatement(node) {
83419
83863
  if (!checkGrammarStatementInAmbientContext(node)) {
@@ -83537,7 +83981,7 @@ function createTypeChecker(host) {
83537
83981
  if (!(isStaticIndex && prop.flags & 4194304 /* Prototype */)) {
83538
83982
  checkIndexConstraintForProperty(type, prop, getLiteralTypeFromProperty(
83539
83983
  prop,
83540
- 19456 /* StringOrNumberLiteralOrUnique */,
83984
+ 8576 /* StringOrNumberLiteralOrUnique */,
83541
83985
  /*includeNonPublic*/
83542
83986
  true
83543
83987
  ), getNonMissingTypeOfSymbol(prop));
@@ -85008,7 +85452,7 @@ function createTypeChecker(host) {
85008
85452
  true
85009
85453
  );
85010
85454
  if (importAttributesType !== emptyObjectType) {
85011
- checkTypeAssignableTo(getTypeFromImportAttributes(node), getNullableType(importAttributesType, 4 /* Undefined */), node);
85455
+ checkTypeAssignableTo(getTypeFromImportAttributes(node), getNullableType(importAttributesType, 32768 /* Undefined */), node);
85012
85456
  }
85013
85457
  const validForTypeAttributes = isExclusivelyTypeOnlyImportOrExport(declaration);
85014
85458
  const override = getResolutionModeOverride(node, validForTypeAttributes ? grammarErrorOnNode : void 0);
@@ -86560,7 +87004,7 @@ function createTypeChecker(host) {
86560
87004
  return getStringLiteralType(name.text);
86561
87005
  case 167 /* ComputedPropertyName */:
86562
87006
  const nameType = checkComputedPropertyName(name);
86563
- return isTypeAssignableToKind(nameType, 16896 /* ESSymbolLike */) ? nameType : stringType;
87007
+ return isTypeAssignableToKind(nameType, 12288 /* ESSymbolLike */) ? nameType : stringType;
86564
87008
  default:
86565
87009
  return Debug.fail("Unsupported property name.");
86566
87010
  }
@@ -87081,19 +87525,19 @@ function createTypeChecker(host) {
87081
87525
  return isTypeOnly ? 11 /* ObjectType */ : 0 /* Unknown */;
87082
87526
  } else if (type.flags & 3 /* AnyOrUnknown */) {
87083
87527
  return 11 /* ObjectType */;
87084
- } else if (isTypeAssignableToKind(type, 16 /* Void */ | 12 /* Nullable */ | 131072 /* Never */)) {
87528
+ } else if (isTypeAssignableToKind(type, 16384 /* Void */ | 98304 /* Nullable */ | 131072 /* Never */)) {
87085
87529
  return 2 /* VoidNullableOrNeverType */;
87086
- } else if (isTypeAssignableToKind(type, 4352 /* BooleanLike */)) {
87530
+ } else if (isTypeAssignableToKind(type, 528 /* BooleanLike */)) {
87087
87531
  return 6 /* BooleanType */;
87088
- } else if (isTypeAssignableToKind(type, 67648 /* NumberLike */)) {
87532
+ } else if (isTypeAssignableToKind(type, 296 /* NumberLike */)) {
87089
87533
  return 3 /* NumberLikeType */;
87090
- } else if (isTypeAssignableToKind(type, 8320 /* BigIntLike */)) {
87534
+ } else if (isTypeAssignableToKind(type, 2112 /* BigIntLike */)) {
87091
87535
  return 4 /* BigIntLikeType */;
87092
- } else if (isTypeAssignableToKind(type, 402654240 /* StringLike */)) {
87536
+ } else if (isTypeAssignableToKind(type, 402653316 /* StringLike */)) {
87093
87537
  return 5 /* StringLikeType */;
87094
87538
  } else if (isTupleType(type)) {
87095
87539
  return 7 /* ArrayLikeType */;
87096
- } else if (isTypeAssignableToKind(type, 16896 /* ESSymbolLike */)) {
87540
+ } else if (isTypeAssignableToKind(type, 12288 /* ESSymbolLike */)) {
87097
87541
  return 8 /* ESSymbolType */;
87098
87542
  } else if (isFunctionType(type)) {
87099
87543
  return 10 /* TypeWithCallSignature */;
@@ -87236,7 +87680,7 @@ function createTypeChecker(host) {
87236
87680
  return false;
87237
87681
  }
87238
87682
  function literalTypeToNode(type, enclosing, tracker) {
87239
- const enumResult = type.flags & 98304 /* EnumLike */ ? nodeBuilder.symbolToExpression(
87683
+ const enumResult = type.flags & 1056 /* EnumLike */ ? nodeBuilder.symbolToExpression(
87240
87684
  type.symbol,
87241
87685
  111551 /* Value */,
87242
87686
  enclosing,
@@ -88255,7 +88699,7 @@ function createTypeChecker(host) {
88255
88699
  return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_must_have_a_type_annotation);
88256
88700
  }
88257
88701
  const type = getTypeFromTypeNode(parameter.type);
88258
- if (someType(type, (t) => !!(t.flags & 19456 /* StringOrNumberLiteralOrUnique */)) || isGenericType(type)) {
88702
+ if (someType(type, (t) => !!(t.flags & 8576 /* StringOrNumberLiteralOrUnique */)) || isGenericType(type)) {
88259
88703
  return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_type_cannot_be_a_literal_type_or_generic_type_Consider_using_a_mapped_object_type_instead);
88260
88704
  }
88261
88705
  if (!everyType(type, isValidIndexKeyType)) {
@@ -88786,7 +89230,7 @@ function createTypeChecker(host) {
88786
89230
  }
88787
89231
  function isSimpleLiteralEnumReference(expr) {
88788
89232
  if ((isPropertyAccessExpression(expr) || isElementAccessExpression(expr) && isStringOrNumberLiteralExpression(expr.argumentExpression)) && isEntityNameExpression(expr.expression)) {
88789
- return !!(checkExpressionCached(expr).flags & 98304 /* EnumLike */);
89233
+ return !!(checkExpressionCached(expr).flags & 1056 /* EnumLike */);
88790
89234
  }
88791
89235
  }
88792
89236
  function checkAmbientInitializer(node) {
@@ -89276,319 +89720,6 @@ function createTypeChecker(host) {
89276
89720
  Debug.assert(specifier && nodeIsSynthesized(specifier) && specifier.text === "tslib", `Expected sourceFile.imports[0] to be the synthesized tslib import`);
89277
89721
  return specifier;
89278
89722
  }
89279
- function compareSymbols(s1, s2) {
89280
- if (s1 === s2) return 0;
89281
- if (s1 === void 0) return 1;
89282
- if (s2 === void 0) return -1;
89283
- if (length(s1.declarations) !== 0 && length(s2.declarations) !== 0) {
89284
- const r2 = compareNodes(s1.declarations[0], s2.declarations[0]);
89285
- if (r2 !== 0) return r2;
89286
- } else if (length(s1.declarations) !== 0) {
89287
- return -1;
89288
- } else if (length(s2.declarations) !== 0) {
89289
- return 1;
89290
- }
89291
- const r = compareComparableValues(s1.escapedName, s2.escapedName);
89292
- if (r !== 0) return r;
89293
- return getSymbolId(s1) - getSymbolId(s2);
89294
- }
89295
- function compareNodes(n1, n2) {
89296
- if (n1 === n2) return 0;
89297
- if (n1 === void 0) return 1;
89298
- if (n2 === void 0) return -1;
89299
- const f1 = fileIndexMap.get(getSourceFileOfNode(n1));
89300
- const f2 = fileIndexMap.get(getSourceFileOfNode(n2));
89301
- if (f1 !== f2) {
89302
- return f1 - f2;
89303
- }
89304
- return n1.pos - n2.pos;
89305
- }
89306
- function compareTypes(t1, t2) {
89307
- if (t1 === t2) return 0;
89308
- if (t1 === void 0) return 1;
89309
- if (t2 === void 0) return -1;
89310
- let c = getSortOrderFlags(t1) - getSortOrderFlags(t2);
89311
- if (c !== 0) return c;
89312
- c = compareTypeNames(t1, t2);
89313
- if (c !== 0) return c;
89314
- if (t1.flags & (1 /* Any */ | 2 /* Unknown */ | 32 /* String */ | 64 /* Number */ | 256 /* Boolean */ | 128 /* BigInt */ | 512 /* ESSymbol */ | 16 /* Void */ | 4 /* Undefined */ | 8 /* Null */ | 131072 /* Never */ | 67108864 /* NonPrimitive */)) {
89315
- } else if (t1.flags & 524288 /* Object */) {
89316
- const c2 = compareSymbols(t1.symbol, t2.symbol);
89317
- if (c2 !== 0) return c2;
89318
- if (getObjectFlags(t1) & 4 /* Reference */ && getObjectFlags(t2) & 4 /* Reference */) {
89319
- const r1 = t1;
89320
- const r2 = t2;
89321
- if (getObjectFlags(r1.target) & 8 /* Tuple */ && getObjectFlags(r2.target) & 8 /* Tuple */) {
89322
- const c3 = compareTupleTypes(r1.target, r2.target);
89323
- if (c3 !== 0) {
89324
- return c3;
89325
- }
89326
- }
89327
- if (r1.node === void 0 && r2.node === void 0) {
89328
- const c3 = compareTypeLists(t1.resolvedTypeArguments, t2.resolvedTypeArguments);
89329
- if (c3 !== 0) {
89330
- return c3;
89331
- }
89332
- } else {
89333
- let c3 = compareNodes(r1.node, r2.node);
89334
- if (c3 !== 0) {
89335
- return c3;
89336
- }
89337
- c3 = compareTypeMappers(t1.mapper, t2.mapper);
89338
- if (c3 !== 0) {
89339
- return c3;
89340
- }
89341
- }
89342
- } else if (getObjectFlags(t1) & 4 /* Reference */) {
89343
- return -1;
89344
- } else if (getObjectFlags(t2) & 4 /* Reference */) {
89345
- return 1;
89346
- } else {
89347
- let c3 = getObjectFlags(t1) & 142607679 /* ObjectTypeKindMask */ - getObjectFlags(t2) & 142607679 /* ObjectTypeKindMask */;
89348
- if (c3 !== 0) {
89349
- return c3;
89350
- }
89351
- c3 = compareTypeMappers(t1.mapper, t2.mapper);
89352
- if (c3 !== 0) {
89353
- return c3;
89354
- }
89355
- }
89356
- } else if (t1.flags & 1048576 /* Union */) {
89357
- const o1 = t1.origin;
89358
- const o2 = t2.origin;
89359
- if (o1 === void 0 && o2 === void 0) {
89360
- const c2 = compareTypeLists(t1.types, t2.types);
89361
- if (c2 !== 0) {
89362
- return c2;
89363
- }
89364
- } else if (o1 === void 0) {
89365
- return 1;
89366
- } else if (o2 === void 0) {
89367
- return -1;
89368
- } else {
89369
- const c2 = compareTypes(o1, o2);
89370
- if (c2 !== 0) {
89371
- return c2;
89372
- }
89373
- }
89374
- } else if (t1.flags & 2097152 /* Intersection */) {
89375
- const c2 = compareTypeLists(t1.types, t2.types);
89376
- if (c2 !== 0) {
89377
- return c2;
89378
- }
89379
- } else if (t1.flags & (32768 /* EnumLiteral */ | 16384 /* UniqueESSymbol */)) {
89380
- const c2 = compareSymbols(t1.symbol, t2.symbol);
89381
- if (c2 !== 0) {
89382
- return c2;
89383
- }
89384
- } else if (t1.flags & 1024 /* StringLiteral */) {
89385
- const c2 = compareComparableValues(t1.value, t2.value);
89386
- if (c2 !== 0) {
89387
- return c2;
89388
- }
89389
- } else if (t1.flags & 2048 /* NumberLiteral */) {
89390
- const c2 = compareComparableValues(t1.value, t2.value);
89391
- if (c2 !== 0) {
89392
- return c2;
89393
- }
89394
- } else if (t1.flags & 4096 /* BooleanLiteral */) {
89395
- const b1 = t1.intrinsicName === "true";
89396
- const b2 = t2.intrinsicName === "true";
89397
- if (b1 !== b2) {
89398
- if (b1) {
89399
- return 1;
89400
- }
89401
- return -1;
89402
- }
89403
- } else if (t1.flags & 262144 /* TypeParameter */) {
89404
- const c2 = compareSymbols(t1.symbol, t2.symbol);
89405
- if (c2 !== 0) {
89406
- return c2;
89407
- }
89408
- } else if (t1.flags & 4194304 /* Index */) {
89409
- let c2 = compareTypes(t1.type, t2.type);
89410
- if (c2 !== 0) {
89411
- return c2;
89412
- }
89413
- c2 = t1.flags - t2.flags;
89414
- if (c2 !== 0) {
89415
- return c2;
89416
- }
89417
- } else if (t1.flags & 8388608 /* IndexedAccess */) {
89418
- let c2 = compareTypes(t1.objectType, t2.objectType);
89419
- if (c2 !== 0) {
89420
- return c2;
89421
- }
89422
- c2 = compareTypes(t1.indexType, t2.indexType);
89423
- if (c2 !== 0) {
89424
- return c2;
89425
- }
89426
- } else if (t1.flags & 16777216 /* Conditional */) {
89427
- let c2 = compareNodes(t1.root.node, t2.root.node);
89428
- if (c2 !== 0) {
89429
- return c2;
89430
- }
89431
- c2 = compareTypeMappers(t1.mapper, t2.mapper);
89432
- if (c2 !== 0) {
89433
- return c2;
89434
- }
89435
- } else if (t1.flags & 33554432 /* Substitution */) {
89436
- let c2 = compareTypes(t1.baseType, t2.baseType);
89437
- if (c2 !== 0) {
89438
- return c2;
89439
- }
89440
- c2 = compareTypes(t1.constraint, t2.constraint);
89441
- if (c2 !== 0) {
89442
- return c2;
89443
- }
89444
- } else if (t1.flags & 134217728 /* TemplateLiteral */) {
89445
- let c2 = slicesCompareString(t1.texts, t2.texts);
89446
- if (c2 !== 0) {
89447
- return c2;
89448
- }
89449
- c2 = compareTypeLists(t1.types, t2.types);
89450
- if (c2 !== 0) {
89451
- return c2;
89452
- }
89453
- } else if (t1.flags & 268435456 /* StringMapping */) {
89454
- const c2 = compareTypes(t1.type, t2.type);
89455
- if (c2 !== 0) {
89456
- return c2;
89457
- }
89458
- }
89459
- return t1.id - t2.id;
89460
- function slicesCompareString(s1, s2) {
89461
- for (let i = 0; i < s1.length; i++) {
89462
- if (i > s2.length) {
89463
- return 1;
89464
- }
89465
- const v1 = s1[i];
89466
- const v2 = s2[i];
89467
- const c2 = compareComparableValues(v1, v2);
89468
- if (c2 !== 0) return c2;
89469
- }
89470
- if (s1.length < s2.length) {
89471
- return -1;
89472
- }
89473
- return 0;
89474
- }
89475
- }
89476
- function getSortOrderFlags(t) {
89477
- return (t.flags & 65536 /* Enum */) >> 1 | t.flags & ~65536 /* Enum */;
89478
- }
89479
- function compareTypeNames(t1, t2) {
89480
- const s1 = getTypeNameSymbol(t1);
89481
- const s2 = getTypeNameSymbol(t2);
89482
- if (s1 === s2) {
89483
- if (t1.aliasTypeArguments !== void 0) {
89484
- return compareTypeLists(t1.aliasTypeArguments, t2.aliasTypeArguments);
89485
- }
89486
- return 0;
89487
- }
89488
- if (s1 === void 0) {
89489
- return 1;
89490
- }
89491
- if (s2 === void 0) {
89492
- return -1;
89493
- }
89494
- return compareComparableValues(s1.escapedName, s2.escapedName);
89495
- }
89496
- function getTypeNameSymbol(t) {
89497
- if (t.aliasSymbol !== void 0) {
89498
- return t.aliasSymbol;
89499
- }
89500
- if (t.flags & (262144 /* TypeParameter */ | 268435456 /* StringMapping */) || getObjectFlags(t) & (3 /* ClassOrInterface */ | 4 /* Reference */)) {
89501
- return t.symbol;
89502
- }
89503
- return void 0;
89504
- }
89505
- function compareTupleTypes(t1, t2) {
89506
- var _a;
89507
- if (t1 === t2) {
89508
- return 0;
89509
- }
89510
- if (t1.readonly === t2.readonly) {
89511
- return t1.readonly ? 1 : -1;
89512
- }
89513
- if (t1.elementFlags.length !== t2.elementFlags.length) {
89514
- return t1.elementFlags.length - t2.elementFlags.length;
89515
- }
89516
- for (let i = 0; i < t1.elementFlags.length; i++) {
89517
- const c = t1.elementFlags[i] - t2.elementFlags[i];
89518
- if (c !== 0) {
89519
- return c;
89520
- }
89521
- }
89522
- for (let i = 0; i < (((_a = t1.labeledElementDeclarations) == null ? void 0 : _a.length) ?? 0); i++) {
89523
- const c = compareElementLabels(t1.labeledElementDeclarations[i], t2.labeledElementDeclarations[i]);
89524
- if (c !== 0) {
89525
- return c;
89526
- }
89527
- }
89528
- return 0;
89529
- }
89530
- function compareElementLabels(n1, n2) {
89531
- if (n1 === n2) {
89532
- return 0;
89533
- }
89534
- if (n1 === void 0) {
89535
- return -1;
89536
- }
89537
- if (n2 === void 0) {
89538
- return 1;
89539
- }
89540
- return compareComparableValues(n1.name.escapedText, n2.name.escapedText);
89541
- }
89542
- function compareTypeLists(s1, s2) {
89543
- if (length(s1) !== length(s2)) {
89544
- return length(s1) - length(s2);
89545
- }
89546
- for (let i = 0; i < length(s1); i++) {
89547
- const c = compareTypes(s1[i], s2 == null ? void 0 : s2[i]);
89548
- if (c !== 0) return c;
89549
- }
89550
- return 0;
89551
- }
89552
- function compareTypeMappers(m1, m2) {
89553
- if (m1 === m2) {
89554
- return 0;
89555
- }
89556
- if (m1 === void 0) {
89557
- return 1;
89558
- }
89559
- if (m2 === void 0) {
89560
- return -1;
89561
- }
89562
- const kind1 = m1.kind;
89563
- const kind2 = m2.kind;
89564
- if (kind1 !== kind2) {
89565
- return kind1 - kind2;
89566
- }
89567
- switch (kind1) {
89568
- case 0 /* Simple */: {
89569
- const c = compareTypes(m1.source, m2.source);
89570
- if (c !== 0) {
89571
- return c;
89572
- }
89573
- return compareTypes(m1.target, m2.target);
89574
- }
89575
- case 1 /* Array */: {
89576
- const c = compareTypeLists(m1.sources, m2.sources);
89577
- if (c !== 0) {
89578
- return c;
89579
- }
89580
- return compareTypeLists(m1.targets, m2.targets);
89581
- }
89582
- case 5 /* Merged */: {
89583
- const c = compareTypeMappers(m1.mapper1, m2.mapper1);
89584
- if (c !== 0) {
89585
- return c;
89586
- }
89587
- return compareTypeMappers(m1.mapper2, m2.mapper2);
89588
- }
89589
- }
89590
- return 0;
89591
- }
89592
89723
  }
89593
89724
  function isNotAccessor(declaration) {
89594
89725
  return !isAccessor(declaration);
@@ -132530,12 +132661,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
132530
132661
  return withNewScope(context, node, () => serializeTypeAnnotationOfDeclaration(accessorType, context, node, symbol) ?? inferTypeOfDeclaration(node, symbol, context));
132531
132662
  }
132532
132663
  if (accessorDeclarations.getAccessor) {
132533
- return withNewScope(context, accessorDeclarations.getAccessor, () => createReturnFromSignature(
132534
- accessorDeclarations.getAccessor,
132535
- /*symbol*/
132536
- void 0,
132537
- context
132538
- ));
132664
+ return withNewScope(context, accessorDeclarations.getAccessor, () => createReturnFromSignature(accessorDeclarations.getAccessor, symbol, context));
132539
132665
  }
132540
132666
  return void 0;
132541
132667
  }
@@ -132645,14 +132771,14 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
132645
132771
  }
132646
132772
  return resolver.serializeTypeOfExpression(context, node) ?? factory.createKeywordTypeNode(133 /* AnyKeyword */);
132647
132773
  }
132648
- function inferReturnTypeOfSignatureSignature(node, context, reportFallback) {
132774
+ function inferReturnTypeOfSignatureSignature(node, context, symbol, reportFallback) {
132649
132775
  if (reportFallback) {
132650
132776
  context.tracker.reportInferenceFallback(node);
132651
132777
  }
132652
132778
  if (context.noInferenceFallback === true) {
132653
132779
  return factory.createKeywordTypeNode(133 /* AnyKeyword */);
132654
132780
  }
132655
- return resolver.serializeReturnTypeForSignature(context, node) ?? factory.createKeywordTypeNode(133 /* AnyKeyword */);
132781
+ return resolver.serializeReturnTypeForSignature(context, node, symbol) ?? factory.createKeywordTypeNode(133 /* AnyKeyword */);
132656
132782
  }
132657
132783
  function inferAccessorType(node, allAccessors, context, symbol, reportFallback = true) {
132658
132784
  if (node.kind === 177 /* GetAccessor */) {
@@ -133087,7 +133213,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
133087
133213
  } else if (isValueSignatureDeclaration(fn)) {
133088
133214
  returnType = typeFromSingleReturnExpression(fn, context);
133089
133215
  }
133090
- return returnType.type !== void 0 ? returnType.type : inferReturnTypeOfSignatureSignature(fn, context, reportFallback && returnType.reportFallback && !returnTypeNode);
133216
+ return returnType.type !== void 0 ? returnType.type : inferReturnTypeOfSignatureSignature(fn, context, symbol, reportFallback && returnType.reportFallback && !returnTypeNode);
133091
133217
  }
133092
133218
  function typeFromSingleReturnExpression(declaration, context) {
133093
133219
  let candidateExpr;