@typescript-deploys/pr-build 5.1.0-pr-50092-15 → 5.1.0-pr-53739-12

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/lib.es5.d.ts CHANGED
@@ -1832,7 +1832,7 @@ interface DataView {
1832
1832
 
1833
1833
  interface DataViewConstructor {
1834
1834
  readonly prototype: DataView;
1835
- new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;
1835
+ new(buffer: ArrayBufferLike & { BYTES_PER_ELEMENT?: never }, byteOffset?: number, byteLength?: number): DataView;
1836
1836
  }
1837
1837
  declare var DataView: DataViewConstructor;
1838
1838
 
package/lib/tsc.js CHANGED
@@ -42568,6 +42568,7 @@ function isInstantiatedModule(node, preserveConstEnums) {
42568
42568
  const moduleState = getModuleInstanceState(node);
42569
42569
  return moduleState === 1 /* Instantiated */ || preserveConstEnums && moduleState === 2 /* ConstEnumOnly */;
42570
42570
  }
42571
+ var UNION_CROSS_PRODUCT_SIZE_LIMIT = 1e5;
42571
42572
  function createTypeChecker(host) {
42572
42573
  var getPackagesMap = memoize(() => {
42573
42574
  var map2 = /* @__PURE__ */ new Map();
@@ -51740,7 +51741,12 @@ function createTypeChecker(host) {
51740
51741
  if (!links.type) {
51741
51742
  Debug.assertIsDefined(links.deferralParent);
51742
51743
  Debug.assertIsDefined(links.deferralConstituents);
51743
- links.type = links.deferralParent.flags & 1048576 /* Union */ ? getUnionType(links.deferralConstituents) : getIntersectionType(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
51750
  }
51745
51751
  return links.type;
51746
51752
  }
@@ -51748,8 +51754,12 @@ function createTypeChecker(host) {
51748
51754
  const links = getSymbolLinks(symbol);
51749
51755
  if (!links.writeType && links.deferralWriteConstituents) {
51750
51756
  Debug.assertIsDefined(links.deferralParent);
51751
- Debug.assertIsDefined(links.deferralConstituents);
51752
- links.writeType = links.deferralParent.flags & 1048576 /* Union */ ? getUnionType(links.deferralWriteConstituents) : getIntersectionType(links.deferralWriteConstituents);
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;
51753
51763
  }
51754
51764
  return links.writeType;
51755
51765
  }
@@ -53786,7 +53796,7 @@ function createTypeChecker(host) {
53786
53796
  return getReducedType(getApparentType(getReducedType(type)));
53787
53797
  }
53788
53798
  function createUnionOrIntersectionProperty(containingType, name, skipObjectFunctionPropertyAugment) {
53789
- var _a2, _b, _c;
53799
+ var _a2, _b, _c, _d;
53790
53800
  let singleProp;
53791
53801
  let propSet;
53792
53802
  let indexTypes;
@@ -53868,8 +53878,9 @@ function createTypeChecker(host) {
53868
53878
  let declarations;
53869
53879
  let firstType;
53870
53880
  let nameType;
53871
- const propTypes = [];
53881
+ let propTypes = [];
53872
53882
  let writeTypes;
53883
+ let deferredMismatchedParts;
53873
53884
  let firstValueDeclaration;
53874
53885
  let hasNonUniformValueDeclaration = false;
53875
53886
  for (const prop of props) {
@@ -53879,6 +53890,24 @@ function createTypeChecker(host) {
53879
53890
  hasNonUniformValueDeclaration = true;
53880
53891
  }
53881
53892
  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
+ }
53882
53911
  const type = getTypeOfSymbol(prop);
53883
53912
  if (!firstType) {
53884
53913
  firstType = type;
@@ -53909,11 +53938,12 @@ function createTypeChecker(host) {
53909
53938
  }
53910
53939
  result.declarations = declarations;
53911
53940
  result.links.nameType = nameType;
53912
- if (propTypes.length > 2) {
53941
+ if (propTypes.length > 2 || deferredMismatchedParts) {
53913
53942
  result.links.checkFlags |= 65536 /* DeferredType */;
53914
53943
  result.links.deferralParent = containingType;
53915
53944
  result.links.deferralConstituents = propTypes;
53916
53945
  result.links.deferralWriteConstituents = writeTypes;
53946
+ result.links.deferredMismatchedParts = deferredMismatchedParts;
53917
53947
  } else {
53918
53948
  result.links.type = isUnion ? getUnionType(propTypes) : getIntersectionType(propTypes);
53919
53949
  if (writeTypes) {
@@ -56270,7 +56300,7 @@ function createTypeChecker(host) {
56270
56300
  function getIntersectionType(types, aliasSymbol, aliasTypeArguments, noSupertypeReduction) {
56271
56301
  const typeMembershipMap = /* @__PURE__ */ new Map();
56272
56302
  const includes = addTypesToIntersection(typeMembershipMap, 0, types);
56273
- const typeSet = arrayFrom(typeMembershipMap.values());
56303
+ let typeSet = arrayFrom(typeMembershipMap.values());
56274
56304
  if (includes & 131072 /* Never */) {
56275
56305
  return contains(typeSet, silentNeverType) ? silentNeverType : neverType;
56276
56306
  }
@@ -56302,6 +56332,8 @@ function createTypeChecker(host) {
56302
56332
  const id = getTypeListId(typeSet) + getAliasId(aliasSymbol, aliasTypeArguments);
56303
56333
  let result = intersectionTypes.get(id);
56304
56334
  if (!result) {
56335
+ const originalSet = typeSet;
56336
+ let runningResult;
56305
56337
  if (includes & 1048576 /* Union */) {
56306
56338
  if (intersectUnionsOfPrimitiveTypes(typeSet)) {
56307
56339
  result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
@@ -56313,12 +56345,32 @@ function createTypeChecker(host) {
56313
56345
  removeFromEach(typeSet, 65536 /* Null */);
56314
56346
  result = getUnionType([getIntersectionType(typeSet), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
56315
56347
  } 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
+ }
56316
56364
  if (!checkCrossProductUnion(typeSet)) {
56317
56365
  return errorType;
56318
56366
  }
56319
56367
  const constituents = getCrossProductIntersections(typeSet);
56320
- const origin = some(constituents, (t) => !!(t.flags & 2097152 /* Intersection */)) && getConstituentCountOfTypes(constituents) > getConstituentCountOfTypes(typeSet) ? createOriginUnionOrIntersectionType(2097152 /* Intersection */, typeSet) : void 0;
56321
- result = getUnionType(constituents, 1 /* Literal */, aliasSymbol, aliasTypeArguments, origin);
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
+ }
56322
56374
  }
56323
56375
  } else {
56324
56376
  result = createIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
@@ -56333,7 +56385,7 @@ function createTypeChecker(host) {
56333
56385
  function checkCrossProductUnion(types) {
56334
56386
  var _a2;
56335
56387
  const size = getCrossProductUnionSize(types);
56336
- if (size >= 1e5) {
56388
+ if (size >= UNION_CROSS_PRODUCT_SIZE_LIMIT) {
56337
56389
  (_a2 = tracing) == null ? void 0 : _a2.instant(tracing.Phase.CheckTypes, "checkCrossProductUnion_DepthLimit", { typeIds: types.map((t) => t.id), size });
56338
56390
  error(currentNode, Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent);
56339
56391
  return false;
package/lib/tsserver.js CHANGED
@@ -47218,6 +47218,7 @@ function isInstantiatedModule(node, preserveConstEnums) {
47218
47218
  const moduleState = getModuleInstanceState(node);
47219
47219
  return moduleState === 1 /* Instantiated */ || preserveConstEnums && moduleState === 2 /* ConstEnumOnly */;
47220
47220
  }
47221
+ var UNION_CROSS_PRODUCT_SIZE_LIMIT = 1e5;
47221
47222
  function createTypeChecker(host) {
47222
47223
  var getPackagesMap = memoize(() => {
47223
47224
  var map2 = /* @__PURE__ */ new Map();
@@ -56390,7 +56391,12 @@ function createTypeChecker(host) {
56390
56391
  if (!links.type) {
56391
56392
  Debug.assertIsDefined(links.deferralParent);
56392
56393
  Debug.assertIsDefined(links.deferralConstituents);
56393
- links.type = links.deferralParent.flags & 1048576 /* Union */ ? getUnionType(links.deferralConstituents) : getIntersectionType(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
56400
  }
56395
56401
  return links.type;
56396
56402
  }
@@ -56398,8 +56404,12 @@ function createTypeChecker(host) {
56398
56404
  const links = getSymbolLinks(symbol);
56399
56405
  if (!links.writeType && links.deferralWriteConstituents) {
56400
56406
  Debug.assertIsDefined(links.deferralParent);
56401
- Debug.assertIsDefined(links.deferralConstituents);
56402
- links.writeType = links.deferralParent.flags & 1048576 /* Union */ ? getUnionType(links.deferralWriteConstituents) : getIntersectionType(links.deferralWriteConstituents);
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;
56403
56413
  }
56404
56414
  return links.writeType;
56405
56415
  }
@@ -58436,7 +58446,7 @@ function createTypeChecker(host) {
58436
58446
  return getReducedType(getApparentType(getReducedType(type)));
58437
58447
  }
58438
58448
  function createUnionOrIntersectionProperty(containingType, name, skipObjectFunctionPropertyAugment) {
58439
- var _a2, _b, _c;
58449
+ var _a2, _b, _c, _d;
58440
58450
  let singleProp;
58441
58451
  let propSet;
58442
58452
  let indexTypes;
@@ -58518,8 +58528,9 @@ function createTypeChecker(host) {
58518
58528
  let declarations;
58519
58529
  let firstType;
58520
58530
  let nameType;
58521
- const propTypes = [];
58531
+ let propTypes = [];
58522
58532
  let writeTypes;
58533
+ let deferredMismatchedParts;
58523
58534
  let firstValueDeclaration;
58524
58535
  let hasNonUniformValueDeclaration = false;
58525
58536
  for (const prop of props) {
@@ -58529,6 +58540,24 @@ function createTypeChecker(host) {
58529
58540
  hasNonUniformValueDeclaration = true;
58530
58541
  }
58531
58542
  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
+ }
58532
58561
  const type = getTypeOfSymbol(prop);
58533
58562
  if (!firstType) {
58534
58563
  firstType = type;
@@ -58559,11 +58588,12 @@ function createTypeChecker(host) {
58559
58588
  }
58560
58589
  result.declarations = declarations;
58561
58590
  result.links.nameType = nameType;
58562
- if (propTypes.length > 2) {
58591
+ if (propTypes.length > 2 || deferredMismatchedParts) {
58563
58592
  result.links.checkFlags |= 65536 /* DeferredType */;
58564
58593
  result.links.deferralParent = containingType;
58565
58594
  result.links.deferralConstituents = propTypes;
58566
58595
  result.links.deferralWriteConstituents = writeTypes;
58596
+ result.links.deferredMismatchedParts = deferredMismatchedParts;
58567
58597
  } else {
58568
58598
  result.links.type = isUnion ? getUnionType(propTypes) : getIntersectionType(propTypes);
58569
58599
  if (writeTypes) {
@@ -60920,7 +60950,7 @@ function createTypeChecker(host) {
60920
60950
  function getIntersectionType(types, aliasSymbol, aliasTypeArguments, noSupertypeReduction) {
60921
60951
  const typeMembershipMap = /* @__PURE__ */ new Map();
60922
60952
  const includes = addTypesToIntersection(typeMembershipMap, 0, types);
60923
- const typeSet = arrayFrom(typeMembershipMap.values());
60953
+ let typeSet = arrayFrom(typeMembershipMap.values());
60924
60954
  if (includes & 131072 /* Never */) {
60925
60955
  return contains(typeSet, silentNeverType) ? silentNeverType : neverType;
60926
60956
  }
@@ -60952,6 +60982,8 @@ function createTypeChecker(host) {
60952
60982
  const id = getTypeListId(typeSet) + getAliasId(aliasSymbol, aliasTypeArguments);
60953
60983
  let result = intersectionTypes.get(id);
60954
60984
  if (!result) {
60985
+ const originalSet = typeSet;
60986
+ let runningResult;
60955
60987
  if (includes & 1048576 /* Union */) {
60956
60988
  if (intersectUnionsOfPrimitiveTypes(typeSet)) {
60957
60989
  result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
@@ -60963,12 +60995,32 @@ function createTypeChecker(host) {
60963
60995
  removeFromEach(typeSet, 65536 /* Null */);
60964
60996
  result = getUnionType([getIntersectionType(typeSet), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
60965
60997
  } 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
+ }
60966
61014
  if (!checkCrossProductUnion(typeSet)) {
60967
61015
  return errorType;
60968
61016
  }
60969
61017
  const constituents = getCrossProductIntersections(typeSet);
60970
- const origin = some(constituents, (t) => !!(t.flags & 2097152 /* Intersection */)) && getConstituentCountOfTypes(constituents) > getConstituentCountOfTypes(typeSet) ? createOriginUnionOrIntersectionType(2097152 /* Intersection */, typeSet) : void 0;
60971
- result = getUnionType(constituents, 1 /* Literal */, aliasSymbol, aliasTypeArguments, origin);
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
+ }
60972
61024
  }
60973
61025
  } else {
60974
61026
  result = createIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
@@ -60983,7 +61035,7 @@ function createTypeChecker(host) {
60983
61035
  function checkCrossProductUnion(types) {
60984
61036
  var _a2;
60985
61037
  const size = getCrossProductUnionSize(types);
60986
- if (size >= 1e5) {
61038
+ if (size >= UNION_CROSS_PRODUCT_SIZE_LIMIT) {
60987
61039
  (_a2 = tracing) == null ? void 0 : _a2.instant(tracing.Phase.CheckTypes, "checkCrossProductUnion_DepthLimit", { typeIds: types.map((t) => t.id), size });
60988
61040
  error(currentNode, Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent);
60989
61041
  return false;
@@ -54191,7 +54191,12 @@ ${lanes.join("\n")}
54191
54191
  if (!links.type) {
54192
54192
  Debug.assertIsDefined(links.deferralParent);
54193
54193
  Debug.assertIsDefined(links.deferralConstituents);
54194
- links.type = links.deferralParent.flags & 1048576 /* Union */ ? getUnionType(links.deferralConstituents) : getIntersectionType(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
54200
  }
54196
54201
  return links.type;
54197
54202
  }
@@ -54199,8 +54204,12 @@ ${lanes.join("\n")}
54199
54204
  const links = getSymbolLinks(symbol);
54200
54205
  if (!links.writeType && links.deferralWriteConstituents) {
54201
54206
  Debug.assertIsDefined(links.deferralParent);
54202
- Debug.assertIsDefined(links.deferralConstituents);
54203
- links.writeType = links.deferralParent.flags & 1048576 /* Union */ ? getUnionType(links.deferralWriteConstituents) : getIntersectionType(links.deferralWriteConstituents);
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;
54204
54213
  }
54205
54214
  return links.writeType;
54206
54215
  }
@@ -56237,7 +56246,7 @@ ${lanes.join("\n")}
56237
56246
  return getReducedType(getApparentType(getReducedType(type)));
56238
56247
  }
56239
56248
  function createUnionOrIntersectionProperty(containingType, name, skipObjectFunctionPropertyAugment) {
56240
- var _a2, _b, _c;
56249
+ var _a2, _b, _c, _d;
56241
56250
  let singleProp;
56242
56251
  let propSet;
56243
56252
  let indexTypes;
@@ -56319,8 +56328,9 @@ ${lanes.join("\n")}
56319
56328
  let declarations;
56320
56329
  let firstType;
56321
56330
  let nameType;
56322
- const propTypes = [];
56331
+ let propTypes = [];
56323
56332
  let writeTypes;
56333
+ let deferredMismatchedParts;
56324
56334
  let firstValueDeclaration;
56325
56335
  let hasNonUniformValueDeclaration = false;
56326
56336
  for (const prop of props) {
@@ -56330,6 +56340,24 @@ ${lanes.join("\n")}
56330
56340
  hasNonUniformValueDeclaration = true;
56331
56341
  }
56332
56342
  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
+ }
56333
56361
  const type = getTypeOfSymbol(prop);
56334
56362
  if (!firstType) {
56335
56363
  firstType = type;
@@ -56360,11 +56388,12 @@ ${lanes.join("\n")}
56360
56388
  }
56361
56389
  result.declarations = declarations;
56362
56390
  result.links.nameType = nameType;
56363
- if (propTypes.length > 2) {
56391
+ if (propTypes.length > 2 || deferredMismatchedParts) {
56364
56392
  result.links.checkFlags |= 65536 /* DeferredType */;
56365
56393
  result.links.deferralParent = containingType;
56366
56394
  result.links.deferralConstituents = propTypes;
56367
56395
  result.links.deferralWriteConstituents = writeTypes;
56396
+ result.links.deferredMismatchedParts = deferredMismatchedParts;
56368
56397
  } else {
56369
56398
  result.links.type = isUnion ? getUnionType(propTypes) : getIntersectionType(propTypes);
56370
56399
  if (writeTypes) {
@@ -58721,7 +58750,7 @@ ${lanes.join("\n")}
58721
58750
  function getIntersectionType(types, aliasSymbol, aliasTypeArguments, noSupertypeReduction) {
58722
58751
  const typeMembershipMap = /* @__PURE__ */ new Map();
58723
58752
  const includes = addTypesToIntersection(typeMembershipMap, 0, types);
58724
- const typeSet = arrayFrom(typeMembershipMap.values());
58753
+ let typeSet = arrayFrom(typeMembershipMap.values());
58725
58754
  if (includes & 131072 /* Never */) {
58726
58755
  return contains(typeSet, silentNeverType) ? silentNeverType : neverType;
58727
58756
  }
@@ -58753,6 +58782,8 @@ ${lanes.join("\n")}
58753
58782
  const id = getTypeListId(typeSet) + getAliasId(aliasSymbol, aliasTypeArguments);
58754
58783
  let result = intersectionTypes.get(id);
58755
58784
  if (!result) {
58785
+ const originalSet = typeSet;
58786
+ let runningResult;
58756
58787
  if (includes & 1048576 /* Union */) {
58757
58788
  if (intersectUnionsOfPrimitiveTypes(typeSet)) {
58758
58789
  result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
@@ -58764,12 +58795,32 @@ ${lanes.join("\n")}
58764
58795
  removeFromEach(typeSet, 65536 /* Null */);
58765
58796
  result = getUnionType([getIntersectionType(typeSet), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
58766
58797
  } 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
+ }
58767
58814
  if (!checkCrossProductUnion(typeSet)) {
58768
58815
  return errorType;
58769
58816
  }
58770
58817
  const constituents = getCrossProductIntersections(typeSet);
58771
- const origin = some(constituents, (t) => !!(t.flags & 2097152 /* Intersection */)) && getConstituentCountOfTypes(constituents) > getConstituentCountOfTypes(typeSet) ? createOriginUnionOrIntersectionType(2097152 /* Intersection */, typeSet) : void 0;
58772
- result = getUnionType(constituents, 1 /* Literal */, aliasSymbol, aliasTypeArguments, origin);
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
+ }
58773
58824
  }
58774
58825
  } else {
58775
58826
  result = createIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
@@ -58784,7 +58835,7 @@ ${lanes.join("\n")}
58784
58835
  function checkCrossProductUnion(types) {
58785
58836
  var _a2;
58786
58837
  const size = getCrossProductUnionSize(types);
58787
- if (size >= 1e5) {
58838
+ if (size >= UNION_CROSS_PRODUCT_SIZE_LIMIT) {
58788
58839
  (_a2 = tracing) == null ? void 0 : _a2.instant(tracing.Phase.CheckTypes, "checkCrossProductUnion_DepthLimit", { typeIds: types.map((t) => t.id), size });
58789
58840
  error(currentNode, Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent);
58790
58841
  return false;
@@ -85470,7 +85521,7 @@ ${lanes.join("\n")}
85470
85521
  readFile: host.readFile ? (fileName) => host.readFile(fileName) : void 0
85471
85522
  };
85472
85523
  }
85473
- var ambientModuleSymbolRegex, anon, nextSymbolId, nextNodeId, nextMergeId, nextFlowId, TypeFacts, typeofNEFacts, CheckMode, SignatureCheckMode, isNotOverloadAndNotAccessor, intrinsicTypeKinds, SymbolLinks, JsxNames, SymbolTrackerImpl;
85524
+ var ambientModuleSymbolRegex, anon, nextSymbolId, nextNodeId, nextMergeId, nextFlowId, TypeFacts, typeofNEFacts, CheckMode, SignatureCheckMode, isNotOverloadAndNotAccessor, intrinsicTypeKinds, SymbolLinks, UNION_CROSS_PRODUCT_SIZE_LIMIT, JsxNames, SymbolTrackerImpl;
85474
85525
  var init_checker = __esm({
85475
85526
  "src/compiler/checker.ts"() {
85476
85527
  "use strict";
@@ -85602,6 +85653,7 @@ ${lanes.join("\n")}
85602
85653
  }));
85603
85654
  SymbolLinks = class {
85604
85655
  };
85656
+ UNION_CROSS_PRODUCT_SIZE_LIMIT = 1e5;
85605
85657
  ((JsxNames2) => {
85606
85658
  JsxNames2.JSX = "JSX";
85607
85659
  JsxNames2.IntrinsicElements = "IntrinsicElements";
package/lib/typescript.js CHANGED
@@ -54191,7 +54191,12 @@ ${lanes.join("\n")}
54191
54191
  if (!links.type) {
54192
54192
  Debug.assertIsDefined(links.deferralParent);
54193
54193
  Debug.assertIsDefined(links.deferralConstituents);
54194
- links.type = links.deferralParent.flags & 1048576 /* Union */ ? getUnionType(links.deferralConstituents) : getIntersectionType(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
54200
  }
54196
54201
  return links.type;
54197
54202
  }
@@ -54199,8 +54204,12 @@ ${lanes.join("\n")}
54199
54204
  const links = getSymbolLinks(symbol);
54200
54205
  if (!links.writeType && links.deferralWriteConstituents) {
54201
54206
  Debug.assertIsDefined(links.deferralParent);
54202
- Debug.assertIsDefined(links.deferralConstituents);
54203
- links.writeType = links.deferralParent.flags & 1048576 /* Union */ ? getUnionType(links.deferralWriteConstituents) : getIntersectionType(links.deferralWriteConstituents);
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;
54204
54213
  }
54205
54214
  return links.writeType;
54206
54215
  }
@@ -56237,7 +56246,7 @@ ${lanes.join("\n")}
56237
56246
  return getReducedType(getApparentType(getReducedType(type)));
56238
56247
  }
56239
56248
  function createUnionOrIntersectionProperty(containingType, name, skipObjectFunctionPropertyAugment) {
56240
- var _a2, _b, _c;
56249
+ var _a2, _b, _c, _d;
56241
56250
  let singleProp;
56242
56251
  let propSet;
56243
56252
  let indexTypes;
@@ -56319,8 +56328,9 @@ ${lanes.join("\n")}
56319
56328
  let declarations;
56320
56329
  let firstType;
56321
56330
  let nameType;
56322
- const propTypes = [];
56331
+ let propTypes = [];
56323
56332
  let writeTypes;
56333
+ let deferredMismatchedParts;
56324
56334
  let firstValueDeclaration;
56325
56335
  let hasNonUniformValueDeclaration = false;
56326
56336
  for (const prop of props) {
@@ -56330,6 +56340,24 @@ ${lanes.join("\n")}
56330
56340
  hasNonUniformValueDeclaration = true;
56331
56341
  }
56332
56342
  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
+ }
56333
56361
  const type = getTypeOfSymbol(prop);
56334
56362
  if (!firstType) {
56335
56363
  firstType = type;
@@ -56360,11 +56388,12 @@ ${lanes.join("\n")}
56360
56388
  }
56361
56389
  result.declarations = declarations;
56362
56390
  result.links.nameType = nameType;
56363
- if (propTypes.length > 2) {
56391
+ if (propTypes.length > 2 || deferredMismatchedParts) {
56364
56392
  result.links.checkFlags |= 65536 /* DeferredType */;
56365
56393
  result.links.deferralParent = containingType;
56366
56394
  result.links.deferralConstituents = propTypes;
56367
56395
  result.links.deferralWriteConstituents = writeTypes;
56396
+ result.links.deferredMismatchedParts = deferredMismatchedParts;
56368
56397
  } else {
56369
56398
  result.links.type = isUnion ? getUnionType(propTypes) : getIntersectionType(propTypes);
56370
56399
  if (writeTypes) {
@@ -58721,7 +58750,7 @@ ${lanes.join("\n")}
58721
58750
  function getIntersectionType(types, aliasSymbol, aliasTypeArguments, noSupertypeReduction) {
58722
58751
  const typeMembershipMap = /* @__PURE__ */ new Map();
58723
58752
  const includes = addTypesToIntersection(typeMembershipMap, 0, types);
58724
- const typeSet = arrayFrom(typeMembershipMap.values());
58753
+ let typeSet = arrayFrom(typeMembershipMap.values());
58725
58754
  if (includes & 131072 /* Never */) {
58726
58755
  return contains(typeSet, silentNeverType) ? silentNeverType : neverType;
58727
58756
  }
@@ -58753,6 +58782,8 @@ ${lanes.join("\n")}
58753
58782
  const id = getTypeListId(typeSet) + getAliasId(aliasSymbol, aliasTypeArguments);
58754
58783
  let result = intersectionTypes.get(id);
58755
58784
  if (!result) {
58785
+ const originalSet = typeSet;
58786
+ let runningResult;
58756
58787
  if (includes & 1048576 /* Union */) {
58757
58788
  if (intersectUnionsOfPrimitiveTypes(typeSet)) {
58758
58789
  result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
@@ -58764,12 +58795,32 @@ ${lanes.join("\n")}
58764
58795
  removeFromEach(typeSet, 65536 /* Null */);
58765
58796
  result = getUnionType([getIntersectionType(typeSet), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
58766
58797
  } 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
+ }
58767
58814
  if (!checkCrossProductUnion(typeSet)) {
58768
58815
  return errorType;
58769
58816
  }
58770
58817
  const constituents = getCrossProductIntersections(typeSet);
58771
- const origin = some(constituents, (t) => !!(t.flags & 2097152 /* Intersection */)) && getConstituentCountOfTypes(constituents) > getConstituentCountOfTypes(typeSet) ? createOriginUnionOrIntersectionType(2097152 /* Intersection */, typeSet) : void 0;
58772
- result = getUnionType(constituents, 1 /* Literal */, aliasSymbol, aliasTypeArguments, origin);
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
+ }
58773
58824
  }
58774
58825
  } else {
58775
58826
  result = createIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
@@ -58784,7 +58835,7 @@ ${lanes.join("\n")}
58784
58835
  function checkCrossProductUnion(types) {
58785
58836
  var _a2;
58786
58837
  const size = getCrossProductUnionSize(types);
58787
- if (size >= 1e5) {
58838
+ if (size >= UNION_CROSS_PRODUCT_SIZE_LIMIT) {
58788
58839
  (_a2 = tracing) == null ? void 0 : _a2.instant(tracing.Phase.CheckTypes, "checkCrossProductUnion_DepthLimit", { typeIds: types.map((t) => t.id), size });
58789
58840
  error(currentNode, Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent);
58790
58841
  return false;
@@ -85470,7 +85521,7 @@ ${lanes.join("\n")}
85470
85521
  readFile: host.readFile ? (fileName) => host.readFile(fileName) : void 0
85471
85522
  };
85472
85523
  }
85473
- var ambientModuleSymbolRegex, anon, nextSymbolId, nextNodeId, nextMergeId, nextFlowId, TypeFacts, typeofNEFacts, CheckMode, SignatureCheckMode, isNotOverloadAndNotAccessor, intrinsicTypeKinds, SymbolLinks, JsxNames, SymbolTrackerImpl;
85524
+ var ambientModuleSymbolRegex, anon, nextSymbolId, nextNodeId, nextMergeId, nextFlowId, TypeFacts, typeofNEFacts, CheckMode, SignatureCheckMode, isNotOverloadAndNotAccessor, intrinsicTypeKinds, SymbolLinks, UNION_CROSS_PRODUCT_SIZE_LIMIT, JsxNames, SymbolTrackerImpl;
85474
85525
  var init_checker = __esm({
85475
85526
  "src/compiler/checker.ts"() {
85476
85527
  "use strict";
@@ -85602,6 +85653,7 @@ ${lanes.join("\n")}
85602
85653
  }));
85603
85654
  SymbolLinks = class {
85604
85655
  };
85656
+ UNION_CROSS_PRODUCT_SIZE_LIMIT = 1e5;
85605
85657
  ((JsxNames2) => {
85606
85658
  JsxNames2.JSX = "JSX";
85607
85659
  JsxNames2.IntrinsicElements = "IntrinsicElements";
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-50092-15",
5
+ "version": "5.1.0-pr-53739-12",
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": "b815a5be102643c893685ca4b757f39774646d20"
117
+ "gitHead": "2493625c9c4fae9f224de64cf587825d651468c6"
118
118
  }