@typescript-deploys/pr-build 5.3.0-pr-55471-8 → 5.3.0-pr-55503-5

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/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.20230822`;
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";
@@ -9480,7 +9480,6 @@ var Diagnostics = {
9480
9480
  Module_0_can_only_be_default_imported_using_the_1_flag: diag(1259, 1 /* Error */, "Module_0_can_only_be_default_imported_using_the_1_flag_1259", "Module '{0}' can only be default-imported using the '{1}' flag"),
9481
9481
  Keywords_cannot_contain_escape_characters: diag(1260, 1 /* Error */, "Keywords_cannot_contain_escape_characters_1260", "Keywords cannot contain escape characters."),
9482
9482
  Already_included_file_name_0_differs_from_file_name_1_only_in_casing: diag(1261, 1 /* Error */, "Already_included_file_name_0_differs_from_file_name_1_only_in_casing_1261", "Already included file name '{0}' differs from file name '{1}' only in casing."),
9483
- Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module: diag(1262, 1 /* Error */, "Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module_1262", "Identifier expected. '{0}' is a reserved word at the top-level of a module."),
9484
9483
  Declarations_with_initializers_cannot_also_have_definite_assignment_assertions: diag(1263, 1 /* Error */, "Declarations_with_initializers_cannot_also_have_definite_assignment_assertions_1263", "Declarations with initializers cannot also have definite assignment assertions."),
9485
9484
  Declarations_with_definite_assignment_assertions_must_also_have_type_annotations: diag(1264, 1 /* Error */, "Declarations_with_definite_assignment_assertions_must_also_have_type_annotations_1264", "Declarations with definite assignment assertions must also have type annotations."),
9486
9485
  A_rest_element_cannot_follow_another_rest_element: diag(1265, 1 /* Error */, "A_rest_element_cannot_follow_another_rest_element_1265", "A rest element cannot follow another rest element."),
@@ -15541,8 +15540,8 @@ function getInternalEmitFlags(node) {
15541
15540
  const emitNode = node.emitNode;
15542
15541
  return emitNode && emitNode.internalFlags || 0;
15543
15542
  }
15544
- function getScriptTargetFeatures() {
15545
- return new Map(Object.entries({
15543
+ var getScriptTargetFeatures = /* @__PURE__ */ memoize(
15544
+ () => new Map(Object.entries({
15546
15545
  Array: new Map(Object.entries({
15547
15546
  es2015: [
15548
15547
  "find",
@@ -15609,7 +15608,7 @@ function getScriptTargetFeatures() {
15609
15608
  "defineProperty",
15610
15609
  "deleteProperty",
15611
15610
  "get",
15612
- " getOwnPropertyDescriptor",
15611
+ "getOwnPropertyDescriptor",
15613
15612
  "getPrototypeOf",
15614
15613
  "has",
15615
15614
  "isExtensible",
@@ -15935,8 +15934,8 @@ function getScriptTargetFeatures() {
15935
15934
  "cause"
15936
15935
  ]
15937
15936
  }))
15938
- }));
15939
- }
15937
+ }))
15938
+ );
15940
15939
  var GetLiteralTextFlags = /* @__PURE__ */ ((GetLiteralTextFlags2) => {
15941
15940
  GetLiteralTextFlags2[GetLiteralTextFlags2["None"] = 0] = "None";
15942
15941
  GetLiteralTextFlags2[GetLiteralTextFlags2["NeverAsciiEscape"] = 1] = "NeverAsciiEscape";
@@ -34369,7 +34368,9 @@ var Parser;
34369
34368
  let dotDotDotToken;
34370
34369
  let expression;
34371
34370
  if (token() !== 20 /* CloseBraceToken */) {
34372
- dotDotDotToken = parseOptionalToken(26 /* DotDotDotToken */);
34371
+ if (!inExpressionContext) {
34372
+ dotDotDotToken = parseOptionalToken(26 /* DotDotDotToken */);
34373
+ }
34373
34374
  expression = parseExpression();
34374
34375
  }
34375
34376
  if (inExpressionContext) {
@@ -45561,12 +45562,8 @@ function createBinder() {
45561
45562
  }
45562
45563
  if (inStrictMode && originalKeywordKind >= 119 /* FirstFutureReservedWord */ && originalKeywordKind <= 127 /* LastFutureReservedWord */) {
45563
45564
  file.bindDiagnostics.push(createDiagnosticForNode2(node, getStrictModeIdentifierMessage(node), declarationNameToString(node)));
45564
- } else if (originalKeywordKind === 135 /* AwaitKeyword */) {
45565
- if (isExternalModule(file) && isInTopLevelContext(node)) {
45566
- file.bindDiagnostics.push(createDiagnosticForNode2(node, Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module, declarationNameToString(node)));
45567
- } else if (node.flags & 65536 /* AwaitContext */) {
45568
- file.bindDiagnostics.push(createDiagnosticForNode2(node, Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here, declarationNameToString(node)));
45569
- }
45565
+ } else if (originalKeywordKind === 135 /* AwaitKeyword */ && (node.flags & 65536 /* AwaitContext */ || isExternalModule(file))) {
45566
+ file.bindDiagnostics.push(createDiagnosticForNode2(node, Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here, declarationNameToString(node)));
45570
45567
  } else if (originalKeywordKind === 127 /* YieldKeyword */ && node.flags & 16384 /* YieldContext */) {
45571
45568
  file.bindDiagnostics.push(createDiagnosticForNode2(node, Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here, declarationNameToString(node)));
45572
45569
  }
@@ -49126,6 +49123,9 @@ function createTypeChecker(host) {
49126
49123
  const sourceFiles = host.getSourceFiles();
49127
49124
  return sourceFiles.indexOf(declarationFile) <= sourceFiles.indexOf(useFile);
49128
49125
  }
49126
+ if (!!(usage.flags & 16777216 /* JSDoc */) || isInTypeQuery(usage) || isInAmbientOrTypeNode(usage)) {
49127
+ return true;
49128
+ }
49129
49129
  if (declaration.pos <= usage.pos && !(isPropertyDeclaration(declaration) && isThisProperty(usage.parent) && !declaration.initializer && !declaration.exclamationToken)) {
49130
49130
  if (declaration.kind === 208 /* BindingElement */) {
49131
49131
  const errorBindingElement = getAncestor(usage, 208 /* BindingElement */);
@@ -49155,9 +49155,6 @@ function createTypeChecker(host) {
49155
49155
  if (usage.kind === 277 /* ExportAssignment */ && usage.isExportEquals) {
49156
49156
  return true;
49157
49157
  }
49158
- if (!!(usage.flags & 16777216 /* JSDoc */) || isInTypeQuery(usage) || isInAmbientOrTypeNode(usage)) {
49159
- return true;
49160
- }
49161
49158
  if (isUsedInFunctionOrInstanceProperty(usage, declaration)) {
49162
49159
  if (emitStandardClassFields && getContainingClass(declaration) && (isPropertyDeclaration(declaration) || isParameterPropertyDeclaration(declaration, declaration.parent))) {
49163
49160
  return !isPropertyImmediatelyReferencedWithinDeclaration(
@@ -55367,8 +55364,8 @@ function createTypeChecker(host) {
55367
55364
  });
55368
55365
  }
55369
55366
  });
55370
- Debug.assert(setter && isFunctionLikeDeclaration(setter));
55371
- const paramSymbol = getSignatureFromDeclaration(setter).parameters[0];
55367
+ Debug.assert(!!setter);
55368
+ const paramSymbol = isFunctionLikeDeclaration(setter) ? getSignatureFromDeclaration(setter).parameters[0] : void 0;
55372
55369
  result.push(setTextRange(
55373
55370
  factory.createSetAccessorDeclaration(
55374
55371
  factory.createModifiersFromModifierFlags(flag),
@@ -56144,7 +56141,7 @@ function createTypeChecker(host) {
56144
56141
  const pattern = declaration.parent;
56145
56142
  if (strictNullChecks && declaration.flags & 33554432 /* Ambient */ && isParameterDeclaration(declaration)) {
56146
56143
  parentType = getNonNullableType(parentType);
56147
- } else if (strictNullChecks && pattern.parent.initializer && !(getTypeFacts(getTypeOfInitializer(pattern.parent.initializer)) & 65536 /* EQUndefined */)) {
56144
+ } else if (strictNullChecks && pattern.parent.initializer && !hasTypeFacts(getTypeOfInitializer(pattern.parent.initializer), 65536 /* EQUndefined */)) {
56148
56145
  parentType = getTypeWithFacts(parentType, 524288 /* NEUndefined */);
56149
56146
  }
56150
56147
  let type;
@@ -56187,7 +56184,7 @@ function createTypeChecker(host) {
56187
56184
  return type;
56188
56185
  }
56189
56186
  if (getEffectiveTypeAnnotationNode(walkUpBindingElementsAndPatterns(declaration))) {
56190
- return strictNullChecks && !(getTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 16777216 /* IsUndefined */) ? getNonUndefinedType(type) : type;
56187
+ return strictNullChecks && !hasTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */), 16777216 /* IsUndefined */) ? getNonUndefinedType(type) : type;
56191
56188
  }
56192
56189
  return widenTypeInferredFromInitializer(declaration, getUnionType([getNonUndefinedType(type), checkDeclarationInitializer(declaration, 0 /* Normal */)], 2 /* Subtype */));
56193
56190
  }
@@ -61789,7 +61786,7 @@ function createTypeChecker(host) {
61789
61786
  }
61790
61787
  function getLiteralTypeFromProperties(type, include, includeOrigin) {
61791
61788
  const origin = includeOrigin && (getObjectFlags(type) & (3 /* ClassOrInterface */ | 4 /* Reference */) || type.aliasSymbol) ? createOriginIndexType(type) : void 0;
61792
- const propertyTypes = map(getPropertiesOfType(type), (prop) => prop.flags & 4194304 /* Prototype */ ? neverType : getLiteralTypeFromProperty(prop, include));
61789
+ const propertyTypes = map(getPropertiesOfType(type), (prop) => getLiteralTypeFromProperty(prop, include));
61793
61790
  const indexKeyTypes = map(getIndexInfosOfType(type), (info) => info !== enumNumberIndexInfo && isKeyTypeIncluded(info.keyType, include) ? info.keyType === stringType && include & 8 /* Number */ ? stringOrNumberType : info.keyType : neverType);
61794
61791
  return getUnionType(
61795
61792
  concatenate(propertyTypes, indexKeyTypes),
@@ -64295,7 +64292,7 @@ function createTypeChecker(host) {
64295
64292
  if (sourceType && targetType) {
64296
64293
  const sourceSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
64297
64294
  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 */);
64295
+ const callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) && getTypeFacts(sourceType, 50331648 /* IsUndefinedOrNull */) === getTypeFacts(targetType, 50331648 /* IsUndefinedOrNull */);
64299
64296
  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
64297
  sourceType,
64301
64298
  targetType,
@@ -67452,7 +67449,7 @@ function createTypeChecker(host) {
67452
67449
  return value.base10Value === "0";
67453
67450
  }
67454
67451
  function removeDefinitelyFalsyTypes(type) {
67455
- return filterType(type, (t) => !!(getTypeFacts(t) & 4194304 /* Truthy */));
67452
+ return filterType(type, (t) => hasTypeFacts(t, 4194304 /* Truthy */));
67456
67453
  }
67457
67454
  function extractDefinitelyFalsyTypes(type) {
67458
67455
  return mapType(type, getDefinitelyFalsyPartOfType);
@@ -68728,12 +68725,14 @@ function createTypeChecker(host) {
68728
68725
  }
68729
68726
  function inferFromSignatures(source, target, kind) {
68730
68727
  const sourceSignatures = getSignaturesOfType(source, kind);
68731
- const targetSignatures = getSignaturesOfType(target, kind);
68732
68728
  const sourceLen = sourceSignatures.length;
68733
- const targetLen = targetSignatures.length;
68734
- const len = sourceLen < targetLen ? sourceLen : targetLen;
68735
- for (let i = 0; i < len; i++) {
68736
- inferFromSignature(getBaseSignature(sourceSignatures[sourceLen - len + i]), getErasedSignature(targetSignatures[targetLen - len + i]));
68729
+ if (sourceLen > 0) {
68730
+ const targetSignatures = getSignaturesOfType(target, kind);
68731
+ const targetLen = targetSignatures.length;
68732
+ for (let i = 0; i < targetLen; i++) {
68733
+ const sourceIndex = Math.max(sourceLen - targetLen + i, 0);
68734
+ inferFromSignature(getBaseSignature(sourceSignatures[sourceIndex]), getErasedSignature(targetSignatures[i]));
68735
+ }
68737
68736
  }
68738
68737
  }
68739
68738
  function inferFromSignature(source, target) {
@@ -69195,7 +69194,13 @@ function createTypeChecker(host) {
69195
69194
  const resolved = resolveStructuredTypeMembers(type);
69196
69195
  return !!(resolved.callSignatures.length || resolved.constructSignatures.length || resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType));
69197
69196
  }
69198
- function getTypeFacts(type) {
69197
+ function getTypeFacts(type, mask2) {
69198
+ return getTypeFactsWorker(type, mask2) & mask2;
69199
+ }
69200
+ function hasTypeFacts(type, mask2) {
69201
+ return getTypeFacts(type, mask2) !== 0;
69202
+ }
69203
+ function getTypeFactsWorker(type, callerOnlyNeeds) {
69199
69204
  if (type.flags & (2097152 /* Intersection */ | 465829888 /* Instantiable */)) {
69200
69205
  type = getBaseConstraintOfType(type) || unknownType;
69201
69206
  }
@@ -69228,6 +69233,10 @@ function createTypeChecker(host) {
69228
69233
  return strictNullChecks ? type === falseType || type === regularFalseType ? 12121864 /* FalseStrictFacts */ : 7927560 /* TrueStrictFacts */ : type === falseType || type === regularFalseType ? 12580616 /* FalseFacts */ : 16774920 /* TrueFacts */;
69229
69234
  }
69230
69235
  if (flags & 524288 /* Object */) {
69236
+ const possibleFacts = strictNullChecks ? 83427327 /* EmptyObjectStrictFacts */ | 7880640 /* FunctionStrictFacts */ | 7888800 /* ObjectStrictFacts */ : 83886079 /* EmptyObjectFacts */ | 16728e3 /* FunctionFacts */ | 16736160 /* ObjectFacts */;
69237
+ if ((callerOnlyNeeds & possibleFacts) === 0) {
69238
+ return 0;
69239
+ }
69231
69240
  return getObjectFlags(type) & 16 /* Anonymous */ && isEmptyObjectType(type) ? strictNullChecks ? 83427327 /* EmptyObjectStrictFacts */ : 83886079 /* EmptyObjectFacts */ : isFunctionObjectType(type) ? strictNullChecks ? 7880640 /* FunctionStrictFacts */ : 16728e3 /* FunctionFacts */ : strictNullChecks ? 7888800 /* ObjectStrictFacts */ : 16736160 /* ObjectFacts */;
69232
69241
  }
69233
69242
  if (flags & 16384 /* Void */) {
@@ -69249,20 +69258,20 @@ function createTypeChecker(host) {
69249
69258
  return 0 /* None */;
69250
69259
  }
69251
69260
  if (flags & 1048576 /* Union */) {
69252
- return reduceLeft(type.types, (facts, t) => facts | getTypeFacts(t), 0 /* None */);
69261
+ return reduceLeft(type.types, (facts, t) => facts | getTypeFactsWorker(t, callerOnlyNeeds), 0 /* None */);
69253
69262
  }
69254
69263
  if (flags & 2097152 /* Intersection */) {
69255
- return getIntersectionTypeFacts(type);
69264
+ return getIntersectionTypeFacts(type, callerOnlyNeeds);
69256
69265
  }
69257
69266
  return 83886079 /* UnknownFacts */;
69258
69267
  }
69259
- function getIntersectionTypeFacts(type) {
69268
+ function getIntersectionTypeFacts(type, callerOnlyNeeds) {
69260
69269
  const ignoreObjects = maybeTypeOfKind(type, 402784252 /* Primitive */);
69261
69270
  let oredFacts = 0 /* None */;
69262
69271
  let andedFacts = 134217727 /* All */;
69263
69272
  for (const t of type.types) {
69264
69273
  if (!(ignoreObjects && t.flags & 524288 /* Object */)) {
69265
- const f = getTypeFacts(t);
69274
+ const f = getTypeFactsWorker(t, callerOnlyNeeds);
69266
69275
  oredFacts |= f;
69267
69276
  andedFacts &= f;
69268
69277
  }
@@ -69270,19 +69279,19 @@ function createTypeChecker(host) {
69270
69279
  return oredFacts & 8256 /* OrFactsMask */ | andedFacts & 134209471 /* AndFactsMask */;
69271
69280
  }
69272
69281
  function getTypeWithFacts(type, include) {
69273
- return filterType(type, (t) => (getTypeFacts(t) & include) !== 0);
69282
+ return filterType(type, (t) => hasTypeFacts(t, include));
69274
69283
  }
69275
69284
  function getAdjustedTypeWithFacts(type, facts) {
69276
69285
  const reduced = recombineUnknownType(getTypeWithFacts(strictNullChecks && type.flags & 2 /* Unknown */ ? unknownUnionType : type, facts));
69277
69286
  if (strictNullChecks) {
69278
69287
  switch (facts) {
69279
69288
  case 524288 /* NEUndefined */:
69280
- return mapType(reduced, (t) => getTypeFacts(t) & 65536 /* EQUndefined */ ? getIntersectionType([t, getTypeFacts(t) & 131072 /* EQNull */ && !maybeTypeOfKind(reduced, 65536 /* Null */) ? getUnionType([emptyObjectType, nullType]) : emptyObjectType]) : t);
69289
+ return mapType(reduced, (t) => hasTypeFacts(t, 65536 /* EQUndefined */) ? getIntersectionType([t, hasTypeFacts(t, 131072 /* EQNull */) && !maybeTypeOfKind(reduced, 65536 /* Null */) ? getUnionType([emptyObjectType, nullType]) : emptyObjectType]) : t);
69281
69290
  case 1048576 /* NENull */:
69282
- return mapType(reduced, (t) => getTypeFacts(t) & 131072 /* EQNull */ ? getIntersectionType([t, getTypeFacts(t) & 65536 /* EQUndefined */ && !maybeTypeOfKind(reduced, 32768 /* Undefined */) ? getUnionType([emptyObjectType, undefinedType]) : emptyObjectType]) : t);
69291
+ return mapType(reduced, (t) => hasTypeFacts(t, 131072 /* EQNull */) ? getIntersectionType([t, hasTypeFacts(t, 65536 /* EQUndefined */) && !maybeTypeOfKind(reduced, 32768 /* Undefined */) ? getUnionType([emptyObjectType, undefinedType]) : emptyObjectType]) : t);
69283
69292
  case 2097152 /* NEUndefinedOrNull */:
69284
69293
  case 4194304 /* Truthy */:
69285
- return mapType(reduced, (t) => getTypeFacts(t) & 262144 /* EQUndefinedOrNull */ ? getGlobalNonNullableTypeInstantiation(t) : t);
69294
+ return mapType(reduced, (t) => hasTypeFacts(t, 262144 /* EQUndefinedOrNull */) ? getGlobalNonNullableTypeInstantiation(t) : t);
69286
69295
  }
69287
69296
  }
69288
69297
  return reduced;
@@ -70269,7 +70278,7 @@ function createTypeChecker(host) {
70269
70278
  return void 0;
70270
70279
  }
70271
70280
  function getDiscriminantPropertyAccess(expr, computedType) {
70272
- const type = declaredType.flags & 1048576 /* Union */ ? declaredType : computedType;
70281
+ const type = !(computedType.flags & 1048576 /* Union */) && declaredType.flags & 1048576 /* Union */ ? declaredType : computedType;
70273
70282
  if (type.flags & 1048576 /* Union */) {
70274
70283
  const access = getCandidateDiscriminantPropertyAccess(expr);
70275
70284
  if (access) {
@@ -70619,14 +70628,14 @@ function createTypeChecker(host) {
70619
70628
  // the constituent based on its type facts. We use the strict subtype relation because it treats `object`
70620
70629
  // as a subtype of `{}`, and we need the type facts check because function types are subtypes of `object`,
70621
70630
  // but are classified as "function" according to `typeof`.
70622
- isTypeRelatedTo(t, impliedType, strictSubtypeRelation) ? getTypeFacts(t) & facts ? t : neverType : (
70631
+ isTypeRelatedTo(t, impliedType, strictSubtypeRelation) ? hasTypeFacts(t, facts) ? t : neverType : (
70623
70632
  // We next check if the consituent is a supertype of the implied type. If so, we substitute the implied
70624
70633
  // type. This handles top types like `unknown` and `{}`, and supertypes like `{ toString(): string }`.
70625
70634
  isTypeSubtypeOf(impliedType, t) ? impliedType : (
70626
70635
  // Neither the constituent nor the implied type is a subtype of the other, however their domains may still
70627
70636
  // overlap. For example, an unconstrained type parameter and type `string`. If the type facts indicate
70628
70637
  // possible overlap, we form an intersection. Otherwise, we eliminate the constituent.
70629
- getTypeFacts(t) & facts ? getIntersectionType([t, impliedType]) : neverType
70638
+ hasTypeFacts(t, facts) ? getIntersectionType([t, impliedType]) : neverType
70630
70639
  )
70631
70640
  )
70632
70641
  ));
@@ -70640,7 +70649,7 @@ function createTypeChecker(host) {
70640
70649
  const hasDefaultClause = clauseStart === clauseEnd || defaultIndex >= clauseStart && defaultIndex < clauseEnd;
70641
70650
  if (hasDefaultClause) {
70642
70651
  const notEqualFacts = getNotEqualFactsFromTypeofSwitch(clauseStart, clauseEnd, witnesses);
70643
- return filterType(type, (t) => (getTypeFacts(t) & notEqualFacts) === notEqualFacts);
70652
+ return filterType(type, (t) => getTypeFacts(t, notEqualFacts) === notEqualFacts);
70644
70653
  }
70645
70654
  const clauseWitnesses = witnesses.slice(clauseStart, clauseEnd);
70646
70655
  return getUnionType(map(clauseWitnesses, (text) => text ? narrowTypeByTypeName(type, text) : neverType));
@@ -70778,7 +70787,7 @@ function createTypeChecker(host) {
70778
70787
  false
70779
70788
  );
70780
70789
  }
70781
- if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) && !(getTypeFacts(predicate.type) & 65536 /* EQUndefined */)) {
70790
+ if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) && !hasTypeFacts(predicate.type, 65536 /* EQUndefined */)) {
70782
70791
  type = getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
70783
70792
  }
70784
70793
  const access = getDiscriminantPropertyAccess(predicateArgument, type);
@@ -70912,7 +70921,7 @@ function createTypeChecker(host) {
70912
70921
  reportCircularityError(declaration.symbol);
70913
70922
  return true;
70914
70923
  }
70915
- const containsUndefined = !!(getTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 16777216 /* IsUndefined */);
70924
+ const containsUndefined = !!hasTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */), 16777216 /* IsUndefined */);
70916
70925
  if (!popTypeResolution()) {
70917
70926
  reportCircularityError(declaration.symbol);
70918
70927
  return true;
@@ -70922,7 +70931,7 @@ function createTypeChecker(host) {
70922
70931
  return links.parameterInitializerContainsUndefined;
70923
70932
  }
70924
70933
  function removeOptionalityFromDeclaredType(declaredType, declaration) {
70925
- const removeUndefined = strictNullChecks && declaration.kind === 169 /* Parameter */ && declaration.initializer && getTypeFacts(declaredType) & 16777216 /* IsUndefined */ && !parameterInitializerContainsUndefined(declaration);
70934
+ const removeUndefined = strictNullChecks && declaration.kind === 169 /* Parameter */ && declaration.initializer && hasTypeFacts(declaredType, 16777216 /* IsUndefined */) && !parameterInitializerContainsUndefined(declaration);
70926
70935
  return removeUndefined ? getTypeWithFacts(declaredType, 524288 /* NEUndefined */) : declaredType;
70927
70936
  }
70928
70937
  function isConstraintPosition(type, node) {
@@ -73752,7 +73761,7 @@ function createTypeChecker(host) {
73752
73761
  return checkNonNullType(checkExpression(node), node);
73753
73762
  }
73754
73763
  function isNullableType(type) {
73755
- return !!(getTypeFacts(type) & 50331648 /* IsUndefinedOrNull */);
73764
+ return hasTypeFacts(type, 50331648 /* IsUndefinedOrNull */);
73756
73765
  }
73757
73766
  function getNonNullableTypeIfNeeded(type) {
73758
73767
  return isNullableType(type) ? getNonNullableType(type) : type;
@@ -73798,7 +73807,7 @@ function createTypeChecker(host) {
73798
73807
  error2(node, Diagnostics.Object_is_of_type_unknown);
73799
73808
  return errorType;
73800
73809
  }
73801
- const facts = getTypeFacts(type);
73810
+ const facts = getTypeFacts(type, 50331648 /* IsUndefinedOrNull */);
73802
73811
  if (facts & 50331648 /* IsUndefinedOrNull */) {
73803
73812
  reportError(node, facts);
73804
73813
  const t = getNonNullableType(type);
@@ -77578,7 +77587,7 @@ function createTypeChecker(host) {
77578
77587
  if (operandConstraint.flags & 3 /* AnyOrUnknown */) {
77579
77588
  return (556800 /* AllTypeofNE */ & notEqualFacts) === 556800 /* AllTypeofNE */;
77580
77589
  }
77581
- return !someType(operandConstraint, (t) => (getTypeFacts(t) & notEqualFacts) === notEqualFacts);
77590
+ return !someType(operandConstraint, (t) => getTypeFacts(t, notEqualFacts) === notEqualFacts);
77582
77591
  }
77583
77592
  const type = checkExpressionCached(node.expression);
77584
77593
  if (!isLiteralType(type)) {
@@ -77896,14 +77905,15 @@ function createTypeChecker(host) {
77896
77905
  if (symbol) {
77897
77906
  if (isReadonlySymbol(symbol)) {
77898
77907
  error2(expr, Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_read_only_property);
77908
+ } else {
77909
+ checkDeleteExpressionMustBeOptional(expr, symbol);
77899
77910
  }
77900
- checkDeleteExpressionMustBeOptional(expr, symbol);
77901
77911
  }
77902
77912
  return booleanType;
77903
77913
  }
77904
77914
  function checkDeleteExpressionMustBeOptional(expr, symbol) {
77905
77915
  const type = getTypeOfSymbol(symbol);
77906
- if (strictNullChecks && !(type.flags & (3 /* AnyOrUnknown */ | 131072 /* Never */)) && !(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ : getTypeFacts(type) & 16777216 /* IsUndefined */)) {
77916
+ if (strictNullChecks && !(type.flags & (3 /* AnyOrUnknown */ | 131072 /* Never */)) && !(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ : hasTypeFacts(type, 16777216 /* IsUndefined */))) {
77907
77917
  error2(expr, Diagnostics.The_operand_of_a_delete_operator_must_be_optional);
77908
77918
  }
77909
77919
  }
@@ -78038,7 +78048,7 @@ function createTypeChecker(host) {
78038
78048
  return getUnaryResultType(operandType);
78039
78049
  case 54 /* ExclamationToken */:
78040
78050
  checkTruthinessOfType(operandType, node.operand);
78041
- const facts = getTypeFacts(operandType) & (4194304 /* Truthy */ | 8388608 /* Falsy */);
78051
+ const facts = getTypeFacts(operandType, 4194304 /* Truthy */ | 8388608 /* Falsy */);
78042
78052
  return facts === 4194304 /* Truthy */ ? falseType : facts === 8388608 /* Falsy */ ? trueType : booleanType;
78043
78053
  case 46 /* PlusPlusToken */:
78044
78054
  case 47 /* MinusMinusToken */:
@@ -78269,7 +78279,7 @@ function createTypeChecker(host) {
78269
78279
  if (exprOrAssignment.kind === 304 /* ShorthandPropertyAssignment */) {
78270
78280
  const prop = exprOrAssignment;
78271
78281
  if (prop.objectAssignmentInitializer) {
78272
- if (strictNullChecks && !(getTypeFacts(checkExpression(prop.objectAssignmentInitializer)) & 16777216 /* IsUndefined */)) {
78282
+ if (strictNullChecks && !hasTypeFacts(checkExpression(prop.objectAssignmentInitializer), 16777216 /* IsUndefined */)) {
78273
78283
  sourceType = getTypeWithFacts(sourceType, 524288 /* NEUndefined */);
78274
78284
  }
78275
78285
  checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, checkMode);
@@ -78681,7 +78691,7 @@ function createTypeChecker(host) {
78681
78691
  return checkInExpression(left, right, leftType, rightType);
78682
78692
  case 56 /* AmpersandAmpersandToken */:
78683
78693
  case 77 /* AmpersandAmpersandEqualsToken */: {
78684
- const resultType2 = getTypeFacts(leftType) & 4194304 /* Truthy */ ? getUnionType([extractDefinitelyFalsyTypes(strictNullChecks ? leftType : getBaseTypeOfLiteralType(rightType)), rightType]) : leftType;
78694
+ const resultType2 = hasTypeFacts(leftType, 4194304 /* Truthy */) ? getUnionType([extractDefinitelyFalsyTypes(strictNullChecks ? leftType : getBaseTypeOfLiteralType(rightType)), rightType]) : leftType;
78685
78695
  if (operator === 77 /* AmpersandAmpersandEqualsToken */) {
78686
78696
  checkAssignmentOperator(rightType);
78687
78697
  }
@@ -78689,7 +78699,7 @@ function createTypeChecker(host) {
78689
78699
  }
78690
78700
  case 57 /* BarBarToken */:
78691
78701
  case 76 /* BarBarEqualsToken */: {
78692
- const resultType2 = getTypeFacts(leftType) & 8388608 /* Falsy */ ? getUnionType([getNonNullableType(removeDefinitelyFalsyTypes(leftType)), rightType], 2 /* Subtype */) : leftType;
78702
+ const resultType2 = hasTypeFacts(leftType, 8388608 /* Falsy */) ? getUnionType([getNonNullableType(removeDefinitelyFalsyTypes(leftType)), rightType], 2 /* Subtype */) : leftType;
78693
78703
  if (operator === 76 /* BarBarEqualsToken */) {
78694
78704
  checkAssignmentOperator(rightType);
78695
78705
  }
@@ -78697,7 +78707,7 @@ function createTypeChecker(host) {
78697
78707
  }
78698
78708
  case 61 /* QuestionQuestionToken */:
78699
78709
  case 78 /* QuestionQuestionEqualsToken */: {
78700
- const resultType2 = getTypeFacts(leftType) & 262144 /* EQUndefinedOrNull */ ? getUnionType([getNonNullableType(leftType), rightType], 2 /* Subtype */) : leftType;
78710
+ const resultType2 = hasTypeFacts(leftType, 262144 /* EQUndefinedOrNull */) ? getUnionType([getNonNullableType(leftType), rightType], 2 /* Subtype */) : leftType;
78701
78711
  if (operator === 78 /* QuestionQuestionEqualsToken */) {
78702
78712
  checkAssignmentOperator(rightType);
78703
78713
  }
@@ -82014,7 +82024,7 @@ function createTypeChecker(host) {
82014
82024
  }
82015
82025
  const type = location === condExpr2 ? condType : checkTruthinessExpression(location);
82016
82026
  const isPropertyExpressionCast = isPropertyAccessExpression(location) && isTypeAssertion(location.expression);
82017
- if (!(getTypeFacts(type) & 4194304 /* Truthy */) || isPropertyExpressionCast)
82027
+ if (!hasTypeFacts(type, 4194304 /* Truthy */) || isPropertyExpressionCast)
82018
82028
  return;
82019
82029
  const callSignatures = getSignaturesOfType(type, 0 /* Call */);
82020
82030
  const isPromise = !!getAwaitedTypeOfPromise(type);
@@ -120221,7 +120231,6 @@ var plainJSErrors = /* @__PURE__ */ new Set([
120221
120231
  Diagnostics.A_module_cannot_have_multiple_default_exports.code,
120222
120232
  Diagnostics.Another_export_default_is_here.code,
120223
120233
  Diagnostics.The_first_export_default_is_here.code,
120224
- Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module.code,
120225
120234
  Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode.code,
120226
120235
  Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here.code,
120227
120236
  Diagnostics.constructor_is_a_reserved_word.code,
@@ -164666,11 +164675,11 @@ function provideInlayHints(context) {
164666
164675
  function isSignatureSupportingReturnAnnotation(node) {
164667
164676
  return isArrowFunction(node) || isFunctionExpression(node) || isFunctionDeclaration(node) || isMethodDeclaration(node) || isGetAccessorDeclaration(node);
164668
164677
  }
164669
- function addParameterHints(text, parameter, position, isFirstVariadicArgument, sourceFile) {
164678
+ function addParameterHints(text, parameter, position, isFirstVariadicArgument) {
164670
164679
  let hintText = `${isFirstVariadicArgument ? "..." : ""}${text}`;
164671
164680
  let displayParts;
164672
164681
  if (shouldUseInteractiveInlayHints(preferences)) {
164673
- displayParts = [getNodeDisplayPart(hintText, parameter, sourceFile), { text: ":" }];
164682
+ displayParts = [getNodeDisplayPart(hintText, parameter), { text: ":" }];
164674
164683
  hintText = "";
164675
164684
  } else {
164676
164685
  hintText += ":";
@@ -164742,7 +164751,6 @@ function provideInlayHints(context) {
164742
164751
  if (!signature || !candidates.length) {
164743
164752
  return;
164744
164753
  }
164745
- const sourceFile = shouldUseInteractiveInlayHints(preferences) ? expr.getSourceFile() : void 0;
164746
164754
  let signatureParamPos = 0;
164747
164755
  for (const originalArg of args) {
164748
164756
  const arg = skipParentheses(originalArg);
@@ -164777,7 +164785,7 @@ function provideInlayHints(context) {
164777
164785
  if (leadingCommentsContainsParameterName(arg, name)) {
164778
164786
  continue;
164779
164787
  }
164780
- addParameterHints(name, parameter, originalArg.getStart(), isFirstVariadicArgument, sourceFile);
164788
+ addParameterHints(name, parameter, originalArg.getStart(), isFirstVariadicArgument);
164781
164789
  }
164782
164790
  }
164783
164791
  }
@@ -164913,7 +164921,8 @@ function provideInlayHints(context) {
164913
164921
  }
164914
164922
  return true;
164915
164923
  }
164916
- function getNodeDisplayPart(text, node, sourceFile) {
164924
+ function getNodeDisplayPart(text, node) {
164925
+ const sourceFile = node.getSourceFile();
164917
164926
  return {
164918
164927
  text,
164919
164928
  span: createTextSpanFromNode(node, sourceFile),
@@ -167712,11 +167721,12 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symb
167712
167721
  if (documentation.length === 0 && isIdentifier(location) && symbol.valueDeclaration && isBindingElement(symbol.valueDeclaration)) {
167713
167722
  const declaration = symbol.valueDeclaration;
167714
167723
  const parent2 = declaration.parent;
167715
- if (isIdentifier(declaration.name) && isObjectBindingPattern(parent2)) {
167716
- const name = getTextOfIdentifierOrLiteral(declaration.name);
167724
+ const name = declaration.propertyName || declaration.name;
167725
+ if (isIdentifier(name) && isObjectBindingPattern(parent2)) {
167726
+ const propertyName = getTextOfIdentifierOrLiteral(name);
167717
167727
  const objectType = typeChecker.getTypeAtLocation(parent2);
167718
167728
  documentation = firstDefined(objectType.isUnion() ? objectType.types : [objectType], (t) => {
167719
- const prop = t.getProperty(name);
167729
+ const prop = t.getProperty(propertyName);
167720
167730
  return prop ? prop.getDocumentationComment(typeChecker) : void 0;
167721
167731
  }) || emptyArray;
167722
167732
  }
@@ -183599,14 +183609,22 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
183599
183609
  return {
183600
183610
  ...hint,
183601
183611
  position: scriptInfo.positionToLineOffset(position),
183602
- displayParts: displayParts == null ? void 0 : displayParts.map(({ text, span, file: file2 }) => ({
183603
- text,
183604
- span: span && {
183605
- start: scriptInfo.positionToLineOffset(span.start),
183606
- end: scriptInfo.positionToLineOffset(span.start + span.length),
183607
- file: file2
183612
+ displayParts: displayParts == null ? void 0 : displayParts.map(({ text, span, file: file2 }) => {
183613
+ if (span) {
183614
+ Debug.assertIsDefined(file2, "Target file should be defined together with its span.");
183615
+ const scriptInfo2 = this.projectService.getScriptInfo(file2);
183616
+ return {
183617
+ text,
183618
+ span: {
183619
+ start: scriptInfo2.positionToLineOffset(span.start),
183620
+ end: scriptInfo2.positionToLineOffset(span.start + span.length),
183621
+ file: file2
183622
+ }
183623
+ };
183624
+ } else {
183625
+ return { text };
183608
183626
  }
183609
- }))
183627
+ })
183610
183628
  };
183611
183629
  });
183612
183630
  }