typescript 5.4.0-dev.20231120 → 5.4.0-dev.20231121

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsc.js CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.4";
21
- var version = `${versionMajorMinor}.0-dev.20231120`;
21
+ var version = `${versionMajorMinor}.0-dev.20231121`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -3661,7 +3661,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
3661
3661
  TypeFlags2[TypeFlags2["InstantiablePrimitive"] = 406847488] = "InstantiablePrimitive";
3662
3662
  TypeFlags2[TypeFlags2["Instantiable"] = 465829888] = "Instantiable";
3663
3663
  TypeFlags2[TypeFlags2["StructuredOrInstantiable"] = 469499904] = "StructuredOrInstantiable";
3664
- TypeFlags2[TypeFlags2["ObjectFlagsType"] = 138117121] = "ObjectFlagsType";
3664
+ TypeFlags2[TypeFlags2["ObjectFlagsType"] = 3899393] = "ObjectFlagsType";
3665
3665
  TypeFlags2[TypeFlags2["Simplifiable"] = 25165824] = "Simplifiable";
3666
3666
  TypeFlags2[TypeFlags2["Singleton"] = 67358815] = "Singleton";
3667
3667
  TypeFlags2[TypeFlags2["Narrowable"] = 536624127] = "Narrowable";
@@ -5935,6 +5935,10 @@ var Diagnostics = {
5935
5935
  ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled: diag(1286, 1 /* Error */, "ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled_1286", "ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled."),
5936
5936
  A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled: diag(1287, 1 /* Error */, "A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimM_1287", "A top-level 'export' modifier cannot be used on value declarations in a CommonJS module when 'verbatimModuleSyntax' is enabled."),
5937
5937
  An_import_alias_cannot_resolve_to_a_type_or_type_only_declaration_when_verbatimModuleSyntax_is_enabled: diag(1288, 1 /* Error */, "An_import_alias_cannot_resolve_to_a_type_or_type_only_declaration_when_verbatimModuleSyntax_is_enabl_1288", "An import alias cannot resolve to a type or type-only declaration when 'verbatimModuleSyntax' is enabled."),
5938
+ _0_resolves_to_a_type_only_declaration_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_import_type_where_0_is_imported: diag(1289, 1 /* Error */, "_0_resolves_to_a_type_only_declaration_and_must_be_marked_type_only_in_this_file_before_re_exporting_1289", "'{0}' resolves to a type-only declaration and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'import type' where '{0}' is imported."),
5939
+ _0_resolves_to_a_type_only_declaration_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_export_type_0_as_default: diag(1290, 1 /* Error */, "_0_resolves_to_a_type_only_declaration_and_must_be_marked_type_only_in_this_file_before_re_exporting_1290", "'{0}' resolves to a type-only declaration and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'export type { {0} as default }'."),
5940
+ _0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_import_type_where_0_is_imported: diag(1291, 1 /* Error */, "_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enable_1291", "'{0}' resolves to a type and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'import type' where '{0}' is imported."),
5941
+ _0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_export_type_0_as_default: diag(1292, 1 /* Error */, "_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enable_1292", "'{0}' resolves to a type and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'export type { {0} as default }'."),
5938
5942
  with_statements_are_not_allowed_in_an_async_function_block: diag(1300, 1 /* Error */, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."),
5939
5943
  await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, 1 /* Error */, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."),
5940
5944
  The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level: diag(1309, 1 /* Error */, "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309", "The current file is a CommonJS module and cannot use 'await' at the top level."),
@@ -15970,7 +15974,7 @@ function getClassLikeDeclarationOfSymbol(symbol) {
15970
15974
  return (_a = symbol.declarations) == null ? void 0 : _a.find(isClassLike);
15971
15975
  }
15972
15976
  function getObjectFlags(type) {
15973
- return type.flags & 138117121 /* ObjectFlagsType */ ? type.objectFlags : 0;
15977
+ return type.flags & 3899393 /* ObjectFlagsType */ ? type.objectFlags : 0;
15974
15978
  }
15975
15979
  function isUMDExportSymbol(symbol) {
15976
15980
  return !!symbol && !!symbol.declarations && !!symbol.declarations[0] && isNamespaceExportDeclaration(symbol.declarations[0]);
@@ -54197,7 +54201,12 @@ function createTypeChecker(host) {
54197
54201
  const checkType = type.checkType;
54198
54202
  const constraint = getLowerBoundOfKeyType(checkType);
54199
54203
  if (constraint !== checkType) {
54200
- return getConditionalTypeInstantiation(type, prependTypeMapping(type.root.checkType, constraint, type.mapper));
54204
+ return getConditionalTypeInstantiation(
54205
+ type,
54206
+ prependTypeMapping(type.root.checkType, constraint, type.mapper),
54207
+ /*forConstraint*/
54208
+ false
54209
+ );
54201
54210
  }
54202
54211
  }
54203
54212
  return type;
@@ -54549,7 +54558,12 @@ function createTypeChecker(host) {
54549
54558
  );
54550
54559
  const constraint = simplified === type.checkType ? getConstraintOfType(simplified) : simplified;
54551
54560
  if (constraint && constraint !== type.checkType) {
54552
- const instantiated = getConditionalTypeInstantiation(type, prependTypeMapping(type.root.checkType, constraint, type.mapper));
54561
+ const instantiated = getConditionalTypeInstantiation(
54562
+ type,
54563
+ prependTypeMapping(type.root.checkType, constraint, type.mapper),
54564
+ /*forConstraint*/
54565
+ true
54566
+ );
54553
54567
  if (!(instantiated.flags & 131072 /* Never */)) {
54554
54568
  type.resolvedConstraintOfDistributive = instantiated;
54555
54569
  return instantiated;
@@ -56983,7 +56997,7 @@ function createTypeChecker(host) {
56983
56997
  }
56984
56998
  }
56985
56999
  function removeStringLiteralsMatchedByTemplateLiterals(types) {
56986
- const templates = filter(types, (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t) && t.types.every((t2) => !(t2.flags & 2097152 /* Intersection */) || !areIntersectedTypesAvoidingPrimitiveReduction(t2.types)));
57000
+ const templates = filter(types, (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t));
56987
57001
  if (templates.length) {
56988
57002
  let i = types.length;
56989
57003
  while (i > 0) {
@@ -57383,19 +57397,14 @@ function createTypeChecker(host) {
57383
57397
  function getConstituentCountOfTypes(types) {
57384
57398
  return reduceLeft(types, (n, t) => n + getConstituentCount(t), 0);
57385
57399
  }
57386
- function areIntersectedTypesAvoidingPrimitiveReduction(types, primitiveFlags = 4 /* String */ | 8 /* Number */ | 64 /* BigInt */) {
57387
- if (types.length !== 2) {
57388
- return false;
57389
- }
57390
- const [t1, t2] = types;
57391
- return !!(t1.flags & primitiveFlags) && t2 === emptyTypeLiteralType || !!(t2.flags & primitiveFlags) && t1 === emptyTypeLiteralType;
57392
- }
57393
57400
  function getTypeFromIntersectionTypeNode(node) {
57394
57401
  const links = getNodeLinks(node);
57395
57402
  if (!links.resolvedType) {
57396
57403
  const aliasSymbol = getAliasSymbolForTypeNode(node);
57397
57404
  const types = map(node.types, getTypeFromTypeNode);
57398
- const noSupertypeReduction = areIntersectedTypesAvoidingPrimitiveReduction(types);
57405
+ const emptyIndex = types.length === 2 ? types.indexOf(emptyTypeLiteralType) : -1;
57406
+ const t = emptyIndex >= 0 ? types[1 - emptyIndex] : unknownType;
57407
+ const noSupertypeReduction = !!(t.flags & (4 /* String */ | 8 /* Number */ | 64 /* BigInt */) || t.flags & 134217728 /* TemplateLiteral */ && isPatternLiteralType(t));
57399
57408
  links.resolvedType = getIntersectionType(types, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol), noSupertypeReduction);
57400
57409
  }
57401
57410
  return links.resolvedType;
@@ -57422,19 +57431,17 @@ function createTypeChecker(host) {
57422
57431
  return constraintType;
57423
57432
  }
57424
57433
  const keyTypes = [];
57425
- if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
57426
- if (!isGenericIndexType(constraintType)) {
57427
- const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
57428
- forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */, !!(indexFlags & 1 /* StringsOnly */), addMemberForKeyType);
57429
- } else {
57434
+ if (isGenericIndexType(constraintType)) {
57435
+ if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
57430
57436
  return getIndexTypeForGenericType(type, indexFlags);
57431
57437
  }
57438
+ forEachType(constraintType, addMemberForKeyType);
57439
+ } else if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
57440
+ const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
57441
+ forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */, !!(indexFlags & 1 /* StringsOnly */), addMemberForKeyType);
57432
57442
  } else {
57433
57443
  forEachType(getLowerBoundOfKeyType(constraintType), addMemberForKeyType);
57434
57444
  }
57435
- if (isGenericIndexType(constraintType)) {
57436
- forEachType(constraintType, addMemberForKeyType);
57437
- }
57438
57445
  const result = indexFlags & 2 /* NoIndexSignatures */ ? filterType(getUnionType(keyTypes), (t) => !(t.flags & (1 /* Any */ | 4 /* String */))) : getUnionType(keyTypes);
57439
57446
  if (result.flags & 1048576 /* Union */ && constraintType.flags & 1048576 /* Union */ && getTypeListId(result.types) === getTypeListId(constraintType.types)) {
57440
57447
  return constraintType;
@@ -57607,11 +57614,6 @@ function createTypeChecker(host) {
57607
57614
  }
57608
57615
  function createTemplateLiteralType(texts, types) {
57609
57616
  const type = createType(134217728 /* TemplateLiteral */);
57610
- type.objectFlags = getPropagatingFlagsOfTypes(
57611
- types,
57612
- /*excludeKinds*/
57613
- 98304 /* Nullable */
57614
- );
57615
57617
  type.texts = texts;
57616
57618
  type.types = types;
57617
57619
  return type;
@@ -57906,7 +57908,15 @@ function createTypeChecker(host) {
57906
57908
  }
57907
57909
  function isPatternLiteralPlaceholderType(type) {
57908
57910
  if (type.flags & 2097152 /* Intersection */) {
57909
- return !isGenericType(type) && some(type.types, (t) => !!(t.flags & (2944 /* Literal */ | 98304 /* Nullable */)) || isPatternLiteralPlaceholderType(t));
57911
+ let seenPlaceholder = false;
57912
+ for (const t of type.types) {
57913
+ if (t.flags & (2944 /* Literal */ | 98304 /* Nullable */) || isPatternLiteralPlaceholderType(t)) {
57914
+ seenPlaceholder = true;
57915
+ } else if (!(t.flags & 524288 /* Object */)) {
57916
+ return false;
57917
+ }
57918
+ }
57919
+ return seenPlaceholder;
57910
57920
  }
57911
57921
  return !!(type.flags & (1 /* Any */ | 4 /* String */ | 8 /* Number */ | 64 /* BigInt */)) || isPatternLiteralType(type);
57912
57922
  }
@@ -57923,7 +57933,7 @@ function createTypeChecker(host) {
57923
57933
  return !!(getGenericObjectFlags(type) & 8388608 /* IsGenericIndexType */);
57924
57934
  }
57925
57935
  function getGenericObjectFlags(type) {
57926
- if (type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */)) {
57936
+ if (type.flags & 3145728 /* UnionOrIntersection */) {
57927
57937
  if (!(type.objectFlags & 2097152 /* IsGenericTypeComputed */)) {
57928
57938
  type.objectFlags |= 2097152 /* IsGenericTypeComputed */ | reduceLeft(type.types, (flags, t) => flags | getGenericObjectFlags(t), 0);
57929
57939
  }
@@ -57935,7 +57945,7 @@ function createTypeChecker(host) {
57935
57945
  }
57936
57946
  return type.objectFlags & 12582912 /* IsGenericType */;
57937
57947
  }
57938
- return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ | 268435456 /* StringMapping */) && !isPatternLiteralType(type) ? 8388608 /* IsGenericIndexType */ : 0);
57948
+ return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) && !isPatternLiteralType(type) ? 8388608 /* IsGenericIndexType */ : 0);
57939
57949
  }
57940
57950
  function getSimplifiedType(type, writing) {
57941
57951
  return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type;
@@ -58116,7 +58126,7 @@ function createTypeChecker(host) {
58116
58126
  function isDeferredType(type, checkTuples) {
58117
58127
  return isGenericType(type) || checkTuples && isTupleType(type) && some(getElementTypes(type), isGenericType);
58118
58128
  }
58119
- function getConditionalType(root, mapper, aliasSymbol, aliasTypeArguments) {
58129
+ function getConditionalType(root, mapper, forConstraint, aliasSymbol, aliasTypeArguments) {
58120
58130
  let result;
58121
58131
  let extraTypes;
58122
58132
  let tailCount = 0;
@@ -58162,7 +58172,7 @@ function createTypeChecker(host) {
58162
58172
  const inferredExtendsType = combinedMapper ? instantiateType(root.extendsType, combinedMapper) : extendsType;
58163
58173
  if (!checkTypeDeferred && !isDeferredType(inferredExtendsType, checkTuples)) {
58164
58174
  if (!(inferredExtendsType.flags & 3 /* AnyOrUnknown */) && (checkType.flags & 1 /* Any */ || !isTypeAssignableTo(getPermissiveInstantiation(checkType), getPermissiveInstantiation(inferredExtendsType)))) {
58165
- if (checkType.flags & 1 /* Any */) {
58175
+ if (checkType.flags & 1 /* Any */ || forConstraint && !(inferredExtendsType.flags & 131072 /* Never */) && someType(getPermissiveInstantiation(inferredExtendsType), (t) => isTypeAssignableTo(t, getPermissiveInstantiation(checkType)))) {
58166
58176
  (extraTypes || (extraTypes = [])).push(instantiateType(getTypeFromTypeNode(root.node.trueType), combinedMapper || mapper));
58167
58177
  }
58168
58178
  const falseType2 = getTypeFromTypeNode(root.node.falseType);
@@ -58272,7 +58282,9 @@ function createTypeChecker(host) {
58272
58282
  links.resolvedType = getConditionalType(
58273
58283
  root,
58274
58284
  /*mapper*/
58275
- void 0
58285
+ void 0,
58286
+ /*forConstraint*/
58287
+ false
58276
58288
  );
58277
58289
  if (outerTypeParameters) {
58278
58290
  root.instantiations = /* @__PURE__ */ new Map();
@@ -58961,7 +58973,7 @@ function createTypeChecker(host) {
58961
58973
  result = target.objectFlags & 4 /* Reference */ ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments) : target.objectFlags & 32 /* Mapped */ ? instantiateMappedType(target, newMapper, newAliasSymbol, newAliasTypeArguments) : instantiateAnonymousType(target, newMapper, newAliasSymbol, newAliasTypeArguments);
58962
58974
  target.instantiations.set(id, result);
58963
58975
  const resultObjectFlags = getObjectFlags(result);
58964
- if (result.flags & 138117121 /* ObjectFlagsType */ && !(resultObjectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
58976
+ if (result.flags & 3899393 /* ObjectFlagsType */ && !(resultObjectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
58965
58977
  const resultCouldContainTypeVariables = some(typeArguments, couldContainTypeVariables);
58966
58978
  if (!(getObjectFlags(result) & 524288 /* CouldContainTypeVariablesComputed */)) {
58967
58979
  if (resultObjectFlags & (32 /* Mapped */ | 16 /* Anonymous */ | 4 /* Reference */)) {
@@ -59127,17 +59139,17 @@ function createTypeChecker(host) {
59127
59139
  result.objectFlags |= result.aliasTypeArguments ? getPropagatingFlagsOfTypes(result.aliasTypeArguments) : 0;
59128
59140
  return result;
59129
59141
  }
59130
- function getConditionalTypeInstantiation(type, mapper, aliasSymbol, aliasTypeArguments) {
59142
+ function getConditionalTypeInstantiation(type, mapper, forConstraint, aliasSymbol, aliasTypeArguments) {
59131
59143
  const root = type.root;
59132
59144
  if (root.outerTypeParameters) {
59133
59145
  const typeArguments = map(root.outerTypeParameters, (t) => getMappedType(t, mapper));
59134
- const id = getTypeListId(typeArguments) + getAliasId(aliasSymbol, aliasTypeArguments);
59146
+ const id = (forConstraint ? "C" : "") + getTypeListId(typeArguments) + getAliasId(aliasSymbol, aliasTypeArguments);
59135
59147
  let result = root.instantiations.get(id);
59136
59148
  if (!result) {
59137
59149
  const newMapper = createTypeMapper(root.outerTypeParameters, typeArguments);
59138
59150
  const checkType = root.checkType;
59139
59151
  const distributionType = root.isDistributive ? getMappedType(checkType, newMapper) : void 0;
59140
- result = distributionType && checkType !== distributionType && distributionType.flags & (1048576 /* Union */ | 131072 /* Never */) ? mapTypeWithAlias(getReducedType(distributionType), (t) => getConditionalType(root, prependTypeMapping(checkType, t, newMapper)), aliasSymbol, aliasTypeArguments) : getConditionalType(root, newMapper, aliasSymbol, aliasTypeArguments);
59152
+ result = distributionType && checkType !== distributionType && distributionType.flags & (1048576 /* Union */ | 131072 /* Never */) ? mapTypeWithAlias(getReducedType(distributionType), (t) => getConditionalType(root, prependTypeMapping(checkType, t, newMapper), forConstraint), aliasSymbol, aliasTypeArguments) : getConditionalType(root, newMapper, forConstraint, aliasSymbol, aliasTypeArguments);
59141
59153
  root.instantiations.set(id, result);
59142
59154
  }
59143
59155
  return result;
@@ -59225,7 +59237,14 @@ function createTypeChecker(host) {
59225
59237
  );
59226
59238
  }
59227
59239
  if (flags & 16777216 /* Conditional */) {
59228
- return getConditionalTypeInstantiation(type, combineTypeMappers(type.mapper, mapper), aliasSymbol, aliasTypeArguments);
59240
+ return getConditionalTypeInstantiation(
59241
+ type,
59242
+ combineTypeMappers(type.mapper, mapper),
59243
+ /*forConstraint*/
59244
+ false,
59245
+ aliasSymbol,
59246
+ aliasTypeArguments
59247
+ );
59229
59248
  }
59230
59249
  if (flags & 33554432 /* Substitution */) {
59231
59250
  const newBaseType = instantiateType(type.baseType, mapper);
@@ -60869,7 +60888,7 @@ function createTypeChecker(host) {
60869
60888
  return relation === comparableRelation ? someTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */), intersectionState) : eachTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */), intersectionState);
60870
60889
  }
60871
60890
  if (target2.flags & 1048576 /* Union */) {
60872
- return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */) && !(target2.flags & 402784252 /* Primitive */));
60891
+ return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */) && !(target2.flags & 402784252 /* Primitive */), intersectionState);
60873
60892
  }
60874
60893
  if (target2.flags & 2097152 /* Intersection */) {
60875
60894
  return typeRelatedToEachType(source2, target2, reportErrors2, 2 /* Target */);
@@ -60914,7 +60933,8 @@ function createTypeChecker(host) {
60914
60933
  sourceType,
60915
60934
  target2,
60916
60935
  /*reportErrors*/
60917
- false
60936
+ false,
60937
+ 0 /* None */
60918
60938
  );
60919
60939
  if (!related) {
60920
60940
  return 0 /* False */;
@@ -60923,7 +60943,7 @@ function createTypeChecker(host) {
60923
60943
  }
60924
60944
  return result2;
60925
60945
  }
60926
- function typeRelatedToSomeType(source2, target2, reportErrors2) {
60946
+ function typeRelatedToSomeType(source2, target2, reportErrors2, intersectionState) {
60927
60947
  const targetTypes = target2.types;
60928
60948
  if (target2.flags & 1048576 /* Union */) {
60929
60949
  if (containsType(targetTypes, source2)) {
@@ -60941,7 +60961,10 @@ function createTypeChecker(host) {
60941
60961
  match,
60942
60962
  2 /* Target */,
60943
60963
  /*reportErrors*/
60944
- false
60964
+ false,
60965
+ /*headMessage*/
60966
+ void 0,
60967
+ intersectionState
60945
60968
  );
60946
60969
  if (related) {
60947
60970
  return related;
@@ -60954,7 +60977,10 @@ function createTypeChecker(host) {
60954
60977
  type,
60955
60978
  2 /* Target */,
60956
60979
  /*reportErrors*/
60957
- false
60980
+ false,
60981
+ /*headMessage*/
60982
+ void 0,
60983
+ intersectionState
60958
60984
  );
60959
60985
  if (related) {
60960
60986
  return related;
@@ -60968,7 +60994,10 @@ function createTypeChecker(host) {
60968
60994
  bestMatchingType,
60969
60995
  2 /* Target */,
60970
60996
  /*reportErrors*/
60971
- true
60997
+ true,
60998
+ /*headMessage*/
60999
+ void 0,
61000
+ intersectionState
60972
61001
  );
60973
61002
  }
60974
61003
  }
@@ -61766,13 +61795,6 @@ function createTypeChecker(host) {
61766
61795
  return result2;
61767
61796
  }
61768
61797
  }
61769
- } else {
61770
- const distributiveConstraint = hasNonCircularBaseConstraint(source2) ? getConstraintOfDistributiveConditionalType(source2) : void 0;
61771
- if (distributiveConstraint) {
61772
- if (result2 = isRelatedTo(distributiveConstraint, target2, 1 /* Source */, reportErrors2)) {
61773
- return result2;
61774
- }
61775
- }
61776
61798
  }
61777
61799
  const defaultConstraint = getDefaultConstraintOfConditionalType(source2);
61778
61800
  if (defaultConstraint) {
@@ -61780,6 +61802,13 @@ function createTypeChecker(host) {
61780
61802
  return result2;
61781
61803
  }
61782
61804
  }
61805
+ const distributiveConstraint = !(targetFlags & 16777216 /* Conditional */) && hasNonCircularBaseConstraint(source2) ? getConstraintOfDistributiveConditionalType(source2) : void 0;
61806
+ if (distributiveConstraint) {
61807
+ resetErrorInfo(saveErrorInfo);
61808
+ if (result2 = isRelatedTo(distributiveConstraint, target2, 1 /* Source */, reportErrors2)) {
61809
+ return result2;
61810
+ }
61811
+ }
61783
61812
  } else {
61784
61813
  if (relation !== subtypeRelation && relation !== strictSubtypeRelation && isPartialMappedType(target2) && isEmptyObjectType(source2)) {
61785
61814
  return -1 /* True */;
@@ -63677,8 +63706,8 @@ function createTypeChecker(host) {
63677
63706
  if (objectFlags & 524288 /* CouldContainTypeVariablesComputed */) {
63678
63707
  return !!(objectFlags & 1048576 /* CouldContainTypeVariables */);
63679
63708
  }
63680
- const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */) && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
63681
- if (type.flags & 138117121 /* ObjectFlagsType */) {
63709
+ const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
63710
+ if (type.flags & 3899393 /* ObjectFlagsType */) {
63682
63711
  type.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (result ? 1048576 /* CouldContainTypeVariables */ : 0);
63683
63712
  }
63684
63713
  return result;
@@ -80651,10 +80680,11 @@ function createTypeChecker(host) {
80651
80680
  node
80652
80681
  ));
80653
80682
  if (sym) {
80683
+ const typeOnlyDeclaration = getTypeOnlyAliasDeclaration(sym, 111551 /* Value */);
80654
80684
  markAliasReferenced(sym, id);
80655
80685
  if (getSymbolFlags(sym) & 111551 /* Value */) {
80656
80686
  checkExpressionCached(id);
80657
- if (!isIllegalExportDefaultInCJS && !(node.flags & 33554432 /* Ambient */) && compilerOptions.verbatimModuleSyntax && getTypeOnlyAliasDeclaration(sym, 111551 /* Value */)) {
80687
+ if (!isIllegalExportDefaultInCJS && !(node.flags & 33554432 /* Ambient */) && compilerOptions.verbatimModuleSyntax && typeOnlyDeclaration) {
80658
80688
  error(
80659
80689
  id,
80660
80690
  node.isExportEquals ? Diagnostics.An_export_declaration_must_reference_a_real_value_when_verbatimModuleSyntax_is_enabled_but_0_resolves_to_a_type_only_declaration : Diagnostics.An_export_default_must_reference_a_real_value_when_verbatimModuleSyntax_is_enabled_but_0_resolves_to_a_type_only_declaration,
@@ -80668,6 +80698,33 @@ function createTypeChecker(host) {
80668
80698
  idText(id)
80669
80699
  );
80670
80700
  }
80701
+ if (!isIllegalExportDefaultInCJS && getIsolatedModules(compilerOptions) && !(sym.flags & 111551 /* Value */)) {
80702
+ if (sym.flags & 2097152 /* Alias */ && resolveAlias(sym) !== unknownSymbol && getSymbolFlags(
80703
+ sym,
80704
+ /*excludeTypeOnlyMeanings*/
80705
+ false,
80706
+ /*excludeLocalMeanings*/
80707
+ true
80708
+ ) & 788968 /* Type */ && (!typeOnlyDeclaration || getSourceFileOfNode(typeOnlyDeclaration) !== getSourceFileOfNode(node))) {
80709
+ error(
80710
+ id,
80711
+ node.isExportEquals ? Diagnostics._0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_import_type_where_0_is_imported : Diagnostics._0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_export_type_0_as_default,
80712
+ idText(id),
80713
+ isolatedModulesLikeFlagName
80714
+ );
80715
+ } else if (typeOnlyDeclaration && getSourceFileOfNode(typeOnlyDeclaration) !== getSourceFileOfNode(node)) {
80716
+ addTypeOnlyDeclarationRelatedInfo(
80717
+ error(
80718
+ id,
80719
+ node.isExportEquals ? Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_import_type_where_0_is_imported : Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_export_type_0_as_default,
80720
+ idText(id),
80721
+ isolatedModulesLikeFlagName
80722
+ ),
80723
+ typeOnlyDeclaration,
80724
+ idText(id)
80725
+ );
80726
+ }
80727
+ }
80671
80728
  } else {
80672
80729
  checkExpressionCached(id);
80673
80730
  }
@@ -82062,7 +82119,11 @@ function createTypeChecker(host) {
82062
82119
  const exportClause = node.exportClause;
82063
82120
  return !!exportClause && (isNamespaceExport(exportClause) || some(exportClause.elements, isValueAliasDeclaration));
82064
82121
  case 277 /* ExportAssignment */:
82065
- return node.expression && node.expression.kind === 80 /* Identifier */ ? isAliasResolvedToValue(getSymbolOfDeclaration(node)) : true;
82122
+ return node.expression && node.expression.kind === 80 /* Identifier */ ? isAliasResolvedToValue(
82123
+ getSymbolOfDeclaration(node),
82124
+ /*excludeTypeOnlyValues*/
82125
+ true
82126
+ ) : true;
82066
82127
  }
82067
82128
  return false;
82068
82129
  }