typescript 5.0.0-dev.20230214 → 5.0.0-dev.20230216

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsserver.js CHANGED
@@ -2287,7 +2287,7 @@ module.exports = __toCommonJS(server_exports);
2287
2287
 
2288
2288
  // src/compiler/corePublic.ts
2289
2289
  var versionMajorMinor = "5.0";
2290
- var version = `${versionMajorMinor}.0-dev.20230214`;
2290
+ var version = `${versionMajorMinor}.0-dev.20230216`;
2291
2291
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2292
2292
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2293
2293
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -6671,13 +6671,14 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
6671
6671
  TypeFlags2[TypeFlags2["AnyOrUnknown"] = 3] = "AnyOrUnknown";
6672
6672
  TypeFlags2[TypeFlags2["Nullable"] = 98304] = "Nullable";
6673
6673
  TypeFlags2[TypeFlags2["Literal"] = 2944] = "Literal";
6674
- TypeFlags2[TypeFlags2["Unit"] = 109440] = "Unit";
6674
+ TypeFlags2[TypeFlags2["Unit"] = 109472] = "Unit";
6675
+ TypeFlags2[TypeFlags2["Freshable"] = 2976] = "Freshable";
6675
6676
  TypeFlags2[TypeFlags2["StringOrNumberLiteral"] = 384] = "StringOrNumberLiteral";
6676
6677
  TypeFlags2[TypeFlags2["StringOrNumberLiteralOrUnique"] = 8576] = "StringOrNumberLiteralOrUnique";
6677
6678
  TypeFlags2[TypeFlags2["DefinitelyFalsy"] = 117632] = "DefinitelyFalsy";
6678
6679
  TypeFlags2[TypeFlags2["PossiblyFalsy"] = 117724] = "PossiblyFalsy";
6679
6680
  TypeFlags2[TypeFlags2["Intrinsic"] = 67359327] = "Intrinsic";
6680
- TypeFlags2[TypeFlags2["Primitive"] = 131068] = "Primitive";
6681
+ TypeFlags2[TypeFlags2["Primitive"] = 134348796] = "Primitive";
6681
6682
  TypeFlags2[TypeFlags2["StringLike"] = 402653316] = "StringLike";
6682
6683
  TypeFlags2[TypeFlags2["NumberLike"] = 296] = "NumberLike";
6683
6684
  TypeFlags2[TypeFlags2["BigIntLike"] = 2112] = "BigIntLike";
@@ -31302,7 +31303,6 @@ var Parser;
31302
31303
  return canFollowExportModifier();
31303
31304
  case 88 /* DefaultKeyword */:
31304
31305
  return nextTokenCanFollowDefaultKeyword();
31305
- case 127 /* AccessorKeyword */:
31306
31306
  case 124 /* StaticKeyword */:
31307
31307
  case 137 /* GetKeyword */:
31308
31308
  case 151 /* SetKeyword */:
@@ -47095,6 +47095,7 @@ var SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
47095
47095
  SignatureCheckMode3[SignatureCheckMode3["StrictCallback"] = 2] = "StrictCallback";
47096
47096
  SignatureCheckMode3[SignatureCheckMode3["IgnoreReturnTypes"] = 4] = "IgnoreReturnTypes";
47097
47097
  SignatureCheckMode3[SignatureCheckMode3["StrictArity"] = 8] = "StrictArity";
47098
+ SignatureCheckMode3[SignatureCheckMode3["StrictTopSignature"] = 16] = "StrictTopSignature";
47098
47099
  SignatureCheckMode3[SignatureCheckMode3["Callback"] = 3] = "Callback";
47099
47100
  return SignatureCheckMode3;
47100
47101
  })(SignatureCheckMode || {});
@@ -47369,15 +47370,14 @@ function createTypeChecker(host) {
47369
47370
  getTypeOfPropertyOfContextualType,
47370
47371
  getFullyQualifiedName,
47371
47372
  getResolvedSignature: (node, candidatesOutArray, argumentCount) => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 0 /* Normal */),
47372
- getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray) => getResolvedSignatureWorker(
47373
+ getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray) => runWithInferenceBlockedFromSourceNode(editingArgument, () => getResolvedSignatureWorker(
47373
47374
  call,
47374
47375
  candidatesOutArray,
47375
47376
  /*argumentCount*/
47376
47377
  void 0,
47377
- 32 /* IsForStringLiteralArgumentCompletions */,
47378
- editingArgument
47379
- ),
47380
- getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */),
47378
+ 32 /* IsForStringLiteralArgumentCompletions */
47379
+ )),
47380
+ getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */)),
47381
47381
  getExpandedParameters,
47382
47382
  hasEffectiveRestParameter,
47383
47383
  containsArgumentsReference,
@@ -47571,32 +47571,41 @@ function createTypeChecker(host) {
47571
47571
  getMemberOverrideModifierStatus,
47572
47572
  isTypeParameterPossiblyReferenced
47573
47573
  };
