@typescript-deploys/pr-build 5.5.0-pr-57649-11 → 5.5.0-pr-58083-15

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.5";
21
- var version = `${versionMajorMinor}.0-insiders.20240408`;
21
+ var version = `${versionMajorMinor}.0-insiders.20240409`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -12934,6 +12934,9 @@ function isObjectLiteralOrClassExpressionMethodOrAccessor(node) {
12934
12934
  function isIdentifierTypePredicate(predicate) {
12935
12935
  return predicate && predicate.kind === 1 /* Identifier */;
12936
12936
  }
12937
+ function isThisTypePredicate(predicate) {
12938
+ return predicate && predicate.kind === 0 /* This */;
12939
+ }
12937
12940
  function forEachPropertyAssignment(objectLiteral, key, callback, key2) {
12938
12941
  return forEach(objectLiteral == null ? void 0 : objectLiteral.properties, (property) => {
12939
12942
  if (!isPropertyAssignment(property))
@@ -45208,7 +45211,6 @@ function createTypeChecker(host) {
45208
45211
  let result;
45209
45212
  let lastLocation;
45210
45213
  let lastSelfReferenceLocation;
45211
- let seenAsUsedOutsideOfSelf = false;
45212
45214
  let propertyWithInvalidInitializer;
45213
45215
  let associatedDeclarationForContainingInitializerOrBindingName;
45214
45216
  let withinDeferredContext = false;
@@ -45420,9 +45422,6 @@ function createTypeChecker(host) {
45420
45422
  location = location.parent.parent.parent;
45421
45423
  }
45422
45424
  break;
45423
- case 175 /* ClassStaticBlockDeclaration */:
45424
- seenAsUsedOutsideOfSelf = true;
45425
- break;
45426
45425
  }
45427
45426
  if (isSelfReferenceLocation(location)) {
45428
45427
  lastSelfReferenceLocation = location;
@@ -45430,7 +45429,7 @@ function createTypeChecker(host) {
45430
45429
  lastLocation = location;
45431
45430
  location = isJSDocTemplateTag(location) ? getEffectiveContainerForJSDocTemplateTag(location) || location.parent : isJSDocParameterTag(location) || isJSDocReturnTag(location) ? getHostSignatureFromJSDoc(location) || location.parent : location.parent;
45432
45431
  }
45433
- if (isUse && result && (seenAsUsedOutsideOfSelf || !lastSelfReferenceLocation || result !== lastSelfReferenceLocation.symbol)) {
45432
+ if (isUse && result && (!lastSelfReferenceLocation || result !== lastSelfReferenceLocation.symbol)) {
45434
45433
  result.isReferenced |= meaning;
45435
45434
  }
45436
45435
  if (!result) {
@@ -48123,7 +48122,7 @@ function createTypeChecker(host) {
48123
48122
  typeToTypeNode: (type, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => typeToTypeNodeHelper(type, context)),
48124
48123
  typePredicateToTypePredicateNode: (typePredicate, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => typePredicateToTypePredicateNodeHelper(typePredicate, context)),
48125
48124
  expressionOrTypeToTypeNode: (expr, type, addUndefined, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => expressionOrTypeToTypeNode(context, expr, type, addUndefined)),
48126
- serializeTypeForDeclaration: (type, symbol, addUndefined, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, addUndefined)),
48125
+ serializeTypeForDeclaration: (declaration, type, symbol, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => serializeTypeForDeclaration(context, declaration, type, symbol)),
48127
48126
  serializeReturnTypeForSignature: (signature, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => serializeReturnTypeForSignature(context, signature)),
48128
48127
  indexInfoToIndexSignatureDeclaration: (indexInfo, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => indexInfoToIndexSignatureDeclarationHelper(
48129
48128
  indexInfo,
@@ -48146,6 +48145,18 @@ function createTypeChecker(host) {
48146
48145
  symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolTableToDeclarationStatements(symbolTable, context)),
48147
48146
  symbolToNode: (symbol, meaning, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolToNode(symbol, context, meaning))
48148
48147
  };
48148
+ function setTextRange2(context, range, location) {
48149
+ if (!nodeIsSynthesized(range) && !(range.flags & 16 /* Synthesized */) && (!context.enclosingFile || context.enclosingFile !== getSourceFileOfNode(range))) {
48150
+ range = factory.cloneNode(range);
48151
+ }
48152
+ if (!location) {
48153
+ return range;
48154
+ }
48155
+ if (!context.enclosingFile || context.enclosingFile !== getSourceFileOfNode(getOriginalNode(location))) {
48156
+ return setOriginalNode(range, location);
48157
+ }
48158
+ return setTextRange(setOriginalNode(range, location), location);
48159
+ }
48149
48160
  function expressionOrTypeToTypeNode(context, expr, type, addUndefined) {
48150
48161
  if (expr) {
48151
48162
  const typeNode = isAssertionExpression(expr) ? expr.type : isJSDocTypeAssertion(expr) ? getJSDocTypeAssertionType(expr) : void 0;
@@ -48210,6 +48221,7 @@ function createTypeChecker(host) {
48210
48221
  const moduleResolverHost = (tracker == null ? void 0 : tracker.trackSymbol) ? tracker.moduleResolverHost : flags & 134217728 /* DoNotIncludeSymbolChain */ ? createBasicNodeBuilderModuleSpecifierResolutionHost(host) : void 0;
48211
48222
  const context = {
48212
48223
  enclosingDeclaration,
48224
+ enclosingFile: enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration),
48213
48225
  flags: flags || 0 /* None */,
48214
48226
  tracker: void 0,
48215
48227
  encounteredError: false,
@@ -48742,7 +48754,7 @@ function createTypeChecker(host) {
48742
48754
  if (!nodeIsSynthesized(node) && getParseTreeNode(node) === node) {
48743
48755
  return node;
48744
48756
  }
48745
- return setTextRange(factory.cloneNode(visitEachChild(
48757
+ return setTextRange2(context, factory.cloneNode(visitEachChild(
48746
48758
  node,
48747
48759
  deepCloneOrReuseNode,
48748
48760
  /*context*/
@@ -49084,7 +49096,13 @@ function createTypeChecker(host) {
49084
49096
  context.reverseMappedStack || (context.reverseMappedStack = []);
49085
49097
  context.reverseMappedStack.push(propertySymbol);
49086
49098
  }
49087
- propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : factory.createKeywordTypeNode(133 /* AnyKeyword */);
49099
+ propertyTypeNode = propertyType ? serializeTypeForDeclaration(
49100
+ context,
49101
+ /*declaration*/
49102
+ void 0,
49103
+ propertyType,
49104
+ propertySymbol
49105
+ ) : factory.createKeywordTypeNode(133 /* AnyKeyword */);
49088
49106
  if (propertyIsReverseMapped) {
49089
49107
  context.reverseMappedStack.pop();
49090
49108
  }
@@ -49473,8 +49491,7 @@ function createTypeChecker(host) {
49473
49491
  function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags) {
49474
49492
  const parameterDeclaration = getEffectiveParameterDeclaration(parameterSymbol);
49475
49493
  const parameterType = getTypeOfSymbol(parameterSymbol);
49476
- const addUndefined = parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration);
49477
- const parameterTypeNode = serializeTypeForDeclaration(context, parameterType, parameterSymbol, context.enclosingDeclaration, addUndefined);
49494
+ const parameterTypeNode = serializeTypeForDeclaration(context, parameterDeclaration, parameterType, parameterSymbol);
49478
49495
  const modifiers = !(context.flags & 8192 /* OmitParameterModifiers */) && preserveModifierFlags && parameterDeclaration && canHaveModifiers(parameterDeclaration) ? map(getModifiers(parameterDeclaration), factory.cloneNode) : void 0;
49479
49496
  const isRest = parameterDeclaration && isRestParameter(parameterDeclaration) || getCheckFlags(parameterSymbol) & 32768 /* RestParameter */;
49480
49497
  const dotDotDotToken = isRest ? factory.createToken(26 /* DotDotDotToken */) : void 0;
@@ -50066,10 +50083,12 @@ function createTypeChecker(host) {
50066
50083
  }
50067
50084
  return enclosingDeclaration;
50068
50085
  }
50069
- function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, addUndefined) {
50086
+ function serializeTypeForDeclaration(context, declaration, type, symbol) {
50070
50087
  var _a;
50088
+ const addUndefined = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration);
50089
+ const enclosingDeclaration = context.enclosingDeclaration;
50071
50090
  if (!isErrorType(type) && enclosingDeclaration) {
50072
- const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
50091
+ const declWithExistingAnnotation = declaration && getNonlocalEffectiveTypeAnnotationNode(declaration) ? declaration : getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
50073
50092
  if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
50074
50093
  const existing = getNonlocalEffectiveTypeAnnotationNode(declWithExistingAnnotation);
50075
50094
  const result2 = tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined);
@@ -50082,7 +50101,7 @@ function createTypeChecker(host) {
50082
50101
  if (type.flags & 8192 /* UniqueESSymbol */ && type.symbol === symbol && (!context.enclosingDeclaration || some(symbol.declarations, (d) => getSourceFileOfNode(d) === getSourceFileOfNode(context.enclosingDeclaration)))) {
50083
50102
  context.flags |= 1048576 /* AllowUniqueESSymbolType */;
50084
50103
  }
50085
- const decl = symbol.valueDeclaration ?? ((_a = symbol.declarations) == null ? void 0 : _a[0]);
50104
+ const decl = declaration ?? symbol.valueDeclaration ?? ((_a = symbol.declarations) == null ? void 0 : _a[0]);
50086
50105
  const expr = decl && isDeclarationWithPossibleInnerTypeNodeReuse(decl) ? getPossibleTypeNodeReuseExpression(decl) : void 0;
50087
50106
  const result = expressionOrTypeToTypeNode(context, expr, type, addUndefined);
50088
50107
  context.flags = oldFlags;
@@ -50196,7 +50215,7 @@ function createTypeChecker(host) {
50196
50215
  const type = getDeclaredTypeOfSymbol(sym);
50197
50216
  const name = sym.flags & 262144 /* TypeParameter */ ? typeParameterToName(type, context) : factory.cloneNode(node2);
50198
50217
  name.symbol = sym;
50199
- return setTextRange(setEmitFlags(setOriginalNode(name, node2), 16777216 /* NoAsciiEscaping */), node2);
50218
+ return setTextRange2(context, setEmitFlags(name, 16777216 /* NoAsciiEscaping */), node2);
50200
50219
  }
50201
50220
  const updated = visitEachChild(
50202
50221
  node2,
@@ -50205,7 +50224,7 @@ function createTypeChecker(host) {
50205
50224
  void 0
50206
50225
  );
50207
50226
  if (updated !== node2) {
50208
- setTextRange(updated, node2);
50227
+ setTextRange2(context, updated, node2);
50209
50228
  }
50210
50229
  return updated;
50211
50230
  }
@@ -50219,12 +50238,12 @@ function createTypeChecker(host) {
50219
50238
  if (hadError) {
50220
50239
  return void 0;
50221
50240
  }
50222
- return transformed === existing ? setTextRange(factory.cloneNode(existing), existing) : transformed;
50241
+ return transformed;
50223
50242
  function visitExistingNodeTreeSymbols(node) {
50224
50243
  const onExitNewScope = isNewScopeNode(node) ? onEnterNewScope(node) : void 0;
50225
50244
  const result = visitExistingNodeTreeSymbolsWorker(node);
50226
50245
  onExitNewScope == null ? void 0 : onExitNewScope();
50227
- return result;
50246
+ return result === node ? setTextRange2(context, factory.cloneNode(result), node) : result;
50228
50247
  }
50229
50248
  function onEnterNewScope(node) {
50230
50249
  const oldContex = context;
@@ -50360,7 +50379,7 @@ function createTypeChecker(host) {
50360
50379
  void 0
50361
50380
  );
50362
50381
  if (visited === node) {
50363
- visited = setTextRange(factory.cloneNode(node), node);
50382
+ visited = setTextRange2(context, factory.cloneNode(node), node);
50364
50383
  }
50365
50384
  visited.type = factory.createKeywordTypeNode(133 /* AnyKeyword */);
50366
50385
  if (isParameter(node)) {
@@ -50383,11 +50402,16 @@ function createTypeChecker(host) {
50383
50402
  /*context*/
50384
50403
  void 0
50385
50404
  );
50386
- const clone = setTextRange(visited === node ? factory.cloneNode(node) : visited, node);
50405
+ const clone = setTextRange2(context, visited === node ? factory.cloneNode(node) : visited, node);
50387
50406
  const flags = getEmitFlags(clone);
50388
50407
  setEmitFlags(clone, flags | (context.flags & 1024 /* MultilineObjectLiterals */ && isTypeLiteralNode(node) ? 0 : 1 /* SingleLine */));
50389
50408
  return clone;
50390
50409
  }
50410
+ if (isStringLiteral(node) && !!(context.flags & 268435456 /* UseSingleQuotesForStringLiteralType */) && !node.singleQuote) {
50411
+ const clone = factory.cloneNode(node);
50412
+ clone.singleQuote = true;
50413
+ return clone;
50414
+ }
50391
50415
  if (isConditionalTypeNode(node)) {
50392
50416
  const checkType = visitNode(node.checkType, visitExistingNodeTreeSymbols, isTypeNode);
50393
50417
  const disposeScope = onEnterNewScope(node);
@@ -50766,7 +50790,8 @@ function createTypeChecker(host) {
50766
50790
  );
50767
50791
  context.tracker.trackSymbol(type.symbol, context.enclosingDeclaration, 111551 /* Value */);
50768
50792
  } else {
50769
- const statement = setTextRange(
50793
+ const statement = setTextRange2(
50794
+ context,
50770
50795
  factory.createVariableStatement(
50771
50796
  /*modifiers*/
50772
50797
  void 0,
@@ -50775,7 +50800,13 @@ function createTypeChecker(host) {
50775
50800
  name,
50776
50801
  /*exclamationToken*/
50777
50802
  void 0,
50778
- serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration)
50803
+ serializeTypeForDeclaration(
50804
+ context,
50805
+ /*declaration*/
50806
+ void 0,
50807
+ type,
50808
+ symbol
50809
+ )
50779
50810
  )
50780
50811
  ], flags)
50781
50812
  ),
@@ -51048,7 +51079,7 @@ function createTypeChecker(host) {
51048
51079
  const signatures = getSignaturesOfType(type, 0 /* Call */);
51049
51080
  for (const sig of signatures) {
51050
51081
  const decl = signatureToSignatureDeclarationHelper(sig, 262 /* FunctionDeclaration */, context, { name: factory.createIdentifier(localName) });
51051
- addResult(setTextRange(decl, getSignatureTextRangeLocation(sig)), modifierFlags);
51082
+ addResult(setTextRange2(context, decl, getSignatureTextRangeLocation(sig)), modifierFlags);
51052
51083
  }
51053
51084
  if (!(symbol.flags & (512 /* ValueModule */ | 1024 /* NamespaceModule */) && !!symbol.exports && !!symbol.exports.size)) {
51054
51085
  const props = filter(getPropertiesOfType(type), isNamespaceMember);
@@ -51226,7 +51257,8 @@ function createTypeChecker(host) {
51226
51257
  const indexSignatures = serializeIndexSignatures(classType, baseTypes[0]);
51227
51258
  context.enclosingDeclaration = oldEnclosing;
51228
51259
  addResult(
51229
- setTextRange(
51260
+ setTextRange2(
51261
+ context,
51230
51262
  factory.createClassDeclaration(
51231
51263
  /*modifiers*/
51232
51264
  void 0,
@@ -51586,7 +51618,13 @@ function createTypeChecker(host) {
51586
51618
  varName,
51587
51619
  /*exclamationToken*/
51588
51620
  void 0,
51589
- serializeTypeForDeclaration(context, typeToSerialize, symbol, enclosingDeclaration)
51621
+ serializeTypeForDeclaration(
51622
+ context,
51623
+ /*declaration*/
51624
+ void 0,
51625
+ typeToSerialize,
51626
+ symbol
51627
+ )
51590
51628
  )
51591
51629
  ], flags)
51592
51630
  );
@@ -51658,7 +51696,8 @@ function createTypeChecker(host) {
51658
51696
  });
51659
51697
  Debug.assert(!!setter);
51660
51698
  const paramSymbol = isFunctionLikeDeclaration(setter) ? getSignatureFromDeclaration(setter).parameters[0] : void 0;
51661
- result.push(setTextRange(
51699
+ result.push(setTextRange2(
51700
+ context,
51662
51701
  factory.createSetAccessorDeclaration(
51663
51702
  factory.createModifiersFromModifierFlags(flag),
51664
51703
  name,
@@ -51670,7 +51709,13 @@ function createTypeChecker(host) {
51670
51709
  paramSymbol ? parameterToParameterDeclarationName(paramSymbol, getEffectiveParameterDeclaration(paramSymbol), context) : "value",
51671
51710
  /*questionToken*/
51672
51711
  void 0,
51673
- isPrivate ? void 0 : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration)
51712
+ isPrivate ? void 0 : serializeTypeForDeclaration(
51713
+ context,
51714
+ /*declaration*/
51715
+ void 0,
51716
+ getTypeOfSymbol(p),
51717
+ p
51718
+ )
51674
51719
  )],
51675
51720
  /*body*/
51676
51721
  void 0
@@ -51680,12 +51725,19 @@ function createTypeChecker(host) {
51680
51725
  }
51681
51726
  if (p.flags & 32768 /* GetAccessor */) {
51682
51727
  const isPrivate2 = modifierFlags & 2 /* Private */;
51683
- result.push(setTextRange(
51728
+ result.push(setTextRange2(
51729
+ context,
51684
51730
  factory.createGetAccessorDeclaration(
51685
51731
  factory.createModifiersFromModifierFlags(flag),
51686
51732
  name,
51687
51733
  [],
51688
- isPrivate2 ? void 0 : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration),
51734
+ isPrivate2 ? void 0 : serializeTypeForDeclaration(
51735
+ context,
51736
+ /*declaration*/
51737
+ void 0,
51738
+ getTypeOfSymbol(p),
51739
+ p
51740
+ ),
51689
51741
  /*body*/
51690
51742
  void 0
51691
51743
  ),
@@ -51694,12 +51746,19 @@ function createTypeChecker(host) {
51694
51746
  }
51695
51747
  return result;
51696
51748
  } else if (p.flags & (4 /* Property */ | 3 /* Variable */ | 98304 /* Accessor */)) {
51697
- return setTextRange(
51749
+ return setTextRange2(
51750
+ context,
51698
51751
  createProperty2(
51699
51752
  factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 8 /* Readonly */ : 0) | flag),
51700
51753
  name,
51701
51754
  p.flags & 16777216 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0,
51702
- isPrivate ? void 0 : serializeTypeForDeclaration(context, getWriteTypeOfSymbol(p), p, enclosingDeclaration),
51755
+ isPrivate ? void 0 : serializeTypeForDeclaration(
51756
+ context,
51757
+ /*declaration*/
51758
+ void 0,
51759
+ getWriteTypeOfSymbol(p),
51760
+ p
51761
+ ),
51703
51762
  // TODO: https://github.com/microsoft/TypeScript/pull/32372#discussion_r328386357
51704
51763
  // interface members can't have initializers, however class members _can_
51705
51764
  /*initializer*/
@@ -51712,7 +51771,8 @@ function createTypeChecker(host) {
51712
51771
  const type = getTypeOfSymbol(p);
51713
51772
  const signatures = getSignaturesOfType(type, 0 /* Call */);
51714
51773
  if (flag & 2 /* Private */) {
51715
- return setTextRange(
51774
+ return setTextRange2(
51775
+ context,
51716
51776
  createProperty2(
51717
51777
  factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 8 /* Readonly */ : 0) | flag),
51718
51778
  name,
@@ -51738,7 +51798,7 @@ function createTypeChecker(host) {
51738
51798
  }
51739
51799
  );
51740
51800
  const location = sig.declaration && isPrototypePropertyAssignment(sig.declaration.parent) ? sig.declaration.parent : sig.declaration;
51741
- results2.push(setTextRange(decl, location));
51801
+ results2.push(setTextRange2(context, decl, location));
51742
51802
  }
51743
51803
  return results2;
51744
51804
  }
@@ -51794,7 +51854,8 @@ function createTypeChecker(host) {
51794
51854
  }
51795
51855
  }
51796
51856
  if (privateProtected) {
51797
- return [setTextRange(
51857
+ return [setTextRange2(
51858
+ context,
51798
51859
  factory.createConstructorDeclaration(
51799
51860
  factory.createModifiersFromModifierFlags(privateProtected),
51800
51861
  /*parameters*/
@@ -51809,7 +51870,7 @@ function createTypeChecker(host) {
51809
51870
  const results2 = [];
51810
51871
  for (const sig of signatures) {
51811
51872
  const decl = signatureToSignatureDeclarationHelper(sig, outputKind, context);
51812
- results2.push(setTextRange(decl, sig.declaration));
51873
+ results2.push(setTextRange2(context, decl, sig.declaration));
51813
51874
  }
51814
51875
  return results2;
51815
51876
  }
@@ -55492,12 +55553,10 @@ function createTypeChecker(host) {
55492
55553
  const target = type.target ?? type;
55493
55554
  const typeVariable = getHomomorphicTypeVariable(target);
55494
55555
  if (typeVariable && !target.declaration.nameType) {
55495
- const constraint = getConstraintTypeFromMappedType(type);
55496
- if (constraint.flags & 4194304 /* Index */) {
55497
- const baseConstraint = getBaseConstraintOfType(constraint.type);
55498
- if (baseConstraint && everyType(baseConstraint, (t) => isArrayOrTupleType(t) || isArrayOrTupleOrIntersection(t))) {
55499
- return instantiateType(target, prependTypeMapping(typeVariable, baseConstraint, type.mapper));
55500
- }
55556
+ const modifiersType = getModifiersTypeFromMappedType(type);
55557
+ const baseConstraint = isGenericMappedType(modifiersType) ? getApparentTypeOfMappedType(modifiersType) : getBaseConstraintOfType(modifiersType);
55558
+ if (baseConstraint && everyType(baseConstraint, (t) => isArrayOrTupleType(t) || isArrayOrTupleOrIntersection(t))) {
55559
+ return instantiateType(target, prependTypeMapping(typeVariable, baseConstraint, type.mapper));
55501
55560
  }
55502
55561
  }
55503
55562
  return type;
@@ -55658,13 +55717,13 @@ function createTypeChecker(host) {
55658
55717
  }
55659
55718
  function getUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment) {
55660
55719
  var _a, _b, _c;
55661
- let property = ((_a = type.propertyCacheWithoutObjectFunctionPropertyAugment) == null ? void 0 : _a.get(name)) || !skipObjectFunctionPropertyAugment ? (_b = type.propertyCache) == null ? void 0 : _b.get(name) : void 0;
55720
+ let property = skipObjectFunctionPropertyAugment ? (_a = type.propertyCacheWithoutObjectFunctionPropertyAugment) == null ? void 0 : _a.get(name) : (_b = type.propertyCache) == null ? void 0 : _b.get(name);
55662
55721
  if (!property) {
55663
55722
  property = createUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment);
55664
55723
  if (property) {
55665
55724
  const properties = skipObjectFunctionPropertyAugment ? type.propertyCacheWithoutObjectFunctionPropertyAugment || (type.propertyCacheWithoutObjectFunctionPropertyAugment = createSymbolTable()) : type.propertyCache || (type.propertyCache = createSymbolTable());
55666
55725
  properties.set(name, property);
55667
- if (skipObjectFunctionPropertyAugment && !((_c = type.propertyCache) == null ? void 0 : _c.get(name))) {
55726
+ if (skipObjectFunctionPropertyAugment && !(getCheckFlags(property) & 48 /* Partial */) && !((_c = type.propertyCache) == null ? void 0 : _c.get(name))) {
55668
55727
  const properties2 = type.propertyCache || (type.propertyCache = createSymbolTable());
55669
55728
  properties2.set(name, property);
55670
55729
  }
@@ -60927,7 +60986,7 @@ function createTypeChecker(host) {
60927
60986
  const sourceTypePredicate = getTypePredicateOfSignature(source);
60928
60987
  if (sourceTypePredicate) {
60929
60988
  result &= compareTypePredicateRelatedTo(sourceTypePredicate, targetTypePredicate, reportErrors2, errorReporter, compareTypes);
60930
- } else if (isIdentifierTypePredicate(targetTypePredicate)) {
60989
+ } else if (isIdentifierTypePredicate(targetTypePredicate) || isThisTypePredicate(targetTypePredicate)) {
60931
60990
  if (reportErrors2) {
60932
60991
  errorReporter(Diagnostics.Signature_0_must_be_a_type_predicate, signatureToString(source));
60933
60992
  }
@@ -83311,9 +83370,10 @@ function createTypeChecker(host) {
83311
83370
  return false;
83312
83371
  }
83313
83372
  function declaredParameterTypeContainsUndefined(parameter) {
83314
- if (!parameter.type)
83373
+ const typeNode = getNonlocalEffectiveTypeAnnotationNode(parameter);
83374
+ if (!typeNode)
83315
83375
  return false;
83316
- const type = getTypeFromTypeNode(parameter.type);
83376
+ const type = getTypeFromTypeNode(typeNode);
83317
83377
  return containsUndefinedType(type);
83318
83378
  }
83319
83379
  function requiresAddingImplicitUndefined(parameter) {
@@ -83323,7 +83383,7 @@ function createTypeChecker(host) {
83323
83383
  return !!strictNullChecks && !isOptionalParameter(parameter) && !isJSDocParameterTag(parameter) && !!parameter.initializer && !hasSyntacticModifier(parameter, 31 /* ParameterPropertyModifier */);
83324
83384
  }
83325
83385
  function isOptionalUninitializedParameterProperty(parameter) {
83326
- return strictNullChecks && isOptionalParameter(parameter) && !parameter.initializer && hasSyntacticModifier(parameter, 31 /* ParameterPropertyModifier */);
83386
+ return strictNullChecks && isOptionalParameter(parameter) && (isJSDocParameterTag(parameter) || !parameter.initializer) && hasSyntacticModifier(parameter, 31 /* ParameterPropertyModifier */);
83327
83387
  }
83328
83388
  function isExpandoFunctionDeclaration(node) {
83329
83389
  const declaration = getParseTreeNode(node, isFunctionDeclaration);
@@ -83473,14 +83533,14 @@ function createTypeChecker(host) {
83473
83533
  return 11 /* ObjectType */;
83474
83534
  }
83475
83535
  }
83476
- function createTypeOfDeclaration(declarationIn, enclosingDeclaration, flags, tracker, addUndefined) {
83536
+ function createTypeOfDeclaration(declarationIn, enclosingDeclaration, flags, tracker) {
83477
83537
  const declaration = getParseTreeNode(declarationIn, isVariableLikeOrAccessor);
83478
83538
  if (!declaration) {
83479
83539
  return factory.createToken(133 /* AnyKeyword */);
83480
83540
  }
83481
83541
  const symbol = getSymbolOfDeclaration(declaration);
83482
83542
  const type = symbol && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* Signature */)) ? getWidenedLiteralType(getTypeOfSymbol(symbol)) : errorType;
83483
- return nodeBuilder.serializeTypeForDeclaration(type, symbol, addUndefined, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
83543
+ return nodeBuilder.serializeTypeForDeclaration(declaration, type, symbol, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
83484
83544
  }
83485
83545
  function isDeclarationWithPossibleInnerTypeNodeReuse(declaration) {
83486
83546
  return isFunctionLike(declaration) || isExportAssignment(declaration) || isVariableLike(declaration);
@@ -109133,7 +109193,7 @@ function transformDeclarations(context) {
109133
109193
  case 172 /* PropertyDeclaration */:
109134
109194
  case 208 /* BindingElement */:
109135
109195
  case 260 /* VariableDeclaration */:
109136
- typeNode = resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldAddImplicitUndefined);
109196
+ typeNode = resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker);
109137
109197
  break;
109138
109198
  case 262 /* FunctionDeclaration */:
109139
109199
  case 180 /* ConstructSignature */:
@@ -3233,7 +3233,6 @@ declare namespace ts {
3233
3233
  private addFilesToNonInferredProject;
3234
3234
  private updateNonInferredProjectFiles;
3235
3235
  private updateRootAndOptionsOfNonInferredProject;
3236
- private sendConfigFileDiagEvent;
3237
3236
  private getOrCreateInferredProjectForProjectRootPathIfEnabled;
3238
3237
  private getOrCreateSingleInferredProjectIfEnabled;
3239
3238
  private getOrCreateSingleInferredWithoutProjectRoot;
package/lib/typescript.js CHANGED
@@ -2335,7 +2335,7 @@ module.exports = __toCommonJS(typescript_exports);
2335
2335
 
2336
2336
  // src/compiler/corePublic.ts
2337
2337
  var versionMajorMinor = "5.5";
2338
- var version = `${versionMajorMinor}.0-insiders.20240408`;
2338
+ var version = `${versionMajorMinor}.0-insiders.20240409`;
2339
2339
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2340
2340
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2341
2341
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -49980,7 +49980,6 @@ function createTypeChecker(host) {
49980
49980
  let result;
49981
49981
  let lastLocation;
49982
49982
  let lastSelfReferenceLocation;
49983
- let seenAsUsedOutsideOfSelf = false;
49984
49983
  let propertyWithInvalidInitializer;
49985
49984
  let associatedDeclarationForContainingInitializerOrBindingName;
49986
49985
  let withinDeferredContext = false;
@@ -50192,9 +50191,6 @@ function createTypeChecker(host) {
50192
50191
  location = location.parent.parent.parent;
50193
50192
  }
50194
50193
  break;
50195
- case 175 /* ClassStaticBlockDeclaration */:
50196
- seenAsUsedOutsideOfSelf = true;
50197
- break;
50198
50194
  }
50199
50195
  if (isSelfReferenceLocation(location)) {
50200
50196
  lastSelfReferenceLocation = location;
@@ -50202,7 +50198,7 @@ function createTypeChecker(host) {
50202
50198
  lastLocation = location;
50203
50199
  location = isJSDocTemplateTag(location) ? getEffectiveContainerForJSDocTemplateTag(location) || location.parent : isJSDocParameterTag(location) || isJSDocReturnTag(location) ? getHostSignatureFromJSDoc(location) || location.parent : location.parent;
50204
50200
  }
50205
- if (isUse && result && (seenAsUsedOutsideOfSelf || !lastSelfReferenceLocation || result !== lastSelfReferenceLocation.symbol)) {
50201
+ if (isUse && result && (!lastSelfReferenceLocation || result !== lastSelfReferenceLocation.symbol)) {
50206
50202
  result.isReferenced |= meaning;
50207
50203
  }
50208
50204
  if (!result) {
@@ -52895,7 +52891,7 @@ function createTypeChecker(host) {
52895
52891
  typeToTypeNode: (type, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => typeToTypeNodeHelper(type, context)),
52896
52892
  typePredicateToTypePredicateNode: (typePredicate, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => typePredicateToTypePredicateNodeHelper(typePredicate, context)),
52897
52893
  expressionOrTypeToTypeNode: (expr, type, addUndefined, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => expressionOrTypeToTypeNode(context, expr, type, addUndefined)),
52898
- serializeTypeForDeclaration: (type, symbol, addUndefined, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, addUndefined)),
52894
+ serializeTypeForDeclaration: (declaration, type, symbol, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => serializeTypeForDeclaration(context, declaration, type, symbol)),
52899
52895
  serializeReturnTypeForSignature: (signature, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => serializeReturnTypeForSignature(context, signature)),
52900
52896
  indexInfoToIndexSignatureDeclaration: (indexInfo, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => indexInfoToIndexSignatureDeclarationHelper(
52901
52897
  indexInfo,
@@ -52918,6 +52914,18 @@ function createTypeChecker(host) {
52918
52914
  symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolTableToDeclarationStatements(symbolTable, context)),
52919
52915
  symbolToNode: (symbol, meaning, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolToNode(symbol, context, meaning))
52920
52916
  };
52917
+ function setTextRange2(context, range, location) {
52918
+ if (!nodeIsSynthesized(range) && !(range.flags & 16 /* Synthesized */) && (!context.enclosingFile || context.enclosingFile !== getSourceFileOfNode(range))) {
52919
+ range = factory.cloneNode(range);
52920
+ }
52921
+ if (!location) {
52922
+ return range;
52923
+ }
52924
+ if (!context.enclosingFile || context.enclosingFile !== getSourceFileOfNode(getOriginalNode(location))) {
52925
+ return setOriginalNode(range, location);
52926
+ }
52927
+ return setTextRange(setOriginalNode(range, location), location);
52928
+ }
52921
52929
  function expressionOrTypeToTypeNode(context, expr, type, addUndefined) {
52922
52930
  if (expr) {
52923
52931
  const typeNode = isAssertionExpression(expr) ? expr.type : isJSDocTypeAssertion(expr) ? getJSDocTypeAssertionType(expr) : void 0;
@@ -52982,6 +52990,7 @@ function createTypeChecker(host) {
52982
52990
  const moduleResolverHost = (tracker == null ? void 0 : tracker.trackSymbol) ? tracker.moduleResolverHost : flags & 134217728 /* DoNotIncludeSymbolChain */ ? createBasicNodeBuilderModuleSpecifierResolutionHost(host) : void 0;
52983
52991
  const context = {
52984
52992
  enclosingDeclaration,
52993
+ enclosingFile: enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration),
52985
52994
  flags: flags || 0 /* None */,
52986
52995
  tracker: void 0,
52987
52996
  encounteredError: false,
@@ -53514,7 +53523,7 @@ function createTypeChecker(host) {
53514
53523
  if (!nodeIsSynthesized(node) && getParseTreeNode(node) === node) {
53515
53524
  return node;
53516
53525
  }
53517
- return setTextRange(factory.cloneNode(visitEachChild(
53526
+ return setTextRange2(context, factory.cloneNode(visitEachChild(
53518
53527
  node,
53519
53528
  deepCloneOrReuseNode,
53520
53529
  /*context*/
@@ -53856,7 +53865,13 @@ function createTypeChecker(host) {
53856
53865
  context.reverseMappedStack || (context.reverseMappedStack = []);
53857
53866
  context.reverseMappedStack.push(propertySymbol);
53858
53867
  }
53859
- propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : factory.createKeywordTypeNode(133 /* AnyKeyword */);
53868
+ propertyTypeNode = propertyType ? serializeTypeForDeclaration(
53869
+ context,
53870
+ /*declaration*/
53871
+ void 0,
53872
+ propertyType,
53873
+ propertySymbol
53874
+ ) : factory.createKeywordTypeNode(133 /* AnyKeyword */);
53860
53875
  if (propertyIsReverseMapped) {
53861
53876
  context.reverseMappedStack.pop();
53862
53877
  }
@@ -54245,8 +54260,7 @@ function createTypeChecker(host) {
54245
54260
  function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags) {
54246
54261
  const parameterDeclaration = getEffectiveParameterDeclaration(parameterSymbol);
54247
54262
  const parameterType = getTypeOfSymbol(parameterSymbol);
54248
- const addUndefined = parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration);
54249
- const parameterTypeNode = serializeTypeForDeclaration(context, parameterType, parameterSymbol, context.enclosingDeclaration, addUndefined);
54263
+ const parameterTypeNode = serializeTypeForDeclaration(context, parameterDeclaration, parameterType, parameterSymbol);
54250
54264
  const modifiers = !(context.flags & 8192 /* OmitParameterModifiers */) && preserveModifierFlags && parameterDeclaration && canHaveModifiers(parameterDeclaration) ? map(getModifiers(parameterDeclaration), factory.cloneNode) : void 0;
54251
54265
  const isRest = parameterDeclaration && isRestParameter(parameterDeclaration) || getCheckFlags(parameterSymbol) & 32768 /* RestParameter */;
54252
54266
  const dotDotDotToken = isRest ? factory.createToken(26 /* DotDotDotToken */) : void 0;
@@ -54838,10 +54852,12 @@ function createTypeChecker(host) {
54838
54852
  }
54839
54853
  return enclosingDeclaration;
54840
54854
  }
54841
- function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, addUndefined) {
54855
+ function serializeTypeForDeclaration(context, declaration, type, symbol) {
54842
54856
  var _a;
54857
+ const addUndefined = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration);
54858
+ const enclosingDeclaration = context.enclosingDeclaration;
54843
54859
  if (!isErrorType(type) && enclosingDeclaration) {
54844
- const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
54860
+ const declWithExistingAnnotation = declaration && getNonlocalEffectiveTypeAnnotationNode(declaration) ? declaration : getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
54845
54861
  if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
54846
54862
  const existing = getNonlocalEffectiveTypeAnnotationNode(declWithExistingAnnotation);
54847
54863
  const result2 = tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined);
@@ -54854,7 +54870,7 @@ function createTypeChecker(host) {
54854
54870
  if (type.flags & 8192 /* UniqueESSymbol */ && type.symbol === symbol && (!context.enclosingDeclaration || some(symbol.declarations, (d) => getSourceFileOfNode(d) === getSourceFileOfNode(context.enclosingDeclaration)))) {
54855
54871
  context.flags |= 1048576 /* AllowUniqueESSymbolType */;
54856
54872
  }
54857
- const decl = symbol.valueDeclaration ?? ((_a = symbol.declarations) == null ? void 0 : _a[0]);
54873
+ const decl = declaration ?? symbol.valueDeclaration ?? ((_a = symbol.declarations) == null ? void 0 : _a[0]);
54858
54874
  const expr = decl && isDeclarationWithPossibleInnerTypeNodeReuse(decl) ? getPossibleTypeNodeReuseExpression(decl) : void 0;
54859
54875
  const result = expressionOrTypeToTypeNode(context, expr, type, addUndefined);
54860
54876
  context.flags = oldFlags;
@@ -54968,7 +54984,7 @@ function createTypeChecker(host) {
54968
54984
  const type = getDeclaredTypeOfSymbol(sym);
54969
54985
  const name = sym.flags & 262144 /* TypeParameter */ ? typeParameterToName(type, context) : factory.cloneNode(node2);
54970
54986
  name.symbol = sym;
54971
- return setTextRange(setEmitFlags(setOriginalNode(name, node2), 16777216 /* NoAsciiEscaping */), node2);
54987
+ return setTextRange2(context, setEmitFlags(name, 16777216 /* NoAsciiEscaping */), node2);
54972
54988
  }
54973
54989
  const updated = visitEachChild(
54974
54990
  node2,
@@ -54977,7 +54993,7 @@ function createTypeChecker(host) {
54977
54993
  void 0
54978
54994
  );
54979
54995
  if (updated !== node2) {
54980
- setTextRange(updated, node2);
54996
+ setTextRange2(context, updated, node2);
54981
54997
  }
54982
54998
  return updated;
54983
54999
  }
@@ -54991,12 +55007,12 @@ function createTypeChecker(host) {
54991
55007
  if (hadError) {
54992
55008
  return void 0;
54993
55009
  }
54994
- return transformed === existing ? setTextRange(factory.cloneNode(existing), existing) : transformed;
55010
+ return transformed;
54995
55011
  function visitExistingNodeTreeSymbols(node) {
54996
55012
  const onExitNewScope = isNewScopeNode(node) ? onEnterNewScope(node) : void 0;
54997
55013
  const result = visitExistingNodeTreeSymbolsWorker(node);
54998
55014
  onExitNewScope == null ? void 0 : onExitNewScope();
54999
- return result;
55015
+ return result === node ? setTextRange2(context, factory.cloneNode(result), node) : result;
55000
55016
  }
55001
55017
  function onEnterNewScope(node) {
55002
55018
  const oldContex = context;
@@ -55132,7 +55148,7 @@ function createTypeChecker(host) {
55132
55148
  void 0
55133
55149
  );
55134
55150
  if (visited === node) {
55135
- visited = setTextRange(factory.cloneNode(node), node);
55151
+ visited = setTextRange2(context, factory.cloneNode(node), node);
55136
55152
  }
55137
55153
  visited.type = factory.createKeywordTypeNode(133 /* AnyKeyword */);
55138
55154
  if (isParameter(node)) {
@@ -55155,11 +55171,16 @@ function createTypeChecker(host) {
55155
55171
  /*context*/
55156
55172
  void 0
55157
55173
  );
55158
- const clone2 = setTextRange(visited === node ? factory.cloneNode(node) : visited, node);
55174
+ const clone2 = setTextRange2(context, visited === node ? factory.cloneNode(node) : visited, node);
55159
55175
  const flags = getEmitFlags(clone2);
55160
55176
  setEmitFlags(clone2, flags | (context.flags & 1024 /* MultilineObjectLiterals */ && isTypeLiteralNode(node) ? 0 : 1 /* SingleLine */));
55161
55177
  return clone2;
55162
55178
  }
55179
+ if (isStringLiteral(node) && !!(context.flags & 268435456 /* UseSingleQuotesForStringLiteralType */) && !node.singleQuote) {
55180
+ const clone2 = factory.cloneNode(node);
55181
+ clone2.singleQuote = true;
55182
+ return clone2;
55183
+ }
55163
55184
  if (isConditionalTypeNode(node)) {
55164
55185
  const checkType = visitNode(node.checkType, visitExistingNodeTreeSymbols, isTypeNode);
55165
55186
  const disposeScope = onEnterNewScope(node);
@@ -55538,7 +55559,8 @@ function createTypeChecker(host) {
55538
55559
  );
55539
55560
  context.tracker.trackSymbol(type.symbol, context.enclosingDeclaration, 111551 /* Value */);
55540
55561
  } else {
55541
- const statement = setTextRange(
55562
+ const statement = setTextRange2(
55563
+ context,
55542
55564
  factory.createVariableStatement(
55543
55565
  /*modifiers*/
55544
55566
  void 0,
@@ -55547,7 +55569,13 @@ function createTypeChecker(host) {
55547
55569
  name,
55548
55570
  /*exclamationToken*/
55549
55571
  void 0,
55550
- serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration)
55572
+ serializeTypeForDeclaration(
55573
+ context,
55574
+ /*declaration*/
55575
+ void 0,
55576
+ type,
55577
+ symbol
55578
+ )
55551
55579
  )
55552
55580
  ], flags)
55553
55581
  ),
@@ -55820,7 +55848,7 @@ function createTypeChecker(host) {
55820
55848
  const signatures = getSignaturesOfType(type, 0 /* Call */);
55821
55849
  for (const sig of signatures) {
55822
55850
  const decl = signatureToSignatureDeclarationHelper(sig, 262 /* FunctionDeclaration */, context, { name: factory.createIdentifier(localName) });
55823
- addResult(setTextRange(decl, getSignatureTextRangeLocation(sig)), modifierFlags);
55851
+ addResult(setTextRange2(context, decl, getSignatureTextRangeLocation(sig)), modifierFlags);
55824
55852
  }
55825
55853
  if (!(symbol.flags & (512 /* ValueModule */ | 1024 /* NamespaceModule */) && !!symbol.exports && !!symbol.exports.size)) {
55826
55854
  const props = filter(getPropertiesOfType(type), isNamespaceMember);
@@ -55998,7 +56026,8 @@ function createTypeChecker(host) {
55998
56026
  const indexSignatures = serializeIndexSignatures(classType, baseTypes[0]);
55999
56027
  context.enclosingDeclaration = oldEnclosing;
56000
56028
  addResult(
56001
- setTextRange(
56029
+ setTextRange2(
56030
+ context,
56002
56031
  factory.createClassDeclaration(
56003
56032
  /*modifiers*/
56004
56033
  void 0,
@@ -56358,7 +56387,13 @@ function createTypeChecker(host) {
56358
56387
  varName,
56359
56388
  /*exclamationToken*/
56360
56389
  void 0,
56361
- serializeTypeForDeclaration(context, typeToSerialize, symbol, enclosingDeclaration)
56390
+ serializeTypeForDeclaration(
56391
+ context,
56392
+ /*declaration*/
56393
+ void 0,
56394
+ typeToSerialize,
56395
+ symbol
56396
+ )
56362
56397
  )
56363
56398
  ], flags)
56364
56399
  );
@@ -56430,7 +56465,8 @@ function createTypeChecker(host) {
56430
56465
  });
56431
56466
  Debug.assert(!!setter);
56432
56467
  const paramSymbol = isFunctionLikeDeclaration(setter) ? getSignatureFromDeclaration(setter).parameters[0] : void 0;
56433
- result.push(setTextRange(
56468
+ result.push(setTextRange2(
56469
+ context,
56434
56470
  factory.createSetAccessorDeclaration(
56435
56471
  factory.createModifiersFromModifierFlags(flag),
56436
56472
  name,
@@ -56442,7 +56478,13 @@ function createTypeChecker(host) {
56442
56478
  paramSymbol ? parameterToParameterDeclarationName(paramSymbol, getEffectiveParameterDeclaration(paramSymbol), context) : "value",
56443
56479
  /*questionToken*/
56444
56480
  void 0,
56445
- isPrivate ? void 0 : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration)
56481
+ isPrivate ? void 0 : serializeTypeForDeclaration(
56482
+ context,
56483
+ /*declaration*/
56484
+ void 0,
56485
+ getTypeOfSymbol(p),
56486
+ p
56487
+ )
56446
56488
  )],
56447
56489
  /*body*/
56448
56490
  void 0
@@ -56452,12 +56494,19 @@ function createTypeChecker(host) {
56452
56494
  }
56453
56495
  if (p.flags & 32768 /* GetAccessor */) {
56454
56496
  const isPrivate2 = modifierFlags & 2 /* Private */;
56455
- result.push(setTextRange(
56497
+ result.push(setTextRange2(
56498
+ context,
56456
56499
  factory.createGetAccessorDeclaration(
56457
56500
  factory.createModifiersFromModifierFlags(flag),
56458
56501
  name,
56459
56502
  [],
56460
- isPrivate2 ? void 0 : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration),
56503
+ isPrivate2 ? void 0 : serializeTypeForDeclaration(
56504
+ context,
56505
+ /*declaration*/
56506
+ void 0,
56507
+ getTypeOfSymbol(p),
56508
+ p
56509
+ ),
56461
56510
  /*body*/
56462
56511
  void 0
56463
56512
  ),
@@ -56466,12 +56515,19 @@ function createTypeChecker(host) {
56466
56515
  }
56467
56516
  return result;
56468
56517
  } else if (p.flags & (4 /* Property */ | 3 /* Variable */ | 98304 /* Accessor */)) {
56469
- return setTextRange(
56518
+ return setTextRange2(
56519
+ context,
56470
56520
  createProperty2(
56471
56521
  factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 8 /* Readonly */ : 0) | flag),
56472
56522
  name,
56473
56523
  p.flags & 16777216 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0,
56474
- isPrivate ? void 0 : serializeTypeForDeclaration(context, getWriteTypeOfSymbol(p), p, enclosingDeclaration),
56524
+ isPrivate ? void 0 : serializeTypeForDeclaration(
56525
+ context,
56526
+ /*declaration*/
56527
+ void 0,
56528
+ getWriteTypeOfSymbol(p),
56529
+ p
56530
+ ),
56475
56531
  // TODO: https://github.com/microsoft/TypeScript/pull/32372#discussion_r328386357
56476
56532
  // interface members can't have initializers, however class members _can_
56477
56533
  /*initializer*/
@@ -56484,7 +56540,8 @@ function createTypeChecker(host) {
56484
56540
  const type = getTypeOfSymbol(p);
56485
56541
  const signatures = getSignaturesOfType(type, 0 /* Call */);
56486
56542
  if (flag & 2 /* Private */) {
56487
- return setTextRange(
56543
+ return setTextRange2(
56544
+ context,
56488
56545
  createProperty2(
56489
56546
  factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 8 /* Readonly */ : 0) | flag),
56490
56547
  name,
@@ -56510,7 +56567,7 @@ function createTypeChecker(host) {
56510
56567
  }
56511
56568
  );
56512
56569
  const location = sig.declaration && isPrototypePropertyAssignment(sig.declaration.parent) ? sig.declaration.parent : sig.declaration;
56513
- results2.push(setTextRange(decl, location));
56570
+ results2.push(setTextRange2(context, decl, location));
56514
56571
  }
56515
56572
  return results2;
56516
56573
  }
@@ -56566,7 +56623,8 @@ function createTypeChecker(host) {
56566
56623
  }
56567
56624
  }
56568
56625
  if (privateProtected) {
56569
- return [setTextRange(
56626
+ return [setTextRange2(
56627
+ context,
56570
56628
  factory.createConstructorDeclaration(
56571
56629
  factory.createModifiersFromModifierFlags(privateProtected),
56572
56630
  /*parameters*/
@@ -56581,7 +56639,7 @@ function createTypeChecker(host) {
56581
56639
  const results2 = [];
56582
56640
  for (const sig of signatures) {
56583
56641
  const decl = signatureToSignatureDeclarationHelper(sig, outputKind, context);
56584
- results2.push(setTextRange(decl, sig.declaration));
56642
+ results2.push(setTextRange2(context, decl, sig.declaration));
56585
56643
  }
56586
56644
  return results2;
56587
56645
  }
@@ -60264,12 +60322,10 @@ function createTypeChecker(host) {
60264
60322
  const target = type.target ?? type;
60265
60323
  const typeVariable = getHomomorphicTypeVariable(target);
60266
60324
  if (typeVariable && !target.declaration.nameType) {
60267
- const constraint = getConstraintTypeFromMappedType(type);
60268
- if (constraint.flags & 4194304 /* Index */) {
60269
- const baseConstraint = getBaseConstraintOfType(constraint.type);
60270
- if (baseConstraint && everyType(baseConstraint, (t) => isArrayOrTupleType(t) || isArrayOrTupleOrIntersection(t))) {
60271
- return instantiateType(target, prependTypeMapping(typeVariable, baseConstraint, type.mapper));
60272
- }
60325
+ const modifiersType = getModifiersTypeFromMappedType(type);
60326
+ const baseConstraint = isGenericMappedType(modifiersType) ? getApparentTypeOfMappedType(modifiersType) : getBaseConstraintOfType(modifiersType);
60327
+ if (baseConstraint && everyType(baseConstraint, (t) => isArrayOrTupleType(t) || isArrayOrTupleOrIntersection(t))) {
60328
+ return instantiateType(target, prependTypeMapping(typeVariable, baseConstraint, type.mapper));
60273
60329
  }
60274
60330
  }
60275
60331
  return type;
@@ -60430,13 +60486,13 @@ function createTypeChecker(host) {
60430
60486
  }
60431
60487
  function getUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment) {
60432
60488
  var _a, _b, _c;
60433
- let property = ((_a = type.propertyCacheWithoutObjectFunctionPropertyAugment) == null ? void 0 : _a.get(name)) || !skipObjectFunctionPropertyAugment ? (_b = type.propertyCache) == null ? void 0 : _b.get(name) : void 0;
60489
+ let property = skipObjectFunctionPropertyAugment ? (_a = type.propertyCacheWithoutObjectFunctionPropertyAugment) == null ? void 0 : _a.get(name) : (_b = type.propertyCache) == null ? void 0 : _b.get(name);
60434
60490
  if (!property) {
60435
60491
  property = createUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment);
60436
60492
  if (property) {
60437
60493
  const properties = skipObjectFunctionPropertyAugment ? type.propertyCacheWithoutObjectFunctionPropertyAugment || (type.propertyCacheWithoutObjectFunctionPropertyAugment = createSymbolTable()) : type.propertyCache || (type.propertyCache = createSymbolTable());
60438
60494
  properties.set(name, property);
60439
- if (skipObjectFunctionPropertyAugment && !((_c = type.propertyCache) == null ? void 0 : _c.get(name))) {
60495
+ if (skipObjectFunctionPropertyAugment && !(getCheckFlags(property) & 48 /* Partial */) && !((_c = type.propertyCache) == null ? void 0 : _c.get(name))) {
60440
60496
  const properties2 = type.propertyCache || (type.propertyCache = createSymbolTable());
60441
60497
  properties2.set(name, property);
60442
60498
  }
@@ -65699,7 +65755,7 @@ function createTypeChecker(host) {
65699
65755
  const sourceTypePredicate = getTypePredicateOfSignature(source);
65700
65756
  if (sourceTypePredicate) {
65701
65757
  result &= compareTypePredicateRelatedTo(sourceTypePredicate, targetTypePredicate, reportErrors2, errorReporter, compareTypes);
65702
- } else if (isIdentifierTypePredicate(targetTypePredicate)) {
65758
+ } else if (isIdentifierTypePredicate(targetTypePredicate) || isThisTypePredicate(targetTypePredicate)) {
65703
65759
  if (reportErrors2) {
65704
65760
  errorReporter(Diagnostics.Signature_0_must_be_a_type_predicate, signatureToString(source));
65705
65761
  }
@@ -88083,9 +88139,10 @@ function createTypeChecker(host) {
88083
88139
  return false;
88084
88140
  }
88085
88141
  function declaredParameterTypeContainsUndefined(parameter) {
88086
- if (!parameter.type)
88142
+ const typeNode = getNonlocalEffectiveTypeAnnotationNode(parameter);
88143
+ if (!typeNode)
88087
88144
  return false;
88088
- const type = getTypeFromTypeNode(parameter.type);
88145
+ const type = getTypeFromTypeNode(typeNode);
88089
88146
  return containsUndefinedType(type);
88090
88147
  }
88091
88148
  function requiresAddingImplicitUndefined(parameter) {
@@ -88095,7 +88152,7 @@ function createTypeChecker(host) {
88095
88152
  return !!strictNullChecks && !isOptionalParameter(parameter) && !isJSDocParameterTag(parameter) && !!parameter.initializer && !hasSyntacticModifier(parameter, 31 /* ParameterPropertyModifier */);
88096
88153
  }
88097
88154
  function isOptionalUninitializedParameterProperty(parameter) {
88098
- return strictNullChecks && isOptionalParameter(parameter) && !parameter.initializer && hasSyntacticModifier(parameter, 31 /* ParameterPropertyModifier */);
88155
+ return strictNullChecks && isOptionalParameter(parameter) && (isJSDocParameterTag(parameter) || !parameter.initializer) && hasSyntacticModifier(parameter, 31 /* ParameterPropertyModifier */);
88099
88156
  }
88100
88157
  function isExpandoFunctionDeclaration(node) {
88101
88158
  const declaration = getParseTreeNode(node, isFunctionDeclaration);
@@ -88245,14 +88302,14 @@ function createTypeChecker(host) {
88245
88302
  return 11 /* ObjectType */;
88246
88303
  }
88247
88304
  }
88248
- function createTypeOfDeclaration(declarationIn, enclosingDeclaration, flags, tracker, addUndefined) {
88305
+ function createTypeOfDeclaration(declarationIn, enclosingDeclaration, flags, tracker) {
88249
88306
  const declaration = getParseTreeNode(declarationIn, isVariableLikeOrAccessor);
88250
88307
  if (!declaration) {
88251
88308
  return factory.createToken(133 /* AnyKeyword */);
88252
88309
  }
88253
88310
  const symbol = getSymbolOfDeclaration(declaration);
88254
88311
  const type = symbol && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* Signature */)) ? getWidenedLiteralType(getTypeOfSymbol(symbol)) : errorType;
88255
- return nodeBuilder.serializeTypeForDeclaration(type, symbol, addUndefined, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
88312
+ return nodeBuilder.serializeTypeForDeclaration(declaration, type, symbol, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
88256
88313
  }
88257
88314
  function isDeclarationWithPossibleInnerTypeNodeReuse(declaration) {
88258
88315
  return isFunctionLike(declaration) || isExportAssignment(declaration) || isVariableLike(declaration);
@@ -114092,7 +114149,7 @@ function transformDeclarations(context) {
114092
114149
  case 172 /* PropertyDeclaration */:
114093
114150
  case 208 /* BindingElement */:
114094
114151
  case 260 /* VariableDeclaration */:
114095
- typeNode = resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldAddImplicitUndefined);
114152
+ typeNode = resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker);
114096
114153
  break;
114097
114154
  case 262 /* FunctionDeclaration */:
114098
114155
  case 180 /* ConstructSignature */:
@@ -181122,6 +181179,13 @@ var ConfiguredProject2 = class extends Project3 {
181122
181179
  this.compilerHost = void 0;
181123
181180
  this.projectService.sendProjectLoadingFinishEvent(this);
181124
181181
  this.projectService.sendProjectTelemetry(this);
181182
+ if (!this.skipConfigDiagEvent && !result) {
181183
+ this.projectService.sendConfigFileDiagEvent(
181184
+ this,
181185
+ /*triggerFile*/
181186
+ void 0
181187
+ );
181188
+ }
181125
181189
  return result;
181126
181190
  }
181127
181191
  /** @internal */
@@ -181576,7 +181640,12 @@ function projectContainsInfoDirectly(project, info) {
181576
181640
  }
181577
181641
  function updateProjectIfDirty(project) {
181578
181642
  project.invalidateResolutionsOfFailedLookupLocations();
181579
- return project.dirty && project.updateGraph();
181643
+ return project.dirty && !project.updateGraph();
181644
+ }
181645
+ function updateConfiguredProjectWithoutConfigDiagIfDirty(project) {
181646
+ project.skipConfigDiagEvent = true;
181647
+ updateProjectIfDirty(project);
181648
+ project.skipConfigDiagEvent = void 0;
181580
181649
  }
181581
181650
  function setProjectOptionsUsed(project) {
181582
181651
  if (isConfiguredProject(project)) {
@@ -182868,6 +182937,7 @@ var _ProjectService = class _ProjectService {
182868
182937
  /** @internal */
182869
182938
  createLoadAndUpdateConfiguredProject(configFileName, reason) {
182870
182939
  const project = this.createAndLoadConfiguredProject(configFileName, reason);
182940
+ project.skipConfigDiagEvent = true;
182871
182941
  project.updateGraph();
182872
182942
  return project;
182873
182943
  }
@@ -183160,6 +183230,7 @@ var _ProjectService = class _ProjectService {
183160
183230
  const configFileName = project.getConfigFilePath();
183161
183231
  this.logger.info(`${isInitialLoad ? "Loading" : "Reloading"} configured project ${configFileName}`);
183162
183232
  this.loadConfiguredProject(project, reason);
183233
+ project.skipConfigDiagEvent = true;
183163
183234
  project.updateGraph();
183164
183235
  this.sendConfigFileDiagEvent(project, configFileName);
183165
183236
  }
@@ -183173,16 +183244,20 @@ var _ProjectService = class _ProjectService {
183173
183244
  project.cleanupProgram();
183174
183245
  project.markAsDirty();
183175
183246
  }
183247
+ /** @internal */
183176
183248
  sendConfigFileDiagEvent(project, triggerFile) {
183177
183249
  if (!this.eventHandler || this.suppressDiagnosticEvents) {
183178
183250
  return;
183179
183251
  }
183180
183252
  const diagnostics = project.getLanguageService().getCompilerOptionsDiagnostics();
183181
183253
  diagnostics.push(...project.getAllProjectErrors());
183254
+ if (!triggerFile && !!diagnostics.length === !!project.hasConfigFileDiagnostics)
183255
+ return;
183256
+ project.hasConfigFileDiagnostics = !!diagnostics.length;
183182
183257
  this.eventHandler(
183183
183258
  {
183184
183259
  eventName: ConfigFileDiagEvent,
183185
- data: { configFileName: project.getConfigFilePath(), diagnostics, triggerFile }
183260
+ data: { configFileName: project.getConfigFilePath(), diagnostics, triggerFile: triggerFile ?? project.getConfigFilePath() }
183186
183261
  }
183187
183262
  );
183188
183263
  }
@@ -183972,7 +184047,7 @@ Dynamic files must always be opened with service's current directory or service
183972
184047
  project = this.createLoadAndUpdateConfiguredProject(configFileName, `Creating possible configured project for ${info.fileName} to open`);
183973
184048
  defaultConfigProjectIsCreated = true;
183974
184049
  } else {
183975
- updateProjectIfDirty(project);
184050
+ updateConfiguredProjectWithoutConfigDiagIfDirty(project);
183976
184051
  }
183977
184052
  projectForConfigFileDiag = project.containsScriptInfo(info) ? project : void 0;
183978
184053
  retainProjects = project;
@@ -183981,7 +184056,7 @@ Dynamic files must always be opened with service's current directory or service
183981
184056
  project,
183982
184057
  info.path,
183983
184058
  (child) => {
183984
- updateProjectIfDirty(child);
184059
+ updateConfiguredProjectWithoutConfigDiagIfDirty(child);
183985
184060
  if (!isArray(retainProjects)) {
183986
184061
  retainProjects = [project, child];
183987
184062
  } else {
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.5.0-pr-57649-11",
5
+ "version": "5.5.0-pr-58083-15",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -112,5 +112,5 @@
112
112
  "node": "20.1.0",
113
113
  "npm": "8.19.4"
114
114
  },
115
- "gitHead": "c6d4d8bbb6e2ed89e9f66e62beaac7007c074687"
115
+ "gitHead": "e2996d44281da43dea46d3633df277a73fe1d8a2"
116
116
  }