@typescript-deploys/pr-build 5.3.0-pr-55476-8 → 5.3.0-pr-55371-11

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.20230823`;
21
+ var version = `${versionMajorMinor}.0-insiders.20230824`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -11839,7 +11839,7 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize(
11839
11839
  "defineProperty",
11840
11840
  "deleteProperty",
11841
11841
  "get",
11842
- " getOwnPropertyDescriptor",
11842
+ "getOwnPropertyDescriptor",
11843
11843
  "getPrototypeOf",
11844
11844
  "has",
11845
11845
  "isExtensible",
@@ -29967,7 +29967,9 @@ var Parser;
29967
29967
  let dotDotDotToken;
29968
29968
  let expression;
29969
29969
  if (token() !== 20 /* CloseBraceToken */) {
29970
- dotDotDotToken = parseOptionalToken(26 /* DotDotDotToken */);
29970
+ if (!inExpressionContext) {
29971
+ dotDotDotToken = parseOptionalToken(26 /* DotDotDotToken */);
29972
+ }
29971
29973
  expression = parseExpression();
29972
29974
  }
29973
29975
  if (inExpressionContext) {
@@ -44418,6 +44420,9 @@ function createTypeChecker(host) {
44418
44420
  const sourceFiles = host.getSourceFiles();
44419
44421
  return sourceFiles.indexOf(declarationFile) <= sourceFiles.indexOf(useFile);
44420
44422
  }
44423
+ if (!!(usage.flags & 16777216 /* JSDoc */) || isInTypeQuery(usage) || isInAmbientOrTypeNode(usage)) {
44424
+ return true;
44425
+ }
44421
44426
  if (declaration.pos <= usage.pos && !(isPropertyDeclaration(declaration) && isThisProperty(usage.parent) && !declaration.initializer && !declaration.exclamationToken)) {
44422
44427
  if (declaration.kind === 208 /* BindingElement */) {
44423
44428
  const errorBindingElement = getAncestor(usage, 208 /* BindingElement */);
@@ -44447,9 +44452,6 @@ function createTypeChecker(host) {
44447
44452
  if (usage.kind === 277 /* ExportAssignment */ && usage.isExportEquals) {
44448
44453
  return true;
44449
44454
  }
44450
- if (!!(usage.flags & 16777216 /* JSDoc */) || isInTypeQuery(usage) || isInAmbientOrTypeNode(usage)) {
44451
- return true;
44452
- }
44453
44455
  if (isUsedInFunctionOrInstanceProperty(usage, declaration)) {
44454
44456
  if (emitStandardClassFields && getContainingClass(declaration) && (isPropertyDeclaration(declaration) || isParameterPropertyDeclaration(declaration, declaration.parent))) {
44455
44457
  return !isPropertyImmediatelyReferencedWithinDeclaration(
@@ -50659,8 +50661,8 @@ function createTypeChecker(host) {
50659
50661
  });
50660
50662
  }
50661
50663
  });
50662
- Debug.assert(setter && isFunctionLikeDeclaration(setter));
50663
- const paramSymbol = getSignatureFromDeclaration(setter).parameters[0];
50664
+ Debug.assert(!!setter);
50665
+ const paramSymbol = isFunctionLikeDeclaration(setter) ? getSignatureFromDeclaration(setter).parameters[0] : void 0;
50664
50666
  result.push(setTextRange(
50665
50667
  factory.createSetAccessorDeclaration(
50666
50668
  factory.createModifiersFromModifierFlags(flag),
@@ -51436,7 +51438,7 @@ function createTypeChecker(host) {
51436
51438
  const pattern = declaration.parent;
51437
51439
  if (strictNullChecks && declaration.flags & 33554432 /* Ambient */ && isParameterDeclaration(declaration)) {
51438
51440
  parentType = getNonNullableType(parentType);
51439
- } else if (strictNullChecks && pattern.parent.initializer && !(getTypeFacts(getTypeOfInitializer(pattern.parent.initializer)) & 65536 /* EQUndefined */)) {
51441
+ } else if (strictNullChecks && pattern.parent.initializer && !hasTypeFacts(getTypeOfInitializer(pattern.parent.initializer), 65536 /* EQUndefined */)) {
51440
51442
  parentType = getTypeWithFacts(parentType, 524288 /* NEUndefined */);
51441
51443
  }
51442
51444
  let type;
@@ -51479,7 +51481,7 @@ function createTypeChecker(host) {
51479
51481
  return type;
51480
51482
  }
51481
51483
  if (getEffectiveTypeAnnotationNode(walkUpBindingElementsAndPatterns(declaration))) {
51482
- return strictNullChecks && !(getTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 16777216 /* IsUndefined */) ? getNonUndefinedType(type) : type;
51484
+ return strictNullChecks && !hasTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */), 16777216 /* IsUndefined */) ? getNonUndefinedType(type) : type;
51483
51485
  }
51484
51486
  return widenTypeInferredFromInitializer(declaration, getUnionType([getNonUndefinedType(type), checkDeclarationInitializer(declaration, 0 /* Normal */)], 2 /* Subtype */));
51485
51487
  }
@@ -59587,7 +59589,7 @@ function createTypeChecker(host) {
59587
59589
  if (sourceType && targetType) {
59588
59590
  const sourceSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
59589
59591
  const targetSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(targetType));
59590
- const callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) && (getTypeFacts(sourceType) & 50331648 /* IsUndefinedOrNull */) === (getTypeFacts(targetType) & 50331648 /* IsUndefinedOrNull */);
59592
+ const callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) && getTypeFacts(sourceType, 50331648 /* IsUndefinedOrNull */) === getTypeFacts(targetType, 50331648 /* IsUndefinedOrNull */);
59591
59593
  let related = callbacks ? compareSignaturesRelated(targetSig, sourceSig, checkMode & 8 /* StrictArity */ | (strictVariance ? 2 /* StrictCallback */ : 1 /* BivariantCallback */), reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) : !(checkMode & 3 /* Callback */) && !strictVariance && compareTypes(
59592
59594
  sourceType,
59593
59595
  targetType,
@@ -61223,6 +61225,9 @@ function createTypeChecker(host) {
61223
61225
  }
61224
61226
  instantiateType(source2, reportUnreliableMapper);
61225
61227
  }
61228
+ if (isTemplateLiteralTypeWithSinglePlaceholderAndNoExtraTexts(target2) && isTypeAssignableTo(source2, stringType) && isTypeAssignableTo(target2.types[0], stringType)) {
61229
+ return isRelatedTo(source2, target2.types[0], 3 /* Both */, reportErrors2);
61230
+ }
61226
61231
  if (isTypeMatchedByTemplateLiteralType(source2, target2)) {
61227
61232
  return -1 /* True */;
61228
61233
  }
@@ -61273,6 +61278,9 @@ function createTypeChecker(host) {
61273
61278
  }
61274
61279
  } else if (sourceFlags & 134217728 /* TemplateLiteral */ && !(targetFlags & 524288 /* Object */)) {
61275
61280
  if (!(targetFlags & 134217728 /* TemplateLiteral */)) {
61281
+ if (isTemplateLiteralTypeWithSinglePlaceholderAndNoExtraTexts(source2) && isTypeAssignableTo(source2.types[0], stringType) && isTypeAssignableTo(target2, stringType)) {
61282
+ return isRelatedTo(source2.types[0], target2, 3 /* Both */, reportErrors2);
61283
+ }
61276
61284
  const constraint = getBaseConstraintOfType(source2);
61277
61285
  if (constraint && constraint !== source2 && (result2 = isRelatedTo(constraint, target2, 1 /* Source */, reportErrors2))) {
61278
61286
  return result2;
@@ -62744,7 +62752,7 @@ function createTypeChecker(host) {
62744
62752
  return value.base10Value === "0";
62745
62753
  }
62746
62754
  function removeDefinitelyFalsyTypes(type) {
62747
- return filterType(type, (t) => !!(getTypeFacts(t) & 4194304 /* Truthy */));
62755
+ return filterType(type, (t) => hasTypeFacts(t, 4194304 /* Truthy */));
62748
62756
  }
62749
62757
  function extractDefinitelyFalsyTypes(type) {
62750
62758
  return mapType(type, getDefinitelyFalsyPartOfType);
@@ -63397,6 +63405,13 @@ function createTypeChecker(host) {
63397
63405
  }
63398
63406
  return false;
63399
63407
  }
63408
+ function isTemplateLiteralTypeWithSinglePlaceholderAndNoExtraTexts(type) {
63409
+ if (!(type.flags & 134217728 /* TemplateLiteral */)) {
63410
+ return false;
63411
+ }
63412
+ const texts = type.texts;
63413
+ return texts.length === 2 && texts[0] === "" && texts[1] === "";
63414
+ }
63400
63415
  function isValidTypeForTemplateLiteralPlaceholder(source, target) {
63401
63416
  if (source === target || target.flags & (1 /* Any */ | 4 /* String */)) {
63402
63417
  return true;
@@ -63416,9 +63431,8 @@ function createTypeChecker(host) {
63416
63431
  false
63417
63432
  ) || target.flags & (512 /* BooleanLiteral */ | 98304 /* Nullable */) && value === target.intrinsicName || target.flags & 268435456 /* StringMapping */ && isMemberOfStringMapping(getStringLiteralType(value), target) || target.flags & 134217728 /* TemplateLiteral */ && isTypeMatchedByTemplateLiteralType(source, target));
63418
63433
  }
63419
- if (source.flags & 134217728 /* TemplateLiteral */) {
63420
- const texts = source.texts;
63421
- return texts.length === 2 && texts[0] === "" && texts[1] === "" && isTypeAssignableTo(source.types[0], target);
63434
+ if (isTemplateLiteralTypeWithSinglePlaceholderAndNoExtraTexts(source)) {
63435
+ return isTypeAssignableTo(source.types[0], target);
63422
63436
  }
63423
63437
  return isTypeAssignableTo(source, target);
63424
63438
  }
@@ -64489,7 +64503,13 @@ function createTypeChecker(host) {
64489
64503
  const resolved = resolveStructuredTypeMembers(type);
64490
64504
  return !!(resolved.callSignatures.length || resolved.constructSignatures.length || resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType));
64491
64505
  }
64492
- function getTypeFacts(type) {
64506
+ function getTypeFacts(type, mask) {
64507
+ return getTypeFactsWorker(type, mask) & mask;
64508
+ }
64509
+ function hasTypeFacts(type, mask) {
64510
+ return getTypeFacts(type, mask) !== 0;
64511
+ }
64512
+ function getTypeFactsWorker(type, callerOnlyNeeds) {
64493
64513
  if (type.flags & (2097152 /* Intersection */ | 465829888 /* Instantiable */)) {
64494
64514
  type = getBaseConstraintOfType(type) || unknownType;
64495
64515
  }
@@ -64522,6 +64542,10 @@ function createTypeChecker(host) {
64522
64542
  return strictNullChecks ? type === falseType || type === regularFalseType ? 12121864 /* FalseStrictFacts */ : 7927560 /* TrueStrictFacts */ : type === falseType || type === regularFalseType ? 12580616 /* FalseFacts */ : 16774920 /* TrueFacts */;
64523
64543
  }
64524
64544
  if (flags & 524288 /* Object */) {
64545
+ const possibleFacts = strictNullChecks ? 83427327 /* EmptyObjectStrictFacts */ | 7880640 /* FunctionStrictFacts */ | 7888800 /* ObjectStrictFacts */ : 83886079 /* EmptyObjectFacts */ | 16728e3 /* FunctionFacts */ | 16736160 /* ObjectFacts */;
64546
+ if ((callerOnlyNeeds & possibleFacts) === 0) {
64547
+ return 0;
64548
+ }
64525
64549
  return getObjectFlags(type) & 16 /* Anonymous */ && isEmptyObjectType(type) ? strictNullChecks ? 83427327 /* EmptyObjectStrictFacts */ : 83886079 /* EmptyObjectFacts */ : isFunctionObjectType(type) ? strictNullChecks ? 7880640 /* FunctionStrictFacts */ : 16728e3 /* FunctionFacts */ : strictNullChecks ? 7888800 /* ObjectStrictFacts */ : 16736160 /* ObjectFacts */;
64526
64550
  }
64527
64551
  if (flags & 16384 /* Void */) {
@@ -64543,20 +64567,20 @@ function createTypeChecker(host) {
64543
64567
  return 0 /* None */;
64544
64568
  }
64545
64569
  if (flags & 1048576 /* Union */) {
64546
- return reduceLeft(type.types, (facts, t) => facts | getTypeFacts(t), 0 /* None */);
64570
+ return reduceLeft(type.types, (facts, t) => facts | getTypeFactsWorker(t, callerOnlyNeeds), 0 /* None */);
64547
64571
  }
64548
64572
  if (flags & 2097152 /* Intersection */) {
64549
- return getIntersectionTypeFacts(type);
64573
+ return getIntersectionTypeFacts(type, callerOnlyNeeds);
64550
64574
  }
64551
64575
  return 83886079 /* UnknownFacts */;
64552
64576
  }
64553
- function getIntersectionTypeFacts(type) {
64577
+ function getIntersectionTypeFacts(type, callerOnlyNeeds) {
64554
64578
  const ignoreObjects = maybeTypeOfKind(type, 402784252 /* Primitive */);
64555
64579
  let oredFacts = 0 /* None */;
64556
64580
  let andedFacts = 134217727 /* All */;
64557
64581
  for (const t of type.types) {
64558
64582
  if (!(ignoreObjects && t.flags & 524288 /* Object */)) {
64559
- const f = getTypeFacts(t);
64583
+ const f = getTypeFactsWorker(t, callerOnlyNeeds);
64560
64584
  oredFacts |= f;
64561
64585
  andedFacts &= f;
64562
64586
  }
@@ -64564,19 +64588,19 @@ function createTypeChecker(host) {
64564
64588
  return oredFacts & 8256 /* OrFactsMask */ | andedFacts & 134209471 /* AndFactsMask */;
64565
64589
  }
64566
64590
  function getTypeWithFacts(type, include) {
64567
- return filterType(type, (t) => (getTypeFacts(t) & include) !== 0);
64591
+ return filterType(type, (t) => hasTypeFacts(t, include));
64568
64592
  }
64569
64593
  function getAdjustedTypeWithFacts(type, facts) {
64570
64594
  const reduced = recombineUnknownType(getTypeWithFacts(strictNullChecks && type.flags & 2 /* Unknown */ ? unknownUnionType : type, facts));
64571
64595
  if (strictNullChecks) {
64572
64596
  switch (facts) {
64573
64597
  case 524288 /* NEUndefined */:
64574
- return mapType(reduced, (t) => getTypeFacts(t) & 65536 /* EQUndefined */ ? getIntersectionType([t, getTypeFacts(t) & 131072 /* EQNull */ && !maybeTypeOfKind(reduced, 65536 /* Null */) ? getUnionType([emptyObjectType, nullType]) : emptyObjectType]) : t);
64598
+ return mapType(reduced, (t) => hasTypeFacts(t, 65536 /* EQUndefined */) ? getIntersectionType([t, hasTypeFacts(t, 131072 /* EQNull */) && !maybeTypeOfKind(reduced, 65536 /* Null */) ? getUnionType([emptyObjectType, nullType]) : emptyObjectType]) : t);
64575
64599
  case 1048576 /* NENull */:
64576
- return mapType(reduced, (t) => getTypeFacts(t) & 131072 /* EQNull */ ? getIntersectionType([t, getTypeFacts(t) & 65536 /* EQUndefined */ && !maybeTypeOfKind(reduced, 32768 /* Undefined */) ? getUnionType([emptyObjectType, undefinedType]) : emptyObjectType]) : t);
64600
+ return mapType(reduced, (t) => hasTypeFacts(t, 131072 /* EQNull */) ? getIntersectionType([t, hasTypeFacts(t, 65536 /* EQUndefined */) && !maybeTypeOfKind(reduced, 32768 /* Undefined */) ? getUnionType([emptyObjectType, undefinedType]) : emptyObjectType]) : t);
64577
64601
  case 2097152 /* NEUndefinedOrNull */:
64578
64602
  case 4194304 /* Truthy */:
64579
- return mapType(reduced, (t) => getTypeFacts(t) & 262144 /* EQUndefinedOrNull */ ? getGlobalNonNullableTypeInstantiation(t) : t);
64603
+ return mapType(reduced, (t) => hasTypeFacts(t, 262144 /* EQUndefinedOrNull */) ? getGlobalNonNullableTypeInstantiation(t) : t);
64580
64604
  }
64581
64605
  }
64582
64606
  return reduced;
@@ -65913,14 +65937,14 @@ function createTypeChecker(host) {
65913
65937
  // the constituent based on its type facts. We use the strict subtype relation because it treats `object`
65914
65938
  // as a subtype of `{}`, and we need the type facts check because function types are subtypes of `object`,
65915
65939
  // but are classified as "function" according to `typeof`.
65916
- isTypeRelatedTo(t, impliedType, strictSubtypeRelation) ? getTypeFacts(t) & facts ? t : neverType : (
65940
+ isTypeRelatedTo(t, impliedType, strictSubtypeRelation) ? hasTypeFacts(t, facts) ? t : neverType : (
65917
65941
  // We next check if the consituent is a supertype of the implied type. If so, we substitute the implied
65918
65942
  // type. This handles top types like `unknown` and `{}`, and supertypes like `{ toString(): string }`.
65919
65943
  isTypeSubtypeOf(impliedType, t) ? impliedType : (
65920
65944
  // Neither the constituent nor the implied type is a subtype of the other, however their domains may still
65921
65945
  // overlap. For example, an unconstrained type parameter and type `string`. If the type facts indicate
65922
65946
  // possible overlap, we form an intersection. Otherwise, we eliminate the constituent.
65923
- getTypeFacts(t) & facts ? getIntersectionType([t, impliedType]) : neverType
65947
+ hasTypeFacts(t, facts) ? getIntersectionType([t, impliedType]) : neverType
65924
65948
  )
65925
65949
  )
65926
65950
  ));
@@ -65934,7 +65958,7 @@ function createTypeChecker(host) {
65934
65958
  const hasDefaultClause = clauseStart === clauseEnd || defaultIndex >= clauseStart && defaultIndex < clauseEnd;
65935
65959
  if (hasDefaultClause) {
65936
65960
  const notEqualFacts = getNotEqualFactsFromTypeofSwitch(clauseStart, clauseEnd, witnesses);
65937
- return filterType(type, (t) => (getTypeFacts(t) & notEqualFacts) === notEqualFacts);
65961
+ return filterType(type, (t) => getTypeFacts(t, notEqualFacts) === notEqualFacts);
65938
65962
  }
65939
65963
  const clauseWitnesses = witnesses.slice(clauseStart, clauseEnd);
65940
65964
  return getUnionType(map(clauseWitnesses, (text) => text ? narrowTypeByTypeName(type, text) : neverType));
@@ -66072,7 +66096,7 @@ function createTypeChecker(host) {
66072
66096
  false
66073
66097
  );
66074
66098
  }
66075
- if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) && !(getTypeFacts(predicate.type) & 65536 /* EQUndefined */)) {
66099
+ if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) && !hasTypeFacts(predicate.type, 65536 /* EQUndefined */)) {
66076
66100
  type = getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
66077
66101
  }
66078
66102
  const access = getDiscriminantPropertyAccess(predicateArgument, type);
@@ -66206,7 +66230,7 @@ function createTypeChecker(host) {
66206
66230
  reportCircularityError(declaration.symbol);
66207
66231
  return true;
66208
66232
  }
66209
- const containsUndefined = !!(getTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 16777216 /* IsUndefined */);
66233
+ const containsUndefined = !!hasTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */), 16777216 /* IsUndefined */);
66210
66234
  if (!popTypeResolution()) {
66211
66235
  reportCircularityError(declaration.symbol);
66212
66236
  return true;
@@ -66216,7 +66240,7 @@ function createTypeChecker(host) {
66216
66240
  return links.parameterInitializerContainsUndefined;
66217
66241
  }
66218
66242
  function removeOptionalityFromDeclaredType(declaredType, declaration) {
66219
- const removeUndefined = strictNullChecks && declaration.kind === 169 /* Parameter */ && declaration.initializer && getTypeFacts(declaredType) & 16777216 /* IsUndefined */ && !parameterInitializerContainsUndefined(declaration);
66243
+ const removeUndefined = strictNullChecks && declaration.kind === 169 /* Parameter */ && declaration.initializer && hasTypeFacts(declaredType, 16777216 /* IsUndefined */) && !parameterInitializerContainsUndefined(declaration);
66220
66244
  return removeUndefined ? getTypeWithFacts(declaredType, 524288 /* NEUndefined */) : declaredType;
66221
66245
  }
66222
66246
  function isConstraintPosition(type, node) {
@@ -69046,7 +69070,7 @@ function createTypeChecker(host) {
69046
69070
  return checkNonNullType(checkExpression(node), node);
69047
69071
  }
69048
69072
  function isNullableType(type) {
69049
- return !!(getTypeFacts(type) & 50331648 /* IsUndefinedOrNull */);
69073
+ return hasTypeFacts(type, 50331648 /* IsUndefinedOrNull */);
69050
69074
  }
69051
69075
  function getNonNullableTypeIfNeeded(type) {
69052
69076
  return isNullableType(type) ? getNonNullableType(type) : type;
@@ -69092,7 +69116,7 @@ function createTypeChecker(host) {
69092
69116
  error(node, Diagnostics.Object_is_of_type_unknown);
69093
69117
  return errorType;
69094
69118
  }
69095
- const facts = getTypeFacts(type);
69119
+ const facts = getTypeFacts(type, 50331648 /* IsUndefinedOrNull */);
69096
69120
  if (facts & 50331648 /* IsUndefinedOrNull */) {
69097
69121
  reportError(node, facts);
69098
69122
  const t = getNonNullableType(type);
@@ -72872,7 +72896,7 @@ function createTypeChecker(host) {
72872
72896
  if (operandConstraint.flags & 3 /* AnyOrUnknown */) {
72873
72897
  return (556800 /* AllTypeofNE */ & notEqualFacts) === 556800 /* AllTypeofNE */;
72874
72898
  }
72875
- return !someType(operandConstraint, (t) => (getTypeFacts(t) & notEqualFacts) === notEqualFacts);
72899
+ return !someType(operandConstraint, (t) => getTypeFacts(t, notEqualFacts) === notEqualFacts);
72876
72900
  }
72877
72901
  const type = checkExpressionCached(node.expression);
72878
72902
  if (!isLiteralType(type)) {
@@ -73190,14 +73214,15 @@ function createTypeChecker(host) {
73190
73214
  if (symbol) {
73191
73215
  if (isReadonlySymbol(symbol)) {
73192
73216
  error(expr, Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_read_only_property);
73217
+ } else {
73218
+ checkDeleteExpressionMustBeOptional(expr, symbol);
73193
73219
  }
73194
- checkDeleteExpressionMustBeOptional(expr, symbol);
73195
73220
  }
73196
73221
  return booleanType;
73197
73222
  }
73198
73223
  function checkDeleteExpressionMustBeOptional(expr, symbol) {
73199
73224
  const type = getTypeOfSymbol(symbol);
73200
- if (strictNullChecks && !(type.flags & (3 /* AnyOrUnknown */ | 131072 /* Never */)) && !(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ : getTypeFacts(type) & 16777216 /* IsUndefined */)) {
73225
+ if (strictNullChecks && !(type.flags & (3 /* AnyOrUnknown */ | 131072 /* Never */)) && !(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ : hasTypeFacts(type, 16777216 /* IsUndefined */))) {
73201
73226
  error(expr, Diagnostics.The_operand_of_a_delete_operator_must_be_optional);
73202
73227
  }
73203
73228
  }
@@ -73332,7 +73357,7 @@ function createTypeChecker(host) {
73332
73357
  return getUnaryResultType(operandType);
73333
73358
  case 54 /* ExclamationToken */:
73334
73359
  checkTruthinessOfType(operandType, node.operand);
73335
- const facts = getTypeFacts(operandType) & (4194304 /* Truthy */ | 8388608 /* Falsy */);
73360
+ const facts = getTypeFacts(operandType, 4194304 /* Truthy */ | 8388608 /* Falsy */);
73336
73361
  return facts === 4194304 /* Truthy */ ? falseType : facts === 8388608 /* Falsy */ ? trueType : booleanType;
73337
73362
  case 46 /* PlusPlusToken */:
73338
73363
  case 47 /* MinusMinusToken */:
@@ -73563,7 +73588,7 @@ function createTypeChecker(host) {
73563
73588
  if (exprOrAssignment.kind === 304 /* ShorthandPropertyAssignment */) {
73564
73589
  const prop = exprOrAssignment;
73565
73590
  if (prop.objectAssignmentInitializer) {
73566
- if (strictNullChecks && !(getTypeFacts(checkExpression(prop.objectAssignmentInitializer)) & 16777216 /* IsUndefined */)) {
73591
+ if (strictNullChecks && !hasTypeFacts(checkExpression(prop.objectAssignmentInitializer), 16777216 /* IsUndefined */)) {
73567
73592
  sourceType = getTypeWithFacts(sourceType, 524288 /* NEUndefined */);
73568
73593
  }
73569
73594
  checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, checkMode);
@@ -73975,7 +74000,7 @@ function createTypeChecker(host) {
73975
74000
  return checkInExpression(left, right, leftType, rightType);
73976
74001
  case 56 /* AmpersandAmpersandToken */:
73977
74002
  case 77 /* AmpersandAmpersandEqualsToken */: {
73978
- const resultType2 = getTypeFacts(leftType) & 4194304 /* Truthy */ ? getUnionType([extractDefinitelyFalsyTypes(strictNullChecks ? leftType : getBaseTypeOfLiteralType(rightType)), rightType]) : leftType;
74003
+ const resultType2 = hasTypeFacts(leftType, 4194304 /* Truthy */) ? getUnionType([extractDefinitelyFalsyTypes(strictNullChecks ? leftType : getBaseTypeOfLiteralType(rightType)), rightType]) : leftType;
73979
74004
  if (operator === 77 /* AmpersandAmpersandEqualsToken */) {
73980
74005
  checkAssignmentOperator(rightType);
73981
74006
  }
@@ -73983,7 +74008,7 @@ function createTypeChecker(host) {
73983
74008
  }
73984
74009
  case 57 /* BarBarToken */:
73985
74010
  case 76 /* BarBarEqualsToken */: {
73986
- const resultType2 = getTypeFacts(leftType) & 8388608 /* Falsy */ ? getUnionType([getNonNullableType(removeDefinitelyFalsyTypes(leftType)), rightType], 2 /* Subtype */) : leftType;
74011
+ const resultType2 = hasTypeFacts(leftType, 8388608 /* Falsy */) ? getUnionType([getNonNullableType(removeDefinitelyFalsyTypes(leftType)), rightType], 2 /* Subtype */) : leftType;
73987
74012
  if (operator === 76 /* BarBarEqualsToken */) {
73988
74013
  checkAssignmentOperator(rightType);
73989
74014
  }
@@ -73991,7 +74016,7 @@ function createTypeChecker(host) {
73991
74016
  }
73992
74017
  case 61 /* QuestionQuestionToken */:
73993
74018
  case 78 /* QuestionQuestionEqualsToken */: {
73994
- const resultType2 = getTypeFacts(leftType) & 262144 /* EQUndefinedOrNull */ ? getUnionType([getNonNullableType(leftType), rightType], 2 /* Subtype */) : leftType;
74019
+ const resultType2 = hasTypeFacts(leftType, 262144 /* EQUndefinedOrNull */) ? getUnionType([getNonNullableType(leftType), rightType], 2 /* Subtype */) : leftType;
73995
74020
  if (operator === 78 /* QuestionQuestionEqualsToken */) {
73996
74021
  checkAssignmentOperator(rightType);
73997
74022
  }
@@ -77308,7 +77333,7 @@ function createTypeChecker(host) {
77308
77333
  }
77309
77334
  const type = location === condExpr2 ? condType : checkTruthinessExpression(location);
77310
77335
  const isPropertyExpressionCast = isPropertyAccessExpression(location) && isTypeAssertion(location.expression);
77311
- if (!(getTypeFacts(type) & 4194304 /* Truthy */) || isPropertyExpressionCast)
77336
+ if (!hasTypeFacts(type, 4194304 /* Truthy */) || isPropertyExpressionCast)
77312
77337
  return;
77313
77338
  const callSignatures = getSignaturesOfType(type, 0 /* Call */);
77314
77339
  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.20230823`;
2336
+ var version = `${versionMajorMinor}.0-insiders.20230824`;
2337
2337
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2338
2338
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2339
2339
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -15609,7 +15609,7 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize(
15609
15609
  "defineProperty",
15610
15610
  "deleteProperty",
15611
15611
  "get",
15612
- " getOwnPropertyDescriptor",
15612
+ "getOwnPropertyDescriptor",
15613
15613
  "getPrototypeOf",
15614
15614
  "has",
15615
15615
  "isExtensible",
@@ -34369,7 +34369,9 @@ var Parser;
34369
34369
  let dotDotDotToken;
34370
34370
  let expression;
34371
34371
  if (token() !== 20 /* CloseBraceToken */) {
34372
- dotDotDotToken = parseOptionalToken(26 /* DotDotDotToken */);
34372
+ if (!inExpressionContext) {
34373
+ dotDotDotToken = parseOptionalToken(26 /* DotDotDotToken */);
34374
+ }
34373
34375
  expression = parseExpression();
34374
34376
  }
34375
34377
  if (inExpressionContext) {
@@ -49126,6 +49128,9 @@ function createTypeChecker(host) {
49126
49128
  const sourceFiles = host.getSourceFiles();
49127
49129
  return sourceFiles.indexOf(declarationFile) <= sourceFiles.indexOf(useFile);
49128
49130
  }
49131
+ if (!!(usage.flags & 16777216 /* JSDoc */) || isInTypeQuery(usage) || isInAmbientOrTypeNode(usage)) {
49132
+ return true;
49133
+ }
49129
49134
  if (declaration.pos <= usage.pos && !(isPropertyDeclaration(declaration) && isThisProperty(usage.parent) && !declaration.initializer && !declaration.exclamationToken)) {
49130
49135
  if (declaration.kind === 208 /* BindingElement */) {
49131
49136
  const errorBindingElement = getAncestor(usage, 208 /* BindingElement */);
@@ -49155,9 +49160,6 @@ function createTypeChecker(host) {
49155
49160
  if (usage.kind === 277 /* ExportAssignment */ && usage.isExportEquals) {
49156
49161
  return true;
49157
49162
  }
49158
- if (!!(usage.flags & 16777216 /* JSDoc */) || isInTypeQuery(usage) || isInAmbientOrTypeNode(usage)) {
49159
- return true;
49160
- }
49161
49163
  if (isUsedInFunctionOrInstanceProperty(usage, declaration)) {
49162
49164
  if (emitStandardClassFields && getContainingClass(declaration) && (isPropertyDeclaration(declaration) || isParameterPropertyDeclaration(declaration, declaration.parent))) {
49163
49165
  return !isPropertyImmediatelyReferencedWithinDeclaration(
@@ -55367,8 +55369,8 @@ function createTypeChecker(host) {
55367
55369
  });
55368
55370
  }
55369
55371
  });
55370
- Debug.assert(setter && isFunctionLikeDeclaration(setter));
55371
- const paramSymbol = getSignatureFromDeclaration(setter).parameters[0];
55372
+ Debug.assert(!!setter);
55373
+ const paramSymbol = isFunctionLikeDeclaration(setter) ? getSignatureFromDeclaration(setter).parameters[0] : void 0;
55372
55374
  result.push(setTextRange(
55373
55375
  factory.createSetAccessorDeclaration(
55374
55376
  factory.createModifiersFromModifierFlags(flag),
@@ -56144,7 +56146,7 @@ function createTypeChecker(host) {
56144
56146
  const pattern = declaration.parent;
56145
56147
  if (strictNullChecks && declaration.flags & 33554432 /* Ambient */ && isParameterDeclaration(declaration)) {
56146
56148
  parentType = getNonNullableType(parentType);
56147
- } else if (strictNullChecks && pattern.parent.initializer && !(getTypeFacts(getTypeOfInitializer(pattern.parent.initializer)) & 65536 /* EQUndefined */)) {
56149
+ } else if (strictNullChecks && pattern.parent.initializer && !hasTypeFacts(getTypeOfInitializer(pattern.parent.initializer), 65536 /* EQUndefined */)) {
56148
56150
  parentType = getTypeWithFacts(parentType, 524288 /* NEUndefined */);
56149
56151
  }
56150
56152
  let type;
@@ -56187,7 +56189,7 @@ function createTypeChecker(host) {
56187
56189
  return type;
56188
56190
  }
56189
56191
  if (getEffectiveTypeAnnotationNode(walkUpBindingElementsAndPatterns(declaration))) {
56190
- return strictNullChecks && !(getTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 16777216 /* IsUndefined */) ? getNonUndefinedType(type) : type;
56192
+ return strictNullChecks && !hasTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */), 16777216 /* IsUndefined */) ? getNonUndefinedType(type) : type;
56191
56193
  }
56192
56194
  return widenTypeInferredFromInitializer(declaration, getUnionType([getNonUndefinedType(type), checkDeclarationInitializer(declaration, 0 /* Normal */)], 2 /* Subtype */));
56193
56195
  }
@@ -64295,7 +64297,7 @@ function createTypeChecker(host) {
64295
64297
  if (sourceType && targetType) {
64296
64298
  const sourceSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
64297
64299
  const targetSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(targetType));
64298
- const callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) && (getTypeFacts(sourceType) & 50331648 /* IsUndefinedOrNull */) === (getTypeFacts(targetType) & 50331648 /* IsUndefinedOrNull */);
64300
+ const callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) && getTypeFacts(sourceType, 50331648 /* IsUndefinedOrNull */) === getTypeFacts(targetType, 50331648 /* IsUndefinedOrNull */);
64299
64301
  let related = callbacks ? compareSignaturesRelated(targetSig, sourceSig, checkMode & 8 /* StrictArity */ | (strictVariance ? 2 /* StrictCallback */ : 1 /* BivariantCallback */), reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) : !(checkMode & 3 /* Callback */) && !strictVariance && compareTypes(
64300
64302
  sourceType,
64301
64303
  targetType,
@@ -65931,6 +65933,9 @@ function createTypeChecker(host) {
65931
65933
  }
65932
65934
  instantiateType(source2, reportUnreliableMapper);
65933
65935
  }
65936
+ if (isTemplateLiteralTypeWithSinglePlaceholderAndNoExtraTexts(target2) && isTypeAssignableTo(source2, stringType) && isTypeAssignableTo(target2.types[0], stringType)) {
65937
+ return isRelatedTo(source2, target2.types[0], 3 /* Both */, reportErrors2);
65938
+ }
65934
65939
  if (isTypeMatchedByTemplateLiteralType(source2, target2)) {
65935
65940
  return -1 /* True */;
65936
65941
  }
@@ -65981,6 +65986,9 @@ function createTypeChecker(host) {
65981
65986
  }
65982
65987
  } else if (sourceFlags & 134217728 /* TemplateLiteral */ && !(targetFlags & 524288 /* Object */)) {
65983
65988
  if (!(targetFlags & 134217728 /* TemplateLiteral */)) {
65989
+ if (isTemplateLiteralTypeWithSinglePlaceholderAndNoExtraTexts(source2) && isTypeAssignableTo(source2.types[0], stringType) && isTypeAssignableTo(target2, stringType)) {
65990
+ return isRelatedTo(source2.types[0], target2, 3 /* Both */, reportErrors2);
65991
+ }
65984
65992
  const constraint = getBaseConstraintOfType(source2);
65985
65993
  if (constraint && constraint !== source2 && (result2 = isRelatedTo(constraint, target2, 1 /* Source */, reportErrors2))) {
65986
65994
  return result2;
@@ -67452,7 +67460,7 @@ function createTypeChecker(host) {
67452
67460
  return value.base10Value === "0";
67453
67461
  }
67454
67462
  function removeDefinitelyFalsyTypes(type) {
67455
- return filterType(type, (t) => !!(getTypeFacts(t) & 4194304 /* Truthy */));
67463
+ return filterType(type, (t) => hasTypeFacts(t, 4194304 /* Truthy */));
67456
67464
  }
67457
67465
  function extractDefinitelyFalsyTypes(type) {
67458
67466
  return mapType(type, getDefinitelyFalsyPartOfType);
@@ -68105,6 +68113,13 @@ function createTypeChecker(host) {
68105
68113
  }
68106
68114
  return false;
68107
68115
  }
68116
+ function isTemplateLiteralTypeWithSinglePlaceholderAndNoExtraTexts(type) {
68117
+ if (!(type.flags & 134217728 /* TemplateLiteral */)) {
68118
+ return false;
68119
+ }
68120
+ const texts = type.texts;
68121
+ return texts.length === 2 && texts[0] === "" && texts[1] === "";
68122
+ }
68108
68123
  function isValidTypeForTemplateLiteralPlaceholder(source, target) {
68109
68124
  if (source === target || target.flags & (1 /* Any */ | 4 /* String */)) {
68110
68125
  return true;
@@ -68124,9 +68139,8 @@ function createTypeChecker(host) {
68124
68139
  false
68125
68140
  ) || target.flags & (512 /* BooleanLiteral */ | 98304 /* Nullable */) && value === target.intrinsicName || target.flags & 268435456 /* StringMapping */ && isMemberOfStringMapping(getStringLiteralType(value), target) || target.flags & 134217728 /* TemplateLiteral */ && isTypeMatchedByTemplateLiteralType(source, target));
68126
68141
  }
68127
- if (source.flags & 134217728 /* TemplateLiteral */) {
68128
- const texts = source.texts;
68129
- return texts.length === 2 && texts[0] === "" && texts[1] === "" && isTypeAssignableTo(source.types[0], target);
68142
+ if (isTemplateLiteralTypeWithSinglePlaceholderAndNoExtraTexts(source)) {
68143
+ return isTypeAssignableTo(source.types[0], target);
68130
68144
  }
68131
68145
  return isTypeAssignableTo(source, target);
68132
68146
  }
@@ -69197,7 +69211,13 @@ function createTypeChecker(host) {
69197
69211
  const resolved = resolveStructuredTypeMembers(type);
69198
69212
  return !!(resolved.callSignatures.length || resolved.constructSignatures.length || resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType));
69199
69213
  }
69200
- function getTypeFacts(type) {
69214
+ function getTypeFacts(type, mask2) {
69215
+ return getTypeFactsWorker(type, mask2) & mask2;
69216
+ }
69217
+ function hasTypeFacts(type, mask2) {
69218
+ return getTypeFacts(type, mask2) !== 0;
69219
+ }
69220
+ function getTypeFactsWorker(type, callerOnlyNeeds) {
69201
69221
  if (type.flags & (2097152 /* Intersection */ | 465829888 /* Instantiable */)) {
69202
69222
  type = getBaseConstraintOfType(type) || unknownType;
69203
69223
  }
@@ -69230,6 +69250,10 @@ function createTypeChecker(host) {
69230
69250
  return strictNullChecks ? type === falseType || type === regularFalseType ? 12121864 /* FalseStrictFacts */ : 7927560 /* TrueStrictFacts */ : type === falseType || type === regularFalseType ? 12580616 /* FalseFacts */ : 16774920 /* TrueFacts */;
69231
69251
  }
69232
69252
  if (flags & 524288 /* Object */) {
69253
+ const possibleFacts = strictNullChecks ? 83427327 /* EmptyObjectStrictFacts */ | 7880640 /* FunctionStrictFacts */ | 7888800 /* ObjectStrictFacts */ : 83886079 /* EmptyObjectFacts */ | 16728e3 /* FunctionFacts */ | 16736160 /* ObjectFacts */;
69254
+ if ((callerOnlyNeeds & possibleFacts) === 0) {
69255
+ return 0;
69256
+ }
69233
69257
  return getObjectFlags(type) & 16 /* Anonymous */ && isEmptyObjectType(type) ? strictNullChecks ? 83427327 /* EmptyObjectStrictFacts */ : 83886079 /* EmptyObjectFacts */ : isFunctionObjectType(type) ? strictNullChecks ? 7880640 /* FunctionStrictFacts */ : 16728e3 /* FunctionFacts */ : strictNullChecks ? 7888800 /* ObjectStrictFacts */ : 16736160 /* ObjectFacts */;
69234
69258
  }
69235
69259
  if (flags & 16384 /* Void */) {
@@ -69251,20 +69275,20 @@ function createTypeChecker(host) {
69251
69275
  return 0 /* None */;
69252
69276
  }
69253
69277
  if (flags & 1048576 /* Union */) {
69254
- return reduceLeft(type.types, (facts, t) => facts | getTypeFacts(t), 0 /* None */);
69278
+ return reduceLeft(type.types, (facts, t) => facts | getTypeFactsWorker(t, callerOnlyNeeds), 0 /* None */);
69255
69279
  }
69256
69280
  if (flags & 2097152 /* Intersection */) {
69257
- return getIntersectionTypeFacts(type);
69281
+ return getIntersectionTypeFacts(type, callerOnlyNeeds);
69258
69282
  }
69259
69283
  return 83886079 /* UnknownFacts */;
69260
69284
  }
69261
- function getIntersectionTypeFacts(type) {
69285
+ function getIntersectionTypeFacts(type, callerOnlyNeeds) {
69262
69286
  const ignoreObjects = maybeTypeOfKind(type, 402784252 /* Primitive */);
69263
69287
  let oredFacts = 0 /* None */;
69264
69288
  let andedFacts = 134217727 /* All */;
69265
69289
  for (const t of type.types) {
69266
69290
  if (!(ignoreObjects && t.flags & 524288 /* Object */)) {
69267
- const f = getTypeFacts(t);
69291
+ const f = getTypeFactsWorker(t, callerOnlyNeeds);
69268
69292
  oredFacts |= f;
69269
69293
  andedFacts &= f;
69270
69294
  }
@@ -69272,19 +69296,19 @@ function createTypeChecker(host) {
69272
69296
  return oredFacts & 8256 /* OrFactsMask */ | andedFacts & 134209471 /* AndFactsMask */;
69273
69297
  }
69274
69298
  function getTypeWithFacts(type, include) {
69275
- return filterType(type, (t) => (getTypeFacts(t) & include) !== 0);
69299
+ return filterType(type, (t) => hasTypeFacts(t, include));
69276
69300
  }
69277
69301
  function getAdjustedTypeWithFacts(type, facts) {
69278
69302
  const reduced = recombineUnknownType(getTypeWithFacts(strictNullChecks && type.flags & 2 /* Unknown */ ? unknownUnionType : type, facts));
69279
69303
  if (strictNullChecks) {
69280
69304
  switch (facts) {
69281
69305
  case 524288 /* NEUndefined */:
69282
- return mapType(reduced, (t) => getTypeFacts(t) & 65536 /* EQUndefined */ ? getIntersectionType([t, getTypeFacts(t) & 131072 /* EQNull */ && !maybeTypeOfKind(reduced, 65536 /* Null */) ? getUnionType([emptyObjectType, nullType]) : emptyObjectType]) : t);
69306
+ return mapType(reduced, (t) => hasTypeFacts(t, 65536 /* EQUndefined */) ? getIntersectionType([t, hasTypeFacts(t, 131072 /* EQNull */) && !maybeTypeOfKind(reduced, 65536 /* Null */) ? getUnionType([emptyObjectType, nullType]) : emptyObjectType]) : t);
69283
69307
  case 1048576 /* NENull */:
69284
- return mapType(reduced, (t) => getTypeFacts(t) & 131072 /* EQNull */ ? getIntersectionType([t, getTypeFacts(t) & 65536 /* EQUndefined */ && !maybeTypeOfKind(reduced, 32768 /* Undefined */) ? getUnionType([emptyObjectType, undefinedType]) : emptyObjectType]) : t);
69308
+ return mapType(reduced, (t) => hasTypeFacts(t, 131072 /* EQNull */) ? getIntersectionType([t, hasTypeFacts(t, 65536 /* EQUndefined */) && !maybeTypeOfKind(reduced, 32768 /* Undefined */) ? getUnionType([emptyObjectType, undefinedType]) : emptyObjectType]) : t);
69285
69309
  case 2097152 /* NEUndefinedOrNull */:
69286
69310
  case 4194304 /* Truthy */:
69287
- return mapType(reduced, (t) => getTypeFacts(t) & 262144 /* EQUndefinedOrNull */ ? getGlobalNonNullableTypeInstantiation(t) : t);
69311
+ return mapType(reduced, (t) => hasTypeFacts(t, 262144 /* EQUndefinedOrNull */) ? getGlobalNonNullableTypeInstantiation(t) : t);
69288
69312
  }
69289
69313
  }
69290
69314
  return reduced;
@@ -70621,14 +70645,14 @@ function createTypeChecker(host) {
70621
70645
  // the constituent based on its type facts. We use the strict subtype relation because it treats `object`
70622
70646
  // as a subtype of `{}`, and we need the type facts check because function types are subtypes of `object`,
70623
70647
  // but are classified as "function" according to `typeof`.
70624
- isTypeRelatedTo(t, impliedType, strictSubtypeRelation) ? getTypeFacts(t) & facts ? t : neverType : (
70648
+ isTypeRelatedTo(t, impliedType, strictSubtypeRelation) ? hasTypeFacts(t, facts) ? t : neverType : (
70625
70649
  // We next check if the consituent is a supertype of the implied type. If so, we substitute the implied
70626
70650
  // type. This handles top types like `unknown` and `{}`, and supertypes like `{ toString(): string }`.
70627
70651
  isTypeSubtypeOf(impliedType, t) ? impliedType : (
70628
70652
  // Neither the constituent nor the implied type is a subtype of the other, however their domains may still
70629
70653
  // overlap. For example, an unconstrained type parameter and type `string`. If the type facts indicate
70630
70654
  // possible overlap, we form an intersection. Otherwise, we eliminate the constituent.
70631
- getTypeFacts(t) & facts ? getIntersectionType([t, impliedType]) : neverType
70655
+ hasTypeFacts(t, facts) ? getIntersectionType([t, impliedType]) : neverType
70632
70656
  )
70633
70657
  )
70634
70658
  ));
@@ -70642,7 +70666,7 @@ function createTypeChecker(host) {
70642
70666
  const hasDefaultClause = clauseStart === clauseEnd || defaultIndex >= clauseStart && defaultIndex < clauseEnd;
70643
70667
  if (hasDefaultClause) {
70644
70668
  const notEqualFacts = getNotEqualFactsFromTypeofSwitch(clauseStart, clauseEnd, witnesses);
70645
- return filterType(type, (t) => (getTypeFacts(t) & notEqualFacts) === notEqualFacts);
70669
+ return filterType(type, (t) => getTypeFacts(t, notEqualFacts) === notEqualFacts);
70646
70670
  }
70647
70671
  const clauseWitnesses = witnesses.slice(clauseStart, clauseEnd);
70648
70672
  return getUnionType(map(clauseWitnesses, (text) => text ? narrowTypeByTypeName(type, text) : neverType));
@@ -70780,7 +70804,7 @@ function createTypeChecker(host) {
70780
70804
  false
70781
70805
  );
70782
70806
  }
70783
- if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) && !(getTypeFacts(predicate.type) & 65536 /* EQUndefined */)) {
70807
+ if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) && !hasTypeFacts(predicate.type, 65536 /* EQUndefined */)) {
70784
70808
  type = getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
70785
70809
  }
70786
70810
  const access = getDiscriminantPropertyAccess(predicateArgument, type);
@@ -70914,7 +70938,7 @@ function createTypeChecker(host) {
70914
70938
  reportCircularityError(declaration.symbol);
70915
70939
  return true;
70916
70940
  }
70917
- const containsUndefined = !!(getTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 16777216 /* IsUndefined */);
70941
+ const containsUndefined = !!hasTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */), 16777216 /* IsUndefined */);
70918
70942
  if (!popTypeResolution()) {
70919
70943
  reportCircularityError(declaration.symbol);
70920
70944
  return true;
@@ -70924,7 +70948,7 @@ function createTypeChecker(host) {
70924
70948
  return links.parameterInitializerContainsUndefined;
70925
70949
  }
70926
70950
  function removeOptionalityFromDeclaredType(declaredType, declaration) {
70927
- const removeUndefined = strictNullChecks && declaration.kind === 169 /* Parameter */ && declaration.initializer && getTypeFacts(declaredType) & 16777216 /* IsUndefined */ && !parameterInitializerContainsUndefined(declaration);
70951
+ const removeUndefined = strictNullChecks && declaration.kind === 169 /* Parameter */ && declaration.initializer && hasTypeFacts(declaredType, 16777216 /* IsUndefined */) && !parameterInitializerContainsUndefined(declaration);
70928
70952
  return removeUndefined ? getTypeWithFacts(declaredType, 524288 /* NEUndefined */) : declaredType;
70929
70953
  }
70930
70954
  function isConstraintPosition(type, node) {
@@ -73754,7 +73778,7 @@ function createTypeChecker(host) {
73754
73778
  return checkNonNullType(checkExpression(node), node);
73755
73779
  }
73756
73780
  function isNullableType(type) {
73757
- return !!(getTypeFacts(type) & 50331648 /* IsUndefinedOrNull */);
73781
+ return hasTypeFacts(type, 50331648 /* IsUndefinedOrNull */);
73758
73782
  }
73759
73783
  function getNonNullableTypeIfNeeded(type) {
73760
73784
  return isNullableType(type) ? getNonNullableType(type) : type;
@@ -73800,7 +73824,7 @@ function createTypeChecker(host) {
73800
73824
  error2(node, Diagnostics.Object_is_of_type_unknown);
73801
73825
  return errorType;
73802
73826
  }
73803
- const facts = getTypeFacts(type);
73827
+ const facts = getTypeFacts(type, 50331648 /* IsUndefinedOrNull */);
73804
73828
  if (facts & 50331648 /* IsUndefinedOrNull */) {
73805
73829
  reportError(node, facts);
73806
73830
  const t = getNonNullableType(type);
@@ -77580,7 +77604,7 @@ function createTypeChecker(host) {
77580
77604
  if (operandConstraint.flags & 3 /* AnyOrUnknown */) {
77581
77605
  return (556800 /* AllTypeofNE */ & notEqualFacts) === 556800 /* AllTypeofNE */;
77582
77606
  }
77583
- return !someType(operandConstraint, (t) => (getTypeFacts(t) & notEqualFacts) === notEqualFacts);
77607
+ return !someType(operandConstraint, (t) => getTypeFacts(t, notEqualFacts) === notEqualFacts);
77584
77608
  }
77585
77609
  const type = checkExpressionCached(node.expression);
77586
77610
  if (!isLiteralType(type)) {
@@ -77898,14 +77922,15 @@ function createTypeChecker(host) {
77898
77922
  if (symbol) {
77899
77923
  if (isReadonlySymbol(symbol)) {
77900
77924
  error2(expr, Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_read_only_property);
77925
+ } else {
77926
+ checkDeleteExpressionMustBeOptional(expr, symbol);
77901
77927
  }
77902
- checkDeleteExpressionMustBeOptional(expr, symbol);
77903
77928
  }
77904
77929
  return booleanType;
77905
77930
  }
77906
77931
  function checkDeleteExpressionMustBeOptional(expr, symbol) {
77907
77932
  const type = getTypeOfSymbol(symbol);
77908
- if (strictNullChecks && !(type.flags & (3 /* AnyOrUnknown */ | 131072 /* Never */)) && !(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ : getTypeFacts(type) & 16777216 /* IsUndefined */)) {
77933
+ if (strictNullChecks && !(type.flags & (3 /* AnyOrUnknown */ | 131072 /* Never */)) && !(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ : hasTypeFacts(type, 16777216 /* IsUndefined */))) {
77909
77934
  error2(expr, Diagnostics.The_operand_of_a_delete_operator_must_be_optional);
77910
77935
  }
77911
77936
  }
@@ -78040,7 +78065,7 @@ function createTypeChecker(host) {
78040
78065
  return getUnaryResultType(operandType);
78041
78066
  case 54 /* ExclamationToken */:
78042
78067
  checkTruthinessOfType(operandType, node.operand);
78043
- const facts = getTypeFacts(operandType) & (4194304 /* Truthy */ | 8388608 /* Falsy */);
78068
+ const facts = getTypeFacts(operandType, 4194304 /* Truthy */ | 8388608 /* Falsy */);
78044
78069
  return facts === 4194304 /* Truthy */ ? falseType : facts === 8388608 /* Falsy */ ? trueType : booleanType;
78045
78070
  case 46 /* PlusPlusToken */:
78046
78071
  case 47 /* MinusMinusToken */:
@@ -78271,7 +78296,7 @@ function createTypeChecker(host) {
78271
78296
  if (exprOrAssignment.kind === 304 /* ShorthandPropertyAssignment */) {
78272
78297
  const prop = exprOrAssignment;
78273
78298
  if (prop.objectAssignmentInitializer) {
78274
- if (strictNullChecks && !(getTypeFacts(checkExpression(prop.objectAssignmentInitializer)) & 16777216 /* IsUndefined */)) {
78299
+ if (strictNullChecks && !hasTypeFacts(checkExpression(prop.objectAssignmentInitializer), 16777216 /* IsUndefined */)) {
78275
78300
  sourceType = getTypeWithFacts(sourceType, 524288 /* NEUndefined */);
78276
78301
  }
78277
78302
  checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, checkMode);
@@ -78683,7 +78708,7 @@ function createTypeChecker(host) {
78683
78708
  return checkInExpression(left, right, leftType, rightType);
78684
78709
  case 56 /* AmpersandAmpersandToken */:
78685
78710
  case 77 /* AmpersandAmpersandEqualsToken */: {
78686
- const resultType2 = getTypeFacts(leftType) & 4194304 /* Truthy */ ? getUnionType([extractDefinitelyFalsyTypes(strictNullChecks ? leftType : getBaseTypeOfLiteralType(rightType)), rightType]) : leftType;
78711
+ const resultType2 = hasTypeFacts(leftType, 4194304 /* Truthy */) ? getUnionType([extractDefinitelyFalsyTypes(strictNullChecks ? leftType : getBaseTypeOfLiteralType(rightType)), rightType]) : leftType;
78687
78712
  if (operator === 77 /* AmpersandAmpersandEqualsToken */) {
78688
78713
  checkAssignmentOperator(rightType);
78689
78714
  }
@@ -78691,7 +78716,7 @@ function createTypeChecker(host) {
78691
78716
  }
78692
78717
  case 57 /* BarBarToken */:
78693
78718
  case 76 /* BarBarEqualsToken */: {
78694
- const resultType2 = getTypeFacts(leftType) & 8388608 /* Falsy */ ? getUnionType([getNonNullableType(removeDefinitelyFalsyTypes(leftType)), rightType], 2 /* Subtype */) : leftType;
78719
+ const resultType2 = hasTypeFacts(leftType, 8388608 /* Falsy */) ? getUnionType([getNonNullableType(removeDefinitelyFalsyTypes(leftType)), rightType], 2 /* Subtype */) : leftType;
78695
78720
  if (operator === 76 /* BarBarEqualsToken */) {
78696
78721
  checkAssignmentOperator(rightType);
78697
78722
  }
@@ -78699,7 +78724,7 @@ function createTypeChecker(host) {
78699
78724
  }
78700
78725
  case 61 /* QuestionQuestionToken */:
78701
78726
  case 78 /* QuestionQuestionEqualsToken */: {
78702
- const resultType2 = getTypeFacts(leftType) & 262144 /* EQUndefinedOrNull */ ? getUnionType([getNonNullableType(leftType), rightType], 2 /* Subtype */) : leftType;
78727
+ const resultType2 = hasTypeFacts(leftType, 262144 /* EQUndefinedOrNull */) ? getUnionType([getNonNullableType(leftType), rightType], 2 /* Subtype */) : leftType;
78703
78728
  if (operator === 78 /* QuestionQuestionEqualsToken */) {
78704
78729
  checkAssignmentOperator(rightType);
78705
78730
  }
@@ -82016,7 +82041,7 @@ function createTypeChecker(host) {
82016
82041
  }
82017
82042
  const type = location === condExpr2 ? condType : checkTruthinessExpression(location);
82018
82043
  const isPropertyExpressionCast = isPropertyAccessExpression(location) && isTypeAssertion(location.expression);
82019
- if (!(getTypeFacts(type) & 4194304 /* Truthy */) || isPropertyExpressionCast)
82044
+ if (!hasTypeFacts(type, 4194304 /* Truthy */) || isPropertyExpressionCast)
82020
82045
  return;
82021
82046
  const callSignatures = getSignaturesOfType(type, 0 /* Call */);
82022
82047
  const isPromise = !!getAwaitedTypeOfPromise(type);
@@ -167714,11 +167739,12 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symb
167714
167739
  if (documentation.length === 0 && isIdentifier(location) && symbol.valueDeclaration && isBindingElement(symbol.valueDeclaration)) {
167715
167740
  const declaration = symbol.valueDeclaration;
167716
167741
  const parent2 = declaration.parent;
167717
- if (isIdentifier(declaration.name) && isObjectBindingPattern(parent2)) {
167718
- const name = getTextOfIdentifierOrLiteral(declaration.name);
167742
+ const name = declaration.propertyName || declaration.name;
167743
+ if (isIdentifier(name) && isObjectBindingPattern(parent2)) {
167744
+ const propertyName = getTextOfIdentifierOrLiteral(name);
167719
167745
  const objectType = typeChecker.getTypeAtLocation(parent2);
167720
167746
  documentation = firstDefined(objectType.isUnion() ? objectType.types : [objectType], (t) => {
167721
- const prop = t.getProperty(name);
167747
+ const prop = t.getProperty(propertyName);
167722
167748
  return prop ? prop.getDocumentationComment(typeChecker) : void 0;
167723
167749
  }) || emptyArray;
167724
167750
  }
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.20230823`;
38
+ version = `${versionMajorMinor}.0-insiders.20230824`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -18985,7 +18985,7 @@ ${lanes.join("\n")}
18985
18985
  "defineProperty",
18986
18986
  "deleteProperty",
18987
18987
  "get",
18988
- " getOwnPropertyDescriptor",
18988
+ "getOwnPropertyDescriptor",
18989
18989
  "getPrototypeOf",
18990
18990
  "has",
18991
18991
  "isExtensible",
@@ -32436,7 +32436,9 @@ ${lanes.join("\n")}
32436
32436
  let dotDotDotToken;
32437
32437
  let expression;
32438
32438
  if (token() !== 20 /* CloseBraceToken */) {
32439
- dotDotDotToken = parseOptionalToken(26 /* DotDotDotToken */);
32439
+ if (!inExpressionContext) {
32440
+ dotDotDotToken = parseOptionalToken(26 /* DotDotDotToken */);
32441
+ }
32440
32442
  expression = parseExpression();
32441
32443
  }
32442
32444
  if (inExpressionContext) {
@@ -46887,6 +46889,9 @@ ${lanes.join("\n")}
46887
46889
  const sourceFiles = host.getSourceFiles();
46888
46890
  return sourceFiles.indexOf(declarationFile) <= sourceFiles.indexOf(useFile);
46889
46891
  }
46892
+ if (!!(usage.flags & 16777216 /* JSDoc */) || isInTypeQuery(usage) || isInAmbientOrTypeNode(usage)) {
46893
+ return true;
46894
+ }
46890
46895
  if (declaration.pos <= usage.pos && !(isPropertyDeclaration(declaration) && isThisProperty(usage.parent) && !declaration.initializer && !declaration.exclamationToken)) {
46891
46896
  if (declaration.kind === 208 /* BindingElement */) {
46892
46897
  const errorBindingElement = getAncestor(usage, 208 /* BindingElement */);
@@ -46916,9 +46921,6 @@ ${lanes.join("\n")}
46916
46921
  if (usage.kind === 277 /* ExportAssignment */ && usage.isExportEquals) {
46917
46922
  return true;
46918
46923
  }
46919
- if (!!(usage.flags & 16777216 /* JSDoc */) || isInTypeQuery(usage) || isInAmbientOrTypeNode(usage)) {
46920
- return true;
46921
- }
46922
46924
  if (isUsedInFunctionOrInstanceProperty(usage, declaration)) {
46923
46925
  if (emitStandardClassFields && getContainingClass(declaration) && (isPropertyDeclaration(declaration) || isParameterPropertyDeclaration(declaration, declaration.parent))) {
46924
46926
  return !isPropertyImmediatelyReferencedWithinDeclaration(
@@ -53128,8 +53130,8 @@ ${lanes.join("\n")}
53128
53130
  });
53129
53131
  }
53130
53132
  });
53131
- Debug.assert(setter && isFunctionLikeDeclaration(setter));
53132
- const paramSymbol = getSignatureFromDeclaration(setter).parameters[0];
53133
+ Debug.assert(!!setter);
53134
+ const paramSymbol = isFunctionLikeDeclaration(setter) ? getSignatureFromDeclaration(setter).parameters[0] : void 0;
53133
53135
  result.push(setTextRange(
53134
53136
  factory.createSetAccessorDeclaration(
53135
53137
  factory.createModifiersFromModifierFlags(flag),
@@ -53905,7 +53907,7 @@ ${lanes.join("\n")}
53905
53907
  const pattern = declaration.parent;
53906
53908
  if (strictNullChecks && declaration.flags & 33554432 /* Ambient */ && isParameterDeclaration(declaration)) {
53907
53909
  parentType = getNonNullableType(parentType);
53908
- } else if (strictNullChecks && pattern.parent.initializer && !(getTypeFacts(getTypeOfInitializer(pattern.parent.initializer)) & 65536 /* EQUndefined */)) {
53910
+ } else if (strictNullChecks && pattern.parent.initializer && !hasTypeFacts(getTypeOfInitializer(pattern.parent.initializer), 65536 /* EQUndefined */)) {
53909
53911
  parentType = getTypeWithFacts(parentType, 524288 /* NEUndefined */);
53910
53912
  }
53911
53913
  let type;
@@ -53948,7 +53950,7 @@ ${lanes.join("\n")}
53948
53950
  return type;
53949
53951
  }
53950
53952
  if (getEffectiveTypeAnnotationNode(walkUpBindingElementsAndPatterns(declaration))) {
53951
- return strictNullChecks && !(getTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 16777216 /* IsUndefined */) ? getNonUndefinedType(type) : type;
53953
+ return strictNullChecks && !hasTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */), 16777216 /* IsUndefined */) ? getNonUndefinedType(type) : type;
53952
53954
  }
53953
53955
  return widenTypeInferredFromInitializer(declaration, getUnionType([getNonUndefinedType(type), checkDeclarationInitializer(declaration, 0 /* Normal */)], 2 /* Subtype */));
53954
53956
  }
@@ -62056,7 +62058,7 @@ ${lanes.join("\n")}
62056
62058
  if (sourceType && targetType) {
62057
62059
  const sourceSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
62058
62060
  const targetSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(targetType));
62059
- const callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) && (getTypeFacts(sourceType) & 50331648 /* IsUndefinedOrNull */) === (getTypeFacts(targetType) & 50331648 /* IsUndefinedOrNull */);
62061
+ const callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) && getTypeFacts(sourceType, 50331648 /* IsUndefinedOrNull */) === getTypeFacts(targetType, 50331648 /* IsUndefinedOrNull */);
62060
62062
  let related = callbacks ? compareSignaturesRelated(targetSig, sourceSig, checkMode & 8 /* StrictArity */ | (strictVariance ? 2 /* StrictCallback */ : 1 /* BivariantCallback */), reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) : !(checkMode & 3 /* Callback */) && !strictVariance && compareTypes(
62061
62063
  sourceType,
62062
62064
  targetType,
@@ -63692,6 +63694,9 @@ ${lanes.join("\n")}
63692
63694
  }
63693
63695
  instantiateType(source2, reportUnreliableMapper);
63694
63696
  }
63697
+ if (isTemplateLiteralTypeWithSinglePlaceholderAndNoExtraTexts(target2) && isTypeAssignableTo(source2, stringType) && isTypeAssignableTo(target2.types[0], stringType)) {
63698
+ return isRelatedTo(source2, target2.types[0], 3 /* Both */, reportErrors2);
63699
+ }
63695
63700
  if (isTypeMatchedByTemplateLiteralType(source2, target2)) {
63696
63701
  return -1 /* True */;
63697
63702
  }
@@ -63742,6 +63747,9 @@ ${lanes.join("\n")}
63742
63747
  }
63743
63748
  } else if (sourceFlags & 134217728 /* TemplateLiteral */ && !(targetFlags & 524288 /* Object */)) {
63744
63749
  if (!(targetFlags & 134217728 /* TemplateLiteral */)) {
63750
+ if (isTemplateLiteralTypeWithSinglePlaceholderAndNoExtraTexts(source2) && isTypeAssignableTo(source2.types[0], stringType) && isTypeAssignableTo(target2, stringType)) {
63751
+ return isRelatedTo(source2.types[0], target2, 3 /* Both */, reportErrors2);
63752
+ }
63745
63753
  const constraint = getBaseConstraintOfType(source2);
63746
63754
  if (constraint && constraint !== source2 && (result2 = isRelatedTo(constraint, target2, 1 /* Source */, reportErrors2))) {
63747
63755
  return result2;
@@ -65213,7 +65221,7 @@ ${lanes.join("\n")}
65213
65221
  return value.base10Value === "0";
65214
65222
  }
65215
65223
  function removeDefinitelyFalsyTypes(type) {
65216
- return filterType(type, (t) => !!(getTypeFacts(t) & 4194304 /* Truthy */));
65224
+ return filterType(type, (t) => hasTypeFacts(t, 4194304 /* Truthy */));
65217
65225
  }
65218
65226
  function extractDefinitelyFalsyTypes(type) {
65219
65227
  return mapType(type, getDefinitelyFalsyPartOfType);
@@ -65866,6 +65874,13 @@ ${lanes.join("\n")}
65866
65874
  }
65867
65875
  return false;
65868
65876
  }
65877
+ function isTemplateLiteralTypeWithSinglePlaceholderAndNoExtraTexts(type) {
65878
+ if (!(type.flags & 134217728 /* TemplateLiteral */)) {
65879
+ return false;
65880
+ }
65881
+ const texts = type.texts;
65882
+ return texts.length === 2 && texts[0] === "" && texts[1] === "";
65883
+ }
65869
65884
  function isValidTypeForTemplateLiteralPlaceholder(source, target) {
65870
65885
  if (source === target || target.flags & (1 /* Any */ | 4 /* String */)) {
65871
65886
  return true;
@@ -65885,9 +65900,8 @@ ${lanes.join("\n")}
65885
65900
  false
65886
65901
  ) || target.flags & (512 /* BooleanLiteral */ | 98304 /* Nullable */) && value === target.intrinsicName || target.flags & 268435456 /* StringMapping */ && isMemberOfStringMapping(getStringLiteralType(value), target) || target.flags & 134217728 /* TemplateLiteral */ && isTypeMatchedByTemplateLiteralType(source, target));
65887
65902
  }
65888
- if (source.flags & 134217728 /* TemplateLiteral */) {
65889
- const texts = source.texts;
65890
- return texts.length === 2 && texts[0] === "" && texts[1] === "" && isTypeAssignableTo(source.types[0], target);
65903
+ if (isTemplateLiteralTypeWithSinglePlaceholderAndNoExtraTexts(source)) {
65904
+ return isTypeAssignableTo(source.types[0], target);
65891
65905
  }
65892
65906
  return isTypeAssignableTo(source, target);
65893
65907
  }
@@ -66958,7 +66972,13 @@ ${lanes.join("\n")}
66958
66972
  const resolved = resolveStructuredTypeMembers(type);
66959
66973
  return !!(resolved.callSignatures.length || resolved.constructSignatures.length || resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType));
66960
66974
  }
66961
- function getTypeFacts(type) {
66975
+ function getTypeFacts(type, mask2) {
66976
+ return getTypeFactsWorker(type, mask2) & mask2;
66977
+ }
66978
+ function hasTypeFacts(type, mask2) {
66979
+ return getTypeFacts(type, mask2) !== 0;
66980
+ }
66981
+ function getTypeFactsWorker(type, callerOnlyNeeds) {
66962
66982
  if (type.flags & (2097152 /* Intersection */ | 465829888 /* Instantiable */)) {
66963
66983
  type = getBaseConstraintOfType(type) || unknownType;
66964
66984
  }
@@ -66991,6 +67011,10 @@ ${lanes.join("\n")}
66991
67011
  return strictNullChecks ? type === falseType || type === regularFalseType ? 12121864 /* FalseStrictFacts */ : 7927560 /* TrueStrictFacts */ : type === falseType || type === regularFalseType ? 12580616 /* FalseFacts */ : 16774920 /* TrueFacts */;
66992
67012
  }
66993
67013
  if (flags & 524288 /* Object */) {
67014
+ const possibleFacts = strictNullChecks ? 83427327 /* EmptyObjectStrictFacts */ | 7880640 /* FunctionStrictFacts */ | 7888800 /* ObjectStrictFacts */ : 83886079 /* EmptyObjectFacts */ | 16728e3 /* FunctionFacts */ | 16736160 /* ObjectFacts */;
67015
+ if ((callerOnlyNeeds & possibleFacts) === 0) {
67016
+ return 0;
67017
+ }
66994
67018
  return getObjectFlags(type) & 16 /* Anonymous */ && isEmptyObjectType(type) ? strictNullChecks ? 83427327 /* EmptyObjectStrictFacts */ : 83886079 /* EmptyObjectFacts */ : isFunctionObjectType(type) ? strictNullChecks ? 7880640 /* FunctionStrictFacts */ : 16728e3 /* FunctionFacts */ : strictNullChecks ? 7888800 /* ObjectStrictFacts */ : 16736160 /* ObjectFacts */;
66995
67019
  }
66996
67020
  if (flags & 16384 /* Void */) {
@@ -67012,20 +67036,20 @@ ${lanes.join("\n")}
67012
67036
  return 0 /* None */;
67013
67037
  }
67014
67038
  if (flags & 1048576 /* Union */) {
67015
- return reduceLeft(type.types, (facts, t) => facts | getTypeFacts(t), 0 /* None */);
67039
+ return reduceLeft(type.types, (facts, t) => facts | getTypeFactsWorker(t, callerOnlyNeeds), 0 /* None */);
67016
67040
  }
67017
67041
  if (flags & 2097152 /* Intersection */) {
67018
- return getIntersectionTypeFacts(type);
67042
+ return getIntersectionTypeFacts(type, callerOnlyNeeds);
67019
67043
  }
67020
67044
  return 83886079 /* UnknownFacts */;
67021
67045
  }
67022
- function getIntersectionTypeFacts(type) {
67046
+ function getIntersectionTypeFacts(type, callerOnlyNeeds) {
67023
67047
  const ignoreObjects = maybeTypeOfKind(type, 402784252 /* Primitive */);
67024
67048
  let oredFacts = 0 /* None */;
67025
67049
  let andedFacts = 134217727 /* All */;
67026
67050
  for (const t of type.types) {
67027
67051
  if (!(ignoreObjects && t.flags & 524288 /* Object */)) {
67028
- const f = getTypeFacts(t);
67052
+ const f = getTypeFactsWorker(t, callerOnlyNeeds);
67029
67053
  oredFacts |= f;
67030
67054
  andedFacts &= f;
67031
67055
  }
@@ -67033,19 +67057,19 @@ ${lanes.join("\n")}
67033
67057
  return oredFacts & 8256 /* OrFactsMask */ | andedFacts & 134209471 /* AndFactsMask */;
67034
67058
  }
67035
67059
  function getTypeWithFacts(type, include) {
67036
- return filterType(type, (t) => (getTypeFacts(t) & include) !== 0);
67060
+ return filterType(type, (t) => hasTypeFacts(t, include));
67037
67061
  }
67038
67062
  function getAdjustedTypeWithFacts(type, facts) {
67039
67063
  const reduced = recombineUnknownType(getTypeWithFacts(strictNullChecks && type.flags & 2 /* Unknown */ ? unknownUnionType : type, facts));
67040
67064
  if (strictNullChecks) {
67041
67065
  switch (facts) {
67042
67066
  case 524288 /* NEUndefined */:
67043
- return mapType(reduced, (t) => getTypeFacts(t) & 65536 /* EQUndefined */ ? getIntersectionType([t, getTypeFacts(t) & 131072 /* EQNull */ && !maybeTypeOfKind(reduced, 65536 /* Null */) ? getUnionType([emptyObjectType, nullType]) : emptyObjectType]) : t);
67067
+ return mapType(reduced, (t) => hasTypeFacts(t, 65536 /* EQUndefined */) ? getIntersectionType([t, hasTypeFacts(t, 131072 /* EQNull */) && !maybeTypeOfKind(reduced, 65536 /* Null */) ? getUnionType([emptyObjectType, nullType]) : emptyObjectType]) : t);
67044
67068
  case 1048576 /* NENull */:
67045
- return mapType(reduced, (t) => getTypeFacts(t) & 131072 /* EQNull */ ? getIntersectionType([t, getTypeFacts(t) & 65536 /* EQUndefined */ && !maybeTypeOfKind(reduced, 32768 /* Undefined */) ? getUnionType([emptyObjectType, undefinedType]) : emptyObjectType]) : t);
67069
+ return mapType(reduced, (t) => hasTypeFacts(t, 131072 /* EQNull */) ? getIntersectionType([t, hasTypeFacts(t, 65536 /* EQUndefined */) && !maybeTypeOfKind(reduced, 32768 /* Undefined */) ? getUnionType([emptyObjectType, undefinedType]) : emptyObjectType]) : t);
67046
67070
  case 2097152 /* NEUndefinedOrNull */:
67047
67071
  case 4194304 /* Truthy */:
67048
- return mapType(reduced, (t) => getTypeFacts(t) & 262144 /* EQUndefinedOrNull */ ? getGlobalNonNullableTypeInstantiation(t) : t);
67072
+ return mapType(reduced, (t) => hasTypeFacts(t, 262144 /* EQUndefinedOrNull */) ? getGlobalNonNullableTypeInstantiation(t) : t);
67049
67073
  }
67050
67074
  }
67051
67075
  return reduced;
@@ -68382,14 +68406,14 @@ ${lanes.join("\n")}
68382
68406
  // the constituent based on its type facts. We use the strict subtype relation because it treats `object`
68383
68407
  // as a subtype of `{}`, and we need the type facts check because function types are subtypes of `object`,
68384
68408
  // but are classified as "function" according to `typeof`.
68385
- isTypeRelatedTo(t, impliedType, strictSubtypeRelation) ? getTypeFacts(t) & facts ? t : neverType : (
68409
+ isTypeRelatedTo(t, impliedType, strictSubtypeRelation) ? hasTypeFacts(t, facts) ? t : neverType : (
68386
68410
  // We next check if the consituent is a supertype of the implied type. If so, we substitute the implied
68387
68411
  // type. This handles top types like `unknown` and `{}`, and supertypes like `{ toString(): string }`.
68388
68412
  isTypeSubtypeOf(impliedType, t) ? impliedType : (
68389
68413
  // Neither the constituent nor the implied type is a subtype of the other, however their domains may still
68390
68414
  // overlap. For example, an unconstrained type parameter and type `string`. If the type facts indicate
68391
68415
  // possible overlap, we form an intersection. Otherwise, we eliminate the constituent.
68392
- getTypeFacts(t) & facts ? getIntersectionType([t, impliedType]) : neverType
68416
+ hasTypeFacts(t, facts) ? getIntersectionType([t, impliedType]) : neverType
68393
68417
  )
68394
68418
  )
68395
68419
  ));
@@ -68403,7 +68427,7 @@ ${lanes.join("\n")}
68403
68427
  const hasDefaultClause = clauseStart === clauseEnd || defaultIndex >= clauseStart && defaultIndex < clauseEnd;
68404
68428
  if (hasDefaultClause) {
68405
68429
  const notEqualFacts = getNotEqualFactsFromTypeofSwitch(clauseStart, clauseEnd, witnesses);
68406
- return filterType(type, (t) => (getTypeFacts(t) & notEqualFacts) === notEqualFacts);
68430
+ return filterType(type, (t) => getTypeFacts(t, notEqualFacts) === notEqualFacts);
68407
68431
  }
68408
68432
  const clauseWitnesses = witnesses.slice(clauseStart, clauseEnd);
68409
68433
  return getUnionType(map(clauseWitnesses, (text) => text ? narrowTypeByTypeName(type, text) : neverType));
@@ -68541,7 +68565,7 @@ ${lanes.join("\n")}
68541
68565
  false
68542
68566
  );
68543
68567
  }
68544
- if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) && !(getTypeFacts(predicate.type) & 65536 /* EQUndefined */)) {
68568
+ if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) && !hasTypeFacts(predicate.type, 65536 /* EQUndefined */)) {
68545
68569
  type = getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
68546
68570
  }
68547
68571
  const access = getDiscriminantPropertyAccess(predicateArgument, type);
@@ -68675,7 +68699,7 @@ ${lanes.join("\n")}
68675
68699
  reportCircularityError(declaration.symbol);
68676
68700
  return true;
68677
68701
  }
68678
- const containsUndefined = !!(getTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 16777216 /* IsUndefined */);
68702
+ const containsUndefined = !!hasTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */), 16777216 /* IsUndefined */);
68679
68703
  if (!popTypeResolution()) {
68680
68704
  reportCircularityError(declaration.symbol);
68681
68705
  return true;
@@ -68685,7 +68709,7 @@ ${lanes.join("\n")}
68685
68709
  return links.parameterInitializerContainsUndefined;
68686
68710
  }
68687
68711
  function removeOptionalityFromDeclaredType(declaredType, declaration) {
68688
- const removeUndefined = strictNullChecks && declaration.kind === 169 /* Parameter */ && declaration.initializer && getTypeFacts(declaredType) & 16777216 /* IsUndefined */ && !parameterInitializerContainsUndefined(declaration);
68712
+ const removeUndefined = strictNullChecks && declaration.kind === 169 /* Parameter */ && declaration.initializer && hasTypeFacts(declaredType, 16777216 /* IsUndefined */) && !parameterInitializerContainsUndefined(declaration);
68689
68713
  return removeUndefined ? getTypeWithFacts(declaredType, 524288 /* NEUndefined */) : declaredType;
68690
68714
  }
68691
68715
  function isConstraintPosition(type, node) {
@@ -71515,7 +71539,7 @@ ${lanes.join("\n")}
71515
71539
  return checkNonNullType(checkExpression(node), node);
71516
71540
  }
71517
71541
  function isNullableType(type) {
71518
- return !!(getTypeFacts(type) & 50331648 /* IsUndefinedOrNull */);
71542
+ return hasTypeFacts(type, 50331648 /* IsUndefinedOrNull */);
71519
71543
  }
71520
71544
  function getNonNullableTypeIfNeeded(type) {
71521
71545
  return isNullableType(type) ? getNonNullableType(type) : type;
@@ -71561,7 +71585,7 @@ ${lanes.join("\n")}
71561
71585
  error2(node, Diagnostics.Object_is_of_type_unknown);
71562
71586
  return errorType;
71563
71587
  }
71564
- const facts = getTypeFacts(type);
71588
+ const facts = getTypeFacts(type, 50331648 /* IsUndefinedOrNull */);
71565
71589
  if (facts & 50331648 /* IsUndefinedOrNull */) {
71566
71590
  reportError(node, facts);
71567
71591
  const t = getNonNullableType(type);
@@ -75341,7 +75365,7 @@ ${lanes.join("\n")}
75341
75365
  if (operandConstraint.flags & 3 /* AnyOrUnknown */) {
75342
75366
  return (556800 /* AllTypeofNE */ & notEqualFacts) === 556800 /* AllTypeofNE */;
75343
75367
  }
75344
- return !someType(operandConstraint, (t) => (getTypeFacts(t) & notEqualFacts) === notEqualFacts);
75368
+ return !someType(operandConstraint, (t) => getTypeFacts(t, notEqualFacts) === notEqualFacts);
75345
75369
  }
75346
75370
  const type = checkExpressionCached(node.expression);
75347
75371
  if (!isLiteralType(type)) {
@@ -75659,14 +75683,15 @@ ${lanes.join("\n")}
75659
75683
  if (symbol) {
75660
75684
  if (isReadonlySymbol(symbol)) {
75661
75685
  error2(expr, Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_read_only_property);
75686
+ } else {
75687
+ checkDeleteExpressionMustBeOptional(expr, symbol);
75662
75688
  }
75663
- checkDeleteExpressionMustBeOptional(expr, symbol);
75664
75689
  }
75665
75690
  return booleanType;
75666
75691
  }
75667
75692
  function checkDeleteExpressionMustBeOptional(expr, symbol) {
75668
75693
  const type = getTypeOfSymbol(symbol);
75669
- if (strictNullChecks && !(type.flags & (3 /* AnyOrUnknown */ | 131072 /* Never */)) && !(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ : getTypeFacts(type) & 16777216 /* IsUndefined */)) {
75694
+ if (strictNullChecks && !(type.flags & (3 /* AnyOrUnknown */ | 131072 /* Never */)) && !(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ : hasTypeFacts(type, 16777216 /* IsUndefined */))) {
75670
75695
  error2(expr, Diagnostics.The_operand_of_a_delete_operator_must_be_optional);
75671
75696
  }
75672
75697
  }
@@ -75801,7 +75826,7 @@ ${lanes.join("\n")}
75801
75826
  return getUnaryResultType(operandType);
75802
75827
  case 54 /* ExclamationToken */:
75803
75828
  checkTruthinessOfType(operandType, node.operand);
75804
- const facts = getTypeFacts(operandType) & (4194304 /* Truthy */ | 8388608 /* Falsy */);
75829
+ const facts = getTypeFacts(operandType, 4194304 /* Truthy */ | 8388608 /* Falsy */);
75805
75830
  return facts === 4194304 /* Truthy */ ? falseType : facts === 8388608 /* Falsy */ ? trueType : booleanType;
75806
75831
  case 46 /* PlusPlusToken */:
75807
75832
  case 47 /* MinusMinusToken */:
@@ -76032,7 +76057,7 @@ ${lanes.join("\n")}
76032
76057
  if (exprOrAssignment.kind === 304 /* ShorthandPropertyAssignment */) {
76033
76058
  const prop = exprOrAssignment;
76034
76059
  if (prop.objectAssignmentInitializer) {
76035
- if (strictNullChecks && !(getTypeFacts(checkExpression(prop.objectAssignmentInitializer)) & 16777216 /* IsUndefined */)) {
76060
+ if (strictNullChecks && !hasTypeFacts(checkExpression(prop.objectAssignmentInitializer), 16777216 /* IsUndefined */)) {
76036
76061
  sourceType = getTypeWithFacts(sourceType, 524288 /* NEUndefined */);
76037
76062
  }
76038
76063
  checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, checkMode);
@@ -76444,7 +76469,7 @@ ${lanes.join("\n")}
76444
76469
  return checkInExpression(left, right, leftType, rightType);
76445
76470
  case 56 /* AmpersandAmpersandToken */:
76446
76471
  case 77 /* AmpersandAmpersandEqualsToken */: {
76447
- const resultType2 = getTypeFacts(leftType) & 4194304 /* Truthy */ ? getUnionType([extractDefinitelyFalsyTypes(strictNullChecks ? leftType : getBaseTypeOfLiteralType(rightType)), rightType]) : leftType;
76472
+ const resultType2 = hasTypeFacts(leftType, 4194304 /* Truthy */) ? getUnionType([extractDefinitelyFalsyTypes(strictNullChecks ? leftType : getBaseTypeOfLiteralType(rightType)), rightType]) : leftType;
76448
76473
  if (operator === 77 /* AmpersandAmpersandEqualsToken */) {
76449
76474
  checkAssignmentOperator(rightType);
76450
76475
  }
@@ -76452,7 +76477,7 @@ ${lanes.join("\n")}
76452
76477
  }
76453
76478
  case 57 /* BarBarToken */:
76454
76479
  case 76 /* BarBarEqualsToken */: {
76455
- const resultType2 = getTypeFacts(leftType) & 8388608 /* Falsy */ ? getUnionType([getNonNullableType(removeDefinitelyFalsyTypes(leftType)), rightType], 2 /* Subtype */) : leftType;
76480
+ const resultType2 = hasTypeFacts(leftType, 8388608 /* Falsy */) ? getUnionType([getNonNullableType(removeDefinitelyFalsyTypes(leftType)), rightType], 2 /* Subtype */) : leftType;
76456
76481
  if (operator === 76 /* BarBarEqualsToken */) {
76457
76482
  checkAssignmentOperator(rightType);
76458
76483
  }
@@ -76460,7 +76485,7 @@ ${lanes.join("\n")}
76460
76485
  }
76461
76486
  case 61 /* QuestionQuestionToken */:
76462
76487
  case 78 /* QuestionQuestionEqualsToken */: {
76463
- const resultType2 = getTypeFacts(leftType) & 262144 /* EQUndefinedOrNull */ ? getUnionType([getNonNullableType(leftType), rightType], 2 /* Subtype */) : leftType;
76488
+ const resultType2 = hasTypeFacts(leftType, 262144 /* EQUndefinedOrNull */) ? getUnionType([getNonNullableType(leftType), rightType], 2 /* Subtype */) : leftType;
76464
76489
  if (operator === 78 /* QuestionQuestionEqualsToken */) {
76465
76490
  checkAssignmentOperator(rightType);
76466
76491
  }
@@ -79777,7 +79802,7 @@ ${lanes.join("\n")}
79777
79802
  }
79778
79803
  const type = location === condExpr2 ? condType : checkTruthinessExpression(location);
79779
79804
  const isPropertyExpressionCast = isPropertyAccessExpression(location) && isTypeAssertion(location.expression);
79780
- if (!(getTypeFacts(type) & 4194304 /* Truthy */) || isPropertyExpressionCast)
79805
+ if (!hasTypeFacts(type, 4194304 /* Truthy */) || isPropertyExpressionCast)
79781
79806
  return;
79782
79807
  const callSignatures = getSignaturesOfType(type, 0 /* Call */);
79783
79808
  const isPromise = !!getAwaitedTypeOfPromise(type);
@@ -167149,11 +167174,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
167149
167174
  if (documentation.length === 0 && isIdentifier(location) && symbol.valueDeclaration && isBindingElement(symbol.valueDeclaration)) {
167150
167175
  const declaration = symbol.valueDeclaration;
167151
167176
  const parent2 = declaration.parent;
167152
- if (isIdentifier(declaration.name) && isObjectBindingPattern(parent2)) {
167153
- const name = getTextOfIdentifierOrLiteral(declaration.name);
167177
+ const name = declaration.propertyName || declaration.name;
167178
+ if (isIdentifier(name) && isObjectBindingPattern(parent2)) {
167179
+ const propertyName = getTextOfIdentifierOrLiteral(name);
167154
167180
  const objectType = typeChecker.getTypeAtLocation(parent2);
167155
167181
  documentation = firstDefined(objectType.isUnion() ? objectType.types : [objectType], (t) => {
167156
- const prop = t.getProperty(name);
167182
+ const prop = t.getProperty(propertyName);
167157
167183
  return prop ? prop.getDocumentationComment(typeChecker) : void 0;
167158
167184
  }) || emptyArray;
167159
167185
  }
@@ -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.20230823`;
57
+ var version = `${versionMajorMinor}.0-insiders.20230824`;
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
@@ -21824,7 +21824,9 @@ var Parser;
21824
21824
  let dotDotDotToken;
21825
21825
  let expression;
21826
21826
  if (token() !== 20 /* CloseBraceToken */) {
21827
- dotDotDotToken = parseOptionalToken(26 /* DotDotDotToken */);
21827
+ if (!inExpressionContext) {
21828
+ dotDotDotToken = parseOptionalToken(26 /* DotDotDotToken */);
21829
+ }
21828
21830
  expression = parseExpression();
21829
21831
  }
21830
21832
  if (inExpressionContext) {
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-55476-8",
5
+ "version": "5.3.0-pr-55371-11",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -42,7 +42,6 @@
42
42
  "@esfx/canceltoken": "^1.0.0",
43
43
  "@octokit/rest": "^19.0.13",
44
44
  "@types/chai": "^4.3.4",
45
- "@types/fs-extra": "^9.0.13",
46
45
  "@types/glob": "^8.1.0",
47
46
  "@types/microsoft__typescript-etw": "^0.1.1",
48
47
  "@types/minimist": "^1.2.2",
@@ -59,7 +58,6 @@
59
58
  "chai": "^4.3.7",
60
59
  "chalk": "^4.1.2",
61
60
  "chokidar": "^3.5.3",
62
- "del": "^6.1.1",
63
61
  "diff": "^5.1.0",
64
62
  "dprint": "^0.40.2",
65
63
  "esbuild": "^0.19.0",
@@ -69,7 +67,6 @@
69
67
  "eslint-plugin-no-null": "^1.0.2",
70
68
  "eslint-plugin-simple-import-sort": "^10.0.0",
71
69
  "fast-xml-parser": "^4.0.11",
72
- "fs-extra": "^9.1.0",
73
70
  "glob": "^8.1.0",
74
71
  "hereby": "^1.6.4",
75
72
  "jsonc-parser": "^3.2.0",
@@ -116,5 +113,5 @@
116
113
  "node": "20.1.0",
117
114
  "npm": "8.19.4"
118
115
  },
119
- "gitHead": "247e45aa5d8ebb7f055841b6531d95ad51f25132"
116
+ "gitHead": "a9de88c08e82e6143ae36b4260ed04a83636078a"
120
117
  }