47574
- function runWithInferenceBlockedFromSourceNode(node, fn) {
47574
+ function runWithoutResolvedSignatureCaching(node, fn) {
47575
47575
  const containingCall = findAncestor(node, isCallLikeExpression);
47576
47576
  const containingCallResolvedSignature = containingCall && getNodeLinks(containingCall).resolvedSignature;
47577
+ if (containingCall) {
47578
+ getNodeLinks(containingCall).resolvedSignature = void 0;
47579
+ }
47580
+ const result = fn();
47581
+ if (containingCall) {
47582
+ getNodeLinks(containingCall).resolvedSignature = containingCallResolvedSignature;
47583
+ }
47584
+ return result;
47585
+ }
47586
+ function runWithInferenceBlockedFromSourceNode(node, fn) {
47587
+ const containingCall = findAncestor(node, isCallLikeExpression);
47577
47588
  if (containingCall) {
47578
47589
  let toMarkSkip = node;
47579
47590
  do {
47580
47591
  getNodeLinks(toMarkSkip).skipDirectInference = true;
47581
47592
  toMarkSkip = toMarkSkip.parent;
47582
47593
  } while (toMarkSkip && toMarkSkip !== containingCall);
47583
- getNodeLinks(containingCall).resolvedSignature = void 0;
47584
47594
  }
47585
- const result = fn();
47595
+ const result = runWithoutResolvedSignatureCaching(node, fn);
47586
47596
  if (containingCall) {
47587
47597
  let toMarkSkip = node;
47588
47598
  do {
47589
47599
  getNodeLinks(toMarkSkip).skipDirectInference = void 0;
47590
47600
  toMarkSkip = toMarkSkip.parent;
47591
47601
  } while (toMarkSkip && toMarkSkip !== containingCall);
47592
- getNodeLinks(containingCall).resolvedSignature = containingCallResolvedSignature;
47593
47602
  }
47594
47603
  return result;
47595
47604
  }
47596
- function getResolvedSignatureWorker(nodeIn, candidatesOutArray, argumentCount, checkMode, editingArgument) {
47605
+ function getResolvedSignatureWorker(nodeIn, candidatesOutArray, argumentCount, checkMode) {
47597
47606
  const node = getParseTreeNode(nodeIn, isCallLikeExpression);
47598
47607
  apparentArgumentCount = argumentCount;
47599
- const res = !node ? void 0 : editingArgument ? runWithInferenceBlockedFromSourceNode(editingArgument, () => getResolvedSignature(node, candidatesOutArray, checkMode)) : getResolvedSignature(node, candidatesOutArray, checkMode);
47608
+ const res = !node ? void 0 : getResolvedSignature(node, candidatesOutArray, checkMode);
47600
47609
  apparentArgumentCount = void 0;
47601
47610
  return res;
47602
47611
  }
@@ -50558,7 +50567,7 @@ function createTypeChecker(host) {
50558
50567
  return shouldTreatPropertiesOfExternalModuleAsExports(type) ? getPropertyOfType(type, memberName) : void 0;
50559
50568
  }
50560
50569
  function shouldTreatPropertiesOfExternalModuleAsExports(resolvedExternalModuleType) {
50561
- return !(resolvedExternalModuleType.flags & 131068 /* Primitive */ || getObjectFlags(resolvedExternalModuleType) & 1 /* Class */ || // `isArrayOrTupleLikeType` is too expensive to use in this auto-imports hot path
50570
+ return !(resolvedExternalModuleType.flags & 134348796 /* Primitive */ || getObjectFlags(resolvedExternalModuleType) & 1 /* Class */ || // `isArrayOrTupleLikeType` is too expensive to use in this auto-imports hot path
50562
50571
  isArrayType(resolvedExternalModuleType) || isTupleType(resolvedExternalModuleType));
50563
50572
  }
50564
50573
  function getExportsOfSymbol(symbol) {
@@ -54757,8 +54766,8 @@ function createTypeChecker(host) {
54757
54766
  const t = types[i];
54758
54767
  flags |= t.flags;
54759
54768
  if (!(t.flags & 98304 /* Nullable */)) {
54760
- if (t.flags & (512 /* BooleanLiteral */ | 1024 /* EnumLiteral */)) {
54761
- const baseType = t.flags & 512 /* BooleanLiteral */ ? booleanType : getBaseTypeOfEnumLiteralType(t);
54769
+ if (t.flags & (512 /* BooleanLiteral */ | 1056 /* EnumLike */)) {
54770
+ const baseType = t.flags & 512 /* BooleanLiteral */ ? booleanType : getBaseTypeOfEnumLikeType(t);
54762
54771
  if (baseType.flags & 1048576 /* Union */) {
54763
54772
  const count = baseType.types.length;
54764
54773
  if (i + count <= types.length && getRegularTypeOfLiteralType(types[i + count - 1]) === getRegularTypeOfLiteralType(baseType.types[count - 1])) {
@@ -56635,8 +56644,8 @@ function createTypeChecker(host) {
56635
56644
  }
56636
56645
  return links.declaredType;
56637
56646
  }
56638
- function getBaseTypeOfEnumLiteralType(type) {
56639
- return type.flags & 1024 /* EnumLiteral */ && !(type.flags & 1048576 /* Union */) ? getDeclaredTypeOfSymbol(getParentOfSymbol(type.symbol)) : type;
56647
+ function getBaseTypeOfEnumLikeType(type) {
56648
+ return type.flags & 1056 /* EnumLike */ && type.symbol.flags & 8 /* EnumMember */ ? getDeclaredTypeOfSymbol(getParentOfSymbol(type.symbol)) : type;
56640
56649
  }
56641
56650
  function getDeclaredTypeOfEnum(symbol) {
56642
56651
  const links = getSymbolLinks(symbol);
@@ -56649,7 +56658,7 @@ function createTypeChecker(host) {
56649
56658
  if (hasBindableName(member)) {
56650
56659
  const memberSymbol = getSymbolOfDeclaration(member);
56651
56660
  const value = getEnumMemberValue(member);
56652
- const memberType = value !== void 0 ? getFreshTypeOfLiteralType(getEnumLiteralType(value, getSymbolId(symbol), memberSymbol)) : createTypeWithSymbol(32 /* Enum */, memberSymbol);
56661
+ const memberType = getFreshTypeOfLiteralType(value !== void 0 ? getEnumLiteralType(value, getSymbolId(symbol), memberSymbol) : createComputedEnumType(memberSymbol));
56653
56662
  getSymbolLinks(memberSymbol).declaredType = memberType;
56654
56663
  memberTypeList.push(getRegularTypeOfLiteralType(memberType));
56655
56664
  }
@@ -56663,7 +56672,7 @@ function createTypeChecker(host) {
56663
56672
  symbol,
56664
56673
  /*aliasTypeArguments*/
56665
56674
  void 0
56666
- ) : createTypeWithSymbol(32 /* Enum */, symbol);
56675
+ ) : createComputedEnumType(symbol);
56667
56676
  if (enumType.flags & 1048576 /* Union */) {
56668
56677
  enumType.flags |= 1024 /* EnumLiteral */;
56669
56678
  enumType.symbol = symbol;
@@ -56672,6 +56681,15 @@ function createTypeChecker(host) {
56672
56681
  }
56673
56682
  return links.declaredType;
56674
56683
  }
56684
+ function createComputedEnumType(symbol) {
56685
+ const regularType = createTypeWithSymbol(32 /* Enum */, symbol);
56686
+ const freshType = createTypeWithSymbol(32 /* Enum */, symbol);
56687
+ regularType.regularType = regularType;
56688
+ regularType.freshType = freshType;
56689
+ freshType.regularType = regularType;
56690
+ freshType.freshType = freshType;
56691
+ return regularType;
56692
+ }
56675
56693
  function getDeclaredTypeOfEnumMember(symbol) {
56676
56694
  const links = getSymbolLinks(symbol);
56677
56695
  if (!links.declaredType) {
@@ -60360,7 +60378,7 @@ function createTypeChecker(host) {
60360
60378
  orderedRemoveItemAt(typeSet, 1);
60361
60379
  }
60362
60380
  }
60363
- if (includes & (2944 /* Literal */ | 8192 /* UniqueESSymbol */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) || includes & 16384 /* Void */ && includes & 32768 /* Undefined */) {
60381
+ if (includes & (32 /* Enum */ | 2944 /* Literal */ | 8192 /* UniqueESSymbol */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) || includes & 16384 /* Void */ && includes & 32768 /* Undefined */) {
60364
60382
  removeRedundantLiteralTypes(typeSet, includes, !!(unionReduction & 2 /* Subtype */));
60365
60383
  }
60366
60384
  if (includes & 128 /* StringLiteral */ && includes & 134217728 /* TemplateLiteral */) {
@@ -60491,7 +60509,7 @@ function createTypeChecker(host) {
60491
60509
  type = undefinedType;
60492
60510
  }
60493
60511
  if (!typeSet.has(type.id.toString())) {
60494
- if (type.flags & 109440 /* Unit */ && includes & 109440 /* Unit */) {
60512
+ if (type.flags & 109472 /* Unit */ && includes & 109472 /* Unit */) {
60495
60513
  includes |= 67108864 /* NonPrimitive */;
60496
60514
  }
60497
60515
  typeSet.set(type.id.toString(), type);
@@ -60767,7 +60785,7 @@ function createTypeChecker(host) {
60767
60785
  const typeVariable = getTypeParameterFromMappedType(mappedType);
60768
60786
  return isDistributive(getNameTypeFromMappedType(mappedType) || typeVariable);
60769
60787
  function isDistributive(type) {
60770
- return type.flags & (3 /* AnyOrUnknown */ | 131068 /* Primitive */ | 131072 /* Never */ | 262144 /* TypeParameter */ | 524288 /* Object */ | 67108864 /* NonPrimitive */) ? true : type.flags & 16777216 /* Conditional */ ? type.root.isDistributive && type.checkType === typeVariable : type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */) ? every(type.types, isDistributive) : type.flags & 8388608 /* IndexedAccess */ ? isDistributive(type.objectType) && isDistributive(type.indexType) : type.flags & 33554432 /* Substitution */ ? isDistributive(type.baseType) && isDistributive(type.constraint) : type.flags & 268435456 /* StringMapping */ ? isDistributive(type.type) : false;
60788
+ return type.flags & (3 /* AnyOrUnknown */ | 134348796 /* Primitive */ | 131072 /* Never */ | 262144 /* TypeParameter */ | 524288 /* Object */ | 67108864 /* NonPrimitive */) ? true : type.flags & 16777216 /* Conditional */ ? type.root.isDistributive && type.checkType === typeVariable : type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */) ? every(type.types, isDistributive) : type.flags & 8388608 /* IndexedAccess */ ? isDistributive(type.objectType) && isDistributive(type.indexType) : type.flags & 33554432 /* Substitution */ ? isDistributive(type.baseType) && isDistributive(type.constraint) : type.flags & 268435456 /* StringMapping */ ? isDistributive(type.type) : false;
60771
60789
  }
60772
60790
  }
60773
60791
  function getLiteralTypeFromPropertyName(name) {
@@ -61864,7 +61882,7 @@ function createTypeChecker(host) {
61864
61882
  return type;
61865
61883
  }
61866
61884
  function getFreshTypeOfLiteralType(type) {
61867
- if (type.flags & 2944 /* Literal */) {
61885
+ if (type.flags & 2976 /* Freshable */) {
61868
61886
  if (!type.freshType) {
61869
61887
  const freshType = createLiteralType(type.flags, type.value, type.symbol, type);
61870
61888
  freshType.freshType = freshType;
@@ -61875,10 +61893,10 @@ function createTypeChecker(host) {
61875
61893
  return type;
61876
61894
  }
61877
61895
  function getRegularTypeOfLiteralType(type) {
61878
- return type.flags & 2944 /* Literal */ ? type.regularType : type.flags & 1048576 /* Union */ ? type.regularType || (type.regularType = mapType(type, getRegularTypeOfLiteralType)) : type;
61896
+ return type.flags & 2976 /* Freshable */ ? type.regularType : type.flags & 1048576 /* Union */ ? type.regularType || (type.regularType = mapType(type, getRegularTypeOfLiteralType)) : type;
61879
61897
  }
61880
61898
  function isFreshLiteralType(type) {
61881
- return !!(type.flags & 2944 /* Literal */) && type.freshType === type;
61899
+ return !!(type.flags & 2976 /* Freshable */) && type.freshType === type;
61882
61900
  }
61883
61901
  function getStringLiteralType(value) {
61884
61902
  let type;
@@ -62557,13 +62575,13 @@ function createTypeChecker(host) {
62557
62575
  return type;
62558
62576
  }
62559
62577
  function getUniqueLiteralFilledInstantiation(type) {
62560
- return type.flags & (131068 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
62578
+ return type.flags & (134348796 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
62561
62579
  }
62562
62580
  function getPermissiveInstantiation(type) {
62563
- return type.flags & (131068 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.permissiveInstantiation || (type.permissiveInstantiation = instantiateType(type, permissiveMapper));
62581
+ return type.flags & (134348796 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.permissiveInstantiation || (type.permissiveInstantiation = instantiateType(type, permissiveMapper));
62564
62582
  }
62565
62583
  function getRestrictiveInstantiation(type) {
62566
- if (type.flags & (131068 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */)) {
62584
+ if (type.flags & (134348796 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */)) {
62567
62585
  return type;
62568
62586
  }
62569
62587
  if (type.restrictiveInstantiation) {
@@ -63143,7 +63161,7 @@ function createTypeChecker(host) {
63143
63161
  }
63144
63162
  }
63145
63163
  function elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
63146
- if (target.flags & (131068 /* Primitive */ | 131072 /* Never */))
63164
+ if (target.flags & (134348796 /* Primitive */ | 131072 /* Never */))
63147
63165
  return false;
63148
63166
  if (isTupleLikeType(source)) {
63149
63167
  return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation, containingMessageChain, errorOutputContainer);
@@ -63192,7 +63210,7 @@ function createTypeChecker(host) {
63192
63210
  }
63193
63211
  }
63194
63212
  function elaborateObjectLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
63195
- if (target.flags & (131068 /* Primitive */ | 131072 /* Never */))
63213
+ if (target.flags & (134348796 /* Primitive */ | 131072 /* Never */))
63196
63214
  return false;
63197
63215
  return elaborateElementwise(generateObjectLiteralElements(node), source, target, relation, containingMessageChain, errorOutputContainer);
63198
63216
  }
@@ -63215,16 +63233,24 @@ function createTypeChecker(host) {
63215
63233
  void 0
63216
63234
  ) !== 0 /* False */;
63217
63235
  }
63218
- function isAnySignature(s) {
63219
- return !s.typeParameters && (!s.thisParameter || isTypeAny(getTypeOfParameter(s.thisParameter))) && s.parameters.length === 1 && signatureHasRestParameter(s) && (getTypeOfParameter(s.parameters[0]) === anyArrayType || isTypeAny(getTypeOfParameter(s.parameters[0]))) && isTypeAny(getReturnTypeOfSignature(s));
63236
+ function isTopSignature(s) {
63237
+ if (!s.typeParameters && (!s.thisParameter || isTypeAny(getTypeOfParameter(s.thisParameter))) && s.parameters.length === 1 && signatureHasRestParameter(s)) {
63238
+ const paramType = getTypeOfParameter(s.parameters[0]);
63239
+ const restType = isArrayType(paramType) ? getTypeArguments(paramType)[0] : paramType;
63240
+ return !!(restType.flags & (1 /* Any */ | 131072 /* Never */) && getReturnTypeOfSignature(s).flags & 3 /* AnyOrUnknown */);
63241
+ }
63242
+ return false;
63220
63243
  }
63221
63244
  function compareSignaturesRelated(source, target, checkMode, reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) {
63222
63245
  if (source === target) {
63223
63246
  return -1 /* True */;
63224
63247
  }
63225
- if (isAnySignature(target)) {
63248
+ if (!(checkMode & 16 /* StrictTopSignature */ && isTopSignature(source)) && isTopSignature(target)) {
63226
63249
  return -1 /* True */;
63227
63250
  }
63251
+ if (checkMode & 16 /* StrictTopSignature */ && isTopSignature(source) && !isTopSignature(target)) {
63252
+ return 0 /* False */;
63253
+ }
63228
63254
  const targetCount = getParameterCount(target);
63229
63255
  const sourceHasMoreParameters = !hasEffectiveRestParameter(target) && (checkMode & 8 /* StrictArity */ ? hasEffectiveRestParameter(source) || getParameterCount(source) > targetCount : getMinArgumentCount(source) > targetCount);
63230
63256
  if (sourceHasMoreParameters) {
@@ -63442,7 +63468,9 @@ function createTypeChecker(host) {
63442
63468
  function isSimpleTypeRelatedTo(source, target, relation, errorReporter) {
63443
63469
  const s = source.flags;
63444
63470
  const t = target.flags;
63445
- if (t & 3 /* AnyOrUnknown */ || s & 131072 /* Never */ || source === wildcardType)
63471
+ if (t & 1 /* Any */ || s & 131072 /* Never */ || source === wildcardType)
63472
+ return true;
63473
+ if (t & 2 /* Unknown */ && !(relation === strictSubtypeRelation && s & 1 /* Any */))
63446
63474
  return true;
63447
63475
  if (t & 131072 /* Never */)
63448
63476
  return false;
@@ -63839,7 +63867,7 @@ function createTypeChecker(host) {
63839
63867
  return isRelatedTo(source2, target2, 3 /* Both */, reportErrors2);
63840
63868
  }
63841
63869
  function isRelatedTo(originalSource, originalTarget, recursionFlags = 3 /* Both */, reportErrors2 = false, headMessage2, intersectionState = 0 /* None */) {
63842
- if (originalSource.flags & 524288 /* Object */ && originalTarget.flags & 131068 /* Primitive */) {
63870
+ if (originalSource.flags & 524288 /* Object */ && originalTarget.flags & 134348796 /* Primitive */) {
63843
63871
  if (relation === comparableRelation && !(originalTarget.flags & 131072 /* Never */) && isSimpleTypeRelatedTo(originalTarget, originalSource, relation) || isSimpleTypeRelatedTo(originalSource, originalTarget, relation, reportErrors2 ? reportError : void 0)) {
63844
63872
  return -1 /* True */;
63845
63873
  }
@@ -63903,7 +63931,7 @@ function createTypeChecker(host) {
63903
63931
  return 0 /* False */;
63904
63932
  }
63905
63933
  }
63906
- const isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source2)) && !(intersectionState & 2 /* Target */) && source2.flags & (131068 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source2 !== globalObjectType && target2.flags & (524288 /* Object */ | 2097152 /* Intersection */) && isWeakType(target2) && (getPropertiesOfType(source2).length > 0 || typeHasCallOrConstructSignatures2(source2));
63934
+ const isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source2)) && !(intersectionState & 2 /* Target */) && source2.flags & (134348796 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source2 !== globalObjectType && target2.flags & (524288 /* Object */ | 2097152 /* Intersection */) && isWeakType(target2) && (getPropertiesOfType(source2).length > 0 || typeHasCallOrConstructSignatures2(source2));
63907
63935
  const isComparingJsxAttributes = !!(getObjectFlags(source2) & 2048 /* JsxAttributes */);
63908
63936
  if (isPerformingCommonPropertyChecks && !hasCommonProperties(source2, target2, isComparingJsxAttributes)) {
63909
63937
  if (reportErrors2) {
@@ -63965,7 +63993,7 @@ function createTypeChecker(host) {
63965
63993
  maybeSuppress = !!errorInfo;
63966
63994
  }
63967
63995
  }
63968
- if (source2.flags & 524288 /* Object */ && target2.flags & 131068 /* Primitive */) {
63996
+ if (source2.flags & 524288 /* Object */ && target2.flags & 134348796 /* Primitive */) {
63969
63997
  tryElaborateErrorsForPrimitivesAndObjects(source2, target2);
63970
63998
  } else if (source2.symbol && source2.flags & 524288 /* Object */ && globalObjectType === source2) {
63971
63999
  reportError(Diagnostics.The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead);
@@ -64111,15 +64139,15 @@ function createTypeChecker(host) {
64111
64139
  }
64112
64140
  function unionOrIntersectionRelatedTo(source2, target2, reportErrors2, intersectionState) {
64113
64141
  if (source2.flags & 1048576 /* Union */) {
64114
- return relation === comparableRelation ? someTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 131068 /* Primitive */), intersectionState) : eachTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 131068 /* Primitive */), intersectionState);
64142
+ return relation === comparableRelation ? someTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 134348796 /* Primitive */), intersectionState) : eachTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 134348796 /* Primitive */), intersectionState);
64115
64143
  }
64116
64144
  if (target2.flags & 1048576 /* Union */) {
64117
- return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 131068 /* Primitive */) && !(target2.flags & 131068 /* Primitive */));
64145
+ return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 134348796 /* Primitive */) && !(target2.flags & 134348796 /* Primitive */));
64118
64146
  }
64119
64147
  if (target2.flags & 2097152 /* Intersection */) {
64120
64148
  return typeRelatedToEachType(source2, target2, reportErrors2, 2 /* Target */);
64121
64149
  }
64122
- if (relation === comparableRelation && target2.flags & 131068 /* Primitive */) {
64150
+ if (relation === comparableRelation && target2.flags & 134348796 /* Primitive */) {
64123
64151
  const constraints = sameMap(source2.types, (t) => t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(t) || unknownType : t);
64124
64152
  if (constraints !== source2.types) {
64125
64153
  source2 = getIntersectionType(constraints);
@@ -65012,7 +65040,7 @@ function createTypeChecker(host) {
65012
65040
  }
65013
65041
  return 0 /* False */;
65014
65042
  }
65015
- const sourceIsPrimitive = !!(sourceFlags & 131068 /* Primitive */);
65043
+ const sourceIsPrimitive = !!(sourceFlags & 134348796 /* Primitive */);
65016
65044
  if (relation !== identityRelation) {
65017
65045
  source2 = getApparentType(source2);
65018
65046
  sourceFlags = source2.flags;
@@ -65682,10 +65710,11 @@ function createTypeChecker(host) {
65682
65710
  return (source2, target2) => reportIncompatibleError(Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible, typeToString(source2), typeToString(target2));
65683
65711
  }
65684
65712
  function signatureRelatedTo(source2, target2, erase, reportErrors2, intersectionState, incompatibleReporter) {
65713
+ const checkMode = relation === subtypeRelation ? 16 /* StrictTopSignature */ : relation === strictSubtypeRelation ? 16 /* StrictTopSignature */ | 8 /* StrictArity */ : 0 /* None */;
65685
65714
  return compareSignaturesRelated(
65686
65715
  erase ? getErasedSignature(source2) : source2,
65687
65716
  erase ? getErasedSignature(target2) : target2,
65688
- relation === strictSubtypeRelation ? 8 /* StrictArity */ : 0,
65717
+ checkMode,
65689
65718
  reportErrors2,
65690
65719
  reportError,
65691
65720
  incompatibleReporter,
@@ -65810,7 +65839,7 @@ function createTypeChecker(host) {
65810
65839
  if (sourceInfo) {
65811
65840
  return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2, intersectionState);
65812
65841
  }
65813
- if (!(intersectionState & 1 /* Source */) && isObjectTypeWithInferableIndex(source2)) {
65842
+ if (!(intersectionState & 1 /* Source */) && (relation !== strictSubtypeRelation || getObjectFlags(source2) & 8192 /* FreshLiteral */) && isObjectTypeWithInferableIndex(source2)) {
65814
65843
  return membersRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState);
65815
65844
  }
65816
65845
  if (reportErrors2) {
@@ -66355,10 +66384,10 @@ function createTypeChecker(host) {
66355
66384
  return void 0;
66356
66385
  }
66357
66386
  function isNeitherUnitTypeNorNever(type) {
66358
- return !(type.flags & (109440 /* Unit */ | 131072 /* Never */));
66387
+ return !(type.flags & (109472 /* Unit */ | 131072 /* Never */));
66359
66388
  }
66360
66389
  function isUnitType(type) {
66361
- return !!(type.flags & 109440 /* Unit */);
66390
+ return !!(type.flags & 109472 /* Unit */);
66362
66391
  }
66363
66392
  function isUnitLikeType(type) {
66364
66393
  const t = getBaseConstraintOrType(type);
@@ -66371,7 +66400,7 @@ function createTypeChecker(host) {
66371
66400
  return type.flags & 16 /* Boolean */ ? true : type.flags & 1048576 /* Union */ ? type.flags & 1024 /* EnumLiteral */ ? true : every(type.types, isUnitType) : isUnitType(type);
66372
66401
  }
66373
66402
  function getBaseTypeOfLiteralType(type) {
66374
- return type.flags & 1024 /* EnumLiteral */ ? getBaseTypeOfEnumLiteralType(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;
66403
+ 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;
66375
66404
  }
66376
66405
  function getBaseTypeOfLiteralTypeUnion(type) {
66377
66406
  var _a2;
@@ -66379,7 +66408,7 @@ function createTypeChecker(host) {
66379
66408
  return (_a2 = getCachedType(key)) != null ? _a2 : setCachedType(key, mapType(type, getBaseTypeOfLiteralType));
66380
66409
  }
66381
66410
  function getWidenedLiteralType(type) {
66382
- return type.flags & 1024 /* EnumLiteral */ && isFreshLiteralType(type) ? getBaseTypeOfEnumLiteralType(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;
66411
+ 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;
66383
66412
  }
66384
66413
  function getWidenedUniqueESSymbolType(type) {
66385
66414
  return type.flags & 8192 /* UniqueESSymbol */ ? esSymbolType : type.flags & 1048576 /* Union */ ? mapType(type, getWidenedUniqueESSymbolType) : type;
@@ -66912,8 +66941,8 @@ function createTypeChecker(host) {
66912
66941
  }
66913
66942
  return false;
66914
66943
  }
66915
- function isTypeParameterAtTopLevel(type, typeParameter) {
66916
- return !!(type === typeParameter || type.flags & 3145728 /* UnionOrIntersection */ && some(type.types, (t) => isTypeParameterAtTopLevel(t, typeParameter)) || type.flags & 16777216 /* Conditional */ && (getTrueTypeFromConditionalType(type) === typeParameter || getFalseTypeFromConditionalType(type) === typeParameter));
66944
+ function isTypeParameterAtTopLevel(type, tp, depth = 0) {
66945
+ return !!(type === tp || type.flags & 3145728 /* UnionOrIntersection */ && some(type.types, (t) => isTypeParameterAtTopLevel(t, tp, depth)) || depth < 3 && type.flags & 16777216 /* Conditional */ && (isTypeParameterAtTopLevel(getTrueTypeFromConditionalType(type), tp, depth + 1) || isTypeParameterAtTopLevel(getFalseTypeFromConditionalType(type), tp, depth + 1)));
66917
66946
  }
66918
66947
  function isTypeParameterAtTopLevelInReturnType(signature, typeParameter) {
66919
66948
  const typePredicate = getTypePredicateOfSignature(signature);
@@ -67007,7 +67036,7 @@ function createTypeChecker(host) {
67007
67036
  yield targetProp;
67008
67037
  } else if (matchDiscriminantProperties) {
67009
67038
  const targetType = getTypeOfSymbol(targetProp);
67010
- if (targetType.flags & 109440 /* Unit */) {
67039
+ if (targetType.flags & 109472 /* Unit */) {
67011
67040
  const sourceType = getTypeOfSymbol(sourceProp);
67012
67041
  if (!(sourceType.flags & 1 /* Any */ || getRegularTypeOfLiteralType(sourceType) === getRegularTypeOfLiteralType(targetType))) {
67013
67042
  yield targetProp;
@@ -67766,7 +67795,7 @@ function createTypeChecker(host) {
67766
67795
  }
67767
67796
  function hasPrimitiveConstraint(type) {
67768
67797
  const constraint = getConstraintOfTypeParameter(type);
67769
- return !!constraint && maybeTypeOfKind(constraint.flags & 16777216 /* Conditional */ ? getDefaultConstraintOfConditionalType(constraint) : constraint, 131068 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
67798
+ return !!constraint && maybeTypeOfKind(constraint.flags & 16777216 /* Conditional */ ? getDefaultConstraintOfConditionalType(constraint) : constraint, 134348796 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
67770
67799
  }
67771
67800
  function isObjectLiteralType2(type) {
67772
67801
  return !!(getObjectFlags(type) & 128 /* ObjectLiteral */);
@@ -68248,7 +68277,7 @@ function createTypeChecker(host) {
68248
68277
  return 83886079 /* UnknownFacts */;
68249
68278
  }
68250
68279
  function getIntersectionTypeFacts(type) {
68251
- const ignoreObjects = maybeTypeOfKind(type, 131068 /* Primitive */);
68280
+ const ignoreObjects = maybeTypeOfKind(type, 134348796 /* Primitive */);
68252
68281
  let oredFacts = 0 /* None */;
68253
68282
  let andedFacts = 134217727 /* All */;
68254
68283
  for (const t of type.types) {
@@ -68447,7 +68476,7 @@ function createTypeChecker(host) {
68447
68476
  }
68448
68477
  return true;
68449
68478
  }
68450
- if (source.flags & 1024 /* EnumLiteral */ && getBaseTypeOfEnumLiteralType(source) === target) {
68479
+ if (source.flags & 1056 /* EnumLike */ && getBaseTypeOfEnumLikeType(source) === target) {
68451
68480
  return true;
68452
68481
  }
68453
68482
  return containsType(target.types, source);
@@ -69511,7 +69540,7 @@ function createTypeChecker(host) {
69511
69540
  }
69512
69541
  if (assumeTrue) {
69513
69542
  if (!doubleEquals && (type.flags & 2 /* Unknown */ || someType(type, isEmptyAnonymousObjectType))) {
69514
- if (valueType.flags & (131068 /* Primitive */ | 67108864 /* NonPrimitive */) || isEmptyAnonymousObjectType(valueType)) {
69543
+ if (valueType.flags & (134348796 /* Primitive */ | 67108864 /* NonPrimitive */) || isEmptyAnonymousObjectType(valueType)) {
69515
69544
  return valueType;
69516
69545
  }
69517
69546
  if (valueType.flags & 524288 /* Object */) {
@@ -69561,7 +69590,7 @@ function createTypeChecker(host) {
69561
69590
  let groundClauseTypes;
69562
69591
  for (let i = 0; i < clauseTypes.length; i += 1) {
69563
69592
  const t = clauseTypes[i];
69564
- if (t.flags & (131068 /* Primitive */ | 67108864 /* NonPrimitive */)) {
69593
+ if (t.flags & (134348796 /* Primitive */ | 67108864 /* NonPrimitive */)) {
69565
69594
  if (groundClauseTypes !== void 0) {
69566
69595
  groundClauseTypes.push(t);
69567
69596
  }
@@ -69709,18 +69738,29 @@ function createTypeChecker(host) {
69709
69738
  return (_a3 = getCachedType(key2)) != null ? _a3 : setCachedType(key2, getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived));
69710
69739
  }
69711
69740
  function getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived) {
69712
- const isRelated = checkDerived ? isTypeDerivedFrom : isTypeSubtypeOf;
69713
69741
  if (!assumeTrue) {
69714
- return filterType(type, (t) => !isRelated(t, candidate));
69742
+ if (checkDerived) {
69743
+ return filterType(type, (t) => !isTypeDerivedFrom(t, candidate));
69744
+ }
69745
+ const trueType2 = getNarrowedType(
69746
+ type,
69747
+ candidate,
69748
+ /*assumeTrue*/
69749
+ true,
69750
+ /*checkDerived*/
69751
+ false
69752
+ );
69753
+ return filterType(type, (t) => !isTypeSubsetOf(t, trueType2));
69715
69754
  }
69716
69755
  if (type.flags & 3 /* AnyOrUnknown */) {
69717
69756
  return candidate;
69718
69757
  }
69758
+ const isRelated = checkDerived ? isTypeDerivedFrom : isTypeSubtypeOf;
69719
69759
  const keyPropertyName = type.flags & 1048576 /* Union */ ? getKeyPropertyName(type) : void 0;
69720
69760
  const narrowedType = mapType(candidate, (c) => {
69721
69761
  const discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
69722
69762
  const matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
69723
- const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeSubtypeOf(c, t) ? c : isTypeSubtypeOf(t, c) ? t : neverType);
69763
+ const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeSubtypeOf(c, t) && !isTypeIdenticalTo(c, t) ? c : isTypeSubtypeOf(t, c) ? t : neverType);
69724
69764
  return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated;
69725
69765
  });
69726
69766
  return !(narrowedType.flags & 131072 /* Never */) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]);
@@ -73060,7 +73100,7 @@ function createTypeChecker(host) {
73060
73100
  function reportNonexistentProperty(propNode, containingType, isUncheckedJS) {
73061
73101
  let errorInfo;
73062
73102
  let relatedInfo;
73063
- if (!isPrivateIdentifier(propNode) && containingType.flags & 1048576 /* Union */ && !(containingType.flags & 131068 /* Primitive */)) {
73103
+ if (!isPrivateIdentifier(propNode) && containingType.flags & 1048576 /* Union */ && !(containingType.flags & 134348796 /* Primitive */)) {
73064
73104
  for (const subtype of containingType.types) {
73065
73105
  if (!getPropertyOfType(subtype, propNode.escapedText) && !getApplicableIndexInfoForName(subtype, propNode.escapedText)) {
73066
73106
  errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Property_0_does_not_exist_on_type_1, declarationNameToString(propNode), typeToString(subtype));
@@ -73657,7 +73697,7 @@ function createTypeChecker(host) {
73657
73697
  } else {
73658
73698
  const contextualType = getIndexedAccessType(restType, getNumberLiteralType(i - index), 256 /* Contextual */);
73659
73699
  const argType = checkExpressionWithContextualType(arg, contextualType, context, checkMode);
73660
- const hasPrimitiveContextualType = inConstContext || maybeTypeOfKind(contextualType, 131068 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
73700
+ const hasPrimitiveContextualType = inConstContext || maybeTypeOfKind(contextualType, 134348796 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
73661
73701
  types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType));
73662
73702
  flags.push(1 /* Required */);
73663
73703
  }
@@ -76907,7 +76947,7 @@ function createTypeChecker(host) {
76907
76947
  if (leftType === silentNeverType || rightType === silentNeverType) {
76908
76948
  return silentNeverType;
76909
76949
  }
76910
- if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 131068 /* Primitive */)) {
76950
+ if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 134348796 /* Primitive */)) {
76911
76951
  error(left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
76912
76952
  }
76913
76953
  if (!(isTypeAny(rightType) || typeHasCallOrConstructSignatures2(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
@@ -77493,7 +77533,7 @@ function createTypeChecker(host) {
77493
77533
  return leftType;
77494
77534
  } else {
77495
77535
  checkAssignmentOperator(rightType);
77496
- return getRegularTypeOfObjectLiteral(rightType);
77536
+ return rightType;
77497
77537
  }
77498
77538
  case 27 /* CommaToken */:
77499
77539
  if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left) && !isIndirectCall(left.parent)) {
@@ -79426,7 +79466,7 @@ function createTypeChecker(host) {
79426
79466
  ))) {
79427
79467
  return typeAsPromise.promisedTypeOfPromise = getTypeArguments(type)[0];
79428
79468
  }
79429
- if (allTypesAssignableToKind(getBaseConstraintOrType(type), 131068 /* Primitive */ | 131072 /* Never */)) {
79469
+ if (allTypesAssignableToKind(getBaseConstraintOrType(type), 134348796 /* Primitive */ | 131072 /* Never */)) {
79430
79470
  return void 0;
79431
79471
  }
79432
79472
  const thenFunction = getTypeOfPropertyOfType(type, "then");
@@ -79478,7 +79518,7 @@ function createTypeChecker(host) {
79478
79518
  return awaitedType || errorType;
79479
79519
  }
79480
79520
  function isThenableType(type) {
79481
- if (allTypesAssignableToKind(getBaseConstraintOrType(type), 131068 /* Primitive */ | 131072 /* Never */)) {
79521
+ if (allTypesAssignableToKind(getBaseConstraintOrType(type), 134348796 /* Primitive */ | 131072 /* Never */)) {
79482
79522
  return false;
79483
79523
  }
79484
79524
  const thenFunction = getTypeOfPropertyOfType(type, "then");
@@ -79527,7 +79567,7 @@ function createTypeChecker(host) {
79527
79567
  return awaitedType;
79528
79568
  }
79529
79569
  }
79530
- Debug.assert(getPromisedTypeOfPromise(type) === void 0, "type provided should not be a non-generic 'promise'-like.");
79570
+ Debug.assert(isAwaitedTypeInstantiation(type) || getPromisedTypeOfPromise(type) === void 0, "type provided should not be a non-generic 'promise'-like.");
79531
79571
  return type;
79532
79572
  }
79533
79573
  function getAwaitedType(type, errorNode, diagnosticMessage, arg0) {
@@ -84876,7 +84916,7 @@ function createTypeChecker(host) {
84876
84916
  return !!(type.flags & 524288 /* Object */) && getSignaturesOfType(type, 0 /* Call */).length > 0;
84877
84917
  }
84878
84918
  function getTypeReferenceSerializationKind(typeNameIn, location) {
84879
- var _a2, _b;
84919
+ var _a2;
84880
84920
  const typeName = getParseTreeNode(typeNameIn, isEntityName);
84881
84921
  if (!typeName)
84882
84922
  return 0 /* Unknown */;
@@ -84908,7 +84948,7 @@ function createTypeChecker(host) {
84908
84948
  location
84909
84949
  );
84910
84950
  const resolvedSymbol = valueSymbol && valueSymbol.flags & 2097152 /* Alias */ ? resolveAlias(valueSymbol) : valueSymbol;
84911
- isTypeOnly || (isTypeOnly = !!((_b = valueSymbol == null ? void 0 : valueSymbol.declarations) == null ? void 0 : _b.every(isTypeOnlyImportOrExportDeclaration)));
84951
+ isTypeOnly || (isTypeOnly = !!(valueSymbol && getTypeOnlyAliasDeclaration(valueSymbol, 111551 /* Value */)));
84912
84952
  const typeSymbol = resolveEntityName(
84913
84953
  typeName,
84914
84954
  788968 /* Type */,
@@ -85059,7 +85099,7 @@ function createTypeChecker(host) {
85059
85099
  return false;
85060
85100
  }
85061
85101
  function literalTypeToNode(type, enclosing, tracker) {
85062
- const enumResult = type.flags & 1024 /* EnumLiteral */ ? nodeBuilder.symbolToExpression(
85102
+ const enumResult = type.flags & 1056 /* EnumLike */ ? nodeBuilder.symbolToExpression(
85063
85103
  type.symbol,
85064
85104
  111551 /* Value */,
85065
85105
  enclosing,
@@ -86620,7 +86660,7 @@ function createTypeChecker(host) {
86620
86660
  }
86621
86661
  function isSimpleLiteralEnumReference(expr) {
86622
86662
  if ((isPropertyAccessExpression(expr) || isElementAccessExpression(expr) && isStringOrNumberLiteralExpression(expr.argumentExpression)) && isEntityNameExpression(expr.expression)) {
86623
- return !!(checkExpressionCached(expr).flags & 1024 /* EnumLiteral */);
86663
+ return !!(checkExpressionCached(expr).flags & 1056 /* EnumLike */);
86624
86664
  }
86625
86665
  }
86626
86666
  function checkAmbientInitializer(node) {
@@ -87022,10 +87062,10 @@ function createTypeChecker(host) {
87022
87062
  }
87023
87063
  function findMostOverlappyType(source, unionTarget) {
87024
87064
  let bestMatch;
87025
- if (!(source.flags & (131068 /* Primitive */ | 406847488 /* InstantiablePrimitive */))) {
87065
+ if (!(source.flags & (134348796 /* Primitive */ | 406847488 /* InstantiablePrimitive */))) {
87026
87066
  let matchingCount = 0;
87027
87067
  for (const target of unionTarget.types) {
87028
- if (!(target.flags & (131068 /* Primitive */ | 406847488 /* InstantiablePrimitive */))) {
87068
+ if (!(target.flags & (134348796 /* Primitive */ | 406847488 /* InstantiablePrimitive */))) {
87029
87069
  const overlap = getIntersectionType([getIndexType(source), getIndexType(target)]);
87030
87070
  if (overlap.flags & 4194304 /* Index */) {
87031
87071
  return target;
@@ -87043,7 +87083,7 @@ function createTypeChecker(host) {
87043
87083
  }
87044
87084
  function filterPrimitivesIfContainsNonPrimitive(type) {
87045
87085
  if (maybeTypeOfKind(type, 67108864 /* NonPrimitive */)) {
87046
- const result = filterType(type, (t) => !(t.flags & 131068 /* Primitive */));
87086
+ const result = filterType(type, (t) => !(t.flags & 134348796 /* Primitive */));
87047
87087
  if (!(result.flags & 131072 /* Never */)) {
87048
87088
  return result;
87049
87089
  }
@@ -141429,7 +141469,8 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
141429
141469
  quotePreference,
141430
141470
  defaultImport,
141431
141471
  namedImports && arrayFrom(namedImports.entries(), ([name, addAsTypeOnly]) => ({ addAsTypeOnly, name })),
141432
- namespaceLikeImport
141472
+ namespaceLikeImport,
141473
+ compilerOptions
141433
141474
  );
141434
141475
  newDeclarations = combine(newDeclarations, declarations);
141435
141476
  });
@@ -142091,7 +142132,14 @@ function codeActionForFixWorker(changes, sourceFile, symbolName2, fix, includeSy
142091
142132
  insertImports(
142092
142133
  changes,
142093
142134
  sourceFile,
142094
- getDeclarations(moduleSpecifier, quotePreference, defaultImport, namedImports, namespaceLikeImport),
142135
+ getDeclarations(
142136
+ moduleSpecifier,
142137
+ quotePreference,
142138
+ defaultImport,
142139
+ namedImports,
142140
+ namespaceLikeImport,
142141
+ compilerOptions
142142
+ ),
142095
142143
  /*blankLineBetween*/
142096
142144
  true,
142097
142145
  preferences
@@ -142273,11 +142321,11 @@ function getImportTypePrefix(moduleSpecifier, quotePreference) {
142273
142321
  function needsTypeOnly({ addAsTypeOnly }) {
142274
142322
  return addAsTypeOnly === 2 /* Required */;
142275
142323
  }
142276
- function getNewImports(moduleSpecifier, quotePreference, defaultImport, namedImports, namespaceLikeImport) {
142324
+ function getNewImports(moduleSpecifier, quotePreference, defaultImport, namedImports, namespaceLikeImport, compilerOptions) {
142277
142325
  const quotedModuleSpecifier = makeStringLiteral(moduleSpecifier, quotePreference);
142278
142326
  let statements;
142279
142327
  if (defaultImport !== void 0 || (namedImports == null ? void 0 : namedImports.length)) {
142280
- const topLevelTypeOnly = (!defaultImport || needsTypeOnly(defaultImport)) && every(namedImports, needsTypeOnly);
142328
+ const topLevelTypeOnly = (!defaultImport || needsTypeOnly(defaultImport)) && every(namedImports, needsTypeOnly) || compilerOptions.verbatimModuleSyntax && (defaultImport == null ? void 0 : defaultImport.addAsTypeOnly) !== 4 /* NotAllowed */ && !some(namedImports, (i) => i.addAsTypeOnly === 4 /* NotAllowed */);
142281
142329
  statements = combine(statements, makeImport(
142282
142330
  defaultImport && factory.createIdentifier(defaultImport.name),
142283
142331
  namedImports == null ? void 0 : namedImports.map(({ addAsTypeOnly, name }) => factory.createImportSpecifier(
@@ -146909,13 +146957,7 @@ function createMethodImplementingSignatures(checker, context, enclosingDeclarati
146909
146957
  function getReturnTypeFromSignatures(signatures, checker, context, enclosingDeclaration) {
146910
146958
  if (length(signatures)) {
146911
146959
  const type = checker.getUnionType(map(signatures, checker.getReturnTypeOfSignature));
146912
- return checker.typeToTypeNode(
146913
- type,
146914
- enclosingDeclaration,
146915
- /*flags*/
146916
- void 0,
146917
- getNoopSymbolTrackerWithResolver(context)
146918
- );
146960
+ return checker.typeToTypeNode(type, enclosingDeclaration, 1 /* NoTruncation */, getNoopSymbolTrackerWithResolver(context));
146919
146961
  }
146920
146962
  }
146921
146963
  function createStubbedMethod(modifiers, name, optional, typeParameters, parameters, returnType, quotePreference, body) {
@@ -151187,7 +151229,7 @@ function getPropertiesForObjectExpression(contextualType, completionsType, obj,
151187
151229
  function getApparentProperties(type, node, checker) {
151188
151230
  if (!type.isUnion())
151189
151231
  return type.getApparentProperties();
151190
- return checker.getAllPossiblePropertiesOfTypes(filter(type.types, (memberType) => !(memberType.flags & 131068 /* Primitive */ || checker.isArrayLikeType(memberType) || checker.isTypeInvalidDueToUnionDiscriminant(memberType, node) || typeHasCallOrConstructSignatures(memberType, checker) || memberType.isClass() && containsNonPublicProperties(memberType.getApparentProperties()))));
151232
+ return checker.getAllPossiblePropertiesOfTypes(filter(type.types, (memberType) => !(memberType.flags & 134348796 /* Primitive */ || checker.isArrayLikeType(memberType) || checker.isTypeInvalidDueToUnionDiscriminant(memberType, node) || typeHasCallOrConstructSignatures(memberType, checker) || memberType.isClass() && containsNonPublicProperties(memberType.getApparentProperties()))));
151191
151233
  }
151192
151234
  function containsNonPublicProperties(props) {
151193
151235
  return some(props, (p) => !!(getDeclarationModifierFlagsFromSymbol(p) & 24 /* NonPublicAccessibilityModifier */));
@@ -155610,6 +155652,7 @@ var jsDocTagNames = [
155610
155652
  "module",
155611
155653
  "name",
155612
155654
  "namespace",
155655
+ "overload",
155613
155656
  "override",
155614
155657
  "package",
155615
155658
  "param",