@typescript-deploys/pr-build 5.3.0-pr-55459-3 → 5.3.0-pr-55476-8

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.20230823`;
2337
2337
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2338
2338
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2339
2339
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -15541,8 +15541,8 @@ function getInternalEmitFlags(node) {
15541
15541
  const emitNode = node.emitNode;
15542
15542
  return emitNode && emitNode.internalFlags || 0;
15543
15543
  }
15544
- function getScriptTargetFeatures() {
15545
- return new Map(Object.entries({
15544
+ var getScriptTargetFeatures = /* @__PURE__ */ memoize(
15545
+ () => new Map(Object.entries({
15546
15546
  Array: new Map(Object.entries({
15547
15547
  es2015: [
15548
15548
  "find",
@@ -15935,8 +15935,8 @@ function getScriptTargetFeatures() {
15935
15935
  "cause"
15936
15936
  ]
15937
15937
  }))
15938
- }));
15939
- }
15938
+ }))
15939
+ );
15940
15940
  var GetLiteralTextFlags = /* @__PURE__ */ ((GetLiteralTextFlags2) => {
15941
15941
  GetLiteralTextFlags2[GetLiteralTextFlags2["None"] = 0] = "None";
15942
15942
  GetLiteralTextFlags2[GetLiteralTextFlags2["NeverAsciiEscape"] = 1] = "NeverAsciiEscape";
@@ -53338,11 +53338,17 @@ function createTypeChecker(host) {
53338
53338
  const constraintNode = constraint && typeToTypeNodeHelper(constraint, context);
53339
53339
  return typeParameterToDeclarationWithConstraint(type, context, constraintNode);
53340
53340
  }
53341
- function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags, privateSymbolVisitor, bundledImports) {
53342
- let parameterDeclaration = getDeclarationOfKind(parameterSymbol, 169 /* Parameter */);
53343
- if (!parameterDeclaration && !isTransientSymbol(parameterSymbol)) {
53344
- parameterDeclaration = getDeclarationOfKind(parameterSymbol, 348 /* JSDocParameterTag */);
53341
+ function getEffectiveParameterDeclaration(parameterSymbol) {
53342
+ const parameterDeclaration = getDeclarationOfKind(parameterSymbol, 169 /* Parameter */);
53343
+ if (parameterDeclaration) {
53344
+ return parameterDeclaration;
53345
53345
  }
53346
+ if (!isTransientSymbol(parameterSymbol)) {
53347
+ return getDeclarationOfKind(parameterSymbol, 348 /* JSDocParameterTag */);
53348
+ }
53349
+ }
53350
+ function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags, privateSymbolVisitor, bundledImports) {
53351
+ const parameterDeclaration = getEffectiveParameterDeclaration(parameterSymbol);
53346
53352
  let parameterType = getTypeOfSymbol(parameterSymbol);
53347
53353
  if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) {
53348
53354
  parameterType = getOptionalType(parameterType);
@@ -53351,7 +53357,7 @@ function createTypeChecker(host) {
53351
53357
  const modifiers = !(context.flags & 8192 /* OmitParameterModifiers */) && preserveModifierFlags && parameterDeclaration && canHaveModifiers(parameterDeclaration) ? map(getModifiers(parameterDeclaration), factory.cloneNode) : void 0;
53352
53358
  const isRest = parameterDeclaration && isRestParameter(parameterDeclaration) || getCheckFlags(parameterSymbol) & 32768 /* RestParameter */;
53353
53359
  const dotDotDotToken = isRest ? factory.createToken(26 /* DotDotDotToken */) : void 0;
53354
- const name = parameterDeclaration ? parameterDeclaration.name ? parameterDeclaration.name.kind === 80 /* Identifier */ ? setEmitFlags(factory.cloneNode(parameterDeclaration.name), 16777216 /* NoAsciiEscaping */) : parameterDeclaration.name.kind === 166 /* QualifiedName */ ? setEmitFlags(factory.cloneNode(parameterDeclaration.name.right), 16777216 /* NoAsciiEscaping */) : cloneBindingName(parameterDeclaration.name) : symbolName(parameterSymbol) : symbolName(parameterSymbol);
53360
+ const name = parameterToParameterDeclarationName(parameterSymbol, parameterDeclaration, context);
53355
53361
  const isOptional = parameterDeclaration && isOptionalParameter(parameterDeclaration) || getCheckFlags(parameterSymbol) & 16384 /* OptionalParameter */;
53356
53362
  const questionToken = isOptional ? factory.createToken(58 /* QuestionToken */) : void 0;
53357
53363
  const parameterNode = factory.createParameterDeclaration(
@@ -53365,6 +53371,9 @@ function createTypeChecker(host) {
53365
53371
  );
53366
53372
  context.approximateLength += symbolName(parameterSymbol).length + 3;
53367
53373
  return parameterNode;
53374
+ }
53375
+ function parameterToParameterDeclarationName(parameterSymbol, parameterDeclaration, context) {
53376
+ return parameterDeclaration ? parameterDeclaration.name ? parameterDeclaration.name.kind === 80 /* Identifier */ ? setEmitFlags(factory.cloneNode(parameterDeclaration.name), 16777216 /* NoAsciiEscaping */) : parameterDeclaration.name.kind === 166 /* QualifiedName */ ? setEmitFlags(factory.cloneNode(parameterDeclaration.name.right), 16777216 /* NoAsciiEscaping */) : cloneBindingName(parameterDeclaration.name) : symbolName(parameterSymbol) : symbolName(parameterSymbol);
53368
53377
  function cloneBindingName(node) {
53369
53378
  return elideInitializerAndSetEmitFlags(node);
53370
53379
  function elideInitializerAndSetEmitFlags(node2) {
@@ -55345,6 +55354,21 @@ function createTypeChecker(host) {
55345
55354
  if (p.flags & 98304 /* Accessor */ && useAccessors) {
55346
55355
  const result = [];
55347
55356
  if (p.flags & 65536 /* SetAccessor */) {
55357
+ const setter = p.declarations && forEach(p.declarations, (d) => {
55358
+ if (d.kind === 178 /* SetAccessor */) {
55359
+ return d;
55360
+ }
55361
+ if (isCallExpression(d) && isBindableObjectDefinePropertyCall(d)) {
55362
+ return forEach(d.arguments[2].properties, (propDecl) => {
55363
+ const id = getNameOfDeclaration(propDecl);
55364
+ if (!!id && isIdentifier(id) && idText(id) === "set") {
55365
+ return propDecl;
55366
+ }
55367
+ });
55368
+ }
55369
+ });
55370
+ Debug.assert(setter && isFunctionLikeDeclaration(setter));
55371
+ const paramSymbol = getSignatureFromDeclaration(setter).parameters[0];
55348
55372
  result.push(setTextRange(
55349
55373
  factory.createSetAccessorDeclaration(
55350
55374
  factory.createModifiersFromModifierFlags(flag),
@@ -55354,7 +55378,7 @@ function createTypeChecker(host) {
55354
55378
  void 0,
55355
55379
  /*dotDotDotToken*/
55356
55380
  void 0,
55357
- "arg",
55381
+ paramSymbol ? parameterToParameterDeclarationName(paramSymbol, getEffectiveParameterDeclaration(paramSymbol), context) : "value",
55358
55382
  /*questionToken*/
55359
55383
  void 0,
55360
55384
  isPrivate ? void 0 : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled)
@@ -56120,7 +56144,7 @@ function createTypeChecker(host) {
56120
56144
  const pattern = declaration.parent;
56121
56145
  if (strictNullChecks && declaration.flags & 33554432 /* Ambient */ && isParameterDeclaration(declaration)) {
56122
56146
  parentType = getNonNullableType(parentType);
56123
- } else if (strictNullChecks && pattern.parent.initializer && !hasTypeFacts(getTypeOfInitializer(pattern.parent.initializer), 65536 /* EQUndefined */)) {
56147
+ } else if (strictNullChecks && pattern.parent.initializer && !(getTypeFacts(getTypeOfInitializer(pattern.parent.initializer)) & 65536 /* EQUndefined */)) {
56124
56148
  parentType = getTypeWithFacts(parentType, 524288 /* NEUndefined */);
56125
56149
  }
56126
56150
  let type;
@@ -56163,7 +56187,7 @@ function createTypeChecker(host) {
56163
56187
  return type;
56164
56188
  }
56165
56189
  if (getEffectiveTypeAnnotationNode(walkUpBindingElementsAndPatterns(declaration))) {
56166
- return strictNullChecks && !hasTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */), 16777216 /* IsUndefined */) ? getNonUndefinedType(type) : type;
56190
+ return strictNullChecks && !(getTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 16777216 /* IsUndefined */) ? getNonUndefinedType(type) : type;
56167
56191
  }
56168
56192
  return widenTypeInferredFromInitializer(declaration, getUnionType([getNonUndefinedType(type), checkDeclarationInitializer(declaration, 0 /* Normal */)], 2 /* Subtype */));
56169
56193
  }
@@ -64271,7 +64295,7 @@ function createTypeChecker(host) {
64271
64295
  if (sourceType && targetType) {
64272
64296
  const sourceSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
64273
64297
  const targetSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(targetType));
64274
- const callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) && getOnlyTypeFacts(sourceType, 50331648 /* IsUndefinedOrNull */) === getOnlyTypeFacts(targetType, 50331648 /* IsUndefinedOrNull */);
64298
+ const callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) && (getTypeFacts(sourceType) & 50331648 /* IsUndefinedOrNull */) === (getTypeFacts(targetType) & 50331648 /* IsUndefinedOrNull */);
64275
64299
  let related = callbacks ? compareSignaturesRelated(targetSig, sourceSig, checkMode & 8 /* StrictArity */ | (strictVariance ? 2 /* StrictCallback */ : 1 /* BivariantCallback */), reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) : !(checkMode & 3 /* Callback */) && !strictVariance && compareTypes(
64276
64300
  sourceType,
64277
64301
  targetType,
@@ -67428,7 +67452,7 @@ function createTypeChecker(host) {
67428
67452
  return value.base10Value === "0";
67429
67453
  }
67430
67454
  function removeDefinitelyFalsyTypes(type) {
67431
- return filterType(type, (t) => hasTypeFacts(t, 4194304 /* Truthy */));
67455
+ return filterType(type, (t) => !!(getTypeFacts(t) & 4194304 /* Truthy */));
67432
67456
  }
67433
67457
  function extractDefinitelyFalsyTypes(type) {
67434
67458
  return mapType(type, getDefinitelyFalsyPartOfType);
@@ -68704,12 +68728,14 @@ function createTypeChecker(host) {
68704
68728
  }
68705
68729
  function inferFromSignatures(source, target, kind) {
68706
68730
  const sourceSignatures = getSignaturesOfType(source, kind);
68707
- const targetSignatures = getSignaturesOfType(target, kind);
68708
68731
  const sourceLen = sourceSignatures.length;
68709
- const targetLen = targetSignatures.length;
68710
- const len = sourceLen < targetLen ? sourceLen : targetLen;
68711
- for (let i = 0; i < len; i++) {
68712
- inferFromSignature(getBaseSignature(sourceSignatures[sourceLen - len + i]), getErasedSignature(targetSignatures[targetLen - len + i]));
68732
+ if (sourceLen > 0) {
68733
+ const targetSignatures = getSignaturesOfType(target, kind);
68734
+ const targetLen = targetSignatures.length;
68735
+ for (let i = 0; i < targetLen; i++) {
68736
+ const sourceIndex = Math.max(sourceLen - targetLen + i, 0);
68737
+ inferFromSignature(getBaseSignature(sourceSignatures[sourceIndex]), getErasedSignature(targetSignatures[i]));
68738
+ }
68713
68739
  }
68714
68740
  }
68715
68741
  function inferFromSignature(source, target) {
@@ -69171,13 +69197,7 @@ function createTypeChecker(host) {
69171
69197
  const resolved = resolveStructuredTypeMembers(type);
69172
69198
  return !!(resolved.callSignatures.length || resolved.constructSignatures.length || resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType));
69173
69199
  }
69174
- function getOnlyTypeFacts(type, mask2) {
69175
- return getTypeFactsWorker(type, mask2) & mask2;
69176
- }
69177
- function hasTypeFacts(type, mask2) {
69178
- return getOnlyTypeFacts(type, mask2) !== 0;
69179
- }
69180
- function getTypeFactsWorker(type, callerOnlyNeeds) {
69200
+ function getTypeFacts(type) {
69181
69201
  if (type.flags & (2097152 /* Intersection */ | 465829888 /* Instantiable */)) {
69182
69202
  type = getBaseConstraintOfType(type) || unknownType;
69183
69203
  }
@@ -69210,10 +69230,6 @@ function createTypeChecker(host) {
69210
69230
  return strictNullChecks ? type === falseType || type === regularFalseType ? 12121864 /* FalseStrictFacts */ : 7927560 /* TrueStrictFacts */ : type === falseType || type === regularFalseType ? 12580616 /* FalseFacts */ : 16774920 /* TrueFacts */;
69211
69231
  }
69212
69232
  if (flags & 524288 /* Object */) {
69213
- const possibleFacts = strictNullChecks ? 83427327 /* EmptyObjectStrictFacts */ | 7880640 /* FunctionStrictFacts */ | 7888800 /* ObjectStrictFacts */ : 83886079 /* EmptyObjectFacts */ | 16728e3 /* FunctionFacts */ | 16736160 /* ObjectFacts */;
69214
- if ((callerOnlyNeeds & possibleFacts) === 0) {
69215
- return 0;
69216
- }
69217
69233
  return getObjectFlags(type) & 16 /* Anonymous */ && isEmptyObjectType(type) ? strictNullChecks ? 83427327 /* EmptyObjectStrictFacts */ : 83886079 /* EmptyObjectFacts */ : isFunctionObjectType(type) ? strictNullChecks ? 7880640 /* FunctionStrictFacts */ : 16728e3 /* FunctionFacts */ : strictNullChecks ? 7888800 /* ObjectStrictFacts */ : 16736160 /* ObjectFacts */;
69218
69234
  }
69219
69235
  if (flags & 16384 /* Void */) {
@@ -69235,20 +69251,20 @@ function createTypeChecker(host) {
69235
69251
  return 0 /* None */;
69236
69252
  }
69237
69253
  if (flags & 1048576 /* Union */) {
69238
- return reduceLeft(type.types, (facts, t) => facts | getTypeFactsWorker(t, callerOnlyNeeds), 0 /* None */);
69254
+ return reduceLeft(type.types, (facts, t) => facts | getTypeFacts(t), 0 /* None */);
69239
69255
  }
69240
69256
  if (flags & 2097152 /* Intersection */) {
69241
- return getIntersectionTypeFacts(type, callerOnlyNeeds);
69257
+ return getIntersectionTypeFacts(type);
69242
69258
  }
69243
69259
  return 83886079 /* UnknownFacts */;
69244
69260
  }
69245
- function getIntersectionTypeFacts(type, callerOnlyNeeds) {
69261
+ function getIntersectionTypeFacts(type) {
69246
69262
  const ignoreObjects = maybeTypeOfKind(type, 402784252 /* Primitive */);
69247
69263
  let oredFacts = 0 /* None */;
69248
69264
  let andedFacts = 134217727 /* All */;
69249
69265
  for (const t of type.types) {
69250
69266
  if (!(ignoreObjects && t.flags & 524288 /* Object */)) {
69251
- const f = getTypeFactsWorker(t, callerOnlyNeeds);
69267
+ const f = getTypeFacts(t);
69252
69268
  oredFacts |= f;
69253
69269
  andedFacts &= f;
69254
69270
  }
@@ -69256,19 +69272,19 @@ function createTypeChecker(host) {
69256
69272
  return oredFacts & 8256 /* OrFactsMask */ | andedFacts & 134209471 /* AndFactsMask */;
69257
69273
  }
69258
69274
  function getTypeWithFacts(type, include) {
69259
- return filterType(type, (t) => hasTypeFacts(t, include));
69275
+ return filterType(type, (t) => (getTypeFacts(t) & include) !== 0);
69260
69276
  }
69261
69277
  function getAdjustedTypeWithFacts(type, facts) {
69262
69278
  const reduced = recombineUnknownType(getTypeWithFacts(strictNullChecks && type.flags & 2 /* Unknown */ ? unknownUnionType : type, facts));
69263
69279
  if (strictNullChecks) {
69264
69280
  switch (facts) {
69265
69281
  case 524288 /* NEUndefined */:
69266
- return mapType(reduced, (t) => hasTypeFacts(t, 65536 /* EQUndefined */) ? getIntersectionType([t, hasTypeFacts(t, 131072 /* EQNull */) && !maybeTypeOfKind(reduced, 65536 /* Null */) ? getUnionType([emptyObjectType, nullType]) : emptyObjectType]) : t);
69282
+ return mapType(reduced, (t) => getTypeFacts(t) & 65536 /* EQUndefined */ ? getIntersectionType([t, getTypeFacts(t) & 131072 /* EQNull */ && !maybeTypeOfKind(reduced, 65536 /* Null */) ? getUnionType([emptyObjectType, nullType]) : emptyObjectType]) : t);
69267
69283
  case 1048576 /* NENull */:
69268
- return mapType(reduced, (t) => hasTypeFacts(t, 131072 /* EQNull */) ? getIntersectionType([t, hasTypeFacts(t, 65536 /* EQUndefined */) && !maybeTypeOfKind(reduced, 32768 /* Undefined */) ? getUnionType([emptyObjectType, undefinedType]) : emptyObjectType]) : t);
69284
+ return mapType(reduced, (t) => getTypeFacts(t) & 131072 /* EQNull */ ? getIntersectionType([t, getTypeFacts(t) & 65536 /* EQUndefined */ && !maybeTypeOfKind(reduced, 32768 /* Undefined */) ? getUnionType([emptyObjectType, undefinedType]) : emptyObjectType]) : t);
69269
69285
  case 2097152 /* NEUndefinedOrNull */:
69270
69286
  case 4194304 /* Truthy */:
69271
- return mapType(reduced, (t) => hasTypeFacts(t, 262144 /* EQUndefinedOrNull */) ? getGlobalNonNullableTypeInstantiation(t) : t);
69287
+ return mapType(reduced, (t) => getTypeFacts(t) & 262144 /* EQUndefinedOrNull */ ? getGlobalNonNullableTypeInstantiation(t) : t);
69272
69288
  }
69273
69289
  }
69274
69290
  return reduced;
@@ -70255,7 +70271,7 @@ function createTypeChecker(host) {
70255
70271
  return void 0;
70256
70272
  }
70257
70273
  function getDiscriminantPropertyAccess(expr, computedType) {
70258
- const type = declaredType.flags & 1048576 /* Union */ ? declaredType : computedType;
70274
+ const type = !(computedType.flags & 1048576 /* Union */) && declaredType.flags & 1048576 /* Union */ ? declaredType : computedType;
70259
70275
  if (type.flags & 1048576 /* Union */) {
70260
70276
  const access = getCandidateDiscriminantPropertyAccess(expr);
70261
70277
  if (access) {
@@ -70605,14 +70621,14 @@ function createTypeChecker(host) {
70605
70621
  // the constituent based on its type facts. We use the strict subtype relation because it treats `object`
70606
70622
  // as a subtype of `{}`, and we need the type facts check because function types are subtypes of `object`,
70607
70623
  // but are classified as "function" according to `typeof`.
70608
- isTypeRelatedTo(t, impliedType, strictSubtypeRelation) ? hasTypeFacts(t, facts) ? t : neverType : (
70624
+ isTypeRelatedTo(t, impliedType, strictSubtypeRelation) ? getTypeFacts(t) & facts ? t : neverType : (
70609
70625
  // We next check if the consituent is a supertype of the implied type. If so, we substitute the implied
70610
70626
  // type. This handles top types like `unknown` and `{}`, and supertypes like `{ toString(): string }`.
70611
70627
  isTypeSubtypeOf(impliedType, t) ? impliedType : (
70612
70628
  // Neither the constituent nor the implied type is a subtype of the other, however their domains may still
70613
70629
  // overlap. For example, an unconstrained type parameter and type `string`. If the type facts indicate
70614
70630
  // possible overlap, we form an intersection. Otherwise, we eliminate the constituent.
70615
- hasTypeFacts(t, facts) ? getIntersectionType([t, impliedType]) : neverType
70631
+ getTypeFacts(t) & facts ? getIntersectionType([t, impliedType]) : neverType
70616
70632
  )
70617
70633
  )
70618
70634
  ));
@@ -70626,7 +70642,7 @@ function createTypeChecker(host) {
70626
70642
  const hasDefaultClause = clauseStart === clauseEnd || defaultIndex >= clauseStart && defaultIndex < clauseEnd;
70627
70643
  if (hasDefaultClause) {
70628
70644
  const notEqualFacts = getNotEqualFactsFromTypeofSwitch(clauseStart, clauseEnd, witnesses);
70629
- return filterType(type, (t) => getOnlyTypeFacts(t, notEqualFacts) === notEqualFacts);
70645
+ return filterType(type, (t) => (getTypeFacts(t) & notEqualFacts) === notEqualFacts);
70630
70646
  }
70631
70647
  const clauseWitnesses = witnesses.slice(clauseStart, clauseEnd);
70632
70648
  return getUnionType(map(clauseWitnesses, (text) => text ? narrowTypeByTypeName(type, text) : neverType));
@@ -70764,7 +70780,7 @@ function createTypeChecker(host) {
70764
70780
  false
70765
70781
  );
70766
70782
  }
70767
- if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) && !hasTypeFacts(predicate.type, 65536 /* EQUndefined */)) {
70783
+ if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) && !(getTypeFacts(predicate.type) & 65536 /* EQUndefined */)) {
70768
70784
  type = getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
70769
70785
  }
70770
70786
  const access = getDiscriminantPropertyAccess(predicateArgument, type);
@@ -70898,7 +70914,7 @@ function createTypeChecker(host) {
70898
70914
  reportCircularityError(declaration.symbol);
70899
70915
  return true;
70900
70916
  }
70901
- const containsUndefined = !!hasTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */), 16777216 /* IsUndefined */);
70917
+ const containsUndefined = !!(getTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 16777216 /* IsUndefined */);
70902
70918
  if (!popTypeResolution()) {
70903
70919
  reportCircularityError(declaration.symbol);
70904
70920
  return true;
@@ -70908,7 +70924,7 @@ function createTypeChecker(host) {
70908
70924
  return links.parameterInitializerContainsUndefined;
70909
70925
  }
70910
70926
  function removeOptionalityFromDeclaredType(declaredType, declaration) {
70911
- const removeUndefined = strictNullChecks && declaration.kind === 169 /* Parameter */ && declaration.initializer && hasTypeFacts(declaredType, 16777216 /* IsUndefined */) && !parameterInitializerContainsUndefined(declaration);
70927
+ const removeUndefined = strictNullChecks && declaration.kind === 169 /* Parameter */ && declaration.initializer && getTypeFacts(declaredType) & 16777216 /* IsUndefined */ && !parameterInitializerContainsUndefined(declaration);
70912
70928
  return removeUndefined ? getTypeWithFacts(declaredType, 524288 /* NEUndefined */) : declaredType;
70913
70929
  }
70914
70930
  function isConstraintPosition(type, node) {
@@ -73738,7 +73754,7 @@ function createTypeChecker(host) {
73738
73754
  return checkNonNullType(checkExpression(node), node);
73739
73755
  }
73740
73756
  function isNullableType(type) {
73741
- return hasTypeFacts(type, 50331648 /* IsUndefinedOrNull */);
73757
+ return !!(getTypeFacts(type) & 50331648 /* IsUndefinedOrNull */);
73742
73758
  }
73743
73759
  function getNonNullableTypeIfNeeded(type) {
73744
73760
  return isNullableType(type) ? getNonNullableType(type) : type;
@@ -73784,7 +73800,7 @@ function createTypeChecker(host) {
73784
73800
  error2(node, Diagnostics.Object_is_of_type_unknown);
73785
73801
  return errorType;
73786
73802
  }
73787
- const facts = getOnlyTypeFacts(type, 50331648 /* IsUndefinedOrNull */);
73803
+ const facts = getTypeFacts(type);
73788
73804
  if (facts & 50331648 /* IsUndefinedOrNull */) {
73789
73805
  reportError(node, facts);
73790
73806
  const t = getNonNullableType(type);
@@ -77564,7 +77580,7 @@ function createTypeChecker(host) {
77564
77580
  if (operandConstraint.flags & 3 /* AnyOrUnknown */) {
77565
77581
  return (556800 /* AllTypeofNE */ & notEqualFacts) === 556800 /* AllTypeofNE */;
77566
77582
  }
77567
- return !someType(operandConstraint, (t) => getOnlyTypeFacts(t, notEqualFacts) === notEqualFacts);
77583
+ return !someType(operandConstraint, (t) => (getTypeFacts(t) & notEqualFacts) === notEqualFacts);
77568
77584
  }
77569
77585
  const type = checkExpressionCached(node.expression);
77570
77586
  if (!isLiteralType(type)) {
@@ -77889,7 +77905,7 @@ function createTypeChecker(host) {
77889
77905
  }
77890
77906
  function checkDeleteExpressionMustBeOptional(expr, symbol) {
77891
77907
  const type = getTypeOfSymbol(symbol);
77892
- if (strictNullChecks && !(type.flags & (3 /* AnyOrUnknown */ | 131072 /* Never */)) && !(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ : hasTypeFacts(type, 16777216 /* IsUndefined */))) {
77908
+ if (strictNullChecks && !(type.flags & (3 /* AnyOrUnknown */ | 131072 /* Never */)) && !(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ : getTypeFacts(type) & 16777216 /* IsUndefined */)) {
77893
77909
  error2(expr, Diagnostics.The_operand_of_a_delete_operator_must_be_optional);
77894
77910
  }
77895
77911
  }
@@ -78024,7 +78040,7 @@ function createTypeChecker(host) {
78024
78040
  return getUnaryResultType(operandType);
78025
78041
  case 54 /* ExclamationToken */:
78026
78042
  checkTruthinessOfType(operandType, node.operand);
78027
- const facts = getOnlyTypeFacts(operandType, 4194304 /* Truthy */ | 8388608 /* Falsy */);
78043
+ const facts = getTypeFacts(operandType) & (4194304 /* Truthy */ | 8388608 /* Falsy */);
78028
78044
  return facts === 4194304 /* Truthy */ ? falseType : facts === 8388608 /* Falsy */ ? trueType : booleanType;
78029
78045
  case 46 /* PlusPlusToken */:
78030
78046
  case 47 /* MinusMinusToken */:
@@ -78255,7 +78271,7 @@ function createTypeChecker(host) {
78255
78271
  if (exprOrAssignment.kind === 304 /* ShorthandPropertyAssignment */) {
78256
78272
  const prop = exprOrAssignment;
78257
78273
  if (prop.objectAssignmentInitializer) {
78258
- if (strictNullChecks && !hasTypeFacts(checkExpression(prop.objectAssignmentInitializer), 16777216 /* IsUndefined */)) {
78274
+ if (strictNullChecks && !(getTypeFacts(checkExpression(prop.objectAssignmentInitializer)) & 16777216 /* IsUndefined */)) {
78259
78275
  sourceType = getTypeWithFacts(sourceType, 524288 /* NEUndefined */);
78260
78276
  }
78261
78277
  checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, checkMode);
@@ -78667,7 +78683,7 @@ function createTypeChecker(host) {
78667
78683
  return checkInExpression(left, right, leftType, rightType);
78668
78684
  case 56 /* AmpersandAmpersandToken */:
78669
78685
  case 77 /* AmpersandAmpersandEqualsToken */: {
78670
- const resultType2 = hasTypeFacts(leftType, 4194304 /* Truthy */) ? getUnionType([extractDefinitelyFalsyTypes(strictNullChecks ? leftType : getBaseTypeOfLiteralType(rightType)), rightType]) : leftType;
78686
+ const resultType2 = getTypeFacts(leftType) & 4194304 /* Truthy */ ? getUnionType([extractDefinitelyFalsyTypes(strictNullChecks ? leftType : getBaseTypeOfLiteralType(rightType)), rightType]) : leftType;
78671
78687
  if (operator === 77 /* AmpersandAmpersandEqualsToken */) {
78672
78688
  checkAssignmentOperator(rightType);
78673
78689
  }
@@ -78675,7 +78691,7 @@ function createTypeChecker(host) {
78675
78691
  }
78676
78692
  case 57 /* BarBarToken */:
78677
78693
  case 76 /* BarBarEqualsToken */: {
78678
- const resultType2 = hasTypeFacts(leftType, 8388608 /* Falsy */) ? getUnionType([getNonNullableType(removeDefinitelyFalsyTypes(leftType)), rightType], 2 /* Subtype */) : leftType;
78694
+ const resultType2 = getTypeFacts(leftType) & 8388608 /* Falsy */ ? getUnionType([getNonNullableType(removeDefinitelyFalsyTypes(leftType)), rightType], 2 /* Subtype */) : leftType;
78679
78695
  if (operator === 76 /* BarBarEqualsToken */) {
78680
78696
  checkAssignmentOperator(rightType);
78681
78697
  }
@@ -78683,7 +78699,7 @@ function createTypeChecker(host) {
78683
78699
  }
78684
78700
  case 61 /* QuestionQuestionToken */:
78685
78701
  case 78 /* QuestionQuestionEqualsToken */: {
78686
- const resultType2 = hasTypeFacts(leftType, 262144 /* EQUndefinedOrNull */) ? getUnionType([getNonNullableType(leftType), rightType], 2 /* Subtype */) : leftType;
78702
+ const resultType2 = getTypeFacts(leftType) & 262144 /* EQUndefinedOrNull */ ? getUnionType([getNonNullableType(leftType), rightType], 2 /* Subtype */) : leftType;
78687
78703
  if (operator === 78 /* QuestionQuestionEqualsToken */) {
78688
78704
  checkAssignmentOperator(rightType);
78689
78705
  }
@@ -82000,7 +82016,7 @@ function createTypeChecker(host) {
82000
82016
  }
82001
82017
  const type = location === condExpr2 ? condType : checkTruthinessExpression(location);
82002
82018
  const isPropertyExpressionCast = isPropertyAccessExpression(location) && isTypeAssertion(location.expression);
82003
- if (!hasTypeFacts(type, 4194304 /* Truthy */) || isPropertyExpressionCast)
82019
+ if (!(getTypeFacts(type) & 4194304 /* Truthy */) || isPropertyExpressionCast)
82004
82020
  return;
82005
82021
  const callSignatures = getSignaturesOfType(type, 0 /* Call */);
82006
82022
  const isPromise = !!getAwaitedTypeOfPromise(type);
@@ -164652,11 +164668,11 @@ function provideInlayHints(context) {
164652
164668
  function isSignatureSupportingReturnAnnotation(node) {
164653
164669
  return isArrowFunction(node) || isFunctionExpression(node) || isFunctionDeclaration(node) || isMethodDeclaration(node) || isGetAccessorDeclaration(node);
164654
164670
  }
164655
- function addParameterHints(text, parameter, position, isFirstVariadicArgument, sourceFile) {
164671
+ function addParameterHints(text, parameter, position, isFirstVariadicArgument) {
164656
164672
  let hintText = `${isFirstVariadicArgument ? "..." : ""}${text}`;
164657
164673
  let displayParts;
164658
164674
  if (shouldUseInteractiveInlayHints(preferences)) {
164659
- displayParts = [getNodeDisplayPart(hintText, parameter, sourceFile), { text: ":" }];
164675
+ displayParts = [getNodeDisplayPart(hintText, parameter), { text: ":" }];
164660
164676
  hintText = "";
164661
164677
  } else {
164662
164678
  hintText += ":";
@@ -164728,7 +164744,6 @@ function provideInlayHints(context) {
164728
164744
  if (!signature || !candidates.length) {
164729
164745
  return;
164730
164746
  }
164731
- const sourceFile = shouldUseInteractiveInlayHints(preferences) ? expr.getSourceFile() : void 0;
164732
164747
  let signatureParamPos = 0;
164733
164748
  for (const originalArg of args) {
164734
164749
  const arg = skipParentheses(originalArg);
@@ -164763,7 +164778,7 @@ function provideInlayHints(context) {
164763
164778
  if (leadingCommentsContainsParameterName(arg, name)) {
164764
164779
  continue;
164765
164780
  }
164766
- addParameterHints(name, parameter, originalArg.getStart(), isFirstVariadicArgument, sourceFile);
164781
+ addParameterHints(name, parameter, originalArg.getStart(), isFirstVariadicArgument);
164767
164782
  }
164768
164783
  }
164769
164784
  }
@@ -164899,7 +164914,8 @@ function provideInlayHints(context) {
164899
164914
  }
164900
164915
  return true;
164901
164916
  }
164902
- function getNodeDisplayPart(text, node, sourceFile) {
164917
+ function getNodeDisplayPart(text, node) {
164918
+ const sourceFile = node.getSourceFile();
164903
164919
  return {
164904
164920
  text,
164905
164921
  span: createTextSpanFromNode(node, sourceFile),
@@ -183585,14 +183601,22 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
183585
183601
  return {
183586
183602
  ...hint,
183587
183603
  position: scriptInfo.positionToLineOffset(position),
183588
- displayParts: displayParts == null ? void 0 : displayParts.map(({ text, span, file: file2 }) => ({
183589
- text,
183590
- span: span && {
183591
- start: scriptInfo.positionToLineOffset(span.start),
183592
- end: scriptInfo.positionToLineOffset(span.start + span.length),
183593
- file: file2
183604
+ displayParts: displayParts == null ? void 0 : displayParts.map(({ text, span, file: file2 }) => {
183605
+ if (span) {
183606
+ Debug.assertIsDefined(file2, "Target file should be defined together with its span.");
183607
+ const scriptInfo2 = this.projectService.getScriptInfo(file2);
183608
+ return {
183609
+ text,
183610
+ span: {
183611
+ start: scriptInfo2.positionToLineOffset(span.start),
183612
+ end: scriptInfo2.positionToLineOffset(span.start + span.length),
183613
+ file: file2
183614
+ }
183615
+ };
183616
+ } else {
183617
+ return { text };
183594
183618
  }
183595
- }))
183619
+ })
183596
183620
  };
183597
183621
  });
183598
183622
  }