typescript 4.8.0-dev.20220715 → 4.8.0-dev.20220718

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
@@ -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.20220715";
72
+ ts.version = ts.versionMajorMinor + ".0-dev.20220718";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  var globals = typeof globalThis !== "undefined" ? globalThis :
@@ -60158,16 +60158,23 @@ var ts;
60158
60158
  if (!assumeTrue) {
60159
60159
  return filterType(type, function (t) { return !isRelated(t, candidate); });
60160
60160
  }
60161
- if (type.flags & 1048576) {
60162
- var assignableType = filterType(type, function (t) { return isRelated(t, candidate); });
60163
- if (!(assignableType.flags & 131072)) {
60164
- return assignableType;
60165
- }
60161
+ if (type.flags & 3) {
60162
+ return candidate;
60166
60163
  }
60167
- return isTypeSubtypeOf(candidate, type) ? candidate :
60168
- isTypeAssignableTo(type, candidate) ? type :
60169
- isTypeAssignableTo(candidate, type) ? candidate :
60170
- getIntersectionType([type, candidate]);
60164
+ var keyPropertyName = type.flags & 1048576 ? getKeyPropertyName(type) : undefined;
60165
+ var narrowedType = mapType(candidate, function (c) {
60166
+ var discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
60167
+ var matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
60168
+ var directlyRelated = mapType(matching || type, function (t) { return isRelated(t, c) ? t : isRelated(c, t) ? c : neverType; });
60169
+ return directlyRelated.flags & 131072 ?
60170
+ mapType(type, function (t) { return maybeTypeOfKind(t, 465829888) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType; }) :
60171
+ directlyRelated;
60172
+ });
60173
+ return !(narrowedType.flags & 131072) ? narrowedType :
60174
+ isTypeSubtypeOf(candidate, type) ? candidate :
60175
+ isTypeAssignableTo(type, candidate) ? type :
60176
+ isTypeAssignableTo(candidate, type) ? candidate :
60177
+ getIntersectionType([type, candidate]);
60171
60178
  }
60172
60179
  function narrowTypeByCallExpression(type, callExpression, assumeTrue) {
60173
60180
  if (hasMatchingArgument(callExpression, reference)) {
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.20220715";
112
+ ts.version = ts.versionMajorMinor + ".0-dev.20220718";
113
113
  /* @internal */
114
114
  var Comparison;
115
115
  (function (Comparison) {
@@ -71916,23 +71916,32 @@ var ts;
71916
71916
  if (!assumeTrue) {
71917
71917
  return filterType(type, function (t) { return !isRelated(t, candidate); });
71918
71918
  }
71919
- // If the current type is a union type, remove all constituents that couldn't be instances of
71920
- // the candidate type. If one or more constituents remain, return a union of those.
71921
- if (type.flags & 1048576 /* Union */) {
71922
- var assignableType = filterType(type, function (t) { return isRelated(t, candidate); });
71923
- if (!(assignableType.flags & 131072 /* Never */)) {
71924
- return assignableType;
71925
- }
71926
- }
71927
- // If the candidate type is a subtype of the target type, narrow to the candidate type.
71928
- // Otherwise, if the target type is assignable to the candidate type, keep the target type.
71929
- // Otherwise, if the candidate type is assignable to the target type, narrow to the candidate
71930
- // type. Otherwise, the types are completely unrelated, so narrow to an intersection of the
71931
- // two types.
71932
- return isTypeSubtypeOf(candidate, type) ? candidate :
71933
- isTypeAssignableTo(type, candidate) ? type :
71934
- isTypeAssignableTo(candidate, type) ? candidate :
71935
- getIntersectionType([type, candidate]);
71919
+ if (type.flags & 3 /* AnyOrUnknown */) {
71920
+ return candidate;
71921
+ }
71922
+ // We first attempt to filter the current type, narrowing constituents as appropriate and removing
71923
+ // constituents that are unrelated to the candidate.
71924
+ var keyPropertyName = type.flags & 1048576 /* Union */ ? getKeyPropertyName(type) : undefined;
71925
+ var narrowedType = mapType(candidate, function (c) {
71926
+ // If a discriminant property is available, use that to reduce the type.
71927
+ var discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
71928
+ var matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
71929
+ // For each constituent t in the current type, if t and and c are directly related, pick the most
71930
+ // specific of the two.
71931
+ var directlyRelated = mapType(matching || type, function (t) { return isRelated(t, c) ? t : isRelated(c, t) ? c : neverType; });
71932
+ // If no constituents are directly related, create intersections for any generic constituents that
71933
+ // are related by constraint.
71934
+ return directlyRelated.flags & 131072 /* Never */ ?
71935
+ mapType(type, function (t) { return maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType; }) :
71936
+ directlyRelated;
71937
+ });
71938
+ // If filtering produced a non-empty type, return that. Otherwise, pick the most specific of the two
71939
+ // based on assignability, or as a last resort produce an intersection.
71940
+ return !(narrowedType.flags & 131072 /* Never */) ? narrowedType :
71941
+ isTypeSubtypeOf(candidate, type) ? candidate :
71942
+ isTypeAssignableTo(type, candidate) ? type :
71943
+ isTypeAssignableTo(candidate, type) ? candidate :
71944
+ getIntersectionType([type, candidate]);
71936
71945
  }
71937
71946
  function narrowTypeByCallExpression(type, callExpression, assumeTrue) {
71938
71947
  if (hasMatchingArgument(callExpression, reference)) {
@@ -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.20220715";
306
+ ts.version = ts.versionMajorMinor + ".0-dev.20220718";
307
307
  /* @internal */
308
308
  var Comparison;
309
309
  (function (Comparison) {
@@ -72110,23 +72110,32 @@ var ts;
72110
72110
  if (!assumeTrue) {
72111
72111
  return filterType(type, function (t) { return !isRelated(t, candidate); });
72112
72112
  }
72113
- // If the current type is a union type, remove all constituents that couldn't be instances of
72114
- // the candidate type. If one or more constituents remain, return a union of those.
72115
- if (type.flags & 1048576 /* Union */) {
72116
- var assignableType = filterType(type, function (t) { return isRelated(t, candidate); });
72117
- if (!(assignableType.flags & 131072 /* Never */)) {
72118
- return assignableType;
72119
- }
72120
- }
72121
- // If the candidate type is a subtype of the target type, narrow to the candidate type.
72122
- // Otherwise, if the target type is assignable to the candidate type, keep the target type.
72123
- // Otherwise, if the candidate type is assignable to the target type, narrow to the candidate
72124
- // type. Otherwise, the types are completely unrelated, so narrow to an intersection of the
72125
- // two types.
72126
- return isTypeSubtypeOf(candidate, type) ? candidate :
72127
- isTypeAssignableTo(type, candidate) ? type :
72128
- isTypeAssignableTo(candidate, type) ? candidate :
72129
- getIntersectionType([type, candidate]);
72113
+ if (type.flags & 3 /* AnyOrUnknown */) {
72114
+ return candidate;
72115
+ }
72116
+ // We first attempt to filter the current type, narrowing constituents as appropriate and removing
72117
+ // constituents that are unrelated to the candidate.
72118
+ var keyPropertyName = type.flags & 1048576 /* Union */ ? getKeyPropertyName(type) : undefined;
72119
+ var narrowedType = mapType(candidate, function (c) {
72120
+ // If a discriminant property is available, use that to reduce the type.
72121
+ var discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
72122
+ var matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
72123
+ // For each constituent t in the current type, if t and and c are directly related, pick the most
72124
+ // specific of the two.
72125
+ var directlyRelated = mapType(matching || type, function (t) { return isRelated(t, c) ? t : isRelated(c, t) ? c : neverType; });
72126
+ // If no constituents are directly related, create intersections for any generic constituents that
72127
+ // are related by constraint.
72128
+ return directlyRelated.flags & 131072 /* Never */ ?
72129
+ mapType(type, function (t) { return maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType; }) :
72130
+ directlyRelated;
72131
+ });
72132
+ // If filtering produced a non-empty type, return that. Otherwise, pick the most specific of the two
72133
+ // based on assignability, or as a last resort produce an intersection.
72134
+ return !(narrowedType.flags & 131072 /* Never */) ? narrowedType :
72135
+ isTypeSubtypeOf(candidate, type) ? candidate :
72136
+ isTypeAssignableTo(type, candidate) ? type :
72137
+ isTypeAssignableTo(candidate, type) ? candidate :
72138
+ getIntersectionType([type, candidate]);
72130
72139
  }
72131
72140
  function narrowTypeByCallExpression(type, callExpression, assumeTrue) {
72132
72141
  if (hasMatchingArgument(callExpression, reference)) {
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.20220715";
297
+ ts.version = ts.versionMajorMinor + ".0-dev.20220718";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -72101,23 +72101,32 @@ var ts;
72101
72101
  if (!assumeTrue) {
72102
72102
  return filterType(type, function (t) { return !isRelated(t, candidate); });
72103
72103
  }
72104
- // If the current type is a union type, remove all constituents that couldn't be instances of
72105
- // the candidate type. If one or more constituents remain, return a union of those.
72106
- if (type.flags & 1048576 /* Union */) {
72107
- var assignableType = filterType(type, function (t) { return isRelated(t, candidate); });
72108
- if (!(assignableType.flags & 131072 /* Never */)) {
72109
- return assignableType;
72110
- }
72111
- }
72112
- // If the candidate type is a subtype of the target type, narrow to the candidate type.
72113
- // Otherwise, if the target type is assignable to the candidate type, keep the target type.
72114
- // Otherwise, if the candidate type is assignable to the target type, narrow to the candidate
72115
- // type. Otherwise, the types are completely unrelated, so narrow to an intersection of the
72116
- // two types.
72117
- return isTypeSubtypeOf(candidate, type) ? candidate :
72118
- isTypeAssignableTo(type, candidate) ? type :
72119
- isTypeAssignableTo(candidate, type) ? candidate :
72120
- getIntersectionType([type, candidate]);
72104
+ if (type.flags & 3 /* AnyOrUnknown */) {
72105
+ return candidate;
72106
+ }
72107
+ // We first attempt to filter the current type, narrowing constituents as appropriate and removing
72108
+ // constituents that are unrelated to the candidate.
72109
+ var keyPropertyName = type.flags & 1048576 /* Union */ ? getKeyPropertyName(type) : undefined;
72110
+ var narrowedType = mapType(candidate, function (c) {
72111
+ // If a discriminant property is available, use that to reduce the type.
72112
+ var discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
72113
+ var matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
72114
+ // For each constituent t in the current type, if t and and c are directly related, pick the most
72115
+ // specific of the two.
72116
+ var directlyRelated = mapType(matching || type, function (t) { return isRelated(t, c) ? t : isRelated(c, t) ? c : neverType; });
72117
+ // If no constituents are directly related, create intersections for any generic constituents that
72118
+ // are related by constraint.
72119
+ return directlyRelated.flags & 131072 /* Never */ ?
72120
+ mapType(type, function (t) { return maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType; }) :
72121
+ directlyRelated;
72122
+ });
72123
+ // If filtering produced a non-empty type, return that. Otherwise, pick the most specific of the two
72124
+ // based on assignability, or as a last resort produce an intersection.
72125
+ return !(narrowedType.flags & 131072 /* Never */) ? narrowedType :
72126
+ isTypeSubtypeOf(candidate, type) ? candidate :
72127
+ isTypeAssignableTo(type, candidate) ? type :
72128
+ isTypeAssignableTo(candidate, type) ? candidate :
72129
+ getIntersectionType([type, candidate]);
72121
72130
  }
72122
72131
  function narrowTypeByCallExpression(type, callExpression, assumeTrue) {
72123
72132
  if (hasMatchingArgument(callExpression, reference)) {
@@ -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.20220715";
297
+ ts.version = ts.versionMajorMinor + ".0-dev.20220718";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -72101,23 +72101,32 @@ var ts;
72101
72101
  if (!assumeTrue) {
72102
72102
  return filterType(type, function (t) { return !isRelated(t, candidate); });
72103
72103
  }
72104
- // If the current type is a union type, remove all constituents that couldn't be instances of
72105
- // the candidate type. If one or more constituents remain, return a union of those.
72106
- if (type.flags & 1048576 /* Union */) {
72107
- var assignableType = filterType(type, function (t) { return isRelated(t, candidate); });
72108
- if (!(assignableType.flags & 131072 /* Never */)) {
72109
- return assignableType;
72110
- }
72111
- }
72112
- // If the candidate type is a subtype of the target type, narrow to the candidate type.
72113
- // Otherwise, if the target type is assignable to the candidate type, keep the target type.
72114
- // Otherwise, if the candidate type is assignable to the target type, narrow to the candidate
72115
- // type. Otherwise, the types are completely unrelated, so narrow to an intersection of the
72116
- // two types.
72117
- return isTypeSubtypeOf(candidate, type) ? candidate :
72118
- isTypeAssignableTo(type, candidate) ? type :
72119
- isTypeAssignableTo(candidate, type) ? candidate :
72120
- getIntersectionType([type, candidate]);
72104
+ if (type.flags & 3 /* AnyOrUnknown */) {
72105
+ return candidate;
72106
+ }
72107
+ // We first attempt to filter the current type, narrowing constituents as appropriate and removing
72108
+ // constituents that are unrelated to the candidate.
72109
+ var keyPropertyName = type.flags & 1048576 /* Union */ ? getKeyPropertyName(type) : undefined;
72110
+ var narrowedType = mapType(candidate, function (c) {
72111
+ // If a discriminant property is available, use that to reduce the type.
72112
+ var discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
72113
+ var matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
72114
+ // For each constituent t in the current type, if t and and c are directly related, pick the most
72115
+ // specific of the two.
72116
+ var directlyRelated = mapType(matching || type, function (t) { return isRelated(t, c) ? t : isRelated(c, t) ? c : neverType; });
72117
+ // If no constituents are directly related, create intersections for any generic constituents that
72118
+ // are related by constraint.
72119
+ return directlyRelated.flags & 131072 /* Never */ ?
72120
+ mapType(type, function (t) { return maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType; }) :
72121
+ directlyRelated;
72122
+ });
72123
+ // If filtering produced a non-empty type, return that. Otherwise, pick the most specific of the two
72124
+ // based on assignability, or as a last resort produce an intersection.
72125
+ return !(narrowedType.flags & 131072 /* Never */) ? narrowedType :
72126
+ isTypeSubtypeOf(candidate, type) ? candidate :
72127
+ isTypeAssignableTo(type, candidate) ? type :
72128
+ isTypeAssignableTo(candidate, type) ? candidate :
72129
+ getIntersectionType([type, candidate]);
72121
72130
  }
72122
72131
  function narrowTypeByCallExpression(type, callExpression, assumeTrue) {
72123
72132
  if (hasMatchingArgument(callExpression, reference)) {
@@ -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.20220715";
92
+ ts.version = ts.versionMajorMinor + ".0-dev.20220718";
93
93
  /* @internal */
94
94
  var Comparison;
95
95
  (function (Comparison) {
@@ -71896,23 +71896,32 @@ var ts;
71896
71896
  if (!assumeTrue) {
71897
71897
  return filterType(type, function (t) { return !isRelated(t, candidate); });
71898
71898
  }
71899
- // If the current type is a union type, remove all constituents that couldn't be instances of
71900
- // the candidate type. If one or more constituents remain, return a union of those.
71901
- if (type.flags & 1048576 /* Union */) {
71902
- var assignableType = filterType(type, function (t) { return isRelated(t, candidate); });
71903
- if (!(assignableType.flags & 131072 /* Never */)) {
71904
- return assignableType;
71905
- }
71906
- }
71907
- // If the candidate type is a subtype of the target type, narrow to the candidate type.
71908
- // Otherwise, if the target type is assignable to the candidate type, keep the target type.
71909
- // Otherwise, if the candidate type is assignable to the target type, narrow to the candidate
71910
- // type. Otherwise, the types are completely unrelated, so narrow to an intersection of the
71911
- // two types.
71912
- return isTypeSubtypeOf(candidate, type) ? candidate :
71913
- isTypeAssignableTo(type, candidate) ? type :
71914
- isTypeAssignableTo(candidate, type) ? candidate :
71915
- getIntersectionType([type, candidate]);
71899
+ if (type.flags & 3 /* AnyOrUnknown */) {
71900
+ return candidate;
71901
+ }
71902
+ // We first attempt to filter the current type, narrowing constituents as appropriate and removing
71903
+ // constituents that are unrelated to the candidate.
71904
+ var keyPropertyName = type.flags & 1048576 /* Union */ ? getKeyPropertyName(type) : undefined;
71905
+ var narrowedType = mapType(candidate, function (c) {
71906
+ // If a discriminant property is available, use that to reduce the type.
71907
+ var discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
71908
+ var matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
71909
+ // For each constituent t in the current type, if t and and c are directly related, pick the most
71910
+ // specific of the two.
71911
+ var directlyRelated = mapType(matching || type, function (t) { return isRelated(t, c) ? t : isRelated(c, t) ? c : neverType; });
71912
+ // If no constituents are directly related, create intersections for any generic constituents that
71913
+ // are related by constraint.
71914
+ return directlyRelated.flags & 131072 /* Never */ ?
71915
+ mapType(type, function (t) { return maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType; }) :
71916
+ directlyRelated;
71917
+ });
71918
+ // If filtering produced a non-empty type, return that. Otherwise, pick the most specific of the two
71919
+ // based on assignability, or as a last resort produce an intersection.
71920
+ return !(narrowedType.flags & 131072 /* Never */) ? narrowedType :
71921
+ isTypeSubtypeOf(candidate, type) ? candidate :
71922
+ isTypeAssignableTo(type, candidate) ? type :
71923
+ isTypeAssignableTo(candidate, type) ? candidate :
71924
+ getIntersectionType([type, candidate]);
71916
71925
  }
71917
71926
  function narrowTypeByCallExpression(type, callExpression, assumeTrue) {
71918
71927
  if (hasMatchingArgument(callExpression, reference)) {
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.20220715",
5
+ "version": "4.8.0-dev.20220718",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [