typescript 5.0.0-dev.20230213 → 5.0.0-dev.20230215

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsc.js CHANGED
@@ -23,7 +23,7 @@ var __export = (target, all) => {
23
23
 
24
24
  // src/compiler/corePublic.ts
25
25
  var versionMajorMinor = "5.0";
26
- var version = `${versionMajorMinor}.0-dev.20230213`;
26
+ var version = `${versionMajorMinor}.0-dev.20230215`;
27
27
 
28
28
  // src/compiler/core.ts
29
29
  var emptyArray = [];
@@ -3748,13 +3748,14 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
3748
3748
  TypeFlags2[TypeFlags2["AnyOrUnknown"] = 3] = "AnyOrUnknown";
3749
3749
  TypeFlags2[TypeFlags2["Nullable"] = 98304] = "Nullable";
3750
3750
  TypeFlags2[TypeFlags2["Literal"] = 2944] = "Literal";
3751
- TypeFlags2[TypeFlags2["Unit"] = 109440] = "Unit";
3751
+ TypeFlags2[TypeFlags2["Unit"] = 109472] = "Unit";
3752
+ TypeFlags2[TypeFlags2["Freshable"] = 2976] = "Freshable";
3752
3753
  TypeFlags2[TypeFlags2["StringOrNumberLiteral"] = 384] = "StringOrNumberLiteral";
3753
3754
  TypeFlags2[TypeFlags2["StringOrNumberLiteralOrUnique"] = 8576] = "StringOrNumberLiteralOrUnique";
3754
3755
  TypeFlags2[TypeFlags2["DefinitelyFalsy"] = 117632] = "DefinitelyFalsy";
3755
3756
  TypeFlags2[TypeFlags2["PossiblyFalsy"] = 117724] = "PossiblyFalsy";
3756
3757
  TypeFlags2[TypeFlags2["Intrinsic"] = 67359327] = "Intrinsic";
3757
- TypeFlags2[TypeFlags2["Primitive"] = 131068] = "Primitive";
3758
+ TypeFlags2[TypeFlags2["Primitive"] = 134348796] = "Primitive";
3758
3759
  TypeFlags2[TypeFlags2["StringLike"] = 402653316] = "StringLike";
3759
3760
  TypeFlags2[TypeFlags2["NumberLike"] = 296] = "NumberLike";
3760
3761
  TypeFlags2[TypeFlags2["BigIntLike"] = 2112] = "BigIntLike";
@@ -12158,7 +12159,7 @@ function isCommonJSContainingModuleKind(kind) {
12158
12159
  return kind === 1 /* CommonJS */ || kind === 100 /* Node16 */ || kind === 199 /* NodeNext */;
12159
12160
  }
12160
12161
  function isEffectiveExternalModule(node, compilerOptions) {
12161
- return isExternalModule(node) || compilerOptions.isolatedModules || isCommonJSContainingModuleKind(getEmitModuleKind(compilerOptions)) && !!node.commonJsModuleIndicator;
12162
+ return isExternalModule(node) || getIsolatedModules(compilerOptions) || isCommonJSContainingModuleKind(getEmitModuleKind(compilerOptions)) && !!node.commonJsModuleIndicator;
12162
12163
  }
12163
12164
  function isEffectiveStrictModeSourceFile(node, compilerOptions) {
12164
12165
  switch (node.scriptKind) {
@@ -12179,7 +12180,7 @@ function isEffectiveStrictModeSourceFile(node, compilerOptions) {
12179
12180
  if (startsWithUseStrict(node.statements)) {
12180
12181
  return true;
12181
12182
  }
12182
- if (isExternalModule(node) || compilerOptions.isolatedModules) {
12183
+ if (isExternalModule(node) || getIsolatedModules(compilerOptions)) {
12183
12184
  if (getEmitModuleKind(compilerOptions) >= 5 /* ES2015 */) {
12184
12185
  return true;
12185
12186
  }
@@ -16235,7 +16236,7 @@ function getEmitDeclarations(compilerOptions) {
16235
16236
  return !!(compilerOptions.declaration || compilerOptions.composite);
16236
16237
  }
16237
16238
  function shouldPreserveConstEnums(compilerOptions) {
16238
- return !!(compilerOptions.preserveConstEnums || compilerOptions.isolatedModules);
16239
+ return !!(compilerOptions.preserveConstEnums || getIsolatedModules(compilerOptions));
16239
16240
  }
16240
16241
  function isIncrementalCompilation(options) {
16241
16242
  return !!(options.incremental || options.composite);
@@ -42519,6 +42520,7 @@ var SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
42519
42520
  SignatureCheckMode3[SignatureCheckMode3["StrictCallback"] = 2] = "StrictCallback";
42520
42521
  SignatureCheckMode3[SignatureCheckMode3["IgnoreReturnTypes"] = 4] = "IgnoreReturnTypes";
42521
42522
  SignatureCheckMode3[SignatureCheckMode3["StrictArity"] = 8] = "StrictArity";
42523
+ SignatureCheckMode3[SignatureCheckMode3["StrictTopSignature"] = 16] = "StrictTopSignature";
42522
42524
  SignatureCheckMode3[SignatureCheckMode3["Callback"] = 3] = "Callback";
42523
42525
  return SignatureCheckMode3;
42524
42526
  })(SignatureCheckMode || {});
@@ -42793,15 +42795,14 @@ function createTypeChecker(host) {
42793
42795
  getTypeOfPropertyOfContextualType,
42794
42796
  getFullyQualifiedName,
42795
42797
  getResolvedSignature: (node, candidatesOutArray, argumentCount) => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 0 /* Normal */),
42796
- getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray) => getResolvedSignatureWorker(
42798
+ getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray) => runWithInferenceBlockedFromSourceNode(editingArgument, () => getResolvedSignatureWorker(
42797
42799
  call,
42798
42800
  candidatesOutArray,
42799
42801
  /*argumentCount*/
42800
42802
  void 0,
42801
- 32 /* IsForStringLiteralArgumentCompletions */,
42802
- editingArgument
42803
- ),
42804
- getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */),
42803
+ 32 /* IsForStringLiteralArgumentCompletions */
42804
+ )),
42805
+ getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */)),
42805
42806
  getExpandedParameters,
42806
42807
  hasEffectiveRestParameter,
42807
42808
  containsArgumentsReference,
@@ -42995,32 +42996,41 @@ function createTypeChecker(host) {
42995
42996
  getMemberOverrideModifierStatus,
42996
42997
  isTypeParameterPossiblyReferenced
42997
42998
  };
42998
- function runWithInferenceBlockedFromSourceNode(node, fn) {
42999
+ function runWithoutResolvedSignatureCaching(node, fn) {
42999
43000
  const containingCall = findAncestor(node, isCallLikeExpression);
43000
43001
  const containingCallResolvedSignature = containingCall && getNodeLinks(containingCall).resolvedSignature;
43002
+ if (containingCall) {
43003
+ getNodeLinks(containingCall).resolvedSignature = void 0;
43004
+ }
43005
+ const result = fn();
43006
+ if (containingCall) {
43007
+ getNodeLinks(containingCall).resolvedSignature = containingCallResolvedSignature;
43008
+ }
43009
+ return result;
43010
+ }
43011
+ function runWithInferenceBlockedFromSourceNode(node, fn) {
43012
+ const containingCall = findAncestor(node, isCallLikeExpression);
43001
43013
  if (containingCall) {
43002
43014
  let toMarkSkip = node;
43003
43015
  do {
43004
43016
  getNodeLinks(toMarkSkip).skipDirectInference = true;
43005
43017
  toMarkSkip = toMarkSkip.parent;
43006
43018
  } while (toMarkSkip && toMarkSkip !== containingCall);
43007
- getNodeLinks(containingCall).resolvedSignature = void 0;
43008
43019
  }
43009
- const result = fn();
43020
+ const result = runWithoutResolvedSignatureCaching(node, fn);
43010
43021
  if (containingCall) {
43011
43022
  let toMarkSkip = node;
43012
43023
  do {
43013
43024
  getNodeLinks(toMarkSkip).skipDirectInference = void 0;
43014
43025
  toMarkSkip = toMarkSkip.parent;
43015
43026
  } while (toMarkSkip && toMarkSkip !== containingCall);
43016
- getNodeLinks(containingCall).resolvedSignature = containingCallResolvedSignature;
43017
43027
  }
43018
43028
  return result;
43019
43029
  }
43020
- function getResolvedSignatureWorker(nodeIn, candidatesOutArray, argumentCount, checkMode, editingArgument) {
43030
+ function getResolvedSignatureWorker(nodeIn, candidatesOutArray, argumentCount, checkMode) {
43021
43031
  const node = getParseTreeNode(nodeIn, isCallLikeExpression);
43022
43032
  apparentArgumentCount = argumentCount;
43023
- const res = !node ? void 0 : editingArgument ? runWithInferenceBlockedFromSourceNode(editingArgument, () => getResolvedSignature(node, candidatesOutArray, checkMode)) : getResolvedSignature(node, candidatesOutArray, checkMode);
43033
+ const res = !node ? void 0 : getResolvedSignature(node, candidatesOutArray, checkMode);
43024
43034
  apparentArgumentCount = void 0;
43025
43035
  return res;
43026
43036
  }
@@ -45982,7 +45992,7 @@ function createTypeChecker(host) {
45982
45992
  return shouldTreatPropertiesOfExternalModuleAsExports(type) ? getPropertyOfType(type, memberName) : void 0;
45983
45993
  }
45984
45994
  function shouldTreatPropertiesOfExternalModuleAsExports(resolvedExternalModuleType) {
45985
- return !(resolvedExternalModuleType.flags & 131068 /* Primitive */ || getObjectFlags(resolvedExternalModuleType) & 1 /* Class */ || // `isArrayOrTupleLikeType` is too expensive to use in this auto-imports hot path
45995
+ return !(resolvedExternalModuleType.flags & 134348796 /* Primitive */ || getObjectFlags(resolvedExternalModuleType) & 1 /* Class */ || // `isArrayOrTupleLikeType` is too expensive to use in this auto-imports hot path
45986
45996
  isArrayType(resolvedExternalModuleType) || isTupleType(resolvedExternalModuleType));
45987
45997
  }
45988
45998
  function getExportsOfSymbol(symbol) {
@@ -50181,8 +50191,8 @@ function createTypeChecker(host) {
50181
50191
  const t = types[i];
50182
50192
  flags |= t.flags;
50183
50193
  if (!(t.flags & 98304 /* Nullable */)) {
50184
- if (t.flags & (512 /* BooleanLiteral */ | 1024 /* EnumLiteral */)) {
50185
- const baseType = t.flags & 512 /* BooleanLiteral */ ? booleanType : getBaseTypeOfEnumLiteralType(t);
50194
+ if (t.flags & (512 /* BooleanLiteral */ | 1056 /* EnumLike */)) {
50195
+ const baseType = t.flags & 512 /* BooleanLiteral */ ? booleanType : getBaseTypeOfEnumLikeType(t);
50186
50196
  if (baseType.flags & 1048576 /* Union */) {
50187
50197
  const count = baseType.types.length;
50188
50198
  if (i + count <= types.length && getRegularTypeOfLiteralType(types[i + count - 1]) === getRegularTypeOfLiteralType(baseType.types[count - 1])) {
@@ -50466,6 +50476,8 @@ function createTypeChecker(host) {
50466
50476
  return !!target.baseTypesResolved;
50467
50477
  case 8 /* WriteType */:
50468
50478
  return !!getSymbolLinks(target).writeType;
50479
+ case 9 /* ParameterInitializerContainsUndefined */:
50480
+ return getNodeLinks(target).parameterInitializerContainsUndefined !== void 0;
50469
50481
  }
50470
50482
  return Debug.assertNever(propertyName);
50471
50483
  }
@@ -52057,8 +52069,8 @@ function createTypeChecker(host) {
52057
52069
  }
52058
52070
  return links.declaredType;
52059
52071
  }
52060
- function getBaseTypeOfEnumLiteralType(type) {
52061
- return type.flags & 1024 /* EnumLiteral */ && !(type.flags & 1048576 /* Union */) ? getDeclaredTypeOfSymbol(getParentOfSymbol(type.symbol)) : type;
52072
+ function getBaseTypeOfEnumLikeType(type) {
52073
+ return type.flags & 1056 /* EnumLike */ && type.symbol.flags & 8 /* EnumMember */ ? getDeclaredTypeOfSymbol(getParentOfSymbol(type.symbol)) : type;
52062
52074
  }
52063
52075
  function getDeclaredTypeOfEnum(symbol) {
52064
52076
  const links = getSymbolLinks(symbol);
@@ -52071,7 +52083,7 @@ function createTypeChecker(host) {
52071
52083
  if (hasBindableName(member)) {
52072
52084
  const memberSymbol = getSymbolOfDeclaration(member);
52073
52085
  const value = getEnumMemberValue(member);
52074
- const memberType = value !== void 0 ? getFreshTypeOfLiteralType(getEnumLiteralType(value, getSymbolId(symbol), memberSymbol)) : createTypeWithSymbol(32 /* Enum */, memberSymbol);
52086
+ const memberType = getFreshTypeOfLiteralType(value !== void 0 ? getEnumLiteralType(value, getSymbolId(symbol), memberSymbol) : createComputedEnumType(memberSymbol));
52075
52087
  getSymbolLinks(memberSymbol).declaredType = memberType;
52076
52088
  memberTypeList.push(getRegularTypeOfLiteralType(memberType));
52077
52089
  }
@@ -52085,7 +52097,7 @@ function createTypeChecker(host) {
52085
52097
  symbol,
52086
52098
  /*aliasTypeArguments*/
52087
52099
  void 0
52088
- ) : createTypeWithSymbol(32 /* Enum */, symbol);
52100
+ ) : createComputedEnumType(symbol);
52089
52101
  if (enumType.flags & 1048576 /* Union */) {
52090
52102
  enumType.flags |= 1024 /* EnumLiteral */;
52091
52103
  enumType.symbol = symbol;
@@ -52094,6 +52106,15 @@ function createTypeChecker(host) {
52094
52106
  }
52095
52107
  return links.declaredType;
52096
52108
  }
52109
+ function createComputedEnumType(symbol) {
52110
+ const regularType = createTypeWithSymbol(32 /* Enum */, symbol);
52111
+ const freshType = createTypeWithSymbol(32 /* Enum */, symbol);
52112
+ regularType.regularType = regularType;
52113
+ regularType.freshType = freshType;
52114
+ freshType.regularType = regularType;
52115
+ freshType.freshType = freshType;
52116
+ return regularType;
52117
+ }
52097
52118
  function getDeclaredTypeOfEnumMember(symbol) {
52098
52119
  const links = getSymbolLinks(symbol);
52099
52120
  if (!links.declaredType) {
@@ -55782,7 +55803,7 @@ function createTypeChecker(host) {
55782
55803
  orderedRemoveItemAt(typeSet, 1);
55783
55804
  }
55784
55805
  }
55785
- if (includes & (2944 /* Literal */ | 8192 /* UniqueESSymbol */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) || includes & 16384 /* Void */ && includes & 32768 /* Undefined */) {
55806
+ if (includes & (32 /* Enum */ | 2944 /* Literal */ | 8192 /* UniqueESSymbol */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) || includes & 16384 /* Void */ && includes & 32768 /* Undefined */) {
55786
55807
  removeRedundantLiteralTypes(typeSet, includes, !!(unionReduction & 2 /* Subtype */));
55787
55808
  }
55788
55809
  if (includes & 128 /* StringLiteral */ && includes & 134217728 /* TemplateLiteral */) {
@@ -55913,7 +55934,7 @@ function createTypeChecker(host) {
55913
55934
  type = undefinedType;
55914
55935
  }
55915
55936
  if (!typeSet.has(type.id.toString())) {
55916
- if (type.flags & 109440 /* Unit */ && includes & 109440 /* Unit */) {
55937
+ if (type.flags & 109472 /* Unit */ && includes & 109472 /* Unit */) {
55917
55938
  includes |= 67108864 /* NonPrimitive */;
55918
55939
  }
55919
55940
  typeSet.set(type.id.toString(), type);
@@ -56189,7 +56210,7 @@ function createTypeChecker(host) {
56189
56210
  const typeVariable = getTypeParameterFromMappedType(mappedType);
56190
56211
  return isDistributive(getNameTypeFromMappedType(mappedType) || typeVariable);
56191
56212
  function isDistributive(type) {
56192
- 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;
56213
+ 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;
56193
56214
  }
56194
56215
  }
56195
56216
  function getLiteralTypeFromPropertyName(name) {
@@ -57286,7 +57307,7 @@ function createTypeChecker(host) {
57286
57307
  return type;
57287
57308
  }
57288
57309
  function getFreshTypeOfLiteralType(type) {
57289
- if (type.flags & 2944 /* Literal */) {
57310
+ if (type.flags & 2976 /* Freshable */) {
57290
57311
  if (!type.freshType) {
57291
57312
  const freshType = createLiteralType(type.flags, type.value, type.symbol, type);
57292
57313
  freshType.freshType = freshType;
@@ -57297,10 +57318,10 @@ function createTypeChecker(host) {
57297
57318
  return type;
57298
57319
  }
57299
57320
  function getRegularTypeOfLiteralType(type) {
57300
- return type.flags & 2944 /* Literal */ ? type.regularType : type.flags & 1048576 /* Union */ ? type.regularType || (type.regularType = mapType(type, getRegularTypeOfLiteralType)) : type;
57321
+ return type.flags & 2976 /* Freshable */ ? type.regularType : type.flags & 1048576 /* Union */ ? type.regularType || (type.regularType = mapType(type, getRegularTypeOfLiteralType)) : type;
57301
57322
  }
57302
57323
  function isFreshLiteralType(type) {
57303
- return !!(type.flags & 2944 /* Literal */) && type.freshType === type;
57324
+ return !!(type.flags & 2976 /* Freshable */) && type.freshType === type;
57304
57325
  }
57305
57326
  function getStringLiteralType(value) {
57306
57327
  let type;
@@ -57979,13 +58000,13 @@ function createTypeChecker(host) {
57979
58000
  return type;
57980
58001
  }
57981
58002
  function getUniqueLiteralFilledInstantiation(type) {
57982
- return type.flags & (131068 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
58003
+ return type.flags & (134348796 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
57983
58004
  }
57984
58005
  function getPermissiveInstantiation(type) {
57985
- return type.flags & (131068 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.permissiveInstantiation || (type.permissiveInstantiation = instantiateType(type, permissiveMapper));
58006
+ return type.flags & (134348796 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.permissiveInstantiation || (type.permissiveInstantiation = instantiateType(type, permissiveMapper));
57986
58007
  }
57987
58008
  function getRestrictiveInstantiation(type) {
57988
- if (type.flags & (131068 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */)) {
58009
+ if (type.flags & (134348796 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */)) {
57989
58010
  return type;
57990
58011
  }
57991
58012
  if (type.restrictiveInstantiation) {
@@ -58565,7 +58586,7 @@ function createTypeChecker(host) {
58565
58586
  }
58566
58587
  }
58567
58588
  function elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
58568
- if (target.flags & (131068 /* Primitive */ | 131072 /* Never */))
58589
+ if (target.flags & (134348796 /* Primitive */ | 131072 /* Never */))
58569
58590
  return false;
58570
58591
  if (isTupleLikeType(source)) {
58571
58592
  return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation, containingMessageChain, errorOutputContainer);
@@ -58614,7 +58635,7 @@ function createTypeChecker(host) {
58614
58635
  }
58615
58636
  }
58616
58637
  function elaborateObjectLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
58617
- if (target.flags & (131068 /* Primitive */ | 131072 /* Never */))
58638
+ if (target.flags & (134348796 /* Primitive */ | 131072 /* Never */))
58618
58639
  return false;
58619
58640
  return elaborateElementwise(generateObjectLiteralElements(node), source, target, relation, containingMessageChain, errorOutputContainer);
58620
58641
  }
@@ -58637,16 +58658,24 @@ function createTypeChecker(host) {
58637
58658
  void 0
58638
58659
  ) !== 0 /* False */;
58639
58660
  }
58640
- function isAnySignature(s) {
58641
- 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));
58661
+ function isTopSignature(s) {
58662
+ if (!s.typeParameters && (!s.thisParameter || isTypeAny(getTypeOfParameter(s.thisParameter))) && s.parameters.length === 1 && signatureHasRestParameter(s)) {
58663
+ const paramType = getTypeOfParameter(s.parameters[0]);
58664
+ const restType = isArrayType(paramType) ? getTypeArguments(paramType)[0] : paramType;
58665
+ return !!(restType.flags & (1 /* Any */ | 131072 /* Never */) && getReturnTypeOfSignature(s).flags & 3 /* AnyOrUnknown */);
58666
+ }
58667
+ return false;
58642
58668
  }
58643
58669
  function compareSignaturesRelated(source, target, checkMode, reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) {
58644
58670
  if (source === target) {
58645
58671
  return -1 /* True */;
58646
58672
  }
58647
- if (isAnySignature(target)) {
58673
+ if (!(checkMode & 16 /* StrictTopSignature */ && isTopSignature(source)) && isTopSignature(target)) {
58648
58674
  return -1 /* True */;
58649
58675
  }
58676
+ if (checkMode & 16 /* StrictTopSignature */ && isTopSignature(source) && !isTopSignature(target)) {
58677
+ return 0 /* False */;
58678
+ }
58650
58679
  const targetCount = getParameterCount(target);
58651
58680
  const sourceHasMoreParameters = !hasEffectiveRestParameter(target) && (checkMode & 8 /* StrictArity */ ? hasEffectiveRestParameter(source) || getParameterCount(source) > targetCount : getMinArgumentCount(source) > targetCount);
58652
58681
  if (sourceHasMoreParameters) {
@@ -58864,7 +58893,9 @@ function createTypeChecker(host) {
58864
58893
  function isSimpleTypeRelatedTo(source, target, relation, errorReporter) {
58865
58894
  const s = source.flags;
58866
58895
  const t = target.flags;
58867
- if (t & 3 /* AnyOrUnknown */ || s & 131072 /* Never */ || source === wildcardType)
58896
+ if (t & 1 /* Any */ || s & 131072 /* Never */ || source === wildcardType)
58897
+ return true;
58898
+ if (t & 2 /* Unknown */ && !(relation === strictSubtypeRelation && s & 1 /* Any */))
58868
58899
  return true;
58869
58900
  if (t & 131072 /* Never */)
58870
58901
  return false;
@@ -59261,7 +59292,7 @@ function createTypeChecker(host) {
59261
59292
  return isRelatedTo(source2, target2, 3 /* Both */, reportErrors2);
59262
59293
  }
59263
59294
  function isRelatedTo(originalSource, originalTarget, recursionFlags = 3 /* Both */, reportErrors2 = false, headMessage2, intersectionState = 0 /* None */) {
59264
- if (originalSource.flags & 524288 /* Object */ && originalTarget.flags & 131068 /* Primitive */) {
59295
+ if (originalSource.flags & 524288 /* Object */ && originalTarget.flags & 134348796 /* Primitive */) {
59265
59296
  if (relation === comparableRelation && !(originalTarget.flags & 131072 /* Never */) && isSimpleTypeRelatedTo(originalTarget, originalSource, relation) || isSimpleTypeRelatedTo(originalSource, originalTarget, relation, reportErrors2 ? reportError : void 0)) {
59266
59297
  return -1 /* True */;
59267
59298
  }
@@ -59325,7 +59356,7 @@ function createTypeChecker(host) {
59325
59356
  return 0 /* False */;
59326
59357
  }
59327
59358
  }
59328
- 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));
59359
+ 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));
59329
59360
  const isComparingJsxAttributes = !!(getObjectFlags(source2) & 2048 /* JsxAttributes */);
59330
59361
  if (isPerformingCommonPropertyChecks && !hasCommonProperties(source2, target2, isComparingJsxAttributes)) {
59331
59362
  if (reportErrors2) {
@@ -59387,7 +59418,7 @@ function createTypeChecker(host) {
59387
59418
  maybeSuppress = !!errorInfo;
59388
59419
  }
59389
59420
  }
59390
- if (source2.flags & 524288 /* Object */ && target2.flags & 131068 /* Primitive */) {
59421
+ if (source2.flags & 524288 /* Object */ && target2.flags & 134348796 /* Primitive */) {
59391
59422
  tryElaborateErrorsForPrimitivesAndObjects(source2, target2);
59392
59423
  } else if (source2.symbol && source2.flags & 524288 /* Object */ && globalObjectType === source2) {
59393
59424
  reportError(Diagnostics.The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead);
@@ -59533,15 +59564,15 @@ function createTypeChecker(host) {
59533
59564
  }
59534
59565
  function unionOrIntersectionRelatedTo(source2, target2, reportErrors2, intersectionState) {
59535
59566
  if (source2.flags & 1048576 /* Union */) {
59536
- return relation === comparableRelation ? someTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 131068 /* Primitive */), intersectionState) : eachTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 131068 /* Primitive */), intersectionState);
59567
+ return relation === comparableRelation ? someTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 134348796 /* Primitive */), intersectionState) : eachTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 134348796 /* Primitive */), intersectionState);
59537
59568
  }
59538
59569
  if (target2.flags & 1048576 /* Union */) {
59539
- return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 131068 /* Primitive */) && !(target2.flags & 131068 /* Primitive */));
59570
+ return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 134348796 /* Primitive */) && !(target2.flags & 134348796 /* Primitive */));
59540
59571
  }
59541
59572
  if (target2.flags & 2097152 /* Intersection */) {
59542
59573
  return typeRelatedToEachType(source2, target2, reportErrors2, 2 /* Target */);
59543
59574
  }
59544
- if (relation === comparableRelation && target2.flags & 131068 /* Primitive */) {
59575
+ if (relation === comparableRelation && target2.flags & 134348796 /* Primitive */) {
59545
59576
  const constraints = sameMap(source2.types, (t) => t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(t) || unknownType : t);
59546
59577
  if (constraints !== source2.types) {
59547
59578
  source2 = getIntersectionType(constraints);
@@ -60434,7 +60465,7 @@ function createTypeChecker(host) {
60434
60465
  }
60435
60466
  return 0 /* False */;
60436
60467
  }
60437
- const sourceIsPrimitive = !!(sourceFlags & 131068 /* Primitive */);
60468
+ const sourceIsPrimitive = !!(sourceFlags & 134348796 /* Primitive */);
60438
60469
  if (relation !== identityRelation) {
60439
60470
  source2 = getApparentType(source2);
60440
60471
  sourceFlags = source2.flags;
@@ -61104,10 +61135,11 @@ function createTypeChecker(host) {
61104
61135
  return (source2, target2) => reportIncompatibleError(Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible, typeToString(source2), typeToString(target2));
61105
61136
  }
61106
61137
  function signatureRelatedTo(source2, target2, erase, reportErrors2, intersectionState, incompatibleReporter) {
61138
+ const checkMode = relation === subtypeRelation ? 16 /* StrictTopSignature */ : relation === strictSubtypeRelation ? 16 /* StrictTopSignature */ | 8 /* StrictArity */ : 0 /* None */;
61107
61139
  return compareSignaturesRelated(
61108
61140
  erase ? getErasedSignature(source2) : source2,
61109
61141
  erase ? getErasedSignature(target2) : target2,
61110
- relation === strictSubtypeRelation ? 8 /* StrictArity */ : 0,
61142
+ checkMode,
61111
61143
  reportErrors2,
61112
61144
  reportError,
61113
61145
  incompatibleReporter,
@@ -61232,7 +61264,7 @@ function createTypeChecker(host) {
61232
61264
  if (sourceInfo) {
61233
61265
  return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2, intersectionState);
61234
61266
  }
61235
- if (!(intersectionState & 1 /* Source */) && isObjectTypeWithInferableIndex(source2)) {
61267
+ if (!(intersectionState & 1 /* Source */) && (relation !== strictSubtypeRelation || getObjectFlags(source2) & 8192 /* FreshLiteral */) && isObjectTypeWithInferableIndex(source2)) {
61236
61268
  return membersRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState);
61237
61269
  }
61238
61270
  if (reportErrors2) {
@@ -61777,10 +61809,10 @@ function createTypeChecker(host) {
61777
61809
  return void 0;
61778
61810
  }
61779
61811
  function isNeitherUnitTypeNorNever(type) {
61780
- return !(type.flags & (109440 /* Unit */ | 131072 /* Never */));
61812
+ return !(type.flags & (109472 /* Unit */ | 131072 /* Never */));
61781
61813
  }
61782
61814
  function isUnitType(type) {
61783
- return !!(type.flags & 109440 /* Unit */);
61815
+ return !!(type.flags & 109472 /* Unit */);
61784
61816
  }
61785
61817
  function isUnitLikeType(type) {
61786
61818
  const t = getBaseConstraintOrType(type);
@@ -61793,7 +61825,7 @@ function createTypeChecker(host) {
61793
61825
  return type.flags & 16 /* Boolean */ ? true : type.flags & 1048576 /* Union */ ? type.flags & 1024 /* EnumLiteral */ ? true : every(type.types, isUnitType) : isUnitType(type);
61794
61826
  }
61795
61827
  function getBaseTypeOfLiteralType(type) {
61796
- 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;
61828
+ 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;
61797
61829
  }
61798
61830
  function getBaseTypeOfLiteralTypeUnion(type) {
61799
61831
  var _a2;
@@ -61801,7 +61833,7 @@ function createTypeChecker(host) {
61801
61833
  return (_a2 = getCachedType(key)) != null ? _a2 : setCachedType(key, mapType(type, getBaseTypeOfLiteralType));
61802
61834
  }
61803
61835
  function getWidenedLiteralType(type) {
61804
- 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;
61836
+ 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;
61805
61837
  }
61806
61838
  function getWidenedUniqueESSymbolType(type) {
61807
61839
  return type.flags & 8192 /* UniqueESSymbol */ ? esSymbolType : type.flags & 1048576 /* Union */ ? mapType(type, getWidenedUniqueESSymbolType) : type;
@@ -62334,8 +62366,8 @@ function createTypeChecker(host) {
62334
62366
  }
62335
62367
  return false;
62336
62368
  }
62337
- function isTypeParameterAtTopLevel(type, typeParameter) {
62338
- return !!(type === typeParameter || type.flags & 3145728 /* UnionOrIntersection */ && some(type.types, (t) => isTypeParameterAtTopLevel(t, typeParameter)) || type.flags & 16777216 /* Conditional */ && (getTrueTypeFromConditionalType(type) === typeParameter || getFalseTypeFromConditionalType(type) === typeParameter));
62369
+ function isTypeParameterAtTopLevel(type, tp, depth = 0) {
62370
+ 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)));
62339
62371
  }
62340
62372
  function isTypeParameterAtTopLevelInReturnType(signature, typeParameter) {
62341
62373
  const typePredicate = getTypePredicateOfSignature(signature);
@@ -62429,7 +62461,7 @@ function createTypeChecker(host) {
62429
62461
  yield targetProp;
62430
62462
  } else if (matchDiscriminantProperties) {
62431
62463
  const targetType = getTypeOfSymbol(targetProp);
62432
- if (targetType.flags & 109440 /* Unit */) {
62464
+ if (targetType.flags & 109472 /* Unit */) {
62433
62465
  const sourceType = getTypeOfSymbol(sourceProp);
62434
62466
  if (!(sourceType.flags & 1 /* Any */ || getRegularTypeOfLiteralType(sourceType) === getRegularTypeOfLiteralType(targetType))) {
62435
62467
  yield targetProp;
@@ -62490,10 +62522,10 @@ function createTypeChecker(host) {
62490
62522
  return getBigIntLiteralType(parseValidBigInt(text));
62491
62523
  }
62492
62524
  function isMemberOfStringMapping(source, target) {
62493
- if (target.flags & (4 /* String */ | 1 /* Any */)) {
62525
+ if (target.flags & 1 /* Any */) {
62494
62526
  return true;
62495
62527
  }
62496
- if (target.flags & 134217728 /* TemplateLiteral */) {
62528
+ if (target.flags & (4 /* String */ | 134217728 /* TemplateLiteral */)) {
62497
62529
  return isTypeAssignableTo(source, target);
62498
62530
  }
62499
62531
  if (target.flags & 268435456 /* StringMapping */) {
@@ -63188,7 +63220,7 @@ function createTypeChecker(host) {
63188
63220
  }
63189
63221
  function hasPrimitiveConstraint(type) {
63190
63222
  const constraint = getConstraintOfTypeParameter(type);
63191
- return !!constraint && maybeTypeOfKind(constraint.flags & 16777216 /* Conditional */ ? getDefaultConstraintOfConditionalType(constraint) : constraint, 131068 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
63223
+ return !!constraint && maybeTypeOfKind(constraint.flags & 16777216 /* Conditional */ ? getDefaultConstraintOfConditionalType(constraint) : constraint, 134348796 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
63192
63224
  }
63193
63225
  function isObjectLiteralType(type) {
63194
63226
  return !!(getObjectFlags(type) & 128 /* ObjectLiteral */);
@@ -63670,7 +63702,7 @@ function createTypeChecker(host) {
63670
63702
  return 83886079 /* UnknownFacts */;
63671
63703
  }
63672
63704
  function getIntersectionTypeFacts(type) {
63673
- const ignoreObjects = maybeTypeOfKind(type, 131068 /* Primitive */);
63705
+ const ignoreObjects = maybeTypeOfKind(type, 134348796 /* Primitive */);
63674
63706
  let oredFacts = 0 /* None */;
63675
63707
  let andedFacts = 134217727 /* All */;
63676
63708
  for (const t of type.types) {
@@ -63869,7 +63901,7 @@ function createTypeChecker(host) {
63869
63901
  }
63870
63902
  return true;
63871
63903
  }
63872
- if (source.flags & 1024 /* EnumLiteral */ && getBaseTypeOfEnumLiteralType(source) === target) {
63904
+ if (source.flags & 1056 /* EnumLike */ && getBaseTypeOfEnumLikeType(source) === target) {
63873
63905
  return true;
63874
63906
  }
63875
63907
  return containsType(target.types, source);
@@ -64933,7 +64965,7 @@ function createTypeChecker(host) {
64933
64965
  }
64934
64966
  if (assumeTrue) {
64935
64967
  if (!doubleEquals && (type.flags & 2 /* Unknown */ || someType(type, isEmptyAnonymousObjectType))) {
64936
- if (valueType.flags & (131068 /* Primitive */ | 67108864 /* NonPrimitive */) || isEmptyAnonymousObjectType(valueType)) {
64968
+ if (valueType.flags & (134348796 /* Primitive */ | 67108864 /* NonPrimitive */) || isEmptyAnonymousObjectType(valueType)) {
64937
64969
  return valueType;
64938
64970
  }
64939
64971
  if (valueType.flags & 524288 /* Object */) {
@@ -64983,7 +65015,7 @@ function createTypeChecker(host) {
64983
65015
  let groundClauseTypes;
64984
65016
  for (let i = 0; i < clauseTypes.length; i += 1) {
64985
65017
  const t = clauseTypes[i];
64986
- if (t.flags & (131068 /* Primitive */ | 67108864 /* NonPrimitive */)) {
65018
+ if (t.flags & (134348796 /* Primitive */ | 67108864 /* NonPrimitive */)) {
64987
65019
  if (groundClauseTypes !== void 0) {
64988
65020
  groundClauseTypes.push(t);
64989
65021
  }
@@ -65131,18 +65163,29 @@ function createTypeChecker(host) {
65131
65163
  return (_a3 = getCachedType(key2)) != null ? _a3 : setCachedType(key2, getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived));
65132
65164
  }
65133
65165
  function getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived) {
65134
- const isRelated = checkDerived ? isTypeDerivedFrom : isTypeSubtypeOf;
65135
65166
  if (!assumeTrue) {
65136
- return filterType(type, (t) => !isRelated(t, candidate));
65167
+ if (checkDerived) {
65168
+ return filterType(type, (t) => !isTypeDerivedFrom(t, candidate));
65169
+ }
65170
+ const trueType2 = getNarrowedType(
65171
+ type,
65172
+ candidate,
65173
+ /*assumeTrue*/
65174
+ true,
65175
+ /*checkDerived*/
65176
+ false
65177
+ );
65178
+ return filterType(type, (t) => !isTypeSubsetOf(t, trueType2));
65137
65179
  }
65138
65180
  if (type.flags & 3 /* AnyOrUnknown */) {
65139
65181
  return candidate;
65140
65182
  }
65183
+ const isRelated = checkDerived ? isTypeDerivedFrom : isTypeSubtypeOf;
65141
65184
  const keyPropertyName = type.flags & 1048576 /* Union */ ? getKeyPropertyName(type) : void 0;
65142
65185
  const narrowedType = mapType(candidate, (c) => {
65143
65186
  const discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
65144
65187
  const matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
65145
- 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);
65188
+ 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);
65146
65189
  return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated;
65147
65190
  });
65148
65191
  return !(narrowedType.flags & 131072 /* Never */) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]);
@@ -65298,15 +65341,25 @@ function createTypeChecker(host) {
65298
65341
  function isConstVariable(symbol) {
65299
65342
  return symbol.flags & 3 /* Variable */ && (getDeclarationNodeFlagsFromSymbol(symbol) & 2 /* Const */) !== 0;
65300
65343
  }
65301
- function removeOptionalityFromDeclaredType(declaredType, declaration) {
65302
- if (pushTypeResolution(declaration.symbol, 2 /* DeclaredType */)) {
65303
- const annotationIncludesUndefined = strictNullChecks && declaration.kind === 166 /* Parameter */ && declaration.initializer && getTypeFacts(declaredType) & 16777216 /* IsUndefined */ && !(getTypeFacts(checkExpression(declaration.initializer)) & 16777216 /* IsUndefined */);
65304
- popTypeResolution();
65305
- return annotationIncludesUndefined ? getTypeWithFacts(declaredType, 524288 /* NEUndefined */) : declaredType;
65306
- } else {
65307
- reportCircularityError(declaration.symbol);
65308
- return declaredType;
65344
+ function parameterInitializerContainsUndefined(declaration) {
65345
+ const links = getNodeLinks(declaration);
65346
+ if (links.parameterInitializerContainsUndefined === void 0) {
65347
+ if (!pushTypeResolution(declaration, 9 /* ParameterInitializerContainsUndefined */)) {
65348
+ reportCircularityError(declaration.symbol);
65349
+ return true;
65350
+ }
65351
+ const containsUndefined = !!(getTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 16777216 /* IsUndefined */);
65352
+ if (!popTypeResolution()) {
65353
+ reportCircularityError(declaration.symbol);
65354
+ return true;
65355
+ }
65356
+ links.parameterInitializerContainsUndefined = containsUndefined;
65309
65357
  }
65358
+ return links.parameterInitializerContainsUndefined;
65359
+ }
65360
+ function removeOptionalityFromDeclaredType(declaredType, declaration) {
65361
+ const removeUndefined = strictNullChecks && declaration.kind === 166 /* Parameter */ && declaration.initializer && getTypeFacts(declaredType) & 16777216 /* IsUndefined */ && !parameterInitializerContainsUndefined(declaration);
65362
+ return removeUndefined ? getTypeWithFacts(declaredType, 524288 /* NEUndefined */) : declaredType;
65310
65363
  }
65311
65364
  function isConstraintPosition(type, node) {
65312
65365
  const parent = node.parent;
@@ -68472,7 +68525,7 @@ function createTypeChecker(host) {
68472
68525
  function reportNonexistentProperty(propNode, containingType, isUncheckedJS) {
68473
68526
  let errorInfo;
68474
68527
  let relatedInfo;
68475
- if (!isPrivateIdentifier(propNode) && containingType.flags & 1048576 /* Union */ && !(containingType.flags & 131068 /* Primitive */)) {
68528
+ if (!isPrivateIdentifier(propNode) && containingType.flags & 1048576 /* Union */ && !(containingType.flags & 134348796 /* Primitive */)) {
68476
68529
  for (const subtype of containingType.types) {
68477
68530
  if (!getPropertyOfType(subtype, propNode.escapedText) && !getApplicableIndexInfoForName(subtype, propNode.escapedText)) {
68478
68531
  errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Property_0_does_not_exist_on_type_1, declarationNameToString(propNode), typeToString(subtype));
@@ -69069,7 +69122,7 @@ function createTypeChecker(host) {
69069
69122
  } else {
69070
69123
  const contextualType = getIndexedAccessType(restType, getNumberLiteralType(i - index), 256 /* Contextual */);
69071
69124
  const argType = checkExpressionWithContextualType(arg, contextualType, context, checkMode);
69072
- const hasPrimitiveContextualType = inConstContext || maybeTypeOfKind(contextualType, 131068 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
69125
+ const hasPrimitiveContextualType = inConstContext || maybeTypeOfKind(contextualType, 134348796 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
69073
69126
  types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType));
69074
69127
  flags.push(1 /* Required */);
69075
69128
  }
@@ -72319,7 +72372,7 @@ function createTypeChecker(host) {
72319
72372
  if (leftType === silentNeverType || rightType === silentNeverType) {
72320
72373
  return silentNeverType;
72321
72374
  }
72322
- if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 131068 /* Primitive */)) {
72375
+ if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 134348796 /* Primitive */)) {
72323
72376
  error(left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
72324
72377
  }
72325
72378
  if (!(isTypeAny(rightType) || typeHasCallOrConstructSignatures2(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
@@ -72905,7 +72958,7 @@ function createTypeChecker(host) {
72905
72958
  return leftType;
72906
72959
  } else {
72907
72960
  checkAssignmentOperator(rightType);
72908
- return getRegularTypeOfObjectLiteral(rightType);
72961
+ return rightType;
72909
72962
  }
72910
72963
  case 27 /* CommaToken */:
72911
72964
  if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left) && !isIndirectCall(left.parent)) {
@@ -74812,6 +74865,9 @@ function createTypeChecker(host) {
74812
74865
  case 273 /* ImportSpecifier */:
74813
74866
  case 79 /* Identifier */:
74814
74867
  return 1 /* ExportValue */;
74868
+ case 170 /* MethodSignature */:
74869
+ case 168 /* PropertySignature */:
74870
+ return 2 /* ExportType */;
74815
74871
  default:
74816
74872
  return Debug.failBadSyntaxKind(d);
74817
74873
  }
@@ -74835,7 +74891,7 @@ function createTypeChecker(host) {
74835
74891
  ))) {
74836
74892
  return typeAsPromise.promisedTypeOfPromise = getTypeArguments(type)[0];
74837
74893
  }
74838
- if (allTypesAssignableToKind(getBaseConstraintOrType(type), 131068 /* Primitive */ | 131072 /* Never */)) {
74894
+ if (allTypesAssignableToKind(getBaseConstraintOrType(type), 134348796 /* Primitive */ | 131072 /* Never */)) {
74839
74895
  return void 0;
74840
74896
  }
74841
74897
  const thenFunction = getTypeOfPropertyOfType(type, "then");
@@ -74887,7 +74943,7 @@ function createTypeChecker(host) {
74887
74943
  return awaitedType || errorType;
74888
74944
  }
74889
74945
  function isThenableType(type) {
74890
- if (allTypesAssignableToKind(getBaseConstraintOrType(type), 131068 /* Primitive */ | 131072 /* Never */)) {
74946
+ if (allTypesAssignableToKind(getBaseConstraintOrType(type), 134348796 /* Primitive */ | 131072 /* Never */)) {
74891
74947
  return false;
74892
74948
  }
74893
74949
  const thenFunction = getTypeOfPropertyOfType(type, "then");
@@ -74936,7 +74992,7 @@ function createTypeChecker(host) {
74936
74992
  return awaitedType;
74937
74993
  }
74938
74994
  }
74939
- Debug.assert(getPromisedTypeOfPromise(type) === void 0, "type provided should not be a non-generic 'promise'-like.");
74995
+ Debug.assert(isAwaitedTypeInstantiation(type) || getPromisedTypeOfPromise(type) === void 0, "type provided should not be a non-generic 'promise'-like.");
74940
74996
  return type;
74941
74997
  }
74942
74998
  function getAwaitedType(type, errorNode, diagnosticMessage, arg0) {
@@ -79195,6 +79251,8 @@ function createTypeChecker(host) {
79195
79251
  if (!(links.flags & 1 /* TypeChecked */)) {
79196
79252
  links.deferredNodes || (links.deferredNodes = /* @__PURE__ */ new Set());
79197
79253
  links.deferredNodes.add(node);
79254
+ } else {
79255
+ Debug.assert(!links.deferredNodes, "A type-checked file should have no deferred nodes.");
79198
79256
  }
79199
79257
  }
79200
79258
  function checkDeferredNodes(context) {
@@ -79202,6 +79260,7 @@ function createTypeChecker(host) {
79202
79260
  if (links.deferredNodes) {
79203
79261
  links.deferredNodes.forEach(checkDeferredNode);
79204
79262
  }
79263
+ links.deferredNodes = void 0;
79205
79264
  }
79206
79265
  function checkDeferredNode(node) {
79207
79266
  var _a2, _b;
@@ -80282,7 +80341,7 @@ function createTypeChecker(host) {
80282
80341
  return !!(type.flags & 524288 /* Object */) && getSignaturesOfType(type, 0 /* Call */).length > 0;
80283
80342
  }
80284
80343
  function getTypeReferenceSerializationKind(typeNameIn, location) {
80285
- var _a2, _b;
80344
+ var _a2;
80286
80345
  const typeName = getParseTreeNode(typeNameIn, isEntityName);
80287
80346
  if (!typeName)
80288
80347
  return 0 /* Unknown */;
@@ -80314,7 +80373,7 @@ function createTypeChecker(host) {
80314
80373
  location
80315
80374
  );
80316
80375
  const resolvedSymbol = valueSymbol && valueSymbol.flags & 2097152 /* Alias */ ? resolveAlias(valueSymbol) : valueSymbol;
80317
- isTypeOnly || (isTypeOnly = !!((_b = valueSymbol == null ? void 0 : valueSymbol.declarations) == null ? void 0 : _b.every(isTypeOnlyImportOrExportDeclaration)));
80376
+ isTypeOnly || (isTypeOnly = !!(valueSymbol && getTypeOnlyAliasDeclaration(valueSymbol, 111551 /* Value */)));
80318
80377
  const typeSymbol = resolveEntityName(
80319
80378
  typeName,
80320
80379
  788968 /* Type */,
@@ -80465,7 +80524,7 @@ function createTypeChecker(host) {
80465
80524
  return false;
80466
80525
  }
80467
80526
  function literalTypeToNode(type, enclosing, tracker) {
80468
- const enumResult = type.flags & 1024 /* EnumLiteral */ ? nodeBuilder.symbolToExpression(
80527
+ const enumResult = type.flags & 1056 /* EnumLike */ ? nodeBuilder.symbolToExpression(
80469
80528
  type.symbol,
80470
80529
  111551 /* Value */,
80471
80530
  enclosing,
@@ -82026,7 +82085,7 @@ function createTypeChecker(host) {
82026
82085
  }
82027
82086
  function isSimpleLiteralEnumReference(expr) {
82028
82087
  if ((isPropertyAccessExpression(expr) || isElementAccessExpression(expr) && isStringOrNumberLiteralExpression(expr.argumentExpression)) && isEntityNameExpression(expr.expression)) {
82029
- return !!(checkExpressionCached(expr).flags & 1024 /* EnumLiteral */);
82088
+ return !!(checkExpressionCached(expr).flags & 1056 /* EnumLike */);
82030
82089
  }
82031
82090
  }
82032
82091
  function checkAmbientInitializer(node) {
@@ -82428,10 +82487,10 @@ function createTypeChecker(host) {
82428
82487
  }
82429
82488
  function findMostOverlappyType(source, unionTarget) {
82430
82489
  let bestMatch;
82431
- if (!(source.flags & (131068 /* Primitive */ | 406847488 /* InstantiablePrimitive */))) {
82490
+ if (!(source.flags & (134348796 /* Primitive */ | 406847488 /* InstantiablePrimitive */))) {
82432
82491
  let matchingCount = 0;
82433
82492
  for (const target of unionTarget.types) {
82434
- if (!(target.flags & (131068 /* Primitive */ | 406847488 /* InstantiablePrimitive */))) {
82493
+ if (!(target.flags & (134348796 /* Primitive */ | 406847488 /* InstantiablePrimitive */))) {
82435
82494
  const overlap = getIntersectionType([getIndexType(source), getIndexType(target)]);
82436
82495
  if (overlap.flags & 4194304 /* Index */) {
82437
82496
  return target;
@@ -82449,7 +82508,7 @@ function createTypeChecker(host) {
82449
82508
  }
82450
82509
  function filterPrimitivesIfContainsNonPrimitive(type) {
82451
82510
  if (maybeTypeOfKind(type, 67108864 /* NonPrimitive */)) {
82452
- const result = filterType(type, (t) => !(t.flags & 131068 /* Primitive */));
82511
+ const result = filterType(type, (t) => !(t.flags & 134348796 /* Primitive */));
82453
82512
  if (!(result.flags & 131072 /* Never */)) {
82454
82513
  return result;
82455
82514
  }
@@ -87027,7 +87086,7 @@ function transformTypeScript(context) {
87027
87086
  return node;
87028
87087
  }
87029
87088
  function tryGetConstEnumValue(node) {
87030
- if (compilerOptions.isolatedModules) {
87089
+ if (getIsolatedModules(compilerOptions)) {
87031
87090
  return void 0;
87032
87091
  }
87033
87092
  return isPropertyAccessExpression(node) || isElementAccessExpression(node) ? resolver.getConstantValue(node) : void 0;
@@ -103357,7 +103416,7 @@ function transformECMAScriptModule(context) {
103357
103416
  if (node.isDeclarationFile) {
103358
103417
  return node;
103359
103418
  }
103360
- if (isExternalModule(node) || compilerOptions.isolatedModules) {
103419
+ if (isExternalModule(node) || getIsolatedModules(compilerOptions)) {
103361
103420
  currentSourceFile = node;
103362
103421
  importRequireStatements = void 0;
103363
103422
  let result = updateExternalModule(node);
@@ -103564,7 +103623,7 @@ function transformECMAScriptModule(context) {
103564
103623
  }
103565
103624
  function onEmitNode(hint, node, emitCallback) {
103566
103625
  if (isSourceFile(node)) {
103567
- if ((isExternalModule(node) || compilerOptions.isolatedModules) && compilerOptions.importHelpers) {
103626
+ if ((isExternalModule(node) || getIsolatedModules(compilerOptions)) && compilerOptions.importHelpers) {
103568
103627
  helperNameSubstitutions = /* @__PURE__ */ new Map();
103569
103628
  }
103570
103629
  previousOnEmitNode(hint, node, emitCallback);
@@ -114158,7 +114217,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
114158
114217
  let imports;
114159
114218
  let moduleAugmentations;
114160
114219
  let ambientModules;
114161
- if ((options.isolatedModules || isExternalModuleFile) && !file.isDeclarationFile) {
114220
+ if ((getIsolatedModules(options) || isExternalModuleFile) && !file.isDeclarationFile) {
114162
114221
  if (options.importHelpers) {
114163
114222
  imports = [createSyntheticImport(externalHelpersModuleNameText, file)];
114164
114223
  }
@@ -114879,12 +114938,12 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
114879
114938
  if (options.exactOptionalPropertyTypes && !getStrictOptionValue(options, "strictNullChecks")) {
114880
114939
  createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "exactOptionalPropertyTypes", "strictNullChecks");
114881
114940
  }
114882
- if (options.isolatedModules) {
114941
+ if (options.isolatedModules || options.verbatimModuleSyntax) {
114883
114942
  if (options.out) {
114884
- createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules");
114943
+ createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", options.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules");
114885
114944
  }
114886
114945
  if (options.outFile) {
114887
- createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules");
114946
+ createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", options.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules");
114888
114947
  }
114889
114948
  }
114890
114949
  if (options.inlineSourceMap) {
@@ -116291,7 +116350,7 @@ var BuilderState;
116291
116350
  return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
116292
116351
  }
116293
116352
  const compilerOptions = programOfThisState.getCompilerOptions();
116294
- if (compilerOptions && (compilerOptions.isolatedModules || outFile(compilerOptions))) {
116353
+ if (compilerOptions && (getIsolatedModules(compilerOptions) || outFile(compilerOptions))) {
116295
116354
  return [sourceFileWithUpdatedShape];
116296
116355
  }
116297
116356
  const seenFileNamesMap = /* @__PURE__ */ new Map();
@@ -116704,7 +116763,7 @@ function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile
116704
116763
  return;
116705
116764
  if (!isChangedSignature(state, affectedFile.resolvedPath))
116706
116765
  return;
116707
- if (state.compilerOptions.isolatedModules) {
116766
+ if (getIsolatedModules(state.compilerOptions)) {
116708
116767
  const seenFileNamesMap = /* @__PURE__ */ new Map();
116709
116768
  seenFileNamesMap.set(affectedFile.resolvedPath, true);
116710
116769
  const queue = BuilderState.getReferencedByPaths(state, affectedFile.resolvedPath);