@typescript-deploys/pr-build 5.1.0-pr-53739-12 → 5.1.0-pr-51328-34

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
@@ -7741,7 +7741,8 @@ var Diagnostics = {
7741
7741
  _0_is_possibly_null_or_undefined: diag(18049, 1 /* Error */, "_0_is_possibly_null_or_undefined_18049", "'{0}' is possibly 'null' or 'undefined'."),
7742
7742
  The_value_0_cannot_be_used_here: diag(18050, 1 /* Error */, "The_value_0_cannot_be_used_here_18050", "The value '{0}' cannot be used here."),
7743
7743
  Compiler_option_0_cannot_be_given_an_empty_string: diag(18051, 1 /* Error */, "Compiler_option_0_cannot_be_given_an_empty_string_18051", "Compiler option '{0}' cannot be given an empty string."),
7744
- Non_abstract_class_0_does_not_implement_all_abstract_members_of_1: diag(18052, 1 /* Error */, "Non_abstract_class_0_does_not_implement_all_abstract_members_of_1_18052", "Non-abstract class '{0}' does not implement all abstract members of '{1}'")
7744
+ Non_abstract_class_0_does_not_implement_all_abstract_members_of_1: diag(18052, 1 /* Error */, "Non_abstract_class_0_does_not_implement_all_abstract_members_of_1_18052", "Non-abstract class '{0}' does not implement all abstract members of '{1}'"),
7745
+ Its_type_0_is_not_a_valid_JSX_element_type: diag(18053, 1 /* Error */, "Its_type_0_is_not_a_valid_JSX_element_type_18053", "Its type '{0}' is not a valid JSX element type.")
7745
7746
  };
7746
7747
 
7747
7748
  // src/compiler/scanner.ts
@@ -42568,7 +42569,6 @@ function isInstantiatedModule(node, preserveConstEnums) {
42568
42569
  const moduleState = getModuleInstanceState(node);
42569
42570
  return moduleState === 1 /* Instantiated */ || preserveConstEnums && moduleState === 2 /* ConstEnumOnly */;
42570
42571
  }
