typescript 4.8.0-dev.20220802 → 4.8.0-dev.20220803

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.
@@ -41,7 +41,7 @@ interface PromiseConstructor {
41
41
  all<T extends readonly unknown[] | []>(values: T): Promise<{ -readonly [P in keyof T]: Awaited<T[P]> }>;
42
42
 
43
43
  // see: lib.es2015.iterable.d.ts
44
- // all<T>(values: Iterable<T | PromiseLike<T>>): Promise<T[]>;
44
+ // all<T>(values: Iterable<T | PromiseLike<T>>): Promise<Awaited<T>[]>;
45
45
 
46
46
  /**
47
47
  * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
@@ -52,7 +52,7 @@ interface PromiseConstructor {
52
52
  race<T extends readonly unknown[] | []>(values: T): Promise<Awaited<T[number]>>;
53
53
 
54
54
  // see: lib.es2015.iterable.d.ts
55
- // race<T>(values: Iterable<T>): Promise<T extends PromiseLike<infer U> ? U : T>;
55
+ // race<T>(values: Iterable<T | PromiseLike<T>>): Promise<Awaited<T>>;
56
56
 
57
57
  /**
58
58
  * Creates a new rejected promise for the provided reason.
@@ -66,13 +66,18 @@ interface PromiseConstructor {
66
66
  * @returns A resolved promise.
67
67
  */
68
68
  resolve(): Promise<void>;
69
-
70
69
  /**
71
70
  * Creates a new resolved promise for the provided value.
72
71
  * @param value A promise.
73
72
  * @returns A promise whose internal state matches the provided promise.
74
73
  */
75
- resolve<T>(value: T | PromiseLike<T>): Promise<T>;
74
+ resolve<T>(value: T): Promise<Awaited<T>>;
75
+ /**
76
+ * Creates a new resolved promise for the provided value.
77
+ * @param value A promise.
78
+ * @returns A promise whose internal state matches the provided promise.
79
+ */
80
+ resolve<T>(value: T | PromiseLike<T>): Promise<Awaited<T>>;
76
81
  }
77
82
 
78
83
  declare var Promise: PromiseConstructor;
package/lib/lib.es5.d.ts CHANGED
@@ -1532,8 +1532,8 @@ interface Promise<T> {
1532
1532
  */
1533
1533
  type Awaited<T> =
1534
1534
  T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode
1535
- T extends object & { then(onfulfilled: infer F): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped
1536
- F extends ((value: infer V, ...args: any) => any) ? // if the argument to `then` is callable, extracts the first argument
1535
+ T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped
1536
+ F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument
1537
1537
  Awaited<V> : // recursively unwrap the value
1538
1538
  never : // the argument to `then` was not callable
1539
1539
  T; // non-object or non-thenable
package/lib/tsc.js CHANGED
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
69
69
  var ts;
70
70
  (function (ts) {
71
71
  ts.versionMajorMinor = "4.8";
72
- ts.version = ts.versionMajorMinor + ".0-dev.20220802";
72
+ ts.version = ts.versionMajorMinor + ".0-dev.20220803";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  var globals = typeof globalThis !== "undefined" ? globalThis :
@@ -55226,6 +55226,12 @@ var ts;
55226
55226
  function structuredTypeRelatedTo(source, target, reportErrors, intersectionState) {
55227
55227
  var saveErrorInfo = captureErrorCalculationState();
55228
55228
  var result = structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo);
55229
+ if (!result && (source.flags & 2097152 || source.flags & 262144 && target.flags & 1048576)) {
55230
+ var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 ? source.types : [source], !!(target.flags & 1048576));
55231
+ if (constraint && everyType(constraint, function (c) { return c !== source; })) {
55232
+ result = isRelatedTo(constraint, target, 1, false, undefined, intersectionState);
55233
+ }
55234
+ }
55229
55235
  if (result) {
55230
55236
  resetErrorInfo(saveErrorInfo);
55231
55237
  }
@@ -55282,14 +55288,6 @@ var ts;
55282
55288
  if (result = unionOrIntersectionRelatedTo(source, target, reportErrors, intersectionState)) {
55283
55289
  return result;
55284
55290
  }
55285
- if (source.flags & 2097152 || source.flags & 262144 && target.flags & 1048576) {
55286
- var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 ? source.types : [source], !!(target.flags & 1048576));
55287
- if (constraint && everyType(constraint, function (c) { return c !== source; })) {
55288
- if (result = isRelatedTo(constraint, target, 1, false, undefined, intersectionState)) {
55289
- return result;
55290
- }
55291
- }
55292
- }
55293
55291
  if (!(sourceFlags & 465829888 ||
55294
55292
  sourceFlags & 524288 && targetFlags & 1048576 ||
55295
55293
  sourceFlags & 2097152 && targetFlags & (524288 | 1048576 | 465829888))) {
package/lib/tsserver.js CHANGED
@@ -109,7 +109,7 @@ var ts;
109
109
  // The following is baselined as a literal template type without intervention
110
110
  /** The version of the TypeScript compiler release */
111
111
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
112
- ts.version = ts.versionMajorMinor + ".0-dev.20220802";
112
+ ts.version = ts.versionMajorMinor + ".0-dev.20220803";
113
113
  /* @internal */
114
114
  var Comparison;
115
115
  (function (Comparison) {
@@ -66198,6 +66198,26 @@ var ts;
66198
66198
  function structuredTypeRelatedTo(source, target, reportErrors, intersectionState) {
66199
66199
  var saveErrorInfo = captureErrorCalculationState();
66200
66200
  var result = structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo);
66201
+ if (!result && (source.flags & 2097152 /* Intersection */ || source.flags & 262144 /* TypeParameter */ && target.flags & 1048576 /* Union */)) {
66202
+ // The combined constraint of an intersection type is the intersection of the constraints of
66203
+ // the constituents. When an intersection type contains instantiable types with union type
66204
+ // constraints, there are situations where we need to examine the combined constraint. One is
66205
+ // when the target is a union type. Another is when the intersection contains types belonging
66206
+ // to one of the disjoint domains. For example, given type variables T and U, each with the
66207
+ // constraint 'string | number', the combined constraint of 'T & U' is 'string | number' and
66208
+ // we need to check this constraint against a union on the target side. Also, given a type
66209
+ // variable V constrained to 'string | number', 'V & number' has a combined constraint of
66210
+ // 'string & number | number & number' which reduces to just 'number'.
66211
+ // This also handles type parameters, as a type parameter with a union constraint compared against a union
66212
+ // needs to have its constraint hoisted into an intersection with said type parameter, this way
66213
+ // the type param can be compared with itself in the target (with the influence of its constraint to match other parts)
66214
+ // For example, if `T extends 1 | 2` and `U extends 2 | 3` and we compare `T & U` to `T & U & (1 | 2 | 3)`
66215
+ var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* Union */));
66216
+ if (constraint && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
66217
+ // TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this
66218
+ result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState);
66219
+ }
66220
+ }
66201
66221
  if (result) {
66202
66222
  resetErrorInfo(saveErrorInfo);
66203
66223
  }
@@ -66255,28 +66275,6 @@ var ts;
66255
66275
  if (result = unionOrIntersectionRelatedTo(source, target, reportErrors, intersectionState)) {
66256
66276
  return result;
66257
66277
  }
66258
- if (source.flags & 2097152 /* Intersection */ || source.flags & 262144 /* TypeParameter */ && target.flags & 1048576 /* Union */) {
66259
- // The combined constraint of an intersection type is the intersection of the constraints of
66260
- // the constituents. When an intersection type contains instantiable types with union type
66261
- // constraints, there are situations where we need to examine the combined constraint. One is
66262
- // when the target is a union type. Another is when the intersection contains types belonging
66263
- // to one of the disjoint domains. For example, given type variables T and U, each with the
66264
- // constraint 'string | number', the combined constraint of 'T & U' is 'string | number' and
66265
- // we need to check this constraint against a union on the target side. Also, given a type
66266
- // variable V constrained to 'string | number', 'V & number' has a combined constraint of
66267
- // 'string & number | number & number' which reduces to just 'number'.
66268
- // This also handles type parameters, as a type parameter with a union constraint compared against a union
66269
- // needs to have its constraint hoisted into an intersection with said type parameter, this way
66270
- // the type param can be compared with itself in the target (with the influence of its constraint to match other parts)
66271
- // For example, if `T extends 1 | 2` and `U extends 2 | 3` and we compare `T & U` to `T & U & (1 | 2 | 3)`
66272
- var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* Union */));
66273
- if (constraint && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
66274
- // TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this
66275
- if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
66276
- return result;
66277
- }
66278
- }
66279
- }
66280
66278
  // The ordered decomposition above doesn't handle all cases. Specifically, we also need to handle:
66281
66279
  // Source is instantiable (e.g. source has union or intersection constraint).
66282
66280
  // Source is an object, target is a union (e.g. { a, b: boolean } <=> { a, b: true } | { a, b: false }).
@@ -303,7 +303,7 @@ var ts;
303
303
  // The following is baselined as a literal template type without intervention
304
304
  /** The version of the TypeScript compiler release */
305
305
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
306
- ts.version = ts.versionMajorMinor + ".0-dev.20220802";
306
+ ts.version = ts.versionMajorMinor + ".0-dev.20220803";
307
307
  /* @internal */
308
308
  var Comparison;
309
309
  (function (Comparison) {
@@ -66392,6 +66392,26 @@ var ts;
66392
66392
  function structuredTypeRelatedTo(source, target, reportErrors, intersectionState) {
66393
66393
  var saveErrorInfo = captureErrorCalculationState();
66394
66394
  var result = structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo);
66395
+ if (!result && (source.flags & 2097152 /* Intersection */ || source.flags & 262144 /* TypeParameter */ && target.flags & 1048576 /* Union */)) {
66396
+ // The combined constraint of an intersection type is the intersection of the constraints of
66397
+ // the constituents. When an intersection type contains instantiable types with union type
66398
+ // constraints, there are situations where we need to examine the combined constraint. One is
66399
+ // when the target is a union type. Another is when the intersection contains types belonging
66400
+ // to one of the disjoint domains. For example, given type variables T and U, each with the
66401
+ // constraint 'string | number', the combined constraint of 'T & U' is 'string | number' and
66402
+ // we need to check this constraint against a union on the target side. Also, given a type
66403
+ // variable V constrained to 'string | number', 'V & number' has a combined constraint of
66404
+ // 'string & number | number & number' which reduces to just 'number'.
66405
+ // This also handles type parameters, as a type parameter with a union constraint compared against a union
66406
+ // needs to have its constraint hoisted into an intersection with said type parameter, this way
66407
+ // the type param can be compared with itself in the target (with the influence of its constraint to match other parts)
66408
+ // For example, if `T extends 1 | 2` and `U extends 2 | 3` and we compare `T & U` to `T & U & (1 | 2 | 3)`
66409
+ var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* Union */));
66410
+ if (constraint && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
66411
+ // TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this
66412
+ result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState);
66413
+ }
66414
+ }
66395
66415
  if (result) {
66396
66416
  resetErrorInfo(saveErrorInfo);
66397
66417
  }
@@ -66449,28 +66469,6 @@ var ts;
66449
66469
  if (result = unionOrIntersectionRelatedTo(source, target, reportErrors, intersectionState)) {
66450
66470
  return result;
66451
66471
  }
66452
- if (source.flags & 2097152 /* Intersection */ || source.flags & 262144 /* TypeParameter */ && target.flags & 1048576 /* Union */) {
66453
- // The combined constraint of an intersection type is the intersection of the constraints of
66454
- // the constituents. When an intersection type contains instantiable types with union type
66455
- // constraints, there are situations where we need to examine the combined constraint. One is
66456
- // when the target is a union type. Another is when the intersection contains types belonging
66457
- // to one of the disjoint domains. For example, given type variables T and U, each with the
66458
- // constraint 'string | number', the combined constraint of 'T & U' is 'string | number' and
66459
- // we need to check this constraint against a union on the target side. Also, given a type
66460
- // variable V constrained to 'string | number', 'V & number' has a combined constraint of
66461
- // 'string & number | number & number' which reduces to just 'number'.
66462
- // This also handles type parameters, as a type parameter with a union constraint compared against a union
66463
- // needs to have its constraint hoisted into an intersection with said type parameter, this way
66464
- // the type param can be compared with itself in the target (with the influence of its constraint to match other parts)
66465
- // For example, if `T extends 1 | 2` and `U extends 2 | 3` and we compare `T & U` to `T & U & (1 | 2 | 3)`
66466
- var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* Union */));
66467
- if (constraint && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
66468
- // TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this
66469
- if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
66470
- return result;
66471
- }
66472
- }
66473
- }
66474
66472
  // The ordered decomposition above doesn't handle all cases. Specifically, we also need to handle:
66475
66473
  // Source is instantiable (e.g. source has union or intersection constraint).
66476
66474
  // Source is an object, target is a union (e.g. { a, b: boolean } <=> { a, b: true } | { a, b: false }).
package/lib/typescript.js CHANGED
@@ -294,7 +294,7 @@ var ts;
294
294
  // The following is baselined as a literal template type without intervention
295
295
  /** The version of the TypeScript compiler release */
296
296
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
297
- ts.version = ts.versionMajorMinor + ".0-dev.20220802";
297
+ ts.version = ts.versionMajorMinor + ".0-dev.20220803";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -66383,6 +66383,26 @@ var ts;
66383
66383
  function structuredTypeRelatedTo(source, target, reportErrors, intersectionState) {
66384
66384
  var saveErrorInfo = captureErrorCalculationState();
66385
66385
  var result = structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo);
66386
+ if (!result && (source.flags & 2097152 /* Intersection */ || source.flags & 262144 /* TypeParameter */ && target.flags & 1048576 /* Union */)) {
66387
+ // The combined constraint of an intersection type is the intersection of the constraints of
66388
+ // the constituents. When an intersection type contains instantiable types with union type
66389
+ // constraints, there are situations where we need to examine the combined constraint. One is
66390
+ // when the target is a union type. Another is when the intersection contains types belonging
66391
+ // to one of the disjoint domains. For example, given type variables T and U, each with the
66392
+ // constraint 'string | number', the combined constraint of 'T & U' is 'string | number' and
66393
+ // we need to check this constraint against a union on the target side. Also, given a type
66394
+ // variable V constrained to 'string | number', 'V & number' has a combined constraint of
66395
+ // 'string & number | number & number' which reduces to just 'number'.
66396
+ // This also handles type parameters, as a type parameter with a union constraint compared against a union
66397
+ // needs to have its constraint hoisted into an intersection with said type parameter, this way
66398
+ // the type param can be compared with itself in the target (with the influence of its constraint to match other parts)
66399
+ // For example, if `T extends 1 | 2` and `U extends 2 | 3` and we compare `T & U` to `T & U & (1 | 2 | 3)`
66400
+ var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* Union */));
66401
+ if (constraint && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
66402
+ // TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this
66403
+ result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState);
66404
+ }
66405
+ }
66386
66406
  if (result) {
66387
66407
  resetErrorInfo(saveErrorInfo);
66388
66408
  }
@@ -66440,28 +66460,6 @@ var ts;
66440
66460
  if (result = unionOrIntersectionRelatedTo(source, target, reportErrors, intersectionState)) {
66441
66461
  return result;
66442
66462
  }
66443
- if (source.flags & 2097152 /* Intersection */ || source.flags & 262144 /* TypeParameter */ && target.flags & 1048576 /* Union */) {
66444
- // The combined constraint of an intersection type is the intersection of the constraints of
66445
- // the constituents. When an intersection type contains instantiable types with union type
66446
- // constraints, there are situations where we need to examine the combined constraint. One is
66447
- // when the target is a union type. Another is when the intersection contains types belonging
66448
- // to one of the disjoint domains. For example, given type variables T and U, each with the
66449
- // constraint 'string | number', the combined constraint of 'T & U' is 'string | number' and
66450
- // we need to check this constraint against a union on the target side. Also, given a type
66451
- // variable V constrained to 'string | number', 'V & number' has a combined constraint of
66452
- // 'string & number | number & number' which reduces to just 'number'.
66453
- // This also handles type parameters, as a type parameter with a union constraint compared against a union
66454
- // needs to have its constraint hoisted into an intersection with said type parameter, this way
66455
- // the type param can be compared with itself in the target (with the influence of its constraint to match other parts)
66456
- // For example, if `T extends 1 | 2` and `U extends 2 | 3` and we compare `T & U` to `T & U & (1 | 2 | 3)`
66457
- var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* Union */));
66458
- if (constraint && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
66459
- // TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this
66460
- if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
66461
- return result;
66462
- }
66463
- }
66464
- }
66465
66463
  // The ordered decomposition above doesn't handle all cases. Specifically, we also need to handle:
66466
66464
  // Source is instantiable (e.g. source has union or intersection constraint).
66467
66465
  // Source is an object, target is a union (e.g. { a, b: boolean } <=> { a, b: true } | { a, b: false }).
@@ -294,7 +294,7 @@ var ts;
294
294
  // The following is baselined as a literal template type without intervention
295
295
  /** The version of the TypeScript compiler release */
296
296
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
297
- ts.version = ts.versionMajorMinor + ".0-dev.20220802";
297
+ ts.version = ts.versionMajorMinor + ".0-dev.20220803";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -66383,6 +66383,26 @@ var ts;
66383
66383
  function structuredTypeRelatedTo(source, target, reportErrors, intersectionState) {
66384
66384
  var saveErrorInfo = captureErrorCalculationState();
66385
66385
  var result = structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo);
66386
+ if (!result && (source.flags & 2097152 /* Intersection */ || source.flags & 262144 /* TypeParameter */ && target.flags & 1048576 /* Union */)) {
66387
+ // The combined constraint of an intersection type is the intersection of the constraints of
66388
+ // the constituents. When an intersection type contains instantiable types with union type
66389
+ // constraints, there are situations where we need to examine the combined constraint. One is
66390
+ // when the target is a union type. Another is when the intersection contains types belonging
66391
+ // to one of the disjoint domains. For example, given type variables T and U, each with the
66392
+ // constraint 'string | number', the combined constraint of 'T & U' is 'string | number' and
66393
+ // we need to check this constraint against a union on the target side. Also, given a type
66394
+ // variable V constrained to 'string | number', 'V & number' has a combined constraint of
66395
+ // 'string & number | number & number' which reduces to just 'number'.
66396
+ // This also handles type parameters, as a type parameter with a union constraint compared against a union
66397
+ // needs to have its constraint hoisted into an intersection with said type parameter, this way
66398
+ // the type param can be compared with itself in the target (with the influence of its constraint to match other parts)
66399
+ // For example, if `T extends 1 | 2` and `U extends 2 | 3` and we compare `T & U` to `T & U & (1 | 2 | 3)`
66400
+ var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* Union */));
66401
+ if (constraint && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
66402
+ // TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this
66403
+ result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState);
66404
+ }
66405
+ }
66386
66406
  if (result) {
66387
66407
  resetErrorInfo(saveErrorInfo);
66388
66408
  }
@@ -66440,28 +66460,6 @@ var ts;
66440
66460
  if (result = unionOrIntersectionRelatedTo(source, target, reportErrors, intersectionState)) {
66441
66461
  return result;
66442
66462
  }
66443
- if (source.flags & 2097152 /* Intersection */ || source.flags & 262144 /* TypeParameter */ && target.flags & 1048576 /* Union */) {
66444
- // The combined constraint of an intersection type is the intersection of the constraints of
66445
- // the constituents. When an intersection type contains instantiable types with union type
66446
- // constraints, there are situations where we need to examine the combined constraint. One is
66447
- // when the target is a union type. Another is when the intersection contains types belonging
66448
- // to one of the disjoint domains. For example, given type variables T and U, each with the
66449
- // constraint 'string | number', the combined constraint of 'T & U' is 'string | number' and
66450
- // we need to check this constraint against a union on the target side. Also, given a type
66451
- // variable V constrained to 'string | number', 'V & number' has a combined constraint of
66452
- // 'string & number | number & number' which reduces to just 'number'.
66453
- // This also handles type parameters, as a type parameter with a union constraint compared against a union
66454
- // needs to have its constraint hoisted into an intersection with said type parameter, this way
66455
- // the type param can be compared with itself in the target (with the influence of its constraint to match other parts)
66456
- // For example, if `T extends 1 | 2` and `U extends 2 | 3` and we compare `T & U` to `T & U & (1 | 2 | 3)`
66457
- var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* Union */));
66458
- if (constraint && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
66459
- // TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this
66460
- if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
66461
- return result;
66462
- }
66463
- }
66464
- }
66465
66463
  // The ordered decomposition above doesn't handle all cases. Specifically, we also need to handle:
66466
66464
  // Source is instantiable (e.g. source has union or intersection constraint).
66467
66465
  // Source is an object, target is a union (e.g. { a, b: boolean } <=> { a, b: true } | { a, b: false }).
@@ -89,7 +89,7 @@ var ts;
89
89
  // The following is baselined as a literal template type without intervention
90
90
  /** The version of the TypeScript compiler release */
91
91
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
92
- ts.version = ts.versionMajorMinor + ".0-dev.20220802";
92
+ ts.version = ts.versionMajorMinor + ".0-dev.20220803";
93
93
  /* @internal */
94
94
  var Comparison;
95
95
  (function (Comparison) {
@@ -66178,6 +66178,26 @@ var ts;
66178
66178
  function structuredTypeRelatedTo(source, target, reportErrors, intersectionState) {
66179
66179
  var saveErrorInfo = captureErrorCalculationState();
66180
66180
  var result = structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo);
66181
+ if (!result && (source.flags & 2097152 /* Intersection */ || source.flags & 262144 /* TypeParameter */ && target.flags & 1048576 /* Union */)) {
66182
+ // The combined constraint of an intersection type is the intersection of the constraints of
66183
+ // the constituents. When an intersection type contains instantiable types with union type
66184
+ // constraints, there are situations where we need to examine the combined constraint. One is
66185
+ // when the target is a union type. Another is when the intersection contains types belonging
66186
+ // to one of the disjoint domains. For example, given type variables T and U, each with the
66187
+ // constraint 'string | number', the combined constraint of 'T & U' is 'string | number' and
66188
+ // we need to check this constraint against a union on the target side. Also, given a type
66189
+ // variable V constrained to 'string | number', 'V & number' has a combined constraint of
66190
+ // 'string & number | number & number' which reduces to just 'number'.
66191
+ // This also handles type parameters, as a type parameter with a union constraint compared against a union
66192
+ // needs to have its constraint hoisted into an intersection with said type parameter, this way
66193
+ // the type param can be compared with itself in the target (with the influence of its constraint to match other parts)
66194
+ // For example, if `T extends 1 | 2` and `U extends 2 | 3` and we compare `T & U` to `T & U & (1 | 2 | 3)`
66195
+ var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* Union */));
66196
+ if (constraint && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
66197
+ // TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this
66198
+ result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState);
66199
+ }
66200
+ }
66181
66201
  if (result) {
66182
66202
  resetErrorInfo(saveErrorInfo);
66183
66203
  }
@@ -66235,28 +66255,6 @@ var ts;
66235
66255
  if (result = unionOrIntersectionRelatedTo(source, target, reportErrors, intersectionState)) {
66236
66256
  return result;
66237
66257
  }
66238
- if (source.flags & 2097152 /* Intersection */ || source.flags & 262144 /* TypeParameter */ && target.flags & 1048576 /* Union */) {
66239
- // The combined constraint of an intersection type is the intersection of the constraints of
66240
- // the constituents. When an intersection type contains instantiable types with union type
66241
- // constraints, there are situations where we need to examine the combined constraint. One is
66242
- // when the target is a union type. Another is when the intersection contains types belonging
66243
- // to one of the disjoint domains. For example, given type variables T and U, each with the
66244
- // constraint 'string | number', the combined constraint of 'T & U' is 'string | number' and
66245
- // we need to check this constraint against a union on the target side. Also, given a type
66246
- // variable V constrained to 'string | number', 'V & number' has a combined constraint of
66247
- // 'string & number | number & number' which reduces to just 'number'.
66248
- // This also handles type parameters, as a type parameter with a union constraint compared against a union
66249
- // needs to have its constraint hoisted into an intersection with said type parameter, this way
66250
- // the type param can be compared with itself in the target (with the influence of its constraint to match other parts)
66251
- // For example, if `T extends 1 | 2` and `U extends 2 | 3` and we compare `T & U` to `T & U & (1 | 2 | 3)`
66252
- var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* Union */));
66253
- if (constraint && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
66254
- // TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this
66255
- if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
66256
- return result;
66257
- }
66258
- }
66259
- }
66260
66258
  // The ordered decomposition above doesn't handle all cases. Specifically, we also need to handle:
66261
66259
  // Source is instantiable (e.g. source has union or intersection constraint).
66262
66260
  // Source is an object, target is a union (e.g. { a, b: boolean } <=> { a, b: true } | { a, b: false }).
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": "4.8.0-dev.20220802",
5
+ "version": "4.8.0-dev.20220803",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [