typescript 5.5.0-dev.20240502 → 5.5.0-dev.20240503

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsc.js CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.5";
21
- var version = `${versionMajorMinor}.0-dev.20240502`;
21
+ var version = `${versionMajorMinor}.0-dev.20240503`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -56906,7 +56906,7 @@ function createTypeChecker(host) {
56906
56906
  }
56907
56907
  }
56908
56908
  return getNormalizedType(
56909
- getIntersectionType(constraints),
56909
+ getIntersectionType(constraints, 2 /* NoConstraintReduction */),
56910
56910
  /*writing*/
56911
56911
  false
56912
56912
  );
@@ -59711,7 +59711,7 @@ function createTypeChecker(host) {
59711
59711
  result.aliasTypeArguments = aliasTypeArguments;
59712
59712
  return result;
59713
59713
  }
59714
- function getIntersectionType(types, aliasSymbol, aliasTypeArguments, noSupertypeReduction) {
59714
+ function getIntersectionType(types, flags = 0 /* None */, aliasSymbol, aliasTypeArguments) {
59715
59715
  const typeMembershipMap = /* @__PURE__ */ new Map();
59716
59716
  const includes = addTypesToIntersection(typeMembershipMap, 0, types);
59717
59717
  const typeSet = arrayFrom(typeMembershipMap.values());
@@ -59732,7 +59732,7 @@ function createTypeChecker(host) {
59732
59732
  return includes & 16777216 /* IncludesEmptyObject */ ? neverType : includes & 32768 /* Undefined */ ? undefinedType : nullType;
59733
59733
  }
59734
59734
  if (includes & 4 /* String */ && includes & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) || includes & 8 /* Number */ && includes & 256 /* NumberLiteral */ || includes & 64 /* BigInt */ && includes & 2048 /* BigIntLiteral */ || includes & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */ || includes & 16384 /* Void */ && includes & 32768 /* Undefined */ || includes & 16777216 /* IncludesEmptyObject */ && includes & 470302716 /* DefinitelyNonNullable */) {
59735
- if (!noSupertypeReduction)
59735
+ if (!(flags & 1 /* NoSupertypeReduction */))
59736
59736
  removeRedundantSupertypes(typeSet, includes);
59737
59737
  }
59738
59738
  if (includes & 262144 /* IncludesMissingType */) {
@@ -59744,7 +59744,7 @@ function createTypeChecker(host) {
59744
59744
  if (typeSet.length === 1) {
59745
59745
  return typeSet[0];
59746
59746
  }
59747
- if (typeSet.length === 2) {
59747
+ if (typeSet.length === 2 && !(flags & 2 /* NoConstraintReduction */)) {
59748
59748
  const typeVarIndex = typeSet[0].flags & 8650752 /* TypeVariable */ ? 0 : 1;
59749
59749
  const typeVariable = typeSet[typeVarIndex];
59750
59750
  const primitiveType = typeSet[1 - typeVarIndex];
@@ -59763,27 +59763,27 @@ function createTypeChecker(host) {
59763
59763
  }
59764
59764
  }
59765
59765
  }
59766
- const id = getTypeListId(typeSet) + getAliasId(aliasSymbol, aliasTypeArguments);
59766
+ const id = getTypeListId(typeSet) + (flags & 2 /* NoConstraintReduction */ ? "*" : getAliasId(aliasSymbol, aliasTypeArguments));
59767
59767
  let result = intersectionTypes.get(id);
59768
59768
  if (!result) {
59769
59769
  if (includes & 1048576 /* Union */) {
59770
59770
  if (intersectUnionsOfPrimitiveTypes(typeSet)) {
59771
- result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
59771
+ result = getIntersectionType(typeSet, flags, aliasSymbol, aliasTypeArguments);
59772
59772
  } else if (every(typeSet, (t) => !!(t.flags & 1048576 /* Union */ && t.types[0].flags & 32768 /* Undefined */))) {
59773
59773
  const containedUndefinedType = some(typeSet, containsMissingType) ? missingType : undefinedType;
59774
59774
  removeFromEach(typeSet, 32768 /* Undefined */);
59775
- result = getUnionType([getIntersectionType(typeSet), containedUndefinedType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
59775
+ result = getUnionType([getIntersectionType(typeSet, flags), containedUndefinedType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
59776
59776
  } else if (every(typeSet, (t) => !!(t.flags & 1048576 /* Union */ && (t.types[0].flags & 65536 /* Null */ || t.types[1].flags & 65536 /* Null */)))) {
59777
59777
  removeFromEach(typeSet, 65536 /* Null */);
59778
- result = getUnionType([getIntersectionType(typeSet), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
59778
+ result = getUnionType([getIntersectionType(typeSet, flags), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
59779
59779
  } else if (typeSet.length >= 4) {
59780
59780
  const middle = Math.floor(typeSet.length / 2);
59781
- result = getIntersectionType([getIntersectionType(typeSet.slice(0, middle)), getIntersectionType(typeSet.slice(middle))], aliasSymbol, aliasTypeArguments);
59781
+ result = getIntersectionType([getIntersectionType(typeSet.slice(0, middle), flags), getIntersectionType(typeSet.slice(middle), flags)], flags, aliasSymbol, aliasTypeArguments);
59782
59782
  } else {
59783
59783
  if (!checkCrossProductUnion(typeSet)) {
59784
59784
  return errorType;
59785
59785
  }
59786
- const constituents = getCrossProductIntersections(typeSet);
59786
+ const constituents = getCrossProductIntersections(typeSet, flags);
59787
59787
  const origin = some(constituents, (t) => !!(t.flags & 2097152 /* Intersection */)) && getConstituentCountOfTypes(constituents) > getConstituentCountOfTypes(typeSet) ? createOriginUnionOrIntersectionType(2097152 /* Intersection */, typeSet) : void 0;
59788
59788
  result = getUnionType(constituents, 1 /* Literal */, aliasSymbol, aliasTypeArguments, origin);
59789
59789
  }
@@ -59807,7 +59807,7 @@ function createTypeChecker(host) {
59807
59807
  }
59808
59808
  return true;
59809
59809
  }
59810
- function getCrossProductIntersections(types) {
59810
+ function getCrossProductIntersections(types, flags) {
59811
59811
  const count = getCrossProductUnionSize(types);
59812
59812
  const intersections = [];
59813
59813
  for (let i = 0; i < count; i++) {
@@ -59821,7 +59821,7 @@ function createTypeChecker(host) {
59821
59821
  n = Math.floor(n / length2);
59822
59822
  }
59823
59823
  }
59824
- const t = getIntersectionType(constituents);
59824
+ const t = getIntersectionType(constituents, flags);
59825
59825
  if (!(t.flags & 131072 /* Never */))
59826
59826
  intersections.push(t);
59827
59827
  }
@@ -59841,7 +59841,7 @@ function createTypeChecker(host) {
59841
59841
  const emptyIndex = types.length === 2 ? types.indexOf(emptyTypeLiteralType) : -1;
59842
59842
  const t = emptyIndex >= 0 ? types[1 - emptyIndex] : unknownType;
59843
59843
  const noSupertypeReduction = !!(t.flags & (4 /* String */ | 8 /* Number */ | 64 /* BigInt */) || t.flags & 134217728 /* TemplateLiteral */ && isPatternLiteralType(t));
59844
- links.resolvedType = getIntersectionType(types, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol), noSupertypeReduction);
59844
+ links.resolvedType = getIntersectionType(types, noSupertypeReduction ? 1 /* NoSupertypeReduction */ : 0, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol));
59845
59845
  }
59846
59846
  return links.resolvedType;
59847
59847
  }
@@ -60532,7 +60532,7 @@ function createTypeChecker(host) {
60532
60532
  if (wasMissingProp) {
60533
60533
  return void 0;
60534
60534
  }
60535
- return accessFlags & 4 /* Writing */ ? getIntersectionType(propTypes, aliasSymbol, aliasTypeArguments) : getUnionType(propTypes, 1 /* Literal */, aliasSymbol, aliasTypeArguments);
60535
+ return accessFlags & 4 /* Writing */ ? getIntersectionType(propTypes, 0 /* None */, aliasSymbol, aliasTypeArguments) : getUnionType(propTypes, 1 /* Literal */, aliasSymbol, aliasTypeArguments);
60536
60536
  }
60537
60537
  return getPropertyTypeForIndexType(objectType, apparentObjectType, indexType, indexType, accessNode, accessFlags | 8 /* CacheSymbol */ | 64 /* ReportDeprecated */);
60538
60538
  }
@@ -61656,7 +61656,7 @@ function createTypeChecker(host) {
61656
61656
  }
61657
61657
  const newAliasSymbol = aliasSymbol || type.aliasSymbol;
61658
61658
  const newAliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper);
61659
- return flags & 2097152 /* Intersection */ || origin && origin.flags & 2097152 /* Intersection */ ? getIntersectionType(newTypes, newAliasSymbol, newAliasTypeArguments) : getUnionType(newTypes, 1 /* Literal */, newAliasSymbol, newAliasTypeArguments);
61659
+ return flags & 2097152 /* Intersection */ || origin && origin.flags & 2097152 /* Intersection */ ? getIntersectionType(newTypes, 0 /* None */, newAliasSymbol, newAliasTypeArguments) : getUnionType(newTypes, 1 /* Literal */, newAliasSymbol, newAliasTypeArguments);
61660
61660
  }
61661
61661
  if (flags & 4194304 /* Index */) {
61662
61662
  return getIndexType(instantiateType(type.type, mapper));
package/lib/typescript.js CHANGED
@@ -99,6 +99,7 @@ __export(typescript_exports, {
99
99
  InlayHints: () => ts_InlayHints_exports,
100
100
  InternalEmitFlags: () => InternalEmitFlags,
101
101
  InternalSymbolName: () => InternalSymbolName,
102
+ IntersectionFlags: () => IntersectionFlags,
102
103
  InvalidatedProjectKind: () => InvalidatedProjectKind,
103
104
  JSDocParsingMode: () => JSDocParsingMode,
104
105
  JsDoc: () => ts_JsDoc_exports,
@@ -2363,7 +2364,7 @@ module.exports = __toCommonJS(typescript_exports);
2363
2364
 
2364
2365
  // src/compiler/corePublic.ts
2365
2366
  var versionMajorMinor = "5.5";
2366
- var version = `${versionMajorMinor}.0-dev.20240502`;
2367
+ var version = `${versionMajorMinor}.0-dev.20240503`;
2367
2368
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2368
2369
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2369
2370
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -6390,6 +6391,12 @@ var UnionReduction = /* @__PURE__ */ ((UnionReduction2) => {
6390
6391
  UnionReduction2[UnionReduction2["Subtype"] = 2] = "Subtype";
6391
6392
  return UnionReduction2;
6392
6393
  })(UnionReduction || {});
6394
+ var IntersectionFlags = /* @__PURE__ */ ((IntersectionFlags2) => {
6395
+ IntersectionFlags2[IntersectionFlags2["None"] = 0] = "None";
6396
+ IntersectionFlags2[IntersectionFlags2["NoSupertypeReduction"] = 1] = "NoSupertypeReduction";
6397
+ IntersectionFlags2[IntersectionFlags2["NoConstraintReduction"] = 2] = "NoConstraintReduction";
6398
+ return IntersectionFlags2;
6399
+ })(IntersectionFlags || {});
6393
6400
  var ContextFlags = /* @__PURE__ */ ((ContextFlags3) => {
6394
6401
  ContextFlags3[ContextFlags3["None"] = 0] = "None";
6395
6402
  ContextFlags3[ContextFlags3["Signature"] = 1] = "Signature";
@@ -61739,7 +61746,7 @@ function createTypeChecker(host) {
61739
61746
  }
61740
61747
  }
61741
61748
  return getNormalizedType(
61742
- getIntersectionType(constraints),
61749
+ getIntersectionType(constraints, 2 /* NoConstraintReduction */),
61743
61750
  /*writing*/
61744
61751
  false
61745
61752
  );
@@ -64544,7 +64551,7 @@ function createTypeChecker(host) {
64544
64551
  result.aliasTypeArguments = aliasTypeArguments;
64545
64552
  return result;
64546
64553
  }
64547
- function getIntersectionType(types, aliasSymbol, aliasTypeArguments, noSupertypeReduction) {
64554
+ function getIntersectionType(types, flags = 0 /* None */, aliasSymbol, aliasTypeArguments) {
64548
64555
  const typeMembershipMap = /* @__PURE__ */ new Map();
64549
64556
  const includes = addTypesToIntersection(typeMembershipMap, 0, types);
64550
64557
  const typeSet = arrayFrom(typeMembershipMap.values());
@@ -64565,7 +64572,7 @@ function createTypeChecker(host) {
64565
64572
  return includes & 16777216 /* IncludesEmptyObject */ ? neverType : includes & 32768 /* Undefined */ ? undefinedType : nullType;
64566
64573
  }
64567
64574
  if (includes & 4 /* String */ && includes & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) || includes & 8 /* Number */ && includes & 256 /* NumberLiteral */ || includes & 64 /* BigInt */ && includes & 2048 /* BigIntLiteral */ || includes & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */ || includes & 16384 /* Void */ && includes & 32768 /* Undefined */ || includes & 16777216 /* IncludesEmptyObject */ && includes & 470302716 /* DefinitelyNonNullable */) {
64568
- if (!noSupertypeReduction)
64575
+ if (!(flags & 1 /* NoSupertypeReduction */))
64569
64576
  removeRedundantSupertypes(typeSet, includes);
64570
64577
  }
64571
64578
  if (includes & 262144 /* IncludesMissingType */) {
@@ -64577,7 +64584,7 @@ function createTypeChecker(host) {
64577
64584
  if (typeSet.length === 1) {
64578
64585
  return typeSet[0];
64579
64586
  }
64580
- if (typeSet.length === 2) {
64587
+ if (typeSet.length === 2 && !(flags & 2 /* NoConstraintReduction */)) {
64581
64588
  const typeVarIndex = typeSet[0].flags & 8650752 /* TypeVariable */ ? 0 : 1;
64582
64589
  const typeVariable = typeSet[typeVarIndex];
64583
64590
  const primitiveType = typeSet[1 - typeVarIndex];
@@ -64596,27 +64603,27 @@ function createTypeChecker(host) {
64596
64603
  }
64597
64604
  }
64598
64605
  }
64599
- const id = getTypeListId(typeSet) + getAliasId(aliasSymbol, aliasTypeArguments);
64606
+ const id = getTypeListId(typeSet) + (flags & 2 /* NoConstraintReduction */ ? "*" : getAliasId(aliasSymbol, aliasTypeArguments));
64600
64607
  let result = intersectionTypes.get(id);
64601
64608
  if (!result) {
64602
64609
  if (includes & 1048576 /* Union */) {
64603
64610
  if (intersectUnionsOfPrimitiveTypes(typeSet)) {
64604
- result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
64611
+ result = getIntersectionType(typeSet, flags, aliasSymbol, aliasTypeArguments);
64605
64612
  } else if (every(typeSet, (t) => !!(t.flags & 1048576 /* Union */ && t.types[0].flags & 32768 /* Undefined */))) {
64606
64613
  const containedUndefinedType = some(typeSet, containsMissingType) ? missingType : undefinedType;
64607
64614
  removeFromEach(typeSet, 32768 /* Undefined */);
64608
- result = getUnionType([getIntersectionType(typeSet), containedUndefinedType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
64615
+ result = getUnionType([getIntersectionType(typeSet, flags), containedUndefinedType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
64609
64616
  } else if (every(typeSet, (t) => !!(t.flags & 1048576 /* Union */ && (t.types[0].flags & 65536 /* Null */ || t.types[1].flags & 65536 /* Null */)))) {
64610
64617
  removeFromEach(typeSet, 65536 /* Null */);
64611
- result = getUnionType([getIntersectionType(typeSet), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
64618
+ result = getUnionType([getIntersectionType(typeSet, flags), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
64612
64619
  } else if (typeSet.length >= 4) {
64613
64620
  const middle = Math.floor(typeSet.length / 2);
64614
- result = getIntersectionType([getIntersectionType(typeSet.slice(0, middle)), getIntersectionType(typeSet.slice(middle))], aliasSymbol, aliasTypeArguments);
64621
+ result = getIntersectionType([getIntersectionType(typeSet.slice(0, middle), flags), getIntersectionType(typeSet.slice(middle), flags)], flags, aliasSymbol, aliasTypeArguments);
64615
64622
  } else {
64616
64623
  if (!checkCrossProductUnion(typeSet)) {
64617
64624
  return errorType;
64618
64625
  }
64619
- const constituents = getCrossProductIntersections(typeSet);
64626
+ const constituents = getCrossProductIntersections(typeSet, flags);
64620
64627
  const origin = some(constituents, (t) => !!(t.flags & 2097152 /* Intersection */)) && getConstituentCountOfTypes(constituents) > getConstituentCountOfTypes(typeSet) ? createOriginUnionOrIntersectionType(2097152 /* Intersection */, typeSet) : void 0;
64621
64628
  result = getUnionType(constituents, 1 /* Literal */, aliasSymbol, aliasTypeArguments, origin);
64622
64629
  }
@@ -64640,7 +64647,7 @@ function createTypeChecker(host) {
64640
64647
  }
64641
64648
  return true;
64642
64649
  }
64643
- function getCrossProductIntersections(types) {
64650
+ function getCrossProductIntersections(types, flags) {
64644
64651
  const count = getCrossProductUnionSize(types);
64645
64652
  const intersections = [];
64646
64653
  for (let i = 0; i < count; i++) {
@@ -64654,7 +64661,7 @@ function createTypeChecker(host) {
64654
64661
  n = Math.floor(n / length2);
64655
64662
  }
64656
64663
  }
64657
- const t = getIntersectionType(constituents);
64664
+ const t = getIntersectionType(constituents, flags);
64658
64665
  if (!(t.flags & 131072 /* Never */))
64659
64666
  intersections.push(t);
64660
64667
  }
@@ -64674,7 +64681,7 @@ function createTypeChecker(host) {
64674
64681
  const emptyIndex = types.length === 2 ? types.indexOf(emptyTypeLiteralType) : -1;
64675
64682
  const t = emptyIndex >= 0 ? types[1 - emptyIndex] : unknownType;
64676
64683
  const noSupertypeReduction = !!(t.flags & (4 /* String */ | 8 /* Number */ | 64 /* BigInt */) || t.flags & 134217728 /* TemplateLiteral */ && isPatternLiteralType(t));
64677
- links.resolvedType = getIntersectionType(types, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol), noSupertypeReduction);
64684
+ links.resolvedType = getIntersectionType(types, noSupertypeReduction ? 1 /* NoSupertypeReduction */ : 0, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol));
64678
64685
  }
64679
64686
  return links.resolvedType;
64680
64687
  }
@@ -65365,7 +65372,7 @@ function createTypeChecker(host) {
65365
65372
  if (wasMissingProp) {
65366
65373
  return void 0;
65367
65374
  }
65368
- return accessFlags & 4 /* Writing */ ? getIntersectionType(propTypes, aliasSymbol, aliasTypeArguments) : getUnionType(propTypes, 1 /* Literal */, aliasSymbol, aliasTypeArguments);
65375
+ return accessFlags & 4 /* Writing */ ? getIntersectionType(propTypes, 0 /* None */, aliasSymbol, aliasTypeArguments) : getUnionType(propTypes, 1 /* Literal */, aliasSymbol, aliasTypeArguments);
65369
65376
  }
65370
65377
  return getPropertyTypeForIndexType(objectType, apparentObjectType, indexType, indexType, accessNode, accessFlags | 8 /* CacheSymbol */ | 64 /* ReportDeprecated */);
65371
65378
  }
@@ -66489,7 +66496,7 @@ function createTypeChecker(host) {
66489
66496
  }
66490
66497
  const newAliasSymbol = aliasSymbol || type.aliasSymbol;
66491
66498
  const newAliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper);
66492
- return flags & 2097152 /* Intersection */ || origin && origin.flags & 2097152 /* Intersection */ ? getIntersectionType(newTypes, newAliasSymbol, newAliasTypeArguments) : getUnionType(newTypes, 1 /* Literal */, newAliasSymbol, newAliasTypeArguments);
66499
+ return flags & 2097152 /* Intersection */ || origin && origin.flags & 2097152 /* Intersection */ ? getIntersectionType(newTypes, 0 /* None */, newAliasSymbol, newAliasTypeArguments) : getUnionType(newTypes, 1 /* Literal */, newAliasSymbol, newAliasTypeArguments);
66493
66500
  }
66494
66501
  if (flags & 4194304 /* Index */) {
66495
66502
  return getIndexType(instantiateType(type.type, mapper));
@@ -178889,6 +178896,7 @@ __export(ts_exports2, {
178889
178896
  InlayHints: () => ts_InlayHints_exports,
178890
178897
  InternalEmitFlags: () => InternalEmitFlags,
178891
178898
  InternalSymbolName: () => InternalSymbolName,
178899
+ IntersectionFlags: () => IntersectionFlags,
178892
178900
  InvalidatedProjectKind: () => InvalidatedProjectKind,
178893
178901
  JSDocParsingMode: () => JSDocParsingMode,
178894
178902
  JsDoc: () => ts_JsDoc_exports,
@@ -193318,6 +193326,7 @@ if (typeof console !== "undefined") {
193318
193326
  InlayHints,
193319
193327
  InternalEmitFlags,
193320
193328
  InternalSymbolName,
193329
+ IntersectionFlags,
193321
193330
  InvalidatedProjectKind,
193322
193331
  JSDocParsingMode,
193323
193332
  JsDoc,
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "typescript",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "5.5.0-dev.20240502",
5
+ "version": "5.5.0-dev.20240503",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -110,5 +110,5 @@
110
110
  "node": "20.1.0",
111
111
  "npm": "8.19.4"
112
112
  },
113
- "gitHead": "7a38980a7e04bee0e273163f26c91d5c99f28298"
113
+ "gitHead": "3a74ec4e992eacba932c302fded9a636a6c00875"
114
114
  }