42571
- var UNION_CROSS_PRODUCT_SIZE_LIMIT = 1e5;
42572
42572
  function createTypeChecker(host) {
42573
42573
  var getPackagesMap = memoize(() => {
42574
42574
  var map2 = /* @__PURE__ */ new Map();
@@ -51741,12 +51741,7 @@ function createTypeChecker(host) {
51741
51741
  if (!links.type) {
51742
51742
  Debug.assertIsDefined(links.deferralParent);
51743
51743
  Debug.assertIsDefined(links.deferralConstituents);
51744
- const operation = links.deferralParent.flags & 1048576 /* Union */ ? getUnionType : getIntersectionType;
51745
- let result = operation(links.deferralConstituents);
51746
- for (const part of links.deferredMismatchedParts || emptyArray) {
51747
- result = operation([result, getTypeOfSymbol(part)]);
51748
- }
51749
- links.type = result;
51744
+ links.type = links.deferralParent.flags & 1048576 /* Union */ ? getUnionType(links.deferralConstituents) : getIntersectionType(links.deferralConstituents);
51750
51745
  }
51751
51746
  return links.type;
51752
51747
  }
@@ -51754,12 +51749,8 @@ function createTypeChecker(host) {
51754
51749
  const links = getSymbolLinks(symbol);
51755
51750
  if (!links.writeType && links.deferralWriteConstituents) {
51756
51751
  Debug.assertIsDefined(links.deferralParent);
51757
- const operation = links.deferralParent.flags & 1048576 /* Union */ ? getUnionType : getIntersectionType;
51758
- let result = operation(links.deferralWriteConstituents);
51759
- for (const part of links.deferredMismatchedParts || emptyArray) {
51760
- result = operation([result, getTypeOfSymbol(part)]);
51761
- }
51762
- links.writeType = result;
51752
+ Debug.assertIsDefined(links.deferralConstituents);
51753
+ links.writeType = links.deferralParent.flags & 1048576 /* Union */ ? getUnionType(links.deferralWriteConstituents) : getIntersectionType(links.deferralWriteConstituents);
51763
51754
  }
51764
51755
  return links.writeType;
51765
51756
  }
@@ -53796,7 +53787,7 @@ function createTypeChecker(host) {
53796
53787
  return getReducedType(getApparentType(getReducedType(type)));
53797
53788
  }
53798
53789
  function createUnionOrIntersectionProperty(containingType, name, skipObjectFunctionPropertyAugment) {
53799
- var _a2, _b, _c, _d;
53790
+ var _a2, _b, _c;
53800
53791
  let singleProp;
53801
53792
  let propSet;
53802
53793
  let indexTypes;
@@ -53878,9 +53869,8 @@ function createTypeChecker(host) {
53878
53869
  let declarations;
53879
53870
  let firstType;
53880
53871
  let nameType;
53881
- let propTypes = [];
53872
+ const propTypes = [];
53882
53873
  let writeTypes;
53883
- let deferredMismatchedParts;
53884
53874
  let firstValueDeclaration;
53885
53875
  let hasNonUniformValueDeclaration = false;
53886
53876
  for (const prop of props) {
@@ -53890,24 +53880,6 @@ function createTypeChecker(host) {
53890
53880
  hasNonUniformValueDeclaration = true;
53891
53881
  }
53892
53882
  declarations = addRange(declarations, prop.declarations);
53893
- if (getCheckFlags(prop) & 65536 /* DeferredType */) {
53894
- checkFlags |= getCheckFlags(prop) & (131072 /* HasNeverType */ | 64 /* HasNonUniformType */ | 128 /* HasLiteralType */);
53895
- if (!nameType) {
53896
- nameType = getSymbolLinks(prop).nameType;
53897
- }
53898
- if ((((_d = getSymbolLinks(prop).deferralParent) == null ? void 0 : _d.flags) & 3145728 /* UnionOrIntersection */) === (containingType.flags & 3145728 /* UnionOrIntersection */)) {
53899
- const deferredWriteTypes = getSymbolLinks(prop).deferralWriteConstituents;
53900
- if (deferredWriteTypes) {
53901
- writeTypes = concatenate(!writeTypes ? propTypes.slice() : writeTypes, deferredWriteTypes);
53902
- }
53903
- propTypes = concatenate(propTypes, getSymbolLinks(prop).deferralConstituents);
53904
- deferredMismatchedParts = concatenate(deferredMismatchedParts, getSymbolLinks(prop).deferredMismatchedParts);
53905
- break;
53906
- } else {
53907
- deferredMismatchedParts = append(deferredMismatchedParts, prop);
53908
- break;
53909
- }
53910
- }
53911
53883
  const type = getTypeOfSymbol(prop);
53912
53884
  if (!firstType) {
53913
53885
  firstType = type;
@@ -53938,12 +53910,11 @@ function createTypeChecker(host) {
53938
53910
  }
53939
53911
  result.declarations = declarations;
53940
53912
  result.links.nameType = nameType;
53941
- if (propTypes.length > 2 || deferredMismatchedParts) {
53913
+ if (propTypes.length > 2) {
53942
53914
  result.links.checkFlags |= 65536 /* DeferredType */;
53943
53915
  result.links.deferralParent = containingType;
53944
53916
  result.links.deferralConstituents = propTypes;
53945
53917
  result.links.deferralWriteConstituents = writeTypes;
53946
- result.links.deferredMismatchedParts = deferredMismatchedParts;
53947
53918
  } else {
53948
53919
  result.links.type = isUnion ? getUnionType(propTypes) : getIntersectionType(propTypes);
53949
53920
  if (writeTypes) {
@@ -56300,7 +56271,7 @@ function createTypeChecker(host) {
56300
56271
  function getIntersectionType(types, aliasSymbol, aliasTypeArguments, noSupertypeReduction) {
56301
56272
  const typeMembershipMap = /* @__PURE__ */ new Map();
56302
56273
  const includes = addTypesToIntersection(typeMembershipMap, 0, types);
56303
- let typeSet = arrayFrom(typeMembershipMap.values());
56274
+ const typeSet = arrayFrom(typeMembershipMap.values());
56304
56275
  if (includes & 131072 /* Never */) {
56305
56276
  return contains(typeSet, silentNeverType) ? silentNeverType : neverType;
56306
56277
  }
@@ -56332,8 +56303,6 @@ function createTypeChecker(host) {
56332
56303
  const id = getTypeListId(typeSet) + getAliasId(aliasSymbol, aliasTypeArguments);
56333
56304
  let result = intersectionTypes.get(id);
56334
56305
  if (!result) {
56335
- const originalSet = typeSet;
56336
- let runningResult;
56337
56306
  if (includes & 1048576 /* Union */) {
56338
56307
  if (intersectUnionsOfPrimitiveTypes(typeSet)) {
56339
56308
  result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
@@ -56345,32 +56314,12 @@ function createTypeChecker(host) {
56345
56314
  removeFromEach(typeSet, 65536 /* Null */);
56346
56315
  result = getUnionType([getIntersectionType(typeSet), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
56347
56316
  } else {
56348
- if (getCrossProductUnionSize(typeSet) >= UNION_CROSS_PRODUCT_SIZE_LIMIT && every(typeSet, (t) => !!(t.flags & 1048576 /* Union */) || !!(t.flags & 402784252 /* Primitive */))) {
56349
- if (typeSet.length > 2 || some(typeSet, (t) => getReducedType(t) !== t)) {
56350
- runningResult = getReducedType(typeSet[0]);
56351
- for (let i = 1; i < typeSet.length; i++) {
56352
- const reducedElem = getReducedType(typeSet[i]);
56353
- runningResult = reducedElem.flags & 402784252 /* Primitive */ && everyType(runningResult, (t) => !!(t.flags & 524288 /* Object */)) ? neverType : getReducedType(intersectTypes(runningResult, reducedElem));
56354
- if (i === typeSet.length - 1 || isTypeAny(runningResult) || runningResult.flags & 131072 /* Never */) {
56355
- return runningResult;
56356
- }
56357
- if (!(runningResult.flags & 1048576 /* Union */) || runningResult.types.length > typeSet.length) {
56358
- typeSet = typeSet.slice(i + 1);
56359
- break;
56360
- }
56361
- }
56362
- }
56363
- }
56364
56317
  if (!checkCrossProductUnion(typeSet)) {
56365
56318
  return errorType;
56366
56319
  }
56367
56320
  const constituents = getCrossProductIntersections(typeSet);
56368
- if (runningResult && runningResult !== typeSet[0]) {
56369
- result = getIntersectionType([runningResult, getUnionType(constituents, 1 /* Literal */)], aliasSymbol, aliasTypeArguments);
56370
- } else {
56371
- const origin = some(constituents, (t) => !!(t.flags & 2097152 /* Intersection */)) && getConstituentCountOfTypes(constituents) > getConstituentCountOfTypes(typeSet) ? createOriginUnionOrIntersectionType(2097152 /* Intersection */, originalSet) : void 0;
56372
- result = getUnionType(constituents, 1 /* Literal */, aliasSymbol, aliasTypeArguments, origin);
56373
- }
56321
+ const origin = some(constituents, (t) => !!(t.flags & 2097152 /* Intersection */)) && getConstituentCountOfTypes(constituents) > getConstituentCountOfTypes(typeSet) ? createOriginUnionOrIntersectionType(2097152 /* Intersection */, typeSet) : void 0;
56322
+ result = getUnionType(constituents, 1 /* Literal */, aliasSymbol, aliasTypeArguments, origin);
56374
56323
  }
56375
56324
  } else {
56376
56325
  result = createIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
@@ -56385,7 +56334,7 @@ function createTypeChecker(host) {
56385
56334
  function checkCrossProductUnion(types) {
56386
56335
  var _a2;
56387
56336
  const size = getCrossProductUnionSize(types);
56388
- if (size >= UNION_CROSS_PRODUCT_SIZE_LIMIT) {
56337
+ if (size >= 1e5) {
56389
56338
  (_a2 = tracing) == null ? void 0 : _a2.instant(tracing.Phase.CheckTypes, "checkCrossProductUnion_DepthLimit", { typeIds: types.map((t) => t.id), size });
56390
56339
  error(currentNode, Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent);
56391
56340
  return false;
@@ -68220,6 +68169,12 @@ function createTypeChecker(host) {
68220
68169
  return getUnionType([jsxElementType, nullType]);
68221
68170
  }
68222
68171
  }
68172
+ function getJsxElementTypeTypeAt(location) {
68173
+ const type = getJsxType(JsxNames.ElementType, location);
68174
+ if (isErrorType(type))
68175
+ return void 0;
68176
+ return type;
68177
+ }
68223
68178
  function getJsxIntrinsicTagNamesAt(location) {
68224
68179
  const intrinsics = getJsxType(JsxNames.IntrinsicElements, location);
68225
68180
  return intrinsics ? getPropertiesOfType(intrinsics) : emptyArray;
@@ -68282,7 +68237,24 @@ function createTypeChecker(host) {
68282
68237
  const jsxOpeningLikeNode = node;
68283
68238
  const sig = getResolvedSignature(jsxOpeningLikeNode);
68284
68239
  checkDeprecatedSignature(sig, node);
68285
- checkJsxReturnAssignableToAppropriateBound(getJsxReferenceKind(jsxOpeningLikeNode), getReturnTypeOfSignature(sig), jsxOpeningLikeNode);
68240
+ const elementTypeConstraint = getJsxElementTypeTypeAt(jsxOpeningLikeNode);
68241
+ if (elementTypeConstraint !== void 0) {
68242
+ const tagType = isJsxIntrinsicIdentifier(jsxOpeningLikeNode.tagName) ? (
68243
+ // TODO: Should this be a literal that library authors could potentially check against?
68244
+ stringType
68245
+ ) : getApparentType(checkExpression(jsxOpeningLikeNode.tagName));
68246
+ checkTypeRelatedTo(tagType, elementTypeConstraint, assignableRelation, jsxOpeningLikeNode.tagName, Diagnostics.Its_type_0_is_not_a_valid_JSX_element_type, () => {
68247
+ const componentName = getTextOfNode(jsxOpeningLikeNode.tagName);
68248
+ return chainDiagnosticMessages(
68249
+ /*details*/
68250
+ void 0,
68251
+ Diagnostics._0_cannot_be_used_as_a_JSX_component,
68252
+ componentName
68253
+ );
68254
+ });
68255
+ } else {
68256
+ checkJsxReturnAssignableToAppropriateBound(getJsxReferenceKind(jsxOpeningLikeNode), getReturnTypeOfSignature(sig), jsxOpeningLikeNode);
68257
+ }
68286
68258
  }
68287
68259
  }
68288
68260
  function isKnownProperty(targetType, name, isComparingJsxAttributes) {
@@ -83045,6 +83017,7 @@ var JsxNames;
83045
83017
  JsxNames2.ElementAttributesPropertyNameContainer = "ElementAttributesProperty";
83046
83018
  JsxNames2.ElementChildrenAttributeNameContainer = "ElementChildrenAttribute";
83047
83019
  JsxNames2.Element = "Element";
83020
+ JsxNames2.ElementType = "ElementType";
83048
83021
  JsxNames2.IntrinsicAttributes = "IntrinsicAttributes";
83049
83022
  JsxNames2.IntrinsicClassAttributes = "IntrinsicClassAttributes";
83050
83023
  JsxNames2.LibraryManagedAttributes = "LibraryManagedAttributes";
package/lib/tsserver.js CHANGED
@@ -11242,7 +11242,8 @@ var Diagnostics = {
11242
11242
  _0_is_possibly_null_or_undefined: diag(18049, 1 /* Error */, "_0_is_possibly_null_or_undefined_18049", "'{0}' is possibly 'null' or 'undefined'."),
11243
11243
  The_value_0_cannot_be_used_here: diag(18050, 1 /* Error */, "The_value_0_cannot_be_used_here_18050", "The value '{0}' cannot be used here."),
11244
11244
  Compiler_option_0_cannot_be_given_an_empty_string: diag(18051, 1 /* Error */, "Compiler_option_0_cannot_be_given_an_empty_string_18051", "Compiler option '{0}' cannot be given an empty string."),
11245
- Non_abstract_class_0_does_not_implement_all_abstract_members_of_1: diag(18052, 1 /* Error */, "Non_abstract_class_0_does_not_implement_all_abstract_members_of_1_18052", "Non-abstract class '{0}' does not implement all abstract members of '{1}'")
11245
+ Non_abstract_class_0_does_not_implement_all_abstract_members_of_1: diag(18052, 1 /* Error */, "Non_abstract_class_0_does_not_implement_all_abstract_members_of_1_18052", "Non-abstract class '{0}' does not implement all abstract members of '{1}'"),
11246
+ Its_type_0_is_not_a_valid_JSX_element_type: diag(18053, 1 /* Error */, "Its_type_0_is_not_a_valid_JSX_element_type_18053", "Its type '{0}' is not a valid JSX element type.")
11246
11247
  };
11247
11248
 
11248
11249
  // src/compiler/scanner.ts
@@ -47218,7 +47219,6 @@ function isInstantiatedModule(node, preserveConstEnums) {
47218
47219
  const moduleState = getModuleInstanceState(node);
47219
47220
  return moduleState === 1 /* Instantiated */ || preserveConstEnums && moduleState === 2 /* ConstEnumOnly */;
47220
47221
  }
47221
- var UNION_CROSS_PRODUCT_SIZE_LIMIT = 1e5;
47222
47222
  function createTypeChecker(host) {
47223
47223
  var getPackagesMap = memoize(() => {
47224
47224
  var map2 = /* @__PURE__ */ new Map();
@@ -56391,12 +56391,7 @@ function createTypeChecker(host) {
56391
56391
  if (!links.type) {
56392
56392
  Debug.assertIsDefined(links.deferralParent);
56393
56393
  Debug.assertIsDefined(links.deferralConstituents);
56394
- const operation = links.deferralParent.flags & 1048576 /* Union */ ? getUnionType : getIntersectionType;
56395
- let result = operation(links.deferralConstituents);
56396
- for (const part of links.deferredMismatchedParts || emptyArray) {
56397
- result = operation([result, getTypeOfSymbol(part)]);
56398
- }
56399
- links.type = result;
56394
+ links.type = links.deferralParent.flags & 1048576 /* Union */ ? getUnionType(links.deferralConstituents) : getIntersectionType(links.deferralConstituents);
56400
56395
  }
56401
56396
  return links.type;
56402
56397
  }
@@ -56404,12 +56399,8 @@ function createTypeChecker(host) {
56404
56399
  const links = getSymbolLinks(symbol);
56405
56400
  if (!links.writeType && links.deferralWriteConstituents) {
56406
56401
  Debug.assertIsDefined(links.deferralParent);
56407
- const operation = links.deferralParent.flags & 1048576 /* Union */ ? getUnionType : getIntersectionType;
56408
- let result = operation(links.deferralWriteConstituents);
56409
- for (const part of links.deferredMismatchedParts || emptyArray) {
56410
- result = operation([result, getTypeOfSymbol(part)]);
56411
- }
56412
- links.writeType = result;
56402
+ Debug.assertIsDefined(links.deferralConstituents);
56403
+ links.writeType = links.deferralParent.flags & 1048576 /* Union */ ? getUnionType(links.deferralWriteConstituents) : getIntersectionType(links.deferralWriteConstituents);
56413
56404
  }
56414
56405
  return links.writeType;
56415
56406
  }
@@ -58446,7 +58437,7 @@ function createTypeChecker(host) {
58446
58437
  return getReducedType(getApparentType(getReducedType(type)));
58447
58438
  }
58448
58439
  function createUnionOrIntersectionProperty(containingType, name, skipObjectFunctionPropertyAugment) {
58449
- var _a2, _b, _c, _d;
58440
+ var _a2, _b, _c;
58450
58441
  let singleProp;
58451
58442
  let propSet;
58452
58443
  let indexTypes;
@@ -58528,9 +58519,8 @@ function createTypeChecker(host) {
58528
58519
  let declarations;
58529
58520
  let firstType;
58530
58521
  let nameType;
58531
- let propTypes = [];
58522
+ const propTypes = [];
58532
58523
  let writeTypes;
58533
- let deferredMismatchedParts;
58534
58524
  let firstValueDeclaration;
58535
58525
  let hasNonUniformValueDeclaration = false;
58536
58526
  for (const prop of props) {
@@ -58540,24 +58530,6 @@ function createTypeChecker(host) {
58540
58530
  hasNonUniformValueDeclaration = true;
58541
58531
  }
58542
58532
  declarations = addRange(declarations, prop.declarations);
58543
- if (getCheckFlags(prop) & 65536 /* DeferredType */) {
58544
- checkFlags |= getCheckFlags(prop) & (131072 /* HasNeverType */ | 64 /* HasNonUniformType */ | 128 /* HasLiteralType */);
58545
- if (!nameType) {
58546
- nameType = getSymbolLinks(prop).nameType;
58547
- }
58548
- if ((((_d = getSymbolLinks(prop).deferralParent) == null ? void 0 : _d.flags) & 3145728 /* UnionOrIntersection */) === (containingType.flags & 3145728 /* UnionOrIntersection */)) {
58549
- const deferredWriteTypes = getSymbolLinks(prop).deferralWriteConstituents;
58550
- if (deferredWriteTypes) {
58551
- writeTypes = concatenate(!writeTypes ? propTypes.slice() : writeTypes, deferredWriteTypes);
58552
- }
58553
- propTypes = concatenate(propTypes, getSymbolLinks(prop).deferralConstituents);
58554
- deferredMismatchedParts = concatenate(deferredMismatchedParts, getSymbolLinks(prop).deferredMismatchedParts);
58555
- break;
58556
- } else {
58557
- deferredMismatchedParts = append(deferredMismatchedParts, prop);
58558
- break;
58559
- }
58560
- }
58561
58533
  const type = getTypeOfSymbol(prop);
58562
58534
  if (!firstType) {
58563
58535
  firstType = type;
@@ -58588,12 +58560,11 @@ function createTypeChecker(host) {
58588
58560
  }
58589
58561
  result.declarations = declarations;
58590
58562
  result.links.nameType = nameType;
58591
- if (propTypes.length > 2 || deferredMismatchedParts) {
58563
+ if (propTypes.length > 2) {
58592
58564
  result.links.checkFlags |= 65536 /* DeferredType */;
58593
58565
  result.links.deferralParent = containingType;
58594
58566
  result.links.deferralConstituents = propTypes;
58595
58567
  result.links.deferralWriteConstituents = writeTypes;
58596
- result.links.deferredMismatchedParts = deferredMismatchedParts;
58597
58568
  } else {
58598
58569
  result.links.type = isUnion ? getUnionType(propTypes) : getIntersectionType(propTypes);
58599
58570
  if (writeTypes) {
@@ -60950,7 +60921,7 @@ function createTypeChecker(host) {
60950
60921
  function getIntersectionType(types, aliasSymbol, aliasTypeArguments, noSupertypeReduction) {
60951
60922
  const typeMembershipMap = /* @__PURE__ */ new Map();
60952
60923
  const includes = addTypesToIntersection(typeMembershipMap, 0, types);
60953
- let typeSet = arrayFrom(typeMembershipMap.values());
60924
+ const typeSet = arrayFrom(typeMembershipMap.values());
60954
60925
  if (includes & 131072 /* Never */) {
60955
60926
  return contains(typeSet, silentNeverType) ? silentNeverType : neverType;
60956
60927
  }
@@ -60982,8 +60953,6 @@ function createTypeChecker(host) {
60982
60953
  const id = getTypeListId(typeSet) + getAliasId(aliasSymbol, aliasTypeArguments);
60983
60954
  let result = intersectionTypes.get(id);
60984
60955
  if (!result) {
60985
- const originalSet = typeSet;
60986
- let runningResult;
60987
60956
  if (includes & 1048576 /* Union */) {
60988
60957
  if (intersectUnionsOfPrimitiveTypes(typeSet)) {
60989
60958
  result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
@@ -60995,32 +60964,12 @@ function createTypeChecker(host) {
60995
60964
  removeFromEach(typeSet, 65536 /* Null */);
60996
60965
  result = getUnionType([getIntersectionType(typeSet), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
60997
60966
  } else {
60998
- if (getCrossProductUnionSize(typeSet) >= UNION_CROSS_PRODUCT_SIZE_LIMIT && every(typeSet, (t) => !!(t.flags & 1048576 /* Union */) || !!(t.flags & 402784252 /* Primitive */))) {
60999
- if (typeSet.length > 2 || some(typeSet, (t) => getReducedType(t) !== t)) {
61000
- runningResult = getReducedType(typeSet[0]);
61001
- for (let i = 1; i < typeSet.length; i++) {
61002
- const reducedElem = getReducedType(typeSet[i]);
61003
- runningResult = reducedElem.flags & 402784252 /* Primitive */ && everyType(runningResult, (t) => !!(t.flags & 524288 /* Object */)) ? neverType : getReducedType(intersectTypes(runningResult, reducedElem));
61004
- if (i === typeSet.length - 1 || isTypeAny(runningResult) || runningResult.flags & 131072 /* Never */) {
61005
- return runningResult;
61006
- }
61007
- if (!(runningResult.flags & 1048576 /* Union */) || runningResult.types.length > typeSet.length) {
61008
- typeSet = typeSet.slice(i + 1);
61009
- break;
61010
- }
61011
- }
61012
- }
61013
- }
61014
60967
  if (!checkCrossProductUnion(typeSet)) {
61015
60968
  return errorType;
61016
60969
  }
61017
60970
  const constituents = getCrossProductIntersections(typeSet);
61018
- if (runningResult && runningResult !== typeSet[0]) {
61019
- result = getIntersectionType([runningResult, getUnionType(constituents, 1 /* Literal */)], aliasSymbol, aliasTypeArguments);
61020
- } else {
61021
- const origin = some(constituents, (t) => !!(t.flags & 2097152 /* Intersection */)) && getConstituentCountOfTypes(constituents) > getConstituentCountOfTypes(typeSet) ? createOriginUnionOrIntersectionType(2097152 /* Intersection */, originalSet) : void 0;
61022
- result = getUnionType(constituents, 1 /* Literal */, aliasSymbol, aliasTypeArguments, origin);
61023
- }
60971
+ const origin = some(constituents, (t) => !!(t.flags & 2097152 /* Intersection */)) && getConstituentCountOfTypes(constituents) > getConstituentCountOfTypes(typeSet) ? createOriginUnionOrIntersectionType(2097152 /* Intersection */, typeSet) : void 0;
60972
+ result = getUnionType(constituents, 1 /* Literal */, aliasSymbol, aliasTypeArguments, origin);
61024
60973
  }
61025
60974
  } else {
61026
60975
  result = createIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
@@ -61035,7 +60984,7 @@ function createTypeChecker(host) {
61035
60984
  function checkCrossProductUnion(types) {
61036
60985
  var _a2;
61037
60986
  const size = getCrossProductUnionSize(types);
61038
- if (size >= UNION_CROSS_PRODUCT_SIZE_LIMIT) {
60987
+ if (size >= 1e5) {
61039
60988
  (_a2 = tracing) == null ? void 0 : _a2.instant(tracing.Phase.CheckTypes, "checkCrossProductUnion_DepthLimit", { typeIds: types.map((t) => t.id), size });
61040
60989
  error(currentNode, Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent);
61041
60990
  return false;
@@ -72870,6 +72819,12 @@ function createTypeChecker(host) {
72870
72819
  return getUnionType([jsxElementType, nullType]);
72871
72820
  }
72872
72821
  }
72822
+ function getJsxElementTypeTypeAt(location) {
72823
+ const type = getJsxType(JsxNames.ElementType, location);
72824
+ if (isErrorType(type))
72825
+ return void 0;
72826
+ return type;
72827
+ }
72873
72828
  function getJsxIntrinsicTagNamesAt(location) {
72874
72829
  const intrinsics = getJsxType(JsxNames.IntrinsicElements, location);
72875
72830
  return intrinsics ? getPropertiesOfType(intrinsics) : emptyArray;
@@ -72932,7 +72887,24 @@ function createTypeChecker(host) {
72932
72887
  const jsxOpeningLikeNode = node;
72933
72888
  const sig = getResolvedSignature(jsxOpeningLikeNode);
72934
72889
  checkDeprecatedSignature(sig, node);
72935
- checkJsxReturnAssignableToAppropriateBound(getJsxReferenceKind(jsxOpeningLikeNode), getReturnTypeOfSignature(sig), jsxOpeningLikeNode);
72890
+ const elementTypeConstraint = getJsxElementTypeTypeAt(jsxOpeningLikeNode);
72891
+ if (elementTypeConstraint !== void 0) {
72892
+ const tagType = isJsxIntrinsicIdentifier(jsxOpeningLikeNode.tagName) ? (
72893
+ // TODO: Should this be a literal that library authors could potentially check against?
72894
+ stringType
72895
+ ) : getApparentType(checkExpression(jsxOpeningLikeNode.tagName));
72896
+ checkTypeRelatedTo(tagType, elementTypeConstraint, assignableRelation, jsxOpeningLikeNode.tagName, Diagnostics.Its_type_0_is_not_a_valid_JSX_element_type, () => {
72897
+ const componentName = getTextOfNode(jsxOpeningLikeNode.tagName);
72898
+ return chainDiagnosticMessages(
72899
+ /*details*/
72900
+ void 0,
72901
+ Diagnostics._0_cannot_be_used_as_a_JSX_component,
72902
+ componentName
72903
+ );
72904
+ });
72905
+ } else {
72906
+ checkJsxReturnAssignableToAppropriateBound(getJsxReferenceKind(jsxOpeningLikeNode), getReturnTypeOfSignature(sig), jsxOpeningLikeNode);
72907
+ }
72936
72908
  }
72937
72909
  }
72938
72910
  function isKnownProperty(targetType, name, isComparingJsxAttributes) {
@@ -87695,6 +87667,7 @@ var JsxNames;
87695
87667
  JsxNames2.ElementAttributesPropertyNameContainer = "ElementAttributesProperty";
87696
87668
  JsxNames2.ElementChildrenAttributeNameContainer = "ElementChildrenAttribute";
87697
87669
  JsxNames2.Element = "Element";
87670
+ JsxNames2.ElementType = "ElementType";
87698
87671
  JsxNames2.IntrinsicAttributes = "IntrinsicAttributes";
87699
87672
  JsxNames2.IntrinsicClassAttributes = "IntrinsicClassAttributes";
87700
87673
  JsxNames2.LibraryManagedAttributes = "LibraryManagedAttributes";
@@ -9058,7 +9058,8 @@ ${lanes.join("\n")}
9058
9058
  _0_is_possibly_null_or_undefined: diag(18049, 1 /* Error */, "_0_is_possibly_null_or_undefined_18049", "'{0}' is possibly 'null' or 'undefined'."),
9059
9059
  The_value_0_cannot_be_used_here: diag(18050, 1 /* Error */, "The_value_0_cannot_be_used_here_18050", "The value '{0}' cannot be used here."),
9060
9060
  Compiler_option_0_cannot_be_given_an_empty_string: diag(18051, 1 /* Error */, "Compiler_option_0_cannot_be_given_an_empty_string_18051", "Compiler option '{0}' cannot be given an empty string."),
9061
- Non_abstract_class_0_does_not_implement_all_abstract_members_of_1: diag(18052, 1 /* Error */, "Non_abstract_class_0_does_not_implement_all_abstract_members_of_1_18052", "Non-abstract class '{0}' does not implement all abstract members of '{1}'")
9061
+ Non_abstract_class_0_does_not_implement_all_abstract_members_of_1: diag(18052, 1 /* Error */, "Non_abstract_class_0_does_not_implement_all_abstract_members_of_1_18052", "Non-abstract class '{0}' does not implement all abstract members of '{1}'"),
9062
+ Its_type_0_is_not_a_valid_JSX_element_type: diag(18053, 1 /* Error */, "Its_type_0_is_not_a_valid_JSX_element_type_18053", "Its type '{0}' is not a valid JSX element type.")
9062
9063
  };
9063
9064
  }
9064
9065
  });
@@ -54191,12 +54192,7 @@ ${lanes.join("\n")}
54191
54192
  if (!links.type) {
54192
54193
  Debug.assertIsDefined(links.deferralParent);
54193
54194
  Debug.assertIsDefined(links.deferralConstituents);
54194
- const operation = links.deferralParent.flags & 1048576 /* Union */ ? getUnionType : getIntersectionType;
54195
- let result = operation(links.deferralConstituents);
54196
- for (const part of links.deferredMismatchedParts || emptyArray) {
54197
- result = operation([result, getTypeOfSymbol(part)]);
54198
- }
54199
- links.type = result;
54195
+ links.type = links.deferralParent.flags & 1048576 /* Union */ ? getUnionType(links.deferralConstituents) : getIntersectionType(links.deferralConstituents);
54200
54196
  }
54201
54197
  return links.type;
54202
54198
  }
@@ -54204,12 +54200,8 @@ ${lanes.join("\n")}
54204
54200
  const links = getSymbolLinks(symbol);
54205
54201
  if (!links.writeType && links.deferralWriteConstituents) {
54206
54202
  Debug.assertIsDefined(links.deferralParent);
54207
- const operation = links.deferralParent.flags & 1048576 /* Union */ ? getUnionType : getIntersectionType;
54208
- let result = operation(links.deferralWriteConstituents);
54209
- for (const part of links.deferredMismatchedParts || emptyArray) {
54210
- result = operation([result, getTypeOfSymbol(part)]);
54211
- }
54212
- links.writeType = result;
54203
+ Debug.assertIsDefined(links.deferralConstituents);
54204
+ links.writeType = links.deferralParent.flags & 1048576 /* Union */ ? getUnionType(links.deferralWriteConstituents) : getIntersectionType(links.deferralWriteConstituents);
54213
54205
  }
54214
54206
  return links.writeType;
54215
54207
  }
@@ -56246,7 +56238,7 @@ ${lanes.join("\n")}
56246
56238
  return getReducedType(getApparentType(getReducedType(type)));
56247
56239
  }
56248
56240
  function createUnionOrIntersectionProperty(containingType, name, skipObjectFunctionPropertyAugment) {
56249
- var _a2, _b, _c, _d;
56241
+ var _a2, _b, _c;
56250
56242
  let singleProp;
56251
56243
  let propSet;
56252
56244
  let indexTypes;
@@ -56328,9 +56320,8 @@ ${lanes.join("\n")}
56328
56320
  let declarations;
56329
56321
  let firstType;
56330
56322
  let nameType;
56331
- let propTypes = [];
56323
+ const propTypes = [];
56332
56324
  let writeTypes;
56333
- let deferredMismatchedParts;
56334
56325
  let firstValueDeclaration;
56335
56326
  let hasNonUniformValueDeclaration = false;
56336
56327
  for (const prop of props) {
@@ -56340,24 +56331,6 @@ ${lanes.join("\n")}
56340
56331
  hasNonUniformValueDeclaration = true;
56341
56332
  }
56342
56333
  declarations = addRange(declarations, prop.declarations);
56343
- if (getCheckFlags(prop) & 65536 /* DeferredType */) {
56344
- checkFlags |= getCheckFlags(prop) & (131072 /* HasNeverType */ | 64 /* HasNonUniformType */ | 128 /* HasLiteralType */);
56345
- if (!nameType) {
56346
- nameType = getSymbolLinks(prop).nameType;
56347
- }
56348
- if ((((_d = getSymbolLinks(prop).deferralParent) == null ? void 0 : _d.flags) & 3145728 /* UnionOrIntersection */) === (containingType.flags & 3145728 /* UnionOrIntersection */)) {
56349
- const deferredWriteTypes = getSymbolLinks(prop).deferralWriteConstituents;
56350
- if (deferredWriteTypes) {
56351
- writeTypes = concatenate(!writeTypes ? propTypes.slice() : writeTypes, deferredWriteTypes);
56352
- }
56353
- propTypes = concatenate(propTypes, getSymbolLinks(prop).deferralConstituents);
56354
- deferredMismatchedParts = concatenate(deferredMismatchedParts, getSymbolLinks(prop).deferredMismatchedParts);
56355
- break;
56356
- } else {
56357
- deferredMismatchedParts = append(deferredMismatchedParts, prop);
56358
- break;
56359
- }
56360
- }
56361
56334
  const type = getTypeOfSymbol(prop);
56362
56335
  if (!firstType) {
56363
56336
  firstType = type;
@@ -56388,12 +56361,11 @@ ${lanes.join("\n")}
56388
56361
  }
56389
56362
  result.declarations = declarations;
56390
56363
  result.links.nameType = nameType;
56391
- if (propTypes.length > 2 || deferredMismatchedParts) {
56364
+ if (propTypes.length > 2) {
56392
56365
  result.links.checkFlags |= 65536 /* DeferredType */;
56393
56366
  result.links.deferralParent = containingType;
56394
56367
  result.links.deferralConstituents = propTypes;
56395
56368
  result.links.deferralWriteConstituents = writeTypes;
56396
- result.links.deferredMismatchedParts = deferredMismatchedParts;
56397
56369
  } else {
56398
56370
  result.links.type = isUnion ? getUnionType(propTypes) : getIntersectionType(propTypes);
56399
56371
  if (writeTypes) {
@@ -58750,7 +58722,7 @@ ${lanes.join("\n")}
58750
58722
  function getIntersectionType(types, aliasSymbol, aliasTypeArguments, noSupertypeReduction) {
58751
58723
  const typeMembershipMap = /* @__PURE__ */ new Map();
58752
58724
  const includes = addTypesToIntersection(typeMembershipMap, 0, types);
58753
- let typeSet = arrayFrom(typeMembershipMap.values());
58725
+ const typeSet = arrayFrom(typeMembershipMap.values());
58754
58726
  if (includes & 131072 /* Never */) {
58755
58727
  return contains(typeSet, silentNeverType) ? silentNeverType : neverType;
58756
58728
  }
@@ -58782,8 +58754,6 @@ ${lanes.join("\n")}
58782
58754
  const id = getTypeListId(typeSet) + getAliasId(aliasSymbol, aliasTypeArguments);
58783
58755
  let result = intersectionTypes.get(id);
58784
58756
  if (!result) {
58785
- const originalSet = typeSet;
58786
- let runningResult;
58787
58757
  if (includes & 1048576 /* Union */) {
58788
58758
  if (intersectUnionsOfPrimitiveTypes(typeSet)) {
58789
58759
  result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
@@ -58795,32 +58765,12 @@ ${lanes.join("\n")}
58795
58765
  removeFromEach(typeSet, 65536 /* Null */);
58796
58766
  result = getUnionType([getIntersectionType(typeSet), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
58797
58767
  } else {
58798
- if (getCrossProductUnionSize(typeSet) >= UNION_CROSS_PRODUCT_SIZE_LIMIT && every(typeSet, (t) => !!(t.flags & 1048576 /* Union */) || !!(t.flags & 402784252 /* Primitive */))) {
58799
- if (typeSet.length > 2 || some(typeSet, (t) => getReducedType(t) !== t)) {
58800
- runningResult = getReducedType(typeSet[0]);
58801
- for (let i = 1; i < typeSet.length; i++) {
58802
- const reducedElem = getReducedType(typeSet[i]);
58803
- runningResult = reducedElem.flags & 402784252 /* Primitive */ && everyType(runningResult, (t) => !!(t.flags & 524288 /* Object */)) ? neverType : getReducedType(intersectTypes(runningResult, reducedElem));
58804
- if (i === typeSet.length - 1 || isTypeAny(runningResult) || runningResult.flags & 131072 /* Never */) {
58805
- return runningResult;
58806
- }
58807
- if (!(runningResult.flags & 1048576 /* Union */) || runningResult.types.length > typeSet.length) {
58808
- typeSet = typeSet.slice(i + 1);
58809
- break;
58810
- }
58811
- }
58812
- }
58813
- }
58814
58768
  if (!checkCrossProductUnion(typeSet)) {
58815
58769
  return errorType;
58816
58770
  }
58817
58771
  const constituents = getCrossProductIntersections(typeSet);
58818
- if (runningResult && runningResult !== typeSet[0]) {
58819
- result = getIntersectionType([runningResult, getUnionType(constituents, 1 /* Literal */)], aliasSymbol, aliasTypeArguments);
58820
- } else {
58821
- const origin = some(constituents, (t) => !!(t.flags & 2097152 /* Intersection */)) && getConstituentCountOfTypes(constituents) > getConstituentCountOfTypes(typeSet) ? createOriginUnionOrIntersectionType(2097152 /* Intersection */, originalSet) : void 0;
58822
- result = getUnionType(constituents, 1 /* Literal */, aliasSymbol, aliasTypeArguments, origin);
58823
- }
58772
+ const origin = some(constituents, (t) => !!(t.flags & 2097152 /* Intersection */)) && getConstituentCountOfTypes(constituents) > getConstituentCountOfTypes(typeSet) ? createOriginUnionOrIntersectionType(2097152 /* Intersection */, typeSet) : void 0;
58773
+ result = getUnionType(constituents, 1 /* Literal */, aliasSymbol, aliasTypeArguments, origin);
58824
58774
  }
58825
58775
  } else {
58826
58776
  result = createIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
@@ -58835,7 +58785,7 @@ ${lanes.join("\n")}
58835
58785
  function checkCrossProductUnion(types) {
58836
58786
  var _a2;
58837
58787
  const size = getCrossProductUnionSize(types);
58838
- if (size >= UNION_CROSS_PRODUCT_SIZE_LIMIT) {
58788
+ if (size >= 1e5) {
58839
58789
  (_a2 = tracing) == null ? void 0 : _a2.instant(tracing.Phase.CheckTypes, "checkCrossProductUnion_DepthLimit", { typeIds: types.map((t) => t.id), size });
58840
58790
  error(currentNode, Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent);
58841
58791
  return false;
@@ -70670,6 +70620,12 @@ ${lanes.join("\n")}
70670
70620
  return getUnionType([jsxElementType, nullType]);
70671
70621
  }
70672
70622
  }
70623
+ function getJsxElementTypeTypeAt(location) {
70624
+ const type = getJsxType(JsxNames.ElementType, location);
70625
+ if (isErrorType(type))
70626
+ return void 0;
70627
+ return type;
70628
+ }
70673
70629
  function getJsxIntrinsicTagNamesAt(location) {
70674
70630
  const intrinsics = getJsxType(JsxNames.IntrinsicElements, location);
70675
70631
  return intrinsics ? getPropertiesOfType(intrinsics) : emptyArray;
@@ -70732,7 +70688,24 @@ ${lanes.join("\n")}
70732
70688
  const jsxOpeningLikeNode = node;
70733
70689
  const sig = getResolvedSignature(jsxOpeningLikeNode);
70734
70690
  checkDeprecatedSignature(sig, node);
70735
- checkJsxReturnAssignableToAppropriateBound(getJsxReferenceKind(jsxOpeningLikeNode), getReturnTypeOfSignature(sig), jsxOpeningLikeNode);
70691
+ const elementTypeConstraint = getJsxElementTypeTypeAt(jsxOpeningLikeNode);
70692
+ if (elementTypeConstraint !== void 0) {
70693
+ const tagType = isJsxIntrinsicIdentifier(jsxOpeningLikeNode.tagName) ? (
70694
+ // TODO: Should this be a literal that library authors could potentially check against?
70695
+ stringType
70696
+ ) : getApparentType(checkExpression(jsxOpeningLikeNode.tagName));
70697
+ checkTypeRelatedTo(tagType, elementTypeConstraint, assignableRelation, jsxOpeningLikeNode.tagName, Diagnostics.Its_type_0_is_not_a_valid_JSX_element_type, () => {
70698
+ const componentName = getTextOfNode(jsxOpeningLikeNode.tagName);
70699
+ return chainDiagnosticMessages(
70700
+ /*details*/
70701
+ void 0,
70702
+ Diagnostics._0_cannot_be_used_as_a_JSX_component,
70703
+ componentName
70704
+ );
70705
+ });
70706
+ } else {
70707
+ checkJsxReturnAssignableToAppropriateBound(getJsxReferenceKind(jsxOpeningLikeNode), getReturnTypeOfSignature(sig), jsxOpeningLikeNode);
70708
+ }
70736
70709
  }
70737
70710
  }
70738
70711
  function isKnownProperty(targetType, name, isComparingJsxAttributes) {
@@ -85521,7 +85494,7 @@ ${lanes.join("\n")}
85521
85494
  readFile: host.readFile ? (fileName) => host.readFile(fileName) : void 0
85522
85495
  };
85523
85496
  }
85524
- var ambientModuleSymbolRegex, anon, nextSymbolId, nextNodeId, nextMergeId, nextFlowId, TypeFacts, typeofNEFacts, CheckMode, SignatureCheckMode, isNotOverloadAndNotAccessor, intrinsicTypeKinds, SymbolLinks, UNION_CROSS_PRODUCT_SIZE_LIMIT, JsxNames, SymbolTrackerImpl;
85497
+ var ambientModuleSymbolRegex, anon, nextSymbolId, nextNodeId, nextMergeId, nextFlowId, TypeFacts, typeofNEFacts, CheckMode, SignatureCheckMode, isNotOverloadAndNotAccessor, intrinsicTypeKinds, SymbolLinks, JsxNames, SymbolTrackerImpl;
85525
85498
  var init_checker = __esm({
85526
85499
  "src/compiler/checker.ts"() {
85527
85500
  "use strict";
@@ -85653,7 +85626,6 @@ ${lanes.join("\n")}
85653
85626
  }));
85654
85627
  SymbolLinks = class {
85655
85628
  };
85656
- UNION_CROSS_PRODUCT_SIZE_LIMIT = 1e5;
85657
85629
  ((JsxNames2) => {
85658
85630
  JsxNames2.JSX = "JSX";
85659
85631
  JsxNames2.IntrinsicElements = "IntrinsicElements";
@@ -85661,6 +85633,7 @@ ${lanes.join("\n")}
85661
85633
  JsxNames2.ElementAttributesPropertyNameContainer = "ElementAttributesProperty";
85662
85634
  JsxNames2.ElementChildrenAttributeNameContainer = "ElementChildrenAttribute";
85663
85635
  JsxNames2.Element = "Element";
85636
+ JsxNames2.ElementType = "ElementType";
85664
85637
  JsxNames2.IntrinsicAttributes = "IntrinsicAttributes";
85665
85638
  JsxNames2.IntrinsicClassAttributes = "IntrinsicClassAttributes";
85666
85639
  JsxNames2.LibraryManagedAttributes = "LibraryManagedAttributes";
package/lib/typescript.js CHANGED
@@ -9058,7 +9058,8 @@ ${lanes.join("\n")}
9058
9058
  _0_is_possibly_null_or_undefined: diag(18049, 1 /* Error */, "_0_is_possibly_null_or_undefined_18049", "'{0}' is possibly 'null' or 'undefined'."),
9059
9059
  The_value_0_cannot_be_used_here: diag(18050, 1 /* Error */, "The_value_0_cannot_be_used_here_18050", "The value '{0}' cannot be used here."),
9060
9060
  Compiler_option_0_cannot_be_given_an_empty_string: diag(18051, 1 /* Error */, "Compiler_option_0_cannot_be_given_an_empty_string_18051", "Compiler option '{0}' cannot be given an empty string."),
9061
- Non_abstract_class_0_does_not_implement_all_abstract_members_of_1: diag(18052, 1 /* Error */, "Non_abstract_class_0_does_not_implement_all_abstract_members_of_1_18052", "Non-abstract class '{0}' does not implement all abstract members of '{1}'")
9061
+ Non_abstract_class_0_does_not_implement_all_abstract_members_of_1: diag(18052, 1 /* Error */, "Non_abstract_class_0_does_not_implement_all_abstract_members_of_1_18052", "Non-abstract class '{0}' does not implement all abstract members of '{1}'"),
9062
+ Its_type_0_is_not_a_valid_JSX_element_type: diag(18053, 1 /* Error */, "Its_type_0_is_not_a_valid_JSX_element_type_18053", "Its type '{0}' is not a valid JSX element type.")
9062
9063
  };
9063
9064
  }
9064
9065
  });
@@ -54191,12 +54192,7 @@ ${lanes.join("\n")}
54191
54192
  if (!links.type) {
54192
54193
  Debug.assertIsDefined(links.deferralParent);
54193
54194
  Debug.assertIsDefined(links.deferralConstituents);
54194
- const operation = links.deferralParent.flags & 1048576 /* Union */ ? getUnionType : getIntersectionType;
54195
- let result = operation(links.deferralConstituents);
54196
- for (const part of links.deferredMismatchedParts || emptyArray) {
54197
- result = operation([result, getTypeOfSymbol(part)]);
54198
- }
54199
- links.type = result;
54195
+ links.type = links.deferralParent.flags & 1048576 /* Union */ ? getUnionType(links.deferralConstituents) : getIntersectionType(links.deferralConstituents);
54200
54196
  }
54201
54197
  return links.type;
54202
54198
  }
@@ -54204,12 +54200,8 @@ ${lanes.join("\n")}
54204
54200
  const links = getSymbolLinks(symbol);
54205
54201
  if (!links.writeType && links.deferralWriteConstituents) {
54206
54202
  Debug.assertIsDefined(links.deferralParent);
54207
- const operation = links.deferralParent.flags & 1048576 /* Union */ ? getUnionType : getIntersectionType;
54208
- let result = operation(links.deferralWriteConstituents);
54209
- for (const part of links.deferredMismatchedParts || emptyArray) {
54210
- result = operation([result, getTypeOfSymbol(part)]);
54211
- }
54212
- links.writeType = result;
54203
+ Debug.assertIsDefined(links.deferralConstituents);
54204
+ links.writeType = links.deferralParent.flags & 1048576 /* Union */ ? getUnionType(links.deferralWriteConstituents) : getIntersectionType(links.deferralWriteConstituents);
54213
54205
  }
54214
54206
  return links.writeType;
54215
54207
  }
@@ -56246,7 +56238,7 @@ ${lanes.join("\n")}
56246
56238
  return getReducedType(getApparentType(getReducedType(type)));
56247
56239
  }
56248
56240
  function createUnionOrIntersectionProperty(containingType, name, skipObjectFunctionPropertyAugment) {
56249
- var _a2, _b, _c, _d;
56241
+ var _a2, _b, _c;
56250
56242
  let singleProp;
56251
56243
  let propSet;
56252
56244
  let indexTypes;
@@ -56328,9 +56320,8 @@ ${lanes.join("\n")}
56328
56320
  let declarations;
56329
56321
  let firstType;
56330
56322
  let nameType;
56331
- let propTypes = [];
56323
+ const propTypes = [];
56332
56324
  let writeTypes;
56333
- let deferredMismatchedParts;
56334
56325
  let firstValueDeclaration;
56335
56326
  let hasNonUniformValueDeclaration = false;
56336
56327
  for (const prop of props) {
@@ -56340,24 +56331,6 @@ ${lanes.join("\n")}
56340
56331
  hasNonUniformValueDeclaration = true;
56341
56332
  }
56342
56333
  declarations = addRange(declarations, prop.declarations);
56343
- if (getCheckFlags(prop) & 65536 /* DeferredType */) {
56344
- checkFlags |= getCheckFlags(prop) & (131072 /* HasNeverType */ | 64 /* HasNonUniformType */ | 128 /* HasLiteralType */);
56345
- if (!nameType) {
56346
- nameType = getSymbolLinks(prop).nameType;
56347
- }
56348
- if ((((_d = getSymbolLinks(prop).deferralParent) == null ? void 0 : _d.flags) & 3145728 /* UnionOrIntersection */) === (containingType.flags & 3145728 /* UnionOrIntersection */)) {
56349
- const deferredWriteTypes = getSymbolLinks(prop).deferralWriteConstituents;
56350
- if (deferredWriteTypes) {
56351
- writeTypes = concatenate(!writeTypes ? propTypes.slice() : writeTypes, deferredWriteTypes);
56352
- }
56353
- propTypes = concatenate(propTypes, getSymbolLinks(prop).deferralConstituents);
56354
- deferredMismatchedParts = concatenate(deferredMismatchedParts, getSymbolLinks(prop).deferredMismatchedParts);
56355
- break;
56356
- } else {
56357
- deferredMismatchedParts = append(deferredMismatchedParts, prop);
56358
- break;
56359
- }
56360
- }
56361
56334
  const type = getTypeOfSymbol(prop);
56362
56335
  if (!firstType) {
56363
56336
  firstType = type;
@@ -56388,12 +56361,11 @@ ${lanes.join("\n")}
56388
56361
  }
56389
56362
  result.declarations = declarations;
56390
56363
  result.links.nameType = nameType;
56391
- if (propTypes.length > 2 || deferredMismatchedParts) {
56364
+ if (propTypes.length > 2) {
56392
56365
  result.links.checkFlags |= 65536 /* DeferredType */;
56393
56366
  result.links.deferralParent = containingType;
56394
56367
  result.links.deferralConstituents = propTypes;
56395
56368
  result.links.deferralWriteConstituents = writeTypes;
56396
- result.links.deferredMismatchedParts = deferredMismatchedParts;
56397
56369
  } else {
56398
56370
  result.links.type = isUnion ? getUnionType(propTypes) : getIntersectionType(propTypes);
56399
56371
  if (writeTypes) {
@@ -58750,7 +58722,7 @@ ${lanes.join("\n")}
58750
58722
  function getIntersectionType(types, aliasSymbol, aliasTypeArguments, noSupertypeReduction) {
58751
58723
  const typeMembershipMap = /* @__PURE__ */ new Map();
58752
58724
  const includes = addTypesToIntersection(typeMembershipMap, 0, types);
58753
- let typeSet = arrayFrom(typeMembershipMap.values());
58725
+ const typeSet = arrayFrom(typeMembershipMap.values());
58754
58726
  if (includes & 131072 /* Never */) {
58755
58727
  return contains(typeSet, silentNeverType) ? silentNeverType : neverType;
58756
58728
  }
@@ -58782,8 +58754,6 @@ ${lanes.join("\n")}
58782
58754
  const id = getTypeListId(typeSet) + getAliasId(aliasSymbol, aliasTypeArguments);
58783
58755
  let result = intersectionTypes.get(id);
58784
58756
  if (!result) {
58785
- const originalSet = typeSet;
58786
- let runningResult;
58787
58757
  if (includes & 1048576 /* Union */) {
58788
58758
  if (intersectUnionsOfPrimitiveTypes(typeSet)) {
58789
58759
  result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
@@ -58795,32 +58765,12 @@ ${lanes.join("\n")}
58795
58765
  removeFromEach(typeSet, 65536 /* Null */);
58796
58766
  result = getUnionType([getIntersectionType(typeSet), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
58797
58767
  } else {
58798
- if (getCrossProductUnionSize(typeSet) >= UNION_CROSS_PRODUCT_SIZE_LIMIT && every(typeSet, (t) => !!(t.flags & 1048576 /* Union */) || !!(t.flags & 402784252 /* Primitive */))) {
58799
- if (typeSet.length > 2 || some(typeSet, (t) => getReducedType(t) !== t)) {
58800
- runningResult = getReducedType(typeSet[0]);
58801
- for (let i = 1; i < typeSet.length; i++) {
58802
- const reducedElem = getReducedType(typeSet[i]);
58803
- runningResult = reducedElem.flags & 402784252 /* Primitive */ && everyType(runningResult, (t) => !!(t.flags & 524288 /* Object */)) ? neverType : getReducedType(intersectTypes(runningResult, reducedElem));
58804
- if (i === typeSet.length - 1 || isTypeAny(runningResult) || runningResult.flags & 131072 /* Never */) {
58805
- return runningResult;
58806
- }
58807
- if (!(runningResult.flags & 1048576 /* Union */) || runningResult.types.length > typeSet.length) {
58808
- typeSet = typeSet.slice(i + 1);
58809
- break;
58810
- }
58811
- }
58812
- }
58813
- }
58814
58768
  if (!checkCrossProductUnion(typeSet)) {
58815
58769
  return errorType;
58816
58770
  }
58817
58771
  const constituents = getCrossProductIntersections(typeSet);
58818
- if (runningResult && runningResult !== typeSet[0]) {
58819
- result = getIntersectionType([runningResult, getUnionType(constituents, 1 /* Literal */)], aliasSymbol, aliasTypeArguments);
58820
- } else {
58821
- const origin = some(constituents, (t) => !!(t.flags & 2097152 /* Intersection */)) && getConstituentCountOfTypes(constituents) > getConstituentCountOfTypes(typeSet) ? createOriginUnionOrIntersectionType(2097152 /* Intersection */, originalSet) : void 0;
58822
- result = getUnionType(constituents, 1 /* Literal */, aliasSymbol, aliasTypeArguments, origin);
58823
- }
58772
+ const origin = some(constituents, (t) => !!(t.flags & 2097152 /* Intersection */)) && getConstituentCountOfTypes(constituents) > getConstituentCountOfTypes(typeSet) ? createOriginUnionOrIntersectionType(2097152 /* Intersection */, typeSet) : void 0;
58773
+ result = getUnionType(constituents, 1 /* Literal */, aliasSymbol, aliasTypeArguments, origin);
58824
58774
  }
58825
58775
  } else {
58826
58776
  result = createIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
@@ -58835,7 +58785,7 @@ ${lanes.join("\n")}
58835
58785
  function checkCrossProductUnion(types) {
58836
58786
  var _a2;
58837
58787
  const size = getCrossProductUnionSize(types);
58838
- if (size >= UNION_CROSS_PRODUCT_SIZE_LIMIT) {
58788
+ if (size >= 1e5) {
58839
58789
  (_a2 = tracing) == null ? void 0 : _a2.instant(tracing.Phase.CheckTypes, "checkCrossProductUnion_DepthLimit", { typeIds: types.map((t) => t.id), size });
58840
58790
  error(currentNode, Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent);
58841
58791
  return false;
@@ -70670,6 +70620,12 @@ ${lanes.join("\n")}
70670
70620
  return getUnionType([jsxElementType, nullType]);
70671
70621
  }
70672
70622
  }
70623
+ function getJsxElementTypeTypeAt(location) {
70624
+ const type = getJsxType(JsxNames.ElementType, location);
70625
+ if (isErrorType(type))
70626
+ return void 0;
70627
+ return type;
70628
+ }
70673
70629
  function getJsxIntrinsicTagNamesAt(location) {
70674
70630
  const intrinsics = getJsxType(JsxNames.IntrinsicElements, location);
70675
70631
  return intrinsics ? getPropertiesOfType(intrinsics) : emptyArray;
@@ -70732,7 +70688,24 @@ ${lanes.join("\n")}
70732
70688
  const jsxOpeningLikeNode = node;
70733
70689
  const sig = getResolvedSignature(jsxOpeningLikeNode);
70734
70690
  checkDeprecatedSignature(sig, node);
70735
- checkJsxReturnAssignableToAppropriateBound(getJsxReferenceKind(jsxOpeningLikeNode), getReturnTypeOfSignature(sig), jsxOpeningLikeNode);
70691
+ const elementTypeConstraint = getJsxElementTypeTypeAt(jsxOpeningLikeNode);
70692
+ if (elementTypeConstraint !== void 0) {
70693
+ const tagType = isJsxIntrinsicIdentifier(jsxOpeningLikeNode.tagName) ? (
70694
+ // TODO: Should this be a literal that library authors could potentially check against?
70695
+ stringType
70696
+ ) : getApparentType(checkExpression(jsxOpeningLikeNode.tagName));
70697
+ checkTypeRelatedTo(tagType, elementTypeConstraint, assignableRelation, jsxOpeningLikeNode.tagName, Diagnostics.Its_type_0_is_not_a_valid_JSX_element_type, () => {
70698
+ const componentName = getTextOfNode(jsxOpeningLikeNode.tagName);
70699
+ return chainDiagnosticMessages(
70700
+ /*details*/
70701
+ void 0,
70702
+ Diagnostics._0_cannot_be_used_as_a_JSX_component,
70703
+ componentName
70704
+ );
70705
+ });
70706
+ } else {
70707
+ checkJsxReturnAssignableToAppropriateBound(getJsxReferenceKind(jsxOpeningLikeNode), getReturnTypeOfSignature(sig), jsxOpeningLikeNode);
70708
+ }
70736
70709
  }
70737
70710
  }
70738
70711
  function isKnownProperty(targetType, name, isComparingJsxAttributes) {
@@ -85521,7 +85494,7 @@ ${lanes.join("\n")}
85521
85494
  readFile: host.readFile ? (fileName) => host.readFile(fileName) : void 0
85522
85495
  };
85523
85496
  }
85524
- var ambientModuleSymbolRegex, anon, nextSymbolId, nextNodeId, nextMergeId, nextFlowId, TypeFacts, typeofNEFacts, CheckMode, SignatureCheckMode, isNotOverloadAndNotAccessor, intrinsicTypeKinds, SymbolLinks, UNION_CROSS_PRODUCT_SIZE_LIMIT, JsxNames, SymbolTrackerImpl;
85497
+ var ambientModuleSymbolRegex, anon, nextSymbolId, nextNodeId, nextMergeId, nextFlowId, TypeFacts, typeofNEFacts, CheckMode, SignatureCheckMode, isNotOverloadAndNotAccessor, intrinsicTypeKinds, SymbolLinks, JsxNames, SymbolTrackerImpl;
85525
85498
  var init_checker = __esm({
85526
85499
  "src/compiler/checker.ts"() {
85527
85500
  "use strict";
@@ -85653,7 +85626,6 @@ ${lanes.join("\n")}
85653
85626
  }));
85654
85627
  SymbolLinks = class {
85655
85628
  };
85656
- UNION_CROSS_PRODUCT_SIZE_LIMIT = 1e5;
85657
85629
  ((JsxNames2) => {
85658
85630
  JsxNames2.JSX = "JSX";
85659
85631
  JsxNames2.IntrinsicElements = "IntrinsicElements";
@@ -85661,6 +85633,7 @@ ${lanes.join("\n")}
85661
85633
  JsxNames2.ElementAttributesPropertyNameContainer = "ElementAttributesProperty";
85662
85634
  JsxNames2.ElementChildrenAttributeNameContainer = "ElementChildrenAttribute";
85663
85635
  JsxNames2.Element = "Element";
85636
+ JsxNames2.ElementType = "ElementType";
85664
85637
  JsxNames2.IntrinsicAttributes = "IntrinsicAttributes";
85665
85638
  JsxNames2.IntrinsicClassAttributes = "IntrinsicClassAttributes";
85666
85639
  JsxNames2.LibraryManagedAttributes = "LibraryManagedAttributes";
@@ -7121,7 +7121,8 @@ var Diagnostics = {
7121
7121
  _0_is_possibly_null_or_undefined: diag(18049, 1 /* Error */, "_0_is_possibly_null_or_undefined_18049", "'{0}' is possibly 'null' or 'undefined'."),
7122
7122
  The_value_0_cannot_be_used_here: diag(18050, 1 /* Error */, "The_value_0_cannot_be_used_here_18050", "The value '{0}' cannot be used here."),
7123
7123
  Compiler_option_0_cannot_be_given_an_empty_string: diag(18051, 1 /* Error */, "Compiler_option_0_cannot_be_given_an_empty_string_18051", "Compiler option '{0}' cannot be given an empty string."),
7124
- Non_abstract_class_0_does_not_implement_all_abstract_members_of_1: diag(18052, 1 /* Error */, "Non_abstract_class_0_does_not_implement_all_abstract_members_of_1_18052", "Non-abstract class '{0}' does not implement all abstract members of '{1}'")
7124
+ Non_abstract_class_0_does_not_implement_all_abstract_members_of_1: diag(18052, 1 /* Error */, "Non_abstract_class_0_does_not_implement_all_abstract_members_of_1_18052", "Non-abstract class '{0}' does not implement all abstract members of '{1}'"),
7125
+ Its_type_0_is_not_a_valid_JSX_element_type: diag(18053, 1 /* Error */, "Its_type_0_is_not_a_valid_JSX_element_type_18053", "Its type '{0}' is not a valid JSX element type.")
7125
7126
  };
7126
7127
 
7127
7128
  // src/compiler/scanner.ts
@@ -28887,6 +28888,7 @@ var JsxNames;
28887
28888
  JsxNames2.ElementAttributesPropertyNameContainer = "ElementAttributesProperty";
28888
28889
  JsxNames2.ElementChildrenAttributeNameContainer = "ElementChildrenAttribute";
28889
28890
  JsxNames2.Element = "Element";
28891
+ JsxNames2.ElementType = "ElementType";
28890
28892
  JsxNames2.IntrinsicAttributes = "IntrinsicAttributes";
28891
28893
  JsxNames2.IntrinsicClassAttributes = "IntrinsicClassAttributes";
28892
28894
  JsxNames2.LibraryManagedAttributes = "LibraryManagedAttributes";
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@typescript-deploys/pr-build",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "5.1.0-pr-53739-12",
5
+ "version": "5.1.0-pr-51328-34",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -114,5 +114,5 @@
114
114
  "node": "14.21.1",
115
115
  "npm": "8.19.3"
116
116
  },
117
- "gitHead": "2493625c9c4fae9f224de64cf587825d651468c6"
117
+ "gitHead": "4c0ad0eb588205a6ba5138b2e0b20babfe3896d3"
118
118
  }