@typescript-deploys/pr-build 5.3.0-pr-54960-22 → 5.3.0-pr-55459-3

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.3";
21
- var version = `${versionMajorMinor}.0-insiders.20230821`;
21
+ var version = `${versionMajorMinor}.0-insiders.20230822`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -51412,7 +51412,7 @@ function createTypeChecker(host) {
51412
51412
  const pattern = declaration.parent;
51413
51413
  if (strictNullChecks && declaration.flags & 33554432 /* Ambient */ && isParameterDeclaration(declaration)) {
51414
51414
  parentType = getNonNullableType(parentType);
51415
- } else if (strictNullChecks && pattern.parent.initializer && !(getTypeFacts(getTypeOfInitializer(pattern.parent.initializer)) & 65536 /* EQUndefined */)) {
51415
+ } else if (strictNullChecks && pattern.parent.initializer && !hasTypeFacts(getTypeOfInitializer(pattern.parent.initializer), 65536 /* EQUndefined */)) {
51416
51416
  parentType = getTypeWithFacts(parentType, 524288 /* NEUndefined */);
51417
51417
  }
51418
51418
  let type;
@@ -51455,7 +51455,7 @@ function createTypeChecker(host) {
51455
51455
  return type;
51456
51456
  }
51457
51457
  if (getEffectiveTypeAnnotationNode(walkUpBindingElementsAndPatterns(declaration))) {
51458
- return strictNullChecks && !(getTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 16777216 /* IsUndefined */) ? getNonUndefinedType(type) : type;
51458
+ return strictNullChecks && !hasTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */), 16777216 /* IsUndefined */) ? getNonUndefinedType(type) : type;
51459
51459
  }
51460
51460
  return widenTypeInferredFromInitializer(declaration, getUnionType([getNonUndefinedType(type), checkDeclarationInitializer(declaration, 0 /* Normal */)], 2 /* Subtype */));
51461
51461
  }
@@ -59563,7 +59563,7 @@ function createTypeChecker(host) {
59563
59563
  if (sourceType && targetType) {
59564
59564
  const sourceSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
59565
59565
  const targetSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(targetType));
59566
- const callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) && (getTypeFacts(sourceType) & 50331648 /* IsUndefinedOrNull */) === (getTypeFacts(targetType) & 50331648 /* IsUndefinedOrNull */);
59566
+ const callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) && getOnlyTypeFacts(sourceType, 50331648 /* IsUndefinedOrNull */) === getOnlyTypeFacts(targetType, 50331648 /* IsUndefinedOrNull */);
59567
59567
  let related = callbacks ? compareSignaturesRelated(targetSig, sourceSig, checkMode & 8 /* StrictArity */ | (strictVariance ? 2 /* StrictCallback */ : 1 /* BivariantCallback */), reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) : !(checkMode & 3 /* Callback */) && !strictVariance && compareTypes(
59568
59568
  sourceType,
59569
59569
  targetType,
@@ -62720,7 +62720,7 @@ function createTypeChecker(host) {
62720
62720
  return value.base10Value === "0";
62721
62721
  }
62722
62722
  function removeDefinitelyFalsyTypes(type) {
62723
- return filterType(type, (t) => !!(getTypeFacts(t) & 4194304 /* Truthy */));
62723
+ return filterType(type, (t) => hasTypeFacts(t, 4194304 /* Truthy */));
62724
62724
  }
62725
62725
  function extractDefinitelyFalsyTypes(type) {
62726
62726
  return mapType(type, getDefinitelyFalsyPartOfType);
@@ -64463,7 +64463,13 @@ function createTypeChecker(host) {
64463
64463
  const resolved = resolveStructuredTypeMembers(type);
64464
64464
  return !!(resolved.callSignatures.length || resolved.constructSignatures.length || resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType));
64465
64465
  }
64466
- function getTypeFacts(type) {
64466
+ function getOnlyTypeFacts(type, mask) {
64467
+ return getTypeFactsWorker(type, mask) & mask;
64468
+ }
64469
+ function hasTypeFacts(type, mask) {
64470
+ return getOnlyTypeFacts(type, mask) !== 0;
64471
+ }
64472
+ function getTypeFactsWorker(type, callerOnlyNeeds) {
64467
64473
  if (type.flags & (2097152 /* Intersection */ | 465829888 /* Instantiable */)) {
64468
64474
  type = getBaseConstraintOfType(type) || unknownType;
64469
64475
  }
@@ -64496,6 +64502,10 @@ function createTypeChecker(host) {
64496
64502
  return strictNullChecks ? type === falseType || type === regularFalseType ? 12121864 /* FalseStrictFacts */ : 7927560 /* TrueStrictFacts */ : type === falseType || type === regularFalseType ? 12580616 /* FalseFacts */ : 16774920 /* TrueFacts */;
64497
64503
  }
64498
64504
  if (flags & 524288 /* Object */) {
64505
+ const possibleFacts = strictNullChecks ? 83427327 /* EmptyObjectStrictFacts */ | 7880640 /* FunctionStrictFacts */ | 7888800 /* ObjectStrictFacts */ : 83886079 /* EmptyObjectFacts */ | 16728e3 /* FunctionFacts */ | 16736160 /* ObjectFacts */;
64506
+ if ((callerOnlyNeeds & possibleFacts) === 0) {
64507
+ return 0;
64508
+ }
64499
64509
  return getObjectFlags(type) & 16 /* Anonymous */ && isEmptyObjectType(type) ? strictNullChecks ? 83427327 /* EmptyObjectStrictFacts */ : 83886079 /* EmptyObjectFacts */ : isFunctionObjectType(type) ? strictNullChecks ? 7880640 /* FunctionStrictFacts */ : 16728e3 /* FunctionFacts */ : strictNullChecks ? 7888800 /* ObjectStrictFacts */ : 16736160 /* ObjectFacts */;
64500
64510
  }
64501
64511
  if (flags & 16384 /* Void */) {
@@ -64517,20 +64527,20 @@ function createTypeChecker(host) {
64517
64527
  return 0 /* None */;
64518
64528
  }
64519
64529
  if (flags & 1048576 /* Union */) {
64520
- return reduceLeft(type.types, (facts, t) => facts | getTypeFacts(t), 0 /* None */);
64530
+ return reduceLeft(type.types, (facts, t) => facts | getTypeFactsWorker(t, callerOnlyNeeds), 0 /* None */);
64521
64531
  }
64522
64532
  if (flags & 2097152 /* Intersection */) {
64523
- return getIntersectionTypeFacts(type);
64533
+ return getIntersectionTypeFacts(type, callerOnlyNeeds);
64524
64534
  }
64525
64535
  return 83886079 /* UnknownFacts */;
64526
64536
  }
64527
- function getIntersectionTypeFacts(type) {
64537
+ function getIntersectionTypeFacts(type, callerOnlyNeeds) {
64528
64538
  const ignoreObjects = maybeTypeOfKind(type, 402784252 /* Primitive */);
64529
64539
  let oredFacts = 0 /* None */;
64530
64540
  let andedFacts = 134217727 /* All */;
64531
64541
  for (const t of type.types) {
64532
64542
  if (!(ignoreObjects && t.flags & 524288 /* Object */)) {
64533
- const f = getTypeFacts(t);
64543
+ const f = getTypeFactsWorker(t, callerOnlyNeeds);
64534
64544
  oredFacts |= f;
64535
64545
  andedFacts &= f;
64536
64546
  }
@@ -64538,19 +64548,19 @@ function createTypeChecker(host) {
64538
64548
  return oredFacts & 8256 /* OrFactsMask */ | andedFacts & 134209471 /* AndFactsMask */;
64539
64549
  }
64540
64550
  function getTypeWithFacts(type, include) {
64541
- return filterType(type, (t) => (getTypeFacts(t) & include) !== 0);
64551
+ return filterType(type, (t) => hasTypeFacts(t, include));
64542
64552
  }
64543
64553
  function getAdjustedTypeWithFacts(type, facts) {
64544
64554
  const reduced = recombineUnknownType(getTypeWithFacts(strictNullChecks && type.flags & 2 /* Unknown */ ? unknownUnionType : type, facts));
64545
64555
  if (strictNullChecks) {
64546
64556
  switch (facts) {
64547
64557
  case 524288 /* NEUndefined */:
64548
- return mapType(reduced, (t) => getTypeFacts(t) & 65536 /* EQUndefined */ ? getIntersectionType([t, getTypeFacts(t) & 131072 /* EQNull */ && !maybeTypeOfKind(reduced, 65536 /* Null */) ? getUnionType([emptyObjectType, nullType]) : emptyObjectType]) : t);
64558
+ return mapType(reduced, (t) => hasTypeFacts(t, 65536 /* EQUndefined */) ? getIntersectionType([t, hasTypeFacts(t, 131072 /* EQNull */) && !maybeTypeOfKind(reduced, 65536 /* Null */) ? getUnionType([emptyObjectType, nullType]) : emptyObjectType]) : t);
64549
64559
  case 1048576 /* NENull */:
64550
- return mapType(reduced, (t) => getTypeFacts(t) & 131072 /* EQNull */ ? getIntersectionType([t, getTypeFacts(t) & 65536 /* EQUndefined */ && !maybeTypeOfKind(reduced, 32768 /* Undefined */) ? getUnionType([emptyObjectType, undefinedType]) : emptyObjectType]) : t);
64560
+ return mapType(reduced, (t) => hasTypeFacts(t, 131072 /* EQNull */) ? getIntersectionType([t, hasTypeFacts(t, 65536 /* EQUndefined */) && !maybeTypeOfKind(reduced, 32768 /* Undefined */) ? getUnionType([emptyObjectType, undefinedType]) : emptyObjectType]) : t);
64551
64561
  case 2097152 /* NEUndefinedOrNull */:
64552
64562
  case 4194304 /* Truthy */:
64553
- return mapType(reduced, (t) => getTypeFacts(t) & 262144 /* EQUndefinedOrNull */ ? getGlobalNonNullableTypeInstantiation(t) : t);
64563
+ return mapType(reduced, (t) => hasTypeFacts(t, 262144 /* EQUndefinedOrNull */) ? getGlobalNonNullableTypeInstantiation(t) : t);
64554
64564
  }
64555
64565
  }
64556
64566
  return reduced;
@@ -65887,14 +65897,14 @@ function createTypeChecker(host) {
65887
65897
  // the constituent based on its type facts. We use the strict subtype relation because it treats `object`
65888
65898
  // as a subtype of `{}`, and we need the type facts check because function types are subtypes of `object`,
65889
65899
  // but are classified as "function" according to `typeof`.
65890
- isTypeRelatedTo(t, impliedType, strictSubtypeRelation) ? getTypeFacts(t) & facts ? t : neverType : (
65900
+ isTypeRelatedTo(t, impliedType, strictSubtypeRelation) ? hasTypeFacts(t, facts) ? t : neverType : (
65891
65901
  // We next check if the consituent is a supertype of the implied type. If so, we substitute the implied
65892
65902
  // type. This handles top types like `unknown` and `{}`, and supertypes like `{ toString(): string }`.
65893
65903
  isTypeSubtypeOf(impliedType, t) ? impliedType : (
65894
65904
  // Neither the constituent nor the implied type is a subtype of the other, however their domains may still
65895
65905
  // overlap. For example, an unconstrained type parameter and type `string`. If the type facts indicate
65896
65906
  // possible overlap, we form an intersection. Otherwise, we eliminate the constituent.
65897
- getTypeFacts(t) & facts ? getIntersectionType([t, impliedType]) : neverType
65907
+ hasTypeFacts(t, facts) ? getIntersectionType([t, impliedType]) : neverType
65898
65908
  )
65899
65909
  )
65900
65910
  ));
@@ -65908,7 +65918,7 @@ function createTypeChecker(host) {
65908
65918
  const hasDefaultClause = clauseStart === clauseEnd || defaultIndex >= clauseStart && defaultIndex < clauseEnd;
65909
65919
  if (hasDefaultClause) {
65910
65920
  const notEqualFacts = getNotEqualFactsFromTypeofSwitch(clauseStart, clauseEnd, witnesses);
65911
- return filterType(type, (t) => (getTypeFacts(t) & notEqualFacts) === notEqualFacts);
65921
+ return filterType(type, (t) => getOnlyTypeFacts(t, notEqualFacts) === notEqualFacts);
65912
65922
  }
65913
65923
  const clauseWitnesses = witnesses.slice(clauseStart, clauseEnd);
65914
65924
  return getUnionType(map(clauseWitnesses, (text) => text ? narrowTypeByTypeName(type, text) : neverType));
@@ -66046,7 +66056,7 @@ function createTypeChecker(host) {
66046
66056
  false
66047
66057
  );
66048
66058
  }
66049
- if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) && !(getTypeFacts(predicate.type) & 65536 /* EQUndefined */)) {
66059
+ if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) && !hasTypeFacts(predicate.type, 65536 /* EQUndefined */)) {
66050
66060
  type = getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
66051
66061
  }
66052
66062
  const access = getDiscriminantPropertyAccess(predicateArgument, type);
@@ -66180,7 +66190,7 @@ function createTypeChecker(host) {
66180
66190
  reportCircularityError(declaration.symbol);
66181
66191
  return true;
66182
66192
  }
66183
- const containsUndefined = !!(getTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 16777216 /* IsUndefined */);
66193
+ const containsUndefined = !!hasTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */), 16777216 /* IsUndefined */);
66184
66194
  if (!popTypeResolution()) {
66185
66195
  reportCircularityError(declaration.symbol);
66186
66196
  return true;
@@ -66190,7 +66200,7 @@ function createTypeChecker(host) {
66190
66200
  return links.parameterInitializerContainsUndefined;
66191
66201
  }
66192
66202
  function removeOptionalityFromDeclaredType(declaredType, declaration) {
66193
- const removeUndefined = strictNullChecks && declaration.kind === 169 /* Parameter */ && declaration.initializer && getTypeFacts(declaredType) & 16777216 /* IsUndefined */ && !parameterInitializerContainsUndefined(declaration);
66203
+ const removeUndefined = strictNullChecks && declaration.kind === 169 /* Parameter */ && declaration.initializer && hasTypeFacts(declaredType, 16777216 /* IsUndefined */) && !parameterInitializerContainsUndefined(declaration);
66194
66204
  return removeUndefined ? getTypeWithFacts(declaredType, 524288 /* NEUndefined */) : declaredType;
66195
66205
  }
66196
66206
  function isConstraintPosition(type, node) {
@@ -69020,7 +69030,7 @@ function createTypeChecker(host) {
69020
69030
  return checkNonNullType(checkExpression(node), node);
69021
69031
  }
69022
69032
  function isNullableType(type) {
69023
- return !!(getTypeFacts(type) & 50331648 /* IsUndefinedOrNull */);
69033
+ return hasTypeFacts(type, 50331648 /* IsUndefinedOrNull */);
69024
69034
  }
69025
69035
  function getNonNullableTypeIfNeeded(type) {
69026
69036
  return isNullableType(type) ? getNonNullableType(type) : type;
@@ -69066,7 +69076,7 @@ function createTypeChecker(host) {
69066
69076
  error(node, Diagnostics.Object_is_of_type_unknown);
69067
69077
  return errorType;
69068
69078
  }
69069
- const facts = getTypeFacts(type);
69079
+ const facts = getOnlyTypeFacts(type, 50331648 /* IsUndefinedOrNull */);
69070
69080
  if (facts & 50331648 /* IsUndefinedOrNull */) {
69071
69081
  reportError(node, facts);
69072
69082
  const t = getNonNullableType(type);
@@ -72846,7 +72856,7 @@ function createTypeChecker(host) {
72846
72856
  if (operandConstraint.flags & 3 /* AnyOrUnknown */) {
72847
72857
  return (556800 /* AllTypeofNE */ & notEqualFacts) === 556800 /* AllTypeofNE */;
72848
72858
  }
72849
- return !someType(operandConstraint, (t) => (getTypeFacts(t) & notEqualFacts) === notEqualFacts);
72859
+ return !someType(operandConstraint, (t) => getOnlyTypeFacts(t, notEqualFacts) === notEqualFacts);
72850
72860
  }
72851
72861
  const type = checkExpressionCached(node.expression);
72852
72862
  if (!isLiteralType(type)) {
@@ -73171,7 +73181,7 @@ function createTypeChecker(host) {
73171
73181
  }
73172
73182
  function checkDeleteExpressionMustBeOptional(expr, symbol) {
73173
73183
  const type = getTypeOfSymbol(symbol);
73174
- if (strictNullChecks && !(type.flags & (3 /* AnyOrUnknown */ | 131072 /* Never */)) && !(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ : getTypeFacts(type) & 16777216 /* IsUndefined */)) {
73184
+ if (strictNullChecks && !(type.flags & (3 /* AnyOrUnknown */ | 131072 /* Never */)) && !(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ : hasTypeFacts(type, 16777216 /* IsUndefined */))) {
73175
73185
  error(expr, Diagnostics.The_operand_of_a_delete_operator_must_be_optional);
73176
73186
  }
73177
73187
  }
@@ -73306,7 +73316,7 @@ function createTypeChecker(host) {
73306
73316
  return getUnaryResultType(operandType);
73307
73317
  case 54 /* ExclamationToken */:
73308
73318
  checkTruthinessOfType(operandType, node.operand);
73309
- const facts = getTypeFacts(operandType) & (4194304 /* Truthy */ | 8388608 /* Falsy */);
73319
+ const facts = getOnlyTypeFacts(operandType, 4194304 /* Truthy */ | 8388608 /* Falsy */);
73310
73320
  return facts === 4194304 /* Truthy */ ? falseType : facts === 8388608 /* Falsy */ ? trueType : booleanType;
73311
73321
  case 46 /* PlusPlusToken */:
73312
73322
  case 47 /* MinusMinusToken */:
@@ -73537,7 +73547,7 @@ function createTypeChecker(host) {
73537
73547
  if (exprOrAssignment.kind === 304 /* ShorthandPropertyAssignment */) {
73538
73548
  const prop = exprOrAssignment;
73539
73549
  if (prop.objectAssignmentInitializer) {
73540
- if (strictNullChecks && !(getTypeFacts(checkExpression(prop.objectAssignmentInitializer)) & 16777216 /* IsUndefined */)) {
73550
+ if (strictNullChecks && !hasTypeFacts(checkExpression(prop.objectAssignmentInitializer), 16777216 /* IsUndefined */)) {
73541
73551
  sourceType = getTypeWithFacts(sourceType, 524288 /* NEUndefined */);
73542
73552
  }
73543
73553
  checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, checkMode);
@@ -73949,7 +73959,7 @@ function createTypeChecker(host) {
73949
73959
  return checkInExpression(left, right, leftType, rightType);
73950
73960
  case 56 /* AmpersandAmpersandToken */:
73951
73961
  case 77 /* AmpersandAmpersandEqualsToken */: {
73952
- const resultType2 = getTypeFacts(leftType) & 4194304 /* Truthy */ ? getUnionType([extractDefinitelyFalsyTypes(strictNullChecks ? leftType : getBaseTypeOfLiteralType(rightType)), rightType]) : leftType;
73962
+ const resultType2 = hasTypeFacts(leftType, 4194304 /* Truthy */) ? getUnionType([extractDefinitelyFalsyTypes(strictNullChecks ? leftType : getBaseTypeOfLiteralType(rightType)), rightType]) : leftType;
73953
73963
  if (operator === 77 /* AmpersandAmpersandEqualsToken */) {
73954
73964
  checkAssignmentOperator(rightType);
73955
73965
  }
@@ -73957,7 +73967,7 @@ function createTypeChecker(host) {
73957
73967
  }
73958
73968
  case 57 /* BarBarToken */:
73959
73969
  case 76 /* BarBarEqualsToken */: {
73960
- const resultType2 = getTypeFacts(leftType) & 8388608 /* Falsy */ ? getUnionType([getNonNullableType(removeDefinitelyFalsyTypes(leftType)), rightType], 2 /* Subtype */) : leftType;
73970
+ const resultType2 = hasTypeFacts(leftType, 8388608 /* Falsy */) ? getUnionType([getNonNullableType(removeDefinitelyFalsyTypes(leftType)), rightType], 2 /* Subtype */) : leftType;
73961
73971
  if (operator === 76 /* BarBarEqualsToken */) {
73962
73972
  checkAssignmentOperator(rightType);
73963
73973
  }
@@ -73965,7 +73975,7 @@ function createTypeChecker(host) {
73965
73975
  }
73966
73976
  case 61 /* QuestionQuestionToken */:
73967
73977
  case 78 /* QuestionQuestionEqualsToken */: {
73968
- const resultType2 = getTypeFacts(leftType) & 262144 /* EQUndefinedOrNull */ ? getUnionType([getNonNullableType(leftType), rightType], 2 /* Subtype */) : leftType;
73978
+ const resultType2 = hasTypeFacts(leftType, 262144 /* EQUndefinedOrNull */) ? getUnionType([getNonNullableType(leftType), rightType], 2 /* Subtype */) : leftType;
73969
73979
  if (operator === 78 /* QuestionQuestionEqualsToken */) {
73970
73980
  checkAssignmentOperator(rightType);
73971
73981
  }
@@ -77282,7 +77292,7 @@ function createTypeChecker(host) {
77282
77292
  }
77283
77293
  const type = location === condExpr2 ? condType : checkTruthinessExpression(location);
77284
77294
  const isPropertyExpressionCast = isPropertyAccessExpression(location) && isTypeAssertion(location.expression);
77285
- if (!(getTypeFacts(type) & 4194304 /* Truthy */) || isPropertyExpressionCast)
77295
+ if (!hasTypeFacts(type, 4194304 /* Truthy */) || isPropertyExpressionCast)
77286
77296
  return;
77287
77297
  const callSignatures = getSignaturesOfType(type, 0 /* Call */);
77288
77298
  const isPromise = !!getAwaitedTypeOfPromise(type);
package/lib/tsserver.js CHANGED
@@ -2333,7 +2333,7 @@ module.exports = __toCommonJS(server_exports);
2333
2333
 
2334
2334
  // src/compiler/corePublic.ts
2335
2335
  var versionMajorMinor = "5.3";
2336
- var version = `${versionMajorMinor}.0-insiders.20230821`;
2336
+ var version = `${versionMajorMinor}.0-insiders.20230822`;
2337
2337
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2338
2338
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2339
2339
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -56120,7 +56120,7 @@ function createTypeChecker(host) {
56120
56120
  const pattern = declaration.parent;
56121
56121
  if (strictNullChecks && declaration.flags & 33554432 /* Ambient */ && isParameterDeclaration(declaration)) {
56122
56122
  parentType = getNonNullableType(parentType);
56123
- } else if (strictNullChecks && pattern.parent.initializer && !(getTypeFacts(getTypeOfInitializer(pattern.parent.initializer)) & 65536 /* EQUndefined */)) {
56123
+ } else if (strictNullChecks && pattern.parent.initializer && !hasTypeFacts(getTypeOfInitializer(pattern.parent.initializer), 65536 /* EQUndefined */)) {
56124
56124
  parentType = getTypeWithFacts(parentType, 524288 /* NEUndefined */);
56125
56125
  }
56126
56126
  let type;
@@ -56163,7 +56163,7 @@ function createTypeChecker(host) {
56163
56163
  return type;
56164
56164
  }
56165
56165
  if (getEffectiveTypeAnnotationNode(walkUpBindingElementsAndPatterns(declaration))) {
56166
- return strictNullChecks && !(getTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 16777216 /* IsUndefined */) ? getNonUndefinedType(type) : type;
56166
+ return strictNullChecks && !hasTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */), 16777216 /* IsUndefined */) ? getNonUndefinedType(type) : type;
56167
56167
  }
56168
56168
  return widenTypeInferredFromInitializer(declaration, getUnionType([getNonUndefinedType(type), checkDeclarationInitializer(declaration, 0 /* Normal */)], 2 /* Subtype */));
56169
56169
  }
@@ -64271,7 +64271,7 @@ function createTypeChecker(host) {
64271
64271
  if (sourceType && targetType) {
64272
64272
  const sourceSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
64273
64273
  const targetSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(targetType));
64274
- const callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) && (getTypeFacts(sourceType) & 50331648 /* IsUndefinedOrNull */) === (getTypeFacts(targetType) & 50331648 /* IsUndefinedOrNull */);
64274
+ const callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) && getOnlyTypeFacts(sourceType, 50331648 /* IsUndefinedOrNull */) === getOnlyTypeFacts(targetType, 50331648 /* IsUndefinedOrNull */);
64275
64275
  let related = callbacks ? compareSignaturesRelated(targetSig, sourceSig, checkMode & 8 /* StrictArity */ | (strictVariance ? 2 /* StrictCallback */ : 1 /* BivariantCallback */), reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) : !(checkMode & 3 /* Callback */) && !strictVariance && compareTypes(
64276
64276
  sourceType,
64277
64277
  targetType,
@@ -67428,7 +67428,7 @@ function createTypeChecker(host) {
67428
67428
  return value.base10Value === "0";
67429
67429
  }
67430
67430
  function removeDefinitelyFalsyTypes(type) {
67431
- return filterType(type, (t) => !!(getTypeFacts(t) & 4194304 /* Truthy */));
67431
+ return filterType(type, (t) => hasTypeFacts(t, 4194304 /* Truthy */));
67432
67432
  }
67433
67433
  function extractDefinitelyFalsyTypes(type) {
67434
67434
  return mapType(type, getDefinitelyFalsyPartOfType);
@@ -69171,7 +69171,13 @@ function createTypeChecker(host) {
69171
69171
  const resolved = resolveStructuredTypeMembers(type);
69172
69172
  return !!(resolved.callSignatures.length || resolved.constructSignatures.length || resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType));
69173
69173
  }
69174
- function getTypeFacts(type) {
69174
+ function getOnlyTypeFacts(type, mask2) {
69175
+ return getTypeFactsWorker(type, mask2) & mask2;
69176
+ }
69177
+ function hasTypeFacts(type, mask2) {
69178
+ return getOnlyTypeFacts(type, mask2) !== 0;
69179
+ }
69180
+ function getTypeFactsWorker(type, callerOnlyNeeds) {
69175
69181
  if (type.flags & (2097152 /* Intersection */ | 465829888 /* Instantiable */)) {
69176
69182
  type = getBaseConstraintOfType(type) || unknownType;
69177
69183
  }
@@ -69204,6 +69210,10 @@ function createTypeChecker(host) {
69204
69210
  return strictNullChecks ? type === falseType || type === regularFalseType ? 12121864 /* FalseStrictFacts */ : 7927560 /* TrueStrictFacts */ : type === falseType || type === regularFalseType ? 12580616 /* FalseFacts */ : 16774920 /* TrueFacts */;
69205
69211
  }
69206
69212
  if (flags & 524288 /* Object */) {
69213
+ const possibleFacts = strictNullChecks ? 83427327 /* EmptyObjectStrictFacts */ | 7880640 /* FunctionStrictFacts */ | 7888800 /* ObjectStrictFacts */ : 83886079 /* EmptyObjectFacts */ | 16728e3 /* FunctionFacts */ | 16736160 /* ObjectFacts */;
69214
+ if ((callerOnlyNeeds & possibleFacts) === 0) {
69215
+ return 0;
69216
+ }
69207
69217
  return getObjectFlags(type) & 16 /* Anonymous */ && isEmptyObjectType(type) ? strictNullChecks ? 83427327 /* EmptyObjectStrictFacts */ : 83886079 /* EmptyObjectFacts */ : isFunctionObjectType(type) ? strictNullChecks ? 7880640 /* FunctionStrictFacts */ : 16728e3 /* FunctionFacts */ : strictNullChecks ? 7888800 /* ObjectStrictFacts */ : 16736160 /* ObjectFacts */;
69208
69218
  }
69209
69219
  if (flags & 16384 /* Void */) {
@@ -69225,20 +69235,20 @@ function createTypeChecker(host) {
69225
69235
  return 0 /* None */;
69226
69236
  }
69227
69237
  if (flags & 1048576 /* Union */) {
69228
- return reduceLeft(type.types, (facts, t) => facts | getTypeFacts(t), 0 /* None */);
69238
+ return reduceLeft(type.types, (facts, t) => facts | getTypeFactsWorker(t, callerOnlyNeeds), 0 /* None */);
69229
69239
  }
69230
69240
  if (flags & 2097152 /* Intersection */) {
69231
- return getIntersectionTypeFacts(type);
69241
+ return getIntersectionTypeFacts(type, callerOnlyNeeds);
69232
69242
  }
69233
69243
  return 83886079 /* UnknownFacts */;
69234
69244
  }
69235
- function getIntersectionTypeFacts(type) {
69245
+ function getIntersectionTypeFacts(type, callerOnlyNeeds) {
69236
69246
  const ignoreObjects = maybeTypeOfKind(type, 402784252 /* Primitive */);
69237
69247
  let oredFacts = 0 /* None */;
69238
69248
  let andedFacts = 134217727 /* All */;
69239
69249
  for (const t of type.types) {
69240
69250
  if (!(ignoreObjects && t.flags & 524288 /* Object */)) {
69241
- const f = getTypeFacts(t);
69251
+ const f = getTypeFactsWorker(t, callerOnlyNeeds);
69242
69252
  oredFacts |= f;
69243
69253
  andedFacts &= f;
69244
69254
  }
@@ -69246,19 +69256,19 @@ function createTypeChecker(host) {
69246
69256
  return oredFacts & 8256 /* OrFactsMask */ | andedFacts & 134209471 /* AndFactsMask */;
69247
69257
  }
69248
69258
  function getTypeWithFacts(type, include) {
69249
- return filterType(type, (t) => (getTypeFacts(t) & include) !== 0);
69259
+ return filterType(type, (t) => hasTypeFacts(t, include));
69250
69260
  }
69251
69261
  function getAdjustedTypeWithFacts(type, facts) {
69252
69262
  const reduced = recombineUnknownType(getTypeWithFacts(strictNullChecks && type.flags & 2 /* Unknown */ ? unknownUnionType : type, facts));
69253
69263
  if (strictNullChecks) {
69254
69264
  switch (facts) {
69255
69265
  case 524288 /* NEUndefined */:
69256
- return mapType(reduced, (t) => getTypeFacts(t) & 65536 /* EQUndefined */ ? getIntersectionType([t, getTypeFacts(t) & 131072 /* EQNull */ && !maybeTypeOfKind(reduced, 65536 /* Null */) ? getUnionType([emptyObjectType, nullType]) : emptyObjectType]) : t);
69266
+ return mapType(reduced, (t) => hasTypeFacts(t, 65536 /* EQUndefined */) ? getIntersectionType([t, hasTypeFacts(t, 131072 /* EQNull */) && !maybeTypeOfKind(reduced, 65536 /* Null */) ? getUnionType([emptyObjectType, nullType]) : emptyObjectType]) : t);
69257
69267
  case 1048576 /* NENull */:
69258
- return mapType(reduced, (t) => getTypeFacts(t) & 131072 /* EQNull */ ? getIntersectionType([t, getTypeFacts(t) & 65536 /* EQUndefined */ && !maybeTypeOfKind(reduced, 32768 /* Undefined */) ? getUnionType([emptyObjectType, undefinedType]) : emptyObjectType]) : t);
69268
+ return mapType(reduced, (t) => hasTypeFacts(t, 131072 /* EQNull */) ? getIntersectionType([t, hasTypeFacts(t, 65536 /* EQUndefined */) && !maybeTypeOfKind(reduced, 32768 /* Undefined */) ? getUnionType([emptyObjectType, undefinedType]) : emptyObjectType]) : t);
69259
69269
  case 2097152 /* NEUndefinedOrNull */:
69260
69270
  case 4194304 /* Truthy */:
69261
- return mapType(reduced, (t) => getTypeFacts(t) & 262144 /* EQUndefinedOrNull */ ? getGlobalNonNullableTypeInstantiation(t) : t);
69271
+ return mapType(reduced, (t) => hasTypeFacts(t, 262144 /* EQUndefinedOrNull */) ? getGlobalNonNullableTypeInstantiation(t) : t);
69262
69272
  }
69263
69273
  }
69264
69274
  return reduced;
@@ -70595,14 +70605,14 @@ function createTypeChecker(host) {
70595
70605
  // the constituent based on its type facts. We use the strict subtype relation because it treats `object`
70596
70606
  // as a subtype of `{}`, and we need the type facts check because function types are subtypes of `object`,
70597
70607
  // but are classified as "function" according to `typeof`.
70598
- isTypeRelatedTo(t, impliedType, strictSubtypeRelation) ? getTypeFacts(t) & facts ? t : neverType : (
70608
+ isTypeRelatedTo(t, impliedType, strictSubtypeRelation) ? hasTypeFacts(t, facts) ? t : neverType : (
70599
70609
  // We next check if the consituent is a supertype of the implied type. If so, we substitute the implied
70600
70610
  // type. This handles top types like `unknown` and `{}`, and supertypes like `{ toString(): string }`.
70601
70611
  isTypeSubtypeOf(impliedType, t) ? impliedType : (
70602
70612
  // Neither the constituent nor the implied type is a subtype of the other, however their domains may still
70603
70613
  // overlap. For example, an unconstrained type parameter and type `string`. If the type facts indicate
70604
70614
  // possible overlap, we form an intersection. Otherwise, we eliminate the constituent.
70605
- getTypeFacts(t) & facts ? getIntersectionType([t, impliedType]) : neverType
70615
+ hasTypeFacts(t, facts) ? getIntersectionType([t, impliedType]) : neverType
70606
70616
  )
70607
70617
  )
70608
70618
  ));
@@ -70616,7 +70626,7 @@ function createTypeChecker(host) {
70616
70626
  const hasDefaultClause = clauseStart === clauseEnd || defaultIndex >= clauseStart && defaultIndex < clauseEnd;
70617
70627
  if (hasDefaultClause) {
70618
70628
  const notEqualFacts = getNotEqualFactsFromTypeofSwitch(clauseStart, clauseEnd, witnesses);
70619
- return filterType(type, (t) => (getTypeFacts(t) & notEqualFacts) === notEqualFacts);
70629
+ return filterType(type, (t) => getOnlyTypeFacts(t, notEqualFacts) === notEqualFacts);
70620
70630
  }
70621
70631
  const clauseWitnesses = witnesses.slice(clauseStart, clauseEnd);
70622
70632
  return getUnionType(map(clauseWitnesses, (text) => text ? narrowTypeByTypeName(type, text) : neverType));
@@ -70754,7 +70764,7 @@ function createTypeChecker(host) {
70754
70764
  false
70755
70765
  );
70756
70766
  }
70757
- if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) && !(getTypeFacts(predicate.type) & 65536 /* EQUndefined */)) {
70767
+ if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) && !hasTypeFacts(predicate.type, 65536 /* EQUndefined */)) {
70758
70768
  type = getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
70759
70769
  }
70760
70770
  const access = getDiscriminantPropertyAccess(predicateArgument, type);
@@ -70888,7 +70898,7 @@ function createTypeChecker(host) {
70888
70898
  reportCircularityError(declaration.symbol);
70889
70899
  return true;
70890
70900
  }
70891
- const containsUndefined = !!(getTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 16777216 /* IsUndefined */);
70901
+ const containsUndefined = !!hasTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */), 16777216 /* IsUndefined */);
70892
70902
  if (!popTypeResolution()) {
70893
70903
  reportCircularityError(declaration.symbol);
70894
70904
  return true;
@@ -70898,7 +70908,7 @@ function createTypeChecker(host) {
70898
70908
  return links.parameterInitializerContainsUndefined;
70899
70909
  }
70900
70910
  function removeOptionalityFromDeclaredType(declaredType, declaration) {
70901
- const removeUndefined = strictNullChecks && declaration.kind === 169 /* Parameter */ && declaration.initializer && getTypeFacts(declaredType) & 16777216 /* IsUndefined */ && !parameterInitializerContainsUndefined(declaration);
70911
+ const removeUndefined = strictNullChecks && declaration.kind === 169 /* Parameter */ && declaration.initializer && hasTypeFacts(declaredType, 16777216 /* IsUndefined */) && !parameterInitializerContainsUndefined(declaration);
70902
70912
  return removeUndefined ? getTypeWithFacts(declaredType, 524288 /* NEUndefined */) : declaredType;
70903
70913
  }
70904
70914
  function isConstraintPosition(type, node) {
@@ -73728,7 +73738,7 @@ function createTypeChecker(host) {
73728
73738
  return checkNonNullType(checkExpression(node), node);
73729
73739
  }
73730
73740
  function isNullableType(type) {
73731
- return !!(getTypeFacts(type) & 50331648 /* IsUndefinedOrNull */);
73741
+ return hasTypeFacts(type, 50331648 /* IsUndefinedOrNull */);
73732
73742
  }
73733
73743
  function getNonNullableTypeIfNeeded(type) {
73734
73744
  return isNullableType(type) ? getNonNullableType(type) : type;
@@ -73774,7 +73784,7 @@ function createTypeChecker(host) {
73774
73784
  error2(node, Diagnostics.Object_is_of_type_unknown);
73775
73785
  return errorType;
73776
73786
  }
73777
- const facts = getTypeFacts(type);
73787
+ const facts = getOnlyTypeFacts(type, 50331648 /* IsUndefinedOrNull */);
73778
73788
  if (facts & 50331648 /* IsUndefinedOrNull */) {
73779
73789
  reportError(node, facts);
73780
73790
  const t = getNonNullableType(type);
@@ -77554,7 +77564,7 @@ function createTypeChecker(host) {
77554
77564
  if (operandConstraint.flags & 3 /* AnyOrUnknown */) {
77555
77565
  return (556800 /* AllTypeofNE */ & notEqualFacts) === 556800 /* AllTypeofNE */;
77556
77566
  }
77557
- return !someType(operandConstraint, (t) => (getTypeFacts(t) & notEqualFacts) === notEqualFacts);
77567
+ return !someType(operandConstraint, (t) => getOnlyTypeFacts(t, notEqualFacts) === notEqualFacts);
77558
77568
  }
77559
77569
  const type = checkExpressionCached(node.expression);
77560
77570
  if (!isLiteralType(type)) {
@@ -77879,7 +77889,7 @@ function createTypeChecker(host) {
77879
77889
  }
77880
77890
  function checkDeleteExpressionMustBeOptional(expr, symbol) {
77881
77891
  const type = getTypeOfSymbol(symbol);
77882
- if (strictNullChecks && !(type.flags & (3 /* AnyOrUnknown */ | 131072 /* Never */)) && !(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ : getTypeFacts(type) & 16777216 /* IsUndefined */)) {
77892
+ if (strictNullChecks && !(type.flags & (3 /* AnyOrUnknown */ | 131072 /* Never */)) && !(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ : hasTypeFacts(type, 16777216 /* IsUndefined */))) {
77883
77893
  error2(expr, Diagnostics.The_operand_of_a_delete_operator_must_be_optional);
77884
77894
  }
77885
77895
  }
@@ -78014,7 +78024,7 @@ function createTypeChecker(host) {
78014
78024
  return getUnaryResultType(operandType);
78015
78025
  case 54 /* ExclamationToken */:
78016
78026
  checkTruthinessOfType(operandType, node.operand);
78017
- const facts = getTypeFacts(operandType) & (4194304 /* Truthy */ | 8388608 /* Falsy */);
78027
+ const facts = getOnlyTypeFacts(operandType, 4194304 /* Truthy */ | 8388608 /* Falsy */);
78018
78028
  return facts === 4194304 /* Truthy */ ? falseType : facts === 8388608 /* Falsy */ ? trueType : booleanType;
78019
78029
  case 46 /* PlusPlusToken */:
78020
78030
  case 47 /* MinusMinusToken */:
@@ -78245,7 +78255,7 @@ function createTypeChecker(host) {
78245
78255
  if (exprOrAssignment.kind === 304 /* ShorthandPropertyAssignment */) {
78246
78256
  const prop = exprOrAssignment;
78247
78257
  if (prop.objectAssignmentInitializer) {
78248
- if (strictNullChecks && !(getTypeFacts(checkExpression(prop.objectAssignmentInitializer)) & 16777216 /* IsUndefined */)) {
78258
+ if (strictNullChecks && !hasTypeFacts(checkExpression(prop.objectAssignmentInitializer), 16777216 /* IsUndefined */)) {
78249
78259
  sourceType = getTypeWithFacts(sourceType, 524288 /* NEUndefined */);
78250
78260
  }
78251
78261
  checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, checkMode);
@@ -78657,7 +78667,7 @@ function createTypeChecker(host) {
78657
78667
  return checkInExpression(left, right, leftType, rightType);
78658
78668
  case 56 /* AmpersandAmpersandToken */:
78659
78669
  case 77 /* AmpersandAmpersandEqualsToken */: {
78660
- const resultType2 = getTypeFacts(leftType) & 4194304 /* Truthy */ ? getUnionType([extractDefinitelyFalsyTypes(strictNullChecks ? leftType : getBaseTypeOfLiteralType(rightType)), rightType]) : leftType;
78670
+ const resultType2 = hasTypeFacts(leftType, 4194304 /* Truthy */) ? getUnionType([extractDefinitelyFalsyTypes(strictNullChecks ? leftType : getBaseTypeOfLiteralType(rightType)), rightType]) : leftType;
78661
78671
  if (operator === 77 /* AmpersandAmpersandEqualsToken */) {
78662
78672
  checkAssignmentOperator(rightType);
78663
78673
  }
@@ -78665,7 +78675,7 @@ function createTypeChecker(host) {
78665
78675
  }
78666
78676
  case 57 /* BarBarToken */:
78667
78677
  case 76 /* BarBarEqualsToken */: {
78668
- const resultType2 = getTypeFacts(leftType) & 8388608 /* Falsy */ ? getUnionType([getNonNullableType(removeDefinitelyFalsyTypes(leftType)), rightType], 2 /* Subtype */) : leftType;
78678
+ const resultType2 = hasTypeFacts(leftType, 8388608 /* Falsy */) ? getUnionType([getNonNullableType(removeDefinitelyFalsyTypes(leftType)), rightType], 2 /* Subtype */) : leftType;
78669
78679
  if (operator === 76 /* BarBarEqualsToken */) {
78670
78680
  checkAssignmentOperator(rightType);
78671
78681
  }
@@ -78673,7 +78683,7 @@ function createTypeChecker(host) {
78673
78683
  }
78674
78684
  case 61 /* QuestionQuestionToken */:
78675
78685
  case 78 /* QuestionQuestionEqualsToken */: {
78676
- const resultType2 = getTypeFacts(leftType) & 262144 /* EQUndefinedOrNull */ ? getUnionType([getNonNullableType(leftType), rightType], 2 /* Subtype */) : leftType;
78686
+ const resultType2 = hasTypeFacts(leftType, 262144 /* EQUndefinedOrNull */) ? getUnionType([getNonNullableType(leftType), rightType], 2 /* Subtype */) : leftType;
78677
78687
  if (operator === 78 /* QuestionQuestionEqualsToken */) {
78678
78688
  checkAssignmentOperator(rightType);
78679
78689
  }
@@ -81990,7 +82000,7 @@ function createTypeChecker(host) {
81990
82000
  }
81991
82001
  const type = location === condExpr2 ? condType : checkTruthinessExpression(location);
81992
82002
  const isPropertyExpressionCast = isPropertyAccessExpression(location) && isTypeAssertion(location.expression);
81993
- if (!(getTypeFacts(type) & 4194304 /* Truthy */) || isPropertyExpressionCast)
82003
+ if (!hasTypeFacts(type, 4194304 /* Truthy */) || isPropertyExpressionCast)
81994
82004
  return;
81995
82005
  const callSignatures = getSignaturesOfType(type, 0 /* Call */);
81996
82006
  const isPromise = !!getAwaitedTypeOfPromise(type);
package/lib/typescript.js CHANGED
@@ -35,7 +35,7 @@ var ts = (() => {
35
35
  "src/compiler/corePublic.ts"() {
36
36
  "use strict";
37
37
  versionMajorMinor = "5.3";
38
- version = `${versionMajorMinor}.0-insiders.20230821`;
38
+ version = `${versionMajorMinor}.0-insiders.20230822`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -53881,7 +53881,7 @@ ${lanes.join("\n")}
53881
53881
  const pattern = declaration.parent;
53882
53882
  if (strictNullChecks && declaration.flags & 33554432 /* Ambient */ && isParameterDeclaration(declaration)) {
53883
53883
  parentType = getNonNullableType(parentType);
53884
- } else if (strictNullChecks && pattern.parent.initializer && !(getTypeFacts(getTypeOfInitializer(pattern.parent.initializer)) & 65536 /* EQUndefined */)) {
53884
+ } else if (strictNullChecks && pattern.parent.initializer && !hasTypeFacts(getTypeOfInitializer(pattern.parent.initializer), 65536 /* EQUndefined */)) {
53885
53885
  parentType = getTypeWithFacts(parentType, 524288 /* NEUndefined */);
53886
53886
  }
53887
53887
  let type;
@@ -53924,7 +53924,7 @@ ${lanes.join("\n")}
53924
53924
  return type;
53925
53925
  }
53926
53926
  if (getEffectiveTypeAnnotationNode(walkUpBindingElementsAndPatterns(declaration))) {
53927
- return strictNullChecks && !(getTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 16777216 /* IsUndefined */) ? getNonUndefinedType(type) : type;
53927
+ return strictNullChecks && !hasTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */), 16777216 /* IsUndefined */) ? getNonUndefinedType(type) : type;
53928
53928
  }
53929
53929
  return widenTypeInferredFromInitializer(declaration, getUnionType([getNonUndefinedType(type), checkDeclarationInitializer(declaration, 0 /* Normal */)], 2 /* Subtype */));
53930
53930
  }
@@ -62032,7 +62032,7 @@ ${lanes.join("\n")}
62032
62032
  if (sourceType && targetType) {
62033
62033
  const sourceSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
62034
62034
  const targetSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(targetType));
62035
- const callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) && (getTypeFacts(sourceType) & 50331648 /* IsUndefinedOrNull */) === (getTypeFacts(targetType) & 50331648 /* IsUndefinedOrNull */);
62035
+ const callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) && getOnlyTypeFacts(sourceType, 50331648 /* IsUndefinedOrNull */) === getOnlyTypeFacts(targetType, 50331648 /* IsUndefinedOrNull */);
62036
62036
  let related = callbacks ? compareSignaturesRelated(targetSig, sourceSig, checkMode & 8 /* StrictArity */ | (strictVariance ? 2 /* StrictCallback */ : 1 /* BivariantCallback */), reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) : !(checkMode & 3 /* Callback */) && !strictVariance && compareTypes(
62037
62037
  sourceType,
62038
62038
  targetType,
@@ -65189,7 +65189,7 @@ ${lanes.join("\n")}
65189
65189
  return value.base10Value === "0";
65190
65190
  }
65191
65191
  function removeDefinitelyFalsyTypes(type) {
65192
- return filterType(type, (t) => !!(getTypeFacts(t) & 4194304 /* Truthy */));
65192
+ return filterType(type, (t) => hasTypeFacts(t, 4194304 /* Truthy */));
65193
65193
  }
65194
65194
  function extractDefinitelyFalsyTypes(type) {
65195
65195
  return mapType(type, getDefinitelyFalsyPartOfType);
@@ -66932,7 +66932,13 @@ ${lanes.join("\n")}
66932
66932
  const resolved = resolveStructuredTypeMembers(type);
66933
66933
  return !!(resolved.callSignatures.length || resolved.constructSignatures.length || resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType));
66934
66934
  }
66935
- function getTypeFacts(type) {
66935
+ function getOnlyTypeFacts(type, mask2) {
66936
+ return getTypeFactsWorker(type, mask2) & mask2;
66937
+ }
66938
+ function hasTypeFacts(type, mask2) {
66939
+ return getOnlyTypeFacts(type, mask2) !== 0;
66940
+ }
66941
+ function getTypeFactsWorker(type, callerOnlyNeeds) {
66936
66942
  if (type.flags & (2097152 /* Intersection */ | 465829888 /* Instantiable */)) {
66937
66943
  type = getBaseConstraintOfType(type) || unknownType;
66938
66944
  }
@@ -66965,6 +66971,10 @@ ${lanes.join("\n")}
66965
66971
  return strictNullChecks ? type === falseType || type === regularFalseType ? 12121864 /* FalseStrictFacts */ : 7927560 /* TrueStrictFacts */ : type === falseType || type === regularFalseType ? 12580616 /* FalseFacts */ : 16774920 /* TrueFacts */;
66966
66972
  }
66967
66973
  if (flags & 524288 /* Object */) {
66974
+ const possibleFacts = strictNullChecks ? 83427327 /* EmptyObjectStrictFacts */ | 7880640 /* FunctionStrictFacts */ | 7888800 /* ObjectStrictFacts */ : 83886079 /* EmptyObjectFacts */ | 16728e3 /* FunctionFacts */ | 16736160 /* ObjectFacts */;
66975
+ if ((callerOnlyNeeds & possibleFacts) === 0) {
66976
+ return 0;
66977
+ }
66968
66978
  return getObjectFlags(type) & 16 /* Anonymous */ && isEmptyObjectType(type) ? strictNullChecks ? 83427327 /* EmptyObjectStrictFacts */ : 83886079 /* EmptyObjectFacts */ : isFunctionObjectType(type) ? strictNullChecks ? 7880640 /* FunctionStrictFacts */ : 16728e3 /* FunctionFacts */ : strictNullChecks ? 7888800 /* ObjectStrictFacts */ : 16736160 /* ObjectFacts */;
66969
66979
  }
66970
66980
  if (flags & 16384 /* Void */) {
@@ -66986,20 +66996,20 @@ ${lanes.join("\n")}
66986
66996
  return 0 /* None */;
66987
66997
  }
66988
66998
  if (flags & 1048576 /* Union */) {
66989
- return reduceLeft(type.types, (facts, t) => facts | getTypeFacts(t), 0 /* None */);
66999
+ return reduceLeft(type.types, (facts, t) => facts | getTypeFactsWorker(t, callerOnlyNeeds), 0 /* None */);
66990
67000
  }
66991
67001
  if (flags & 2097152 /* Intersection */) {
66992
- return getIntersectionTypeFacts(type);
67002
+ return getIntersectionTypeFacts(type, callerOnlyNeeds);
66993
67003
  }
66994
67004
  return 83886079 /* UnknownFacts */;
66995
67005
  }
66996
- function getIntersectionTypeFacts(type) {
67006
+ function getIntersectionTypeFacts(type, callerOnlyNeeds) {
66997
67007
  const ignoreObjects = maybeTypeOfKind(type, 402784252 /* Primitive */);
66998
67008
  let oredFacts = 0 /* None */;
66999
67009
  let andedFacts = 134217727 /* All */;
67000
67010
  for (const t of type.types) {
67001
67011
  if (!(ignoreObjects && t.flags & 524288 /* Object */)) {
67002
- const f = getTypeFacts(t);
67012
+ const f = getTypeFactsWorker(t, callerOnlyNeeds);
67003
67013
  oredFacts |= f;
67004
67014
  andedFacts &= f;
67005
67015
  }
@@ -67007,19 +67017,19 @@ ${lanes.join("\n")}
67007
67017
  return oredFacts & 8256 /* OrFactsMask */ | andedFacts & 134209471 /* AndFactsMask */;
67008
67018
  }
67009
67019
  function getTypeWithFacts(type, include) {
67010
- return filterType(type, (t) => (getTypeFacts(t) & include) !== 0);
67020
+ return filterType(type, (t) => hasTypeFacts(t, include));
67011
67021
  }
67012
67022
  function getAdjustedTypeWithFacts(type, facts) {
67013
67023
  const reduced = recombineUnknownType(getTypeWithFacts(strictNullChecks && type.flags & 2 /* Unknown */ ? unknownUnionType : type, facts));
67014
67024
  if (strictNullChecks) {
67015
67025
  switch (facts) {
67016
67026
  case 524288 /* NEUndefined */:
67017
- return mapType(reduced, (t) => getTypeFacts(t) & 65536 /* EQUndefined */ ? getIntersectionType([t, getTypeFacts(t) & 131072 /* EQNull */ && !maybeTypeOfKind(reduced, 65536 /* Null */) ? getUnionType([emptyObjectType, nullType]) : emptyObjectType]) : t);
67027
+ return mapType(reduced, (t) => hasTypeFacts(t, 65536 /* EQUndefined */) ? getIntersectionType([t, hasTypeFacts(t, 131072 /* EQNull */) && !maybeTypeOfKind(reduced, 65536 /* Null */) ? getUnionType([emptyObjectType, nullType]) : emptyObjectType]) : t);
67018
67028
  case 1048576 /* NENull */:
67019
- return mapType(reduced, (t) => getTypeFacts(t) & 131072 /* EQNull */ ? getIntersectionType([t, getTypeFacts(t) & 65536 /* EQUndefined */ && !maybeTypeOfKind(reduced, 32768 /* Undefined */) ? getUnionType([emptyObjectType, undefinedType]) : emptyObjectType]) : t);
67029
+ return mapType(reduced, (t) => hasTypeFacts(t, 131072 /* EQNull */) ? getIntersectionType([t, hasTypeFacts(t, 65536 /* EQUndefined */) && !maybeTypeOfKind(reduced, 32768 /* Undefined */) ? getUnionType([emptyObjectType, undefinedType]) : emptyObjectType]) : t);
67020
67030
  case 2097152 /* NEUndefinedOrNull */:
67021
67031
  case 4194304 /* Truthy */:
67022
- return mapType(reduced, (t) => getTypeFacts(t) & 262144 /* EQUndefinedOrNull */ ? getGlobalNonNullableTypeInstantiation(t) : t);
67032
+ return mapType(reduced, (t) => hasTypeFacts(t, 262144 /* EQUndefinedOrNull */) ? getGlobalNonNullableTypeInstantiation(t) : t);
67023
67033
  }
67024
67034
  }
67025
67035
  return reduced;
@@ -68356,14 +68366,14 @@ ${lanes.join("\n")}
68356
68366
  // the constituent based on its type facts. We use the strict subtype relation because it treats `object`
68357
68367
  // as a subtype of `{}`, and we need the type facts check because function types are subtypes of `object`,
68358
68368
  // but are classified as "function" according to `typeof`.
68359
- isTypeRelatedTo(t, impliedType, strictSubtypeRelation) ? getTypeFacts(t) & facts ? t : neverType : (
68369
+ isTypeRelatedTo(t, impliedType, strictSubtypeRelation) ? hasTypeFacts(t, facts) ? t : neverType : (
68360
68370
  // We next check if the consituent is a supertype of the implied type. If so, we substitute the implied
68361
68371
  // type. This handles top types like `unknown` and `{}`, and supertypes like `{ toString(): string }`.
68362
68372
  isTypeSubtypeOf(impliedType, t) ? impliedType : (
68363
68373
  // Neither the constituent nor the implied type is a subtype of the other, however their domains may still
68364
68374
  // overlap. For example, an unconstrained type parameter and type `string`. If the type facts indicate
68365
68375
  // possible overlap, we form an intersection. Otherwise, we eliminate the constituent.
68366
- getTypeFacts(t) & facts ? getIntersectionType([t, impliedType]) : neverType
68376
+ hasTypeFacts(t, facts) ? getIntersectionType([t, impliedType]) : neverType
68367
68377
  )
68368
68378
  )
68369
68379
  ));
@@ -68377,7 +68387,7 @@ ${lanes.join("\n")}
68377
68387
  const hasDefaultClause = clauseStart === clauseEnd || defaultIndex >= clauseStart && defaultIndex < clauseEnd;
68378
68388
  if (hasDefaultClause) {
68379
68389
  const notEqualFacts = getNotEqualFactsFromTypeofSwitch(clauseStart, clauseEnd, witnesses);
68380
- return filterType(type, (t) => (getTypeFacts(t) & notEqualFacts) === notEqualFacts);
68390
+ return filterType(type, (t) => getOnlyTypeFacts(t, notEqualFacts) === notEqualFacts);
68381
68391
  }
68382
68392
  const clauseWitnesses = witnesses.slice(clauseStart, clauseEnd);
68383
68393
  return getUnionType(map(clauseWitnesses, (text) => text ? narrowTypeByTypeName(type, text) : neverType));
@@ -68515,7 +68525,7 @@ ${lanes.join("\n")}
68515
68525
  false
68516
68526
  );
68517
68527
  }
68518
- if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) && !(getTypeFacts(predicate.type) & 65536 /* EQUndefined */)) {
68528
+ if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) && !hasTypeFacts(predicate.type, 65536 /* EQUndefined */)) {
68519
68529
  type = getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
68520
68530
  }
68521
68531
  const access = getDiscriminantPropertyAccess(predicateArgument, type);
@@ -68649,7 +68659,7 @@ ${lanes.join("\n")}
68649
68659
  reportCircularityError(declaration.symbol);
68650
68660
  return true;
68651
68661
  }
68652
- const containsUndefined = !!(getTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 16777216 /* IsUndefined */);
68662
+ const containsUndefined = !!hasTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */), 16777216 /* IsUndefined */);
68653
68663
  if (!popTypeResolution()) {
68654
68664
  reportCircularityError(declaration.symbol);
68655
68665
  return true;
@@ -68659,7 +68669,7 @@ ${lanes.join("\n")}
68659
68669
  return links.parameterInitializerContainsUndefined;
68660
68670
  }
68661
68671
  function removeOptionalityFromDeclaredType(declaredType, declaration) {
68662
- const removeUndefined = strictNullChecks && declaration.kind === 169 /* Parameter */ && declaration.initializer && getTypeFacts(declaredType) & 16777216 /* IsUndefined */ && !parameterInitializerContainsUndefined(declaration);
68672
+ const removeUndefined = strictNullChecks && declaration.kind === 169 /* Parameter */ && declaration.initializer && hasTypeFacts(declaredType, 16777216 /* IsUndefined */) && !parameterInitializerContainsUndefined(declaration);
68663
68673
  return removeUndefined ? getTypeWithFacts(declaredType, 524288 /* NEUndefined */) : declaredType;
68664
68674
  }
68665
68675
  function isConstraintPosition(type, node) {
@@ -71489,7 +71499,7 @@ ${lanes.join("\n")}
71489
71499
  return checkNonNullType(checkExpression(node), node);
71490
71500
  }
71491
71501
  function isNullableType(type) {
71492
- return !!(getTypeFacts(type) & 50331648 /* IsUndefinedOrNull */);
71502
+ return hasTypeFacts(type, 50331648 /* IsUndefinedOrNull */);
71493
71503
  }
71494
71504
  function getNonNullableTypeIfNeeded(type) {
71495
71505
  return isNullableType(type) ? getNonNullableType(type) : type;
@@ -71535,7 +71545,7 @@ ${lanes.join("\n")}
71535
71545
  error2(node, Diagnostics.Object_is_of_type_unknown);
71536
71546
  return errorType;
71537
71547
  }
71538
- const facts = getTypeFacts(type);
71548
+ const facts = getOnlyTypeFacts(type, 50331648 /* IsUndefinedOrNull */);
71539
71549
  if (facts & 50331648 /* IsUndefinedOrNull */) {
71540
71550
  reportError(node, facts);
71541
71551
  const t = getNonNullableType(type);
@@ -75315,7 +75325,7 @@ ${lanes.join("\n")}
75315
75325
  if (operandConstraint.flags & 3 /* AnyOrUnknown */) {
75316
75326
  return (556800 /* AllTypeofNE */ & notEqualFacts) === 556800 /* AllTypeofNE */;
75317
75327
  }
75318
- return !someType(operandConstraint, (t) => (getTypeFacts(t) & notEqualFacts) === notEqualFacts);
75328
+ return !someType(operandConstraint, (t) => getOnlyTypeFacts(t, notEqualFacts) === notEqualFacts);
75319
75329
  }
75320
75330
  const type = checkExpressionCached(node.expression);
75321
75331
  if (!isLiteralType(type)) {
@@ -75640,7 +75650,7 @@ ${lanes.join("\n")}
75640
75650
  }
75641
75651
  function checkDeleteExpressionMustBeOptional(expr, symbol) {
75642
75652
  const type = getTypeOfSymbol(symbol);
75643
- if (strictNullChecks && !(type.flags & (3 /* AnyOrUnknown */ | 131072 /* Never */)) && !(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ : getTypeFacts(type) & 16777216 /* IsUndefined */)) {
75653
+ if (strictNullChecks && !(type.flags & (3 /* AnyOrUnknown */ | 131072 /* Never */)) && !(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ : hasTypeFacts(type, 16777216 /* IsUndefined */))) {
75644
75654
  error2(expr, Diagnostics.The_operand_of_a_delete_operator_must_be_optional);
75645
75655
  }
75646
75656
  }
@@ -75775,7 +75785,7 @@ ${lanes.join("\n")}
75775
75785
  return getUnaryResultType(operandType);
75776
75786
  case 54 /* ExclamationToken */:
75777
75787
  checkTruthinessOfType(operandType, node.operand);
75778
- const facts = getTypeFacts(operandType) & (4194304 /* Truthy */ | 8388608 /* Falsy */);
75788
+ const facts = getOnlyTypeFacts(operandType, 4194304 /* Truthy */ | 8388608 /* Falsy */);
75779
75789
  return facts === 4194304 /* Truthy */ ? falseType : facts === 8388608 /* Falsy */ ? trueType : booleanType;
75780
75790
  case 46 /* PlusPlusToken */:
75781
75791
  case 47 /* MinusMinusToken */:
@@ -76006,7 +76016,7 @@ ${lanes.join("\n")}
76006
76016
  if (exprOrAssignment.kind === 304 /* ShorthandPropertyAssignment */) {
76007
76017
  const prop = exprOrAssignment;
76008
76018
  if (prop.objectAssignmentInitializer) {
76009
- if (strictNullChecks && !(getTypeFacts(checkExpression(prop.objectAssignmentInitializer)) & 16777216 /* IsUndefined */)) {
76019
+ if (strictNullChecks && !hasTypeFacts(checkExpression(prop.objectAssignmentInitializer), 16777216 /* IsUndefined */)) {
76010
76020
  sourceType = getTypeWithFacts(sourceType, 524288 /* NEUndefined */);
76011
76021
  }
76012
76022
  checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, checkMode);
@@ -76418,7 +76428,7 @@ ${lanes.join("\n")}
76418
76428
  return checkInExpression(left, right, leftType, rightType);
76419
76429
  case 56 /* AmpersandAmpersandToken */:
76420
76430
  case 77 /* AmpersandAmpersandEqualsToken */: {
76421
- const resultType2 = getTypeFacts(leftType) & 4194304 /* Truthy */ ? getUnionType([extractDefinitelyFalsyTypes(strictNullChecks ? leftType : getBaseTypeOfLiteralType(rightType)), rightType]) : leftType;
76431
+ const resultType2 = hasTypeFacts(leftType, 4194304 /* Truthy */) ? getUnionType([extractDefinitelyFalsyTypes(strictNullChecks ? leftType : getBaseTypeOfLiteralType(rightType)), rightType]) : leftType;
76422
76432
  if (operator === 77 /* AmpersandAmpersandEqualsToken */) {
76423
76433
  checkAssignmentOperator(rightType);
76424
76434
  }
@@ -76426,7 +76436,7 @@ ${lanes.join("\n")}
76426
76436
  }
76427
76437
  case 57 /* BarBarToken */:
76428
76438
  case 76 /* BarBarEqualsToken */: {
76429
- const resultType2 = getTypeFacts(leftType) & 8388608 /* Falsy */ ? getUnionType([getNonNullableType(removeDefinitelyFalsyTypes(leftType)), rightType], 2 /* Subtype */) : leftType;
76439
+ const resultType2 = hasTypeFacts(leftType, 8388608 /* Falsy */) ? getUnionType([getNonNullableType(removeDefinitelyFalsyTypes(leftType)), rightType], 2 /* Subtype */) : leftType;
76430
76440
  if (operator === 76 /* BarBarEqualsToken */) {
76431
76441
  checkAssignmentOperator(rightType);
76432
76442
  }
@@ -76434,7 +76444,7 @@ ${lanes.join("\n")}
76434
76444
  }
76435
76445
  case 61 /* QuestionQuestionToken */:
76436
76446
  case 78 /* QuestionQuestionEqualsToken */: {
76437
- const resultType2 = getTypeFacts(leftType) & 262144 /* EQUndefinedOrNull */ ? getUnionType([getNonNullableType(leftType), rightType], 2 /* Subtype */) : leftType;
76447
+ const resultType2 = hasTypeFacts(leftType, 262144 /* EQUndefinedOrNull */) ? getUnionType([getNonNullableType(leftType), rightType], 2 /* Subtype */) : leftType;
76438
76448
  if (operator === 78 /* QuestionQuestionEqualsToken */) {
76439
76449
  checkAssignmentOperator(rightType);
76440
76450
  }
@@ -79751,7 +79761,7 @@ ${lanes.join("\n")}
79751
79761
  }
79752
79762
  const type = location === condExpr2 ? condType : checkTruthinessExpression(location);
79753
79763
  const isPropertyExpressionCast = isPropertyAccessExpression(location) && isTypeAssertion(location.expression);
79754
- if (!(getTypeFacts(type) & 4194304 /* Truthy */) || isPropertyExpressionCast)
79764
+ if (!hasTypeFacts(type, 4194304 /* Truthy */) || isPropertyExpressionCast)
79755
79765
  return;
79756
79766
  const callSignatures = getSignaturesOfType(type, 0 /* Call */);
79757
79767
  const isPromise = !!getAwaitedTypeOfPromise(type);
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
54
54
 
55
55
  // src/compiler/corePublic.ts
56
56
  var versionMajorMinor = "5.3";
57
- var version = `${versionMajorMinor}.0-insiders.20230821`;
57
+ var version = `${versionMajorMinor}.0-insiders.20230822`;
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
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.3.0-pr-54960-22",
5
+ "version": "5.3.0-pr-55459-3",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -116,5 +116,5 @@
116
116
  "node": "20.1.0",
117
117
  "npm": "8.19.4"
118
118
  },
119
- "gitHead": "f8cc24a8ac05cb2c324aee134f69db1d696a2dc7"
119
+ "gitHead": "b0d71ce9f63cc73c46d03076e74a95943720149b"
120
120
  }