@typescript-deploys/pr-build 5.5.0-pr-57465-98 → 5.5.0-pr-57772-2

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
@@ -1760,6 +1760,7 @@ __export(server_exports, {
1760
1760
  isSuperProperty: () => isSuperProperty,
1761
1761
  isSupportedSourceFileName: () => isSupportedSourceFileName,
1762
1762
  isSwitchStatement: () => isSwitchStatement,
1763
+ isSyntacticallyString: () => isSyntacticallyString,
1763
1764
  isSyntaxList: () => isSyntaxList,
1764
1765
  isSyntheticExpression: () => isSyntheticExpression,
1765
1766
  isSyntheticReference: () => isSyntheticReference,
@@ -2326,7 +2327,7 @@ module.exports = __toCommonJS(server_exports);
2326
2327
 
2327
2328
  // src/compiler/corePublic.ts
2328
2329
  var versionMajorMinor = "5.5";
2329
- var version = `${versionMajorMinor}.0-insiders.20240313`;
2330
+ var version = `${versionMajorMinor}.0-insiders.20240314`;
2330
2331
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2331
2332
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2332
2333
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -9675,6 +9676,8 @@ var Diagnostics = {
9675
9676
  The_left_hand_side_of_a_for_in_statement_cannot_be_an_await_using_declaration: diag(1494, 1 /* Error */, "The_left_hand_side_of_a_for_in_statement_cannot_be_an_await_using_declaration_1494", "The left-hand side of a 'for...in' statement cannot be an 'await using' declaration."),
9676
9677
  _0_modifier_cannot_appear_on_an_await_using_declaration: diag(1495, 1 /* Error */, "_0_modifier_cannot_appear_on_an_await_using_declaration_1495", "'{0}' modifier cannot appear on an 'await using' declaration."),
9677
9678
  Identifier_string_literal_or_number_literal_expected: diag(1496, 1 /* Error */, "Identifier_string_literal_or_number_literal_expected_1496", "Identifier, string literal, or number literal expected."),
9679
+ Expression_must_be_enclosed_in_parentheses_to_be_used_as_a_decorator: diag(1497, 1 /* Error */, "Expression_must_be_enclosed_in_parentheses_to_be_used_as_a_decorator_1497", "Expression must be enclosed in parentheses to be used as a decorator."),
9680
+ Invalid_syntax_in_decorator: diag(1498, 1 /* Error */, "Invalid_syntax_in_decorator_1498", "Invalid syntax in decorator."),
9678
9681
  The_types_of_0_are_incompatible_between_these_types: diag(2200, 1 /* Error */, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
9679
9682
  The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, 1 /* Error */, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
9680
9683
  Call_signature_return_types_0_and_1_are_incompatible: diag(
@@ -11326,6 +11329,8 @@ var Diagnostics = {
11326
11329
  Add_optional_parameter_to_0: diag(95191, 3 /* Message */, "Add_optional_parameter_to_0_95191", "Add optional parameter to '{0}'"),
11327
11330
  Add_optional_parameters_to_0: diag(95192, 3 /* Message */, "Add_optional_parameters_to_0_95192", "Add optional parameters to '{0}'"),
11328
11331
  Add_all_optional_parameters: diag(95193, 3 /* Message */, "Add_all_optional_parameters_95193", "Add all optional parameters"),
11332
+ Wrap_in_parentheses: diag(95194, 3 /* Message */, "Wrap_in_parentheses_95194", "Wrap in parentheses"),
11333
+ Wrap_all_invalid_decorator_expressions_in_parentheses: diag(95195, 3 /* Message */, "Wrap_all_invalid_decorator_expressions_in_parentheses_95195", "Wrap all invalid decorator expressions in parentheses"),
11329
11334
  No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, 1 /* Error */, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
11330
11335
  Classes_may_not_have_a_field_named_constructor: diag(18006, 1 /* Error */, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
11331
11336
  JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, 1 /* Error */, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
@@ -21910,6 +21915,20 @@ function replaceFirstStar(s, replacement) {
21910
21915
  function getNameFromImportAttribute(node) {
21911
21916
  return isIdentifier(node.name) ? node.name.escapedText : escapeLeadingUnderscores(node.name.text);
21912
21917
  }
21918
+ function isSyntacticallyString(expr) {
21919
+ expr = skipOuterExpressions(expr);
21920
+ switch (expr.kind) {
21921
+ case 226 /* BinaryExpression */:
21922
+ const left = expr.left;
21923
+ const right = expr.right;
21924
+ return expr.operatorToken.kind === 40 /* PlusToken */ && (isSyntacticallyString(left) || isSyntacticallyString(right));
21925
+ case 228 /* TemplateExpression */:
21926
+ case 11 /* StringLiteral */:
21927
+ case 15 /* NoSubstitutionTemplateLiteral */:
21928
+ return true;
21929
+ }
21930
+ return false;
21931
+ }
21913
21932
 
21914
21933
  // src/compiler/factory/baseNodeFactory.ts
21915
21934
  function createBaseNodeFactory() {
@@ -44493,7 +44512,7 @@ function createBinder() {
44493
44512
  inAssignmentPattern = saveInAssignmentPattern;
44494
44513
  return;
44495
44514
  }
44496
- if (node.kind >= 243 /* FirstStatement */ && node.kind <= 259 /* LastStatement */ && (!options.allowUnreachableCode || node.kind === 253 /* ReturnStatement */)) {
44515
+ if (node.kind >= 243 /* FirstStatement */ && node.kind <= 259 /* LastStatement */ && !options.allowUnreachableCode) {
44497
44516
  node.flowNode = currentFlow;
44498
44517
  }
44499
44518
  switch (node.kind) {
@@ -52521,6 +52540,18 @@ function createTypeChecker(host) {
52521
52540
  function createNodeBuilder() {
52522
52541
  return {
52523
52542
  typeToTypeNode: (type, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => typeToTypeNodeHelper(type, context)),
52543
+ expressionOrTypeToTypeNode: (type, expr, addUndefined, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => expressionOrTypeToTypeNode(context, expr, type, addUndefined)),
52544
+ serializeTypeForDeclaration: (type, symbol, addUndefined, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => serializeTypeForDeclaration(
52545
+ context,
52546
+ type,
52547
+ symbol,
52548
+ enclosingDeclaration,
52549
+ /*includePrivateSymbol*/
52550
+ void 0,
52551
+ /*bundled*/
52552
+ void 0,
52553
+ addUndefined
52554
+ )),
52524
52555
  indexInfoToIndexSignatureDeclaration: (indexInfo, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => indexInfoToIndexSignatureDeclarationHelper(
52525
52556
  indexInfo,
52526
52557
  context,
@@ -52542,6 +52573,47 @@ function createTypeChecker(host) {
52542
52573
  symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, tracker, bundled) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolTableToDeclarationStatements(symbolTable, context, bundled)),
52543
52574
  symbolToNode: (symbol, meaning, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolToNode(symbol, context, meaning))
52544
52575
  };
52576
+ function expressionOrTypeToTypeNode(context, expr, type, addUndefined) {
52577
+ if (expr) {
52578
+ const typeNode = isAssertionExpression(expr) ? expr.type : isJSDocTypeAssertion(expr) ? getJSDocTypeAssertionType(expr) : void 0;
52579
+ if (typeNode && !isConstTypeReference(typeNode)) {
52580
+ const result = tryReuseExistingTypeNode(context, typeNode, type, expr.parent, addUndefined);
52581
+ if (result) {
52582
+ return result;
52583
+ }
52584
+ }
52585
+ }
52586
+ if (addUndefined) {
52587
+ type = getOptionalType(type);
52588
+ }
52589
+ return typeToTypeNodeHelper(type, context);
52590
+ }
52591
+ function tryReuseExistingTypeNode(context, typeNode, type, host2, addUndefined, includePrivateSymbol, bundled) {
52592
+ const originalType = type;
52593
+ if (addUndefined) {
52594
+ type = getOptionalType(type);
52595
+ }
52596
+ const clone2 = tryReuseExistingNonParameterTypeNode(context, typeNode, type, host2, includePrivateSymbol, bundled);
52597
+ if (clone2) {
52598
+ return clone2;
52599
+ }
52600
+ if (addUndefined && originalType !== type) {
52601
+ const cloneMissingUndefined = tryReuseExistingNonParameterTypeNode(context, typeNode, originalType, host2, includePrivateSymbol, bundled);
52602
+ if (cloneMissingUndefined) {
52603
+ return factory.createUnionTypeNode([cloneMissingUndefined, factory.createKeywordTypeNode(157 /* UndefinedKeyword */)]);
52604
+ }
52605
+ }
52606
+ return void 0;
52607
+ }
52608
+ function tryReuseExistingNonParameterTypeNode(context, existing, type, host2 = context.enclosingDeclaration, includePrivateSymbol, bundled, annotationType) {
52609
+ if (typeNodeIsEquivalentToType(existing, host2, type, annotationType) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
52610
+ const result = serializeExistingTypeNode(context, existing, includePrivateSymbol, bundled);
52611
+ if (result) {
52612
+ return result;
52613
+ }
52614
+ }
52615
+ return void 0;
52616
+ }
52545
52617
  function symbolToNode(symbol, context, meaning) {
52546
52618
  if (context.flags & 1073741824 /* WriteComputedProps */) {
52547
52619
  if (symbol.valueDeclaration) {
@@ -52983,8 +53055,8 @@ function createTypeChecker(host) {
52983
53055
  if (isInstantiationExpressionType) {
52984
53056
  const instantiationExpressionType = type2;
52985
53057
  const existing = instantiationExpressionType.node;
52986
- if (isTypeQueryNode(existing) && getTypeFromTypeNode(existing) === type2) {
52987
- const typeNode = serializeExistingTypeNode(context, existing);
53058
+ if (isTypeQueryNode(existing)) {
53059
+ const typeNode = tryReuseExistingNonParameterTypeNode(context, existing, type2);
52988
53060
  if (typeNode) {
52989
53061
  return typeNode;
52990
53062
  }
@@ -53787,11 +53859,9 @@ function createTypeChecker(host) {
53787
53859
  }
53788
53860
  function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags, privateSymbolVisitor, bundledImports) {
53789
53861
  const parameterDeclaration = getEffectiveParameterDeclaration(parameterSymbol);
53790
- let parameterType = getTypeOfSymbol(parameterSymbol);
53791
- if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) {
53792
- parameterType = getOptionalType(parameterType);
53793
- }
53794
- const parameterTypeNode = serializeTypeForDeclaration(context, parameterType, parameterSymbol, context.enclosingDeclaration, privateSymbolVisitor, bundledImports);
53862
+ const parameterType = getTypeOfSymbol(parameterSymbol);
53863
+ const addUndefined = parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration);
53864
+ const parameterTypeNode = serializeTypeForDeclaration(context, parameterType, parameterSymbol, context.enclosingDeclaration, privateSymbolVisitor, bundledImports, addUndefined);
53795
53865
  const modifiers = !(context.flags & 8192 /* OmitParameterModifiers */) && preserveModifierFlags && parameterDeclaration && canHaveModifiers(parameterDeclaration) ? map(getModifiers(parameterDeclaration), factory.cloneNode) : void 0;
53796
53866
  const isRest = parameterDeclaration && isRestParameter(parameterDeclaration) || getCheckFlags(parameterSymbol) & 32768 /* RestParameter */;
53797
53867
  const dotDotDotToken = isRest ? factory.createToken(26 /* DotDotDotToken */) : void 0;
@@ -54381,16 +54451,15 @@ function createTypeChecker(host) {
54381
54451
  }
54382
54452
  return enclosingDeclaration;
54383
54453
  }
54384
- function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled) {
54454
+ function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled, addUndefined) {
54455
+ var _a;
54385
54456
  if (!isErrorType(type) && enclosingDeclaration) {
54386
54457
  const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
54387
54458
  if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
54388
54459
  const existing = getEffectiveTypeAnnotationNode(declWithExistingAnnotation);
54389
- if (typeNodeIsEquivalentToType(existing, declWithExistingAnnotation, type) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
54390
- const result2 = serializeExistingTypeNode(context, existing, includePrivateSymbol, bundled);
54391
- if (result2) {
54392
- return result2;
54393
- }
54460
+ const result2 = tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined, includePrivateSymbol, bundled);
54461
+ if (result2) {
54462
+ return result2;
54394
54463
  }
54395
54464
  }
54396
54465
  }
@@ -54398,16 +54467,17 @@ function createTypeChecker(host) {
54398
54467
  if (type.flags & 8192 /* UniqueESSymbol */ && type.symbol === symbol && (!context.enclosingDeclaration || some(symbol.declarations, (d) => getSourceFileOfNode(d) === getSourceFileOfNode(context.enclosingDeclaration)))) {
54399
54468
  context.flags |= 1048576 /* AllowUniqueESSymbolType */;
54400
54469
  }
54401
- const result = typeToTypeNodeHelper(type, context);
54470
+ const decl = symbol.valueDeclaration || ((_a = symbol.declarations) == null ? void 0 : _a[0]);
54471
+ const expr = decl && isDeclarationWithPossibleInnerTypeNodeReuse(decl) ? getPossibleTypeNodeReuseExpression(decl) : void 0;
54472
+ const result = expressionOrTypeToTypeNode(context, expr, type, addUndefined);
54402
54473
  context.flags = oldFlags;
54403
54474
  return result;
54404
54475
  }
54405
- function typeNodeIsEquivalentToType(typeNode, annotatedDeclaration, type) {
54406
- const typeFromTypeNode = getTypeFromTypeNode(typeNode);
54476
+ function typeNodeIsEquivalentToType(typeNode, annotatedDeclaration, type, typeFromTypeNode = getTypeFromTypeNode(typeNode)) {
54407
54477
  if (typeFromTypeNode === type) {
54408
54478
  return true;
54409
54479
  }
54410
- if (isParameter(annotatedDeclaration) && annotatedDeclaration.questionToken) {
54480
+ if (annotatedDeclaration && (isParameter(annotatedDeclaration) || isPropertyDeclaration(annotatedDeclaration)) && annotatedDeclaration.questionToken) {
54411
54481
  return getTypeWithFacts(type, 524288 /* NEUndefined */) === typeFromTypeNode;
54412
54482
  }
54413
54483
  return false;
@@ -54419,11 +54489,9 @@ function createTypeChecker(host) {
54419
54489
  if (!!findAncestor(annotation, (n) => n === enclosingDeclarationIgnoringFakeScope) && annotation) {
54420
54490
  const annotated = getTypeFromTypeNode(annotation);
54421
54491
  const thisInstantiated = annotated.flags & 262144 /* TypeParameter */ && annotated.isThisType ? instantiateType(annotated, signature.mapper) : annotated;
54422
- if (thisInstantiated === type && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(annotation, type)) {
54423
- const result = serializeExistingTypeNode(context, annotation, includePrivateSymbol, bundled);
54424
- if (result) {
54425
- return result;
54426
- }
54492
+ const result = tryReuseExistingNonParameterTypeNode(context, annotation, type, signature.declaration, includePrivateSymbol, bundled, thisInstantiated);
54493
+ if (result) {
54494
+ return result;
54427
54495
  }
54428
54496
  }
54429
54497
  }
@@ -54452,7 +54520,9 @@ function createTypeChecker(host) {
54452
54520
  /*shouldComputeAliasesToMakeVisible*/
54453
54521
  false
54454
54522
  ).accessibility !== 0 /* Accessible */) {
54455
- introducesError = true;
54523
+ if (!isDeclarationName(node)) {
54524
+ introducesError = true;
54525
+ }
54456
54526
  } else {
54457
54527
  context.tracker.trackSymbol(sym, context.enclosingDeclaration, -1 /* All */);
54458
54528
  includePrivateSymbol == null ? void 0 : includePrivateSymbol(sym);
@@ -54590,6 +54660,31 @@ function createTypeChecker(host) {
54590
54660
  node.isTypeOf
54591
54661
  );
54592
54662
  }
54663
+ if (isParameter(node)) {
54664
+ if (!node.type && !node.initializer) {
54665
+ return factory.updateParameterDeclaration(
54666
+ node,
54667
+ /*modifiers*/
54668
+ void 0,
54669
+ node.dotDotDotToken,
54670
+ visitEachChild(
54671
+ node.name,
54672
+ visitExistingNodeTreeSymbols,
54673
+ /*context*/
54674
+ void 0
54675
+ ),
54676
+ node.questionToken,
54677
+ factory.createKeywordTypeNode(133 /* AnyKeyword */),
54678
+ /*initializer*/
54679
+ void 0
54680
+ );
54681
+ }
54682
+ }
54683
+ if (isPropertySignature(node)) {
54684
+ if (!node.type && !node.initializer) {
54685
+ return factory.updatePropertySignature(node, node.modifiers, node.name, node.questionToken, factory.createKeywordTypeNode(133 /* AnyKeyword */));
54686
+ }
54687
+ }
54593
54688
  if (isEntityName(node) || isEntityNameExpression(node)) {
54594
54689
  const { introducesError, node: result } = trackExistingEntityName(node, context, includePrivateSymbol);
54595
54690
  hadError = hadError || introducesError;
@@ -54597,7 +54692,7 @@ function createTypeChecker(host) {
54597
54692
  return result;
54598
54693
  }
54599
54694
  }
54600
- if (file && isTupleTypeNode(node) && getLineAndCharacterOfPosition(file, node.pos).line === getLineAndCharacterOfPosition(file, node.end).line) {
54695
+ if (file && isTupleTypeNode(node) && !nodeIsSynthesized(node) && getLineAndCharacterOfPosition(file, node.pos).line === getLineAndCharacterOfPosition(file, node.end).line) {
54601
54696
  setEmitFlags(node, 1 /* SingleLine */);
54602
54697
  }
54603
54698
  return visitEachChild(
@@ -55121,7 +55216,15 @@ function createTypeChecker(host) {
55121
55216
  context.flags |= 8388608 /* InTypeAlias */;
55122
55217
  const oldEnclosingDecl = context.enclosingDeclaration;
55123
55218
  context.enclosingDeclaration = jsdocAliasDecl;
55124
- const typeNode = jsdocAliasDecl && jsdocAliasDecl.typeExpression && isJSDocTypeExpression(jsdocAliasDecl.typeExpression) && serializeExistingTypeNode(context, jsdocAliasDecl.typeExpression.type, includePrivateSymbol, bundled) || typeToTypeNodeHelper(aliasType, context);
55219
+ const typeNode = jsdocAliasDecl && jsdocAliasDecl.typeExpression && isJSDocTypeExpression(jsdocAliasDecl.typeExpression) && tryReuseExistingNonParameterTypeNode(
55220
+ context,
55221
+ jsdocAliasDecl.typeExpression.type,
55222
+ aliasType,
55223
+ /*host*/
55224
+ void 0,
55225
+ includePrivateSymbol,
55226
+ bundled
55227
+ ) || typeToTypeNodeHelper(aliasType, context);
55125
55228
  addResult(
55126
55229
  setSyntheticLeadingComments(
55127
55230
  factory.createTypeAliasDeclaration(
@@ -55354,7 +55457,15 @@ function createTypeChecker(host) {
55354
55457
  }
55355
55458
  return cleanup(factory.createExpressionWithTypeArguments(
55356
55459
  expr,
55357
- map(e.typeArguments, (a) => serializeExistingTypeNode(context, a, includePrivateSymbol, bundled) || typeToTypeNodeHelper(getTypeFromTypeNode(a), context))
55460
+ map(e.typeArguments, (a) => tryReuseExistingNonParameterTypeNode(
55461
+ context,
55462
+ a,
55463
+ getTypeFromTypeNode(a),
55464
+ /*host*/
55465
+ void 0,
55466
+ includePrivateSymbol,
55467
+ bundled
55468
+ ) || typeToTypeNodeHelper(getTypeFromTypeNode(a), context))
55358
55469
  ));
55359
55470
  function cleanup(result2) {
55360
55471
  context.enclosingDeclaration = oldEnclosing;
@@ -55813,8 +55924,10 @@ function createTypeChecker(host) {
55813
55924
  }
55814
55925
  }
55815
55926
  function isTypeRepresentableAsFunctionNamespaceMerge(typeToSerialize, hostSymbol) {
55927
+ var _a2;
55816
55928
  const ctxSrc = getSourceFileOfNode(context.enclosingDeclaration);
55817
- return getObjectFlags(typeToSerialize) & (16 /* Anonymous */ | 32 /* Mapped */) && !length(getIndexInfosOfType(typeToSerialize)) && !isClassInstanceSide(typeToSerialize) && // While a class instance is potentially representable as a NS, prefer printing a reference to the instance type and serializing the class
55929
+ return getObjectFlags(typeToSerialize) & (16 /* Anonymous */ | 32 /* Mapped */) && !some((_a2 = typeToSerialize.symbol) == null ? void 0 : _a2.declarations, isTypeNode) && // If the type comes straight from a type node, we shouldn't try to break it up
55930
+ !length(getIndexInfosOfType(typeToSerialize)) && !isClassInstanceSide(typeToSerialize) && // While a class instance is potentially representable as a NS, prefer printing a reference to the instance type and serializing the class
55818
55931
  !!(length(filter(getPropertiesOfType(typeToSerialize), isNamespaceMember)) || length(getSignaturesOfType(typeToSerialize, 0 /* Call */))) && !length(getSignaturesOfType(typeToSerialize, 1 /* Construct */)) && // TODO: could probably serialize as function + ns + class, now that that's OK
55819
55932
  !getDeclarationWithTypeAnnotation(hostSymbol, enclosingDeclaration) && !(typeToSerialize.symbol && some(typeToSerialize.symbol.declarations, (d) => getSourceFileOfNode(d) !== ctxSrc)) && !some(getPropertiesOfType(typeToSerialize), (p) => isLateBoundName(p.escapedName)) && !some(getPropertiesOfType(typeToSerialize), (p) => some(p.declarations, (d) => getSourceFileOfNode(d) !== ctxSrc)) && every(getPropertiesOfType(typeToSerialize), (p) => {
55820
55933
  if (!isIdentifierText(symbolName(p), languageVersion)) {
@@ -60393,15 +60506,7 @@ function createTypeChecker(host) {
60393
60506
  jsdocPredicate = getTypePredicateOfSignature(jsdocSignature);
60394
60507
  }
60395
60508
  }
60396
- if (type || jsdocPredicate) {
60397
- signature.resolvedTypePredicate = type && isTypePredicateNode(type) ? createTypePredicateFromTypePredicateNode(type, signature) : jsdocPredicate || noTypePredicate;
60398
- } else if (signature.declaration && isFunctionLikeDeclaration(signature.declaration) && (!signature.resolvedReturnType || signature.resolvedReturnType.flags & 16 /* Boolean */)) {
60399
- const { declaration } = signature;
60400
- signature.resolvedTypePredicate = noTypePredicate;
60401
- signature.resolvedTypePredicate = getTypePredicateFromBody(declaration) || noTypePredicate;
60402
- } else {
60403
- signature.resolvedTypePredicate = noTypePredicate;
60404
- }
60509
+ signature.resolvedTypePredicate = type && isTypePredicateNode(type) ? createTypePredicateFromTypePredicateNode(type, signature) : jsdocPredicate || noTypePredicate;
60405
60510
  }
60406
60511
  Debug.assert(!!signature.resolvedTypePredicate);
60407
60512
  }
@@ -62351,7 +62456,7 @@ function createTypeChecker(host) {
62351
62456
  const typeVarIndex = typeSet[0].flags & 8650752 /* TypeVariable */ ? 0 : 1;
62352
62457
  const typeVariable = typeSet[typeVarIndex];
62353
62458
  const primitiveType = typeSet[1 - typeVarIndex];
62354
- if (typeVariable.flags & 8650752 /* TypeVariable */ && (primitiveType.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */) || includes & 16777216 /* IncludesEmptyObject */)) {
62459
+ if (typeVariable.flags & 8650752 /* TypeVariable */ && (primitiveType.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */) && !isGenericStringLikeType(primitiveType) || includes & 16777216 /* IncludesEmptyObject */)) {
62355
62460
  const constraint = getBaseConstraintOfType(typeVariable);
62356
62461
  if (constraint && everyType(constraint, (t) => !!(t.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */)) || isEmptyAnonymousObjectType(t))) {
62357
62462
  if (isTypeStrictSubtypeOf(constraint, primitiveType)) {
@@ -62956,6 +63061,9 @@ function createTypeChecker(host) {
62956
63061
  function isPatternLiteralType(type) {
62957
63062
  return !!(type.flags & 134217728 /* TemplateLiteral */) && every(type.types, isPatternLiteralPlaceholderType) || !!(type.flags & 268435456 /* StringMapping */) && isPatternLiteralPlaceholderType(type.type);
62958
63063
  }
63064
+ function isGenericStringLikeType(type) {
63065
+ return !!(type.flags & (134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */)) && !isPatternLiteralType(type);
63066
+ }
62959
63067
  function isGenericType(type) {
62960
63068
  return !!getGenericObjectFlags(type);
62961
63069
  }
@@ -62978,7 +63086,7 @@ function createTypeChecker(host) {
62978
63086
  }
62979
63087
  return type.objectFlags & 12582912 /* IsGenericType */;
62980
63088
  }
62981
- return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) && !isPatternLiteralType(type) ? 8388608 /* IsGenericIndexType */ : 0);
63089
+ return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */) || isGenericStringLikeType(type) ? 8388608 /* IsGenericIndexType */ : 0);
62982
63090
  }
62983
63091
  function getSimplifiedType(type, writing) {
62984
63092
  return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type;
@@ -76245,7 +76353,10 @@ function createTypeChecker(host) {
76245
76353
  return Debug.fail();
76246
76354
  }
76247
76355
  function getDecoratorArgumentCount(node, signature) {
76248
- return compilerOptions.experimentalDecorators ? getLegacyDecoratorArgumentCount(node, signature) : 2;
76356
+ return compilerOptions.experimentalDecorators ? getLegacyDecoratorArgumentCount(node, signature) : (
76357
+ // Allow the runtime to oversupply arguments to an ES decorator as long as there's at least one parameter.
76358
+ Math.min(Math.max(getParameterCount(signature), 1), 2)
76359
+ );
76249
76360
  }
76250
76361
  function getLegacyDecoratorArgumentCount(node, signature) {
76251
76362
  switch (node.parent.kind) {
@@ -78825,67 +78936,6 @@ function createTypeChecker(host) {
78825
78936
  return false;
78826
78937
  }
78827
78938
  }
78828
- function getTypePredicateFromBody(func) {
78829
- switch (func.kind) {
78830
- case 176 /* Constructor */:
78831
- case 177 /* GetAccessor */:
78832
- case 178 /* SetAccessor */:
78833
- return void 0;
78834
- }
78835
- const functionFlags = getFunctionFlags(func);
78836
- if (functionFlags !== 0 /* Normal */ || func.parameters.length === 0)
78837
- return void 0;
78838
- let singleReturn;
78839
- if (func.body && func.body.kind !== 241 /* Block */) {
78840
- singleReturn = func.body;
78841
- } else {
78842
- const bailedEarly = forEachReturnStatement(func.body, (returnStatement) => {
78843
- if (singleReturn || !returnStatement.expression)
78844
- return true;
78845
- singleReturn = returnStatement.expression;
78846
- });
78847
- if (bailedEarly || !singleReturn || functionHasImplicitReturn(func))
78848
- return void 0;
78849
- }
78850
- return checkIfExpressionRefinesAnyParameter(func, singleReturn);
78851
- }
78852
- function checkIfExpressionRefinesAnyParameter(func, expr) {
78853
- expr = skipParentheses(
78854
- expr,
78855
- /*excludeJSDocTypeAssertions*/
78856
- true
78857
- );
78858
- const returnType = checkExpressionCached(expr);
78859
- if (!(returnType.flags & 16 /* Boolean */))
78860
- return void 0;
78861
- return forEach(func.parameters, (param, i) => {
78862
- const initType = getTypeOfSymbol(param.symbol);
78863
- if (!initType || initType.flags & 16 /* Boolean */ || !isIdentifier(param.name) || isSymbolAssigned(param.symbol)) {
78864
- return;
78865
- }
78866
- const trueType2 = checkIfExpressionRefinesParameter(func, expr, param, initType);
78867
- if (trueType2) {
78868
- return createTypePredicate(1 /* Identifier */, unescapeLeadingUnderscores(param.name.escapedText), i, trueType2);
78869
- }
78870
- });
78871
- }
78872
- function checkIfExpressionRefinesParameter(func, expr, param, initType) {
78873
- const antecedent = expr.flowNode || expr.parent.kind === 253 /* ReturnStatement */ && expr.parent.flowNode || { flags: 2 /* Start */ };
78874
- const trueCondition = {
78875
- flags: 32 /* TrueCondition */,
78876
- node: expr,
78877
- antecedent
78878
- };
78879
- const trueType2 = getFlowTypeOfReference(param.name, initType, initType, func, trueCondition);
78880
- if (trueType2 === initType)
78881
- return void 0;
78882
- const falseCondition = {
78883
- ...trueCondition,
78884
- flags: 64 /* FalseCondition */
78885
- };
78886
- const falseSubtype = getFlowTypeOfReference(param.name, trueType2, trueType2, func, falseCondition);
78887
- return falseSubtype.flags & 131072 /* Never */ ? trueType2 : void 0;
78888
- }
78889
78939
  function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func, returnType) {
78890
78940
  addLazyDiagnostic(checkAllCodePathsInNonVoidFunctionReturnOrThrowDiagnostics);
78891
78941
  return;
@@ -82166,7 +82216,56 @@ function createTypeChecker(host) {
82166
82216
  }
82167
82217
  }
82168
82218
  }
82219
+ function checkGrammarDecorator(decorator) {
82220
+ const sourceFile = getSourceFileOfNode(decorator);
82221
+ if (!hasParseDiagnostics(sourceFile)) {
82222
+ let node = decorator.expression;
82223
+ if (isParenthesizedExpression(node)) {
82224
+ return false;
82225
+ }
82226
+ let canHaveCallExpression = true;
82227
+ let errorNode;
82228
+ while (true) {
82229
+ if (isExpressionWithTypeArguments(node) || isNonNullExpression(node)) {
82230
+ node = node.expression;
82231
+ continue;
82232
+ }
82233
+ if (isCallExpression(node)) {
82234
+ if (!canHaveCallExpression) {
82235
+ errorNode = node;
82236
+ }
82237
+ if (node.questionDotToken) {
82238
+ errorNode = node.questionDotToken;
82239
+ }
82240
+ node = node.expression;
82241
+ canHaveCallExpression = false;
82242
+ continue;
82243
+ }
82244
+ if (isPropertyAccessExpression(node)) {
82245
+ if (node.questionDotToken) {
82246
+ errorNode = node.questionDotToken;
82247
+ }
82248
+ node = node.expression;
82249
+ canHaveCallExpression = false;
82250
+ continue;
82251
+ }
82252
+ if (!isIdentifier(node)) {
82253
+ errorNode = node;
82254
+ }
82255
+ break;
82256
+ }
82257
+ if (errorNode) {
82258
+ addRelatedInfo(
82259
+ error2(decorator.expression, Diagnostics.Expression_must_be_enclosed_in_parentheses_to_be_used_as_a_decorator),
82260
+ createDiagnosticForNode(errorNode, Diagnostics.Invalid_syntax_in_decorator)
82261
+ );
82262
+ return true;
82263
+ }
82264
+ }
82265
+ return false;
82266
+ }
82169
82267
  function checkDecorator(node) {
82268
+ checkGrammarDecorator(node);
82170
82269
  const signature = getResolvedSignature(node);
82171
82270
  checkDeprecatedSignature(signature, node);
82172
82271
  const returnType = getReturnTypeOfSignature(signature);
@@ -87589,14 +87688,34 @@ function createTypeChecker(host) {
87589
87688
  return factory.createToken(133 /* AnyKeyword */);
87590
87689
  }
87591
87690
  const symbol = getSymbolOfDeclaration(declaration);
87592
- let type = symbol && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* Signature */)) ? getWidenedLiteralType(getTypeOfSymbol(symbol)) : errorType;
87593
- if (type.flags & 8192 /* UniqueESSymbol */ && type.symbol === symbol) {
87594
- flags |= 1048576 /* AllowUniqueESSymbolType */;
87595
- }
87596
- if (addUndefined) {
87597
- type = getOptionalType(type);
87691
+ const type = symbol && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* Signature */)) ? getWidenedLiteralType(getTypeOfSymbol(symbol)) : errorType;
87692
+ return nodeBuilder.serializeTypeForDeclaration(type, symbol, addUndefined, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
87693
+ }
87694
+ function isDeclarationWithPossibleInnerTypeNodeReuse(declaration) {
87695
+ return isFunctionLike(declaration) || isExportAssignment(declaration) || isVariableLike(declaration);
87696
+ }
87697
+ function getPossibleTypeNodeReuseExpression(declaration) {
87698
+ var _a;
87699
+ return isFunctionLike(declaration) && !isSetAccessor(declaration) ? getSingleReturnExpression(declaration) : isExportAssignment(declaration) ? declaration.expression : !!declaration.initializer ? declaration.initializer : isParameter(declaration) && isSetAccessor(declaration.parent) ? getSingleReturnExpression(getAllAccessorDeclarations((_a = getSymbolOfDeclaration(declaration.parent)) == null ? void 0 : _a.declarations, declaration.parent).getAccessor) : void 0;
87700
+ }
87701
+ function getSingleReturnExpression(declaration) {
87702
+ let candidateExpr;
87703
+ if (declaration && !nodeIsMissing(declaration.body)) {
87704
+ const body = declaration.body;
87705
+ if (body && isBlock(body)) {
87706
+ forEachReturnStatement(body, (s) => {
87707
+ if (!candidateExpr) {
87708
+ candidateExpr = s.expression;
87709
+ } else {
87710
+ candidateExpr = void 0;
87711
+ return true;
87712
+ }
87713
+ });
87714
+ } else {
87715
+ candidateExpr = body;
87716
+ }
87598
87717
  }
87599
- return nodeBuilder.typeToTypeNode(type, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
87718
+ return candidateExpr;
87600
87719
  }
87601
87720
  function createReturnTypeOfSignatureDeclaration(signatureDeclarationIn, enclosingDeclaration, flags, tracker) {
87602
87721
  const signatureDeclaration = getParseTreeNode(signatureDeclarationIn, isFunctionLike);
@@ -87604,7 +87723,15 @@ function createTypeChecker(host) {
87604
87723
  return factory.createToken(133 /* AnyKeyword */);
87605
87724
  }
87606
87725
  const signature = getSignatureFromDeclaration(signatureDeclaration);
87607
- return nodeBuilder.typeToTypeNode(getReturnTypeOfSignature(signature), enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
87726
+ return nodeBuilder.expressionOrTypeToTypeNode(
87727
+ getReturnTypeOfSignature(signature),
87728
+ getPossibleTypeNodeReuseExpression(signatureDeclaration),
87729
+ /*addUndefined*/
87730
+ void 0,
87731
+ enclosingDeclaration,
87732
+ flags | 1024 /* MultilineObjectLiterals */,
87733
+ tracker
87734
+ );
87608
87735
  }
87609
87736
  function createTypeOfExpression(exprIn, enclosingDeclaration, flags, tracker) {
87610
87737
  const expr = getParseTreeNode(exprIn, isExpression);
@@ -87612,7 +87739,15 @@ function createTypeChecker(host) {
87612
87739
  return factory.createToken(133 /* AnyKeyword */);
87613
87740
  }
87614
87741
  const type = getWidenedType(getRegularTypeOfExpression(expr));
87615
- return nodeBuilder.typeToTypeNode(type, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
87742
+ return nodeBuilder.expressionOrTypeToTypeNode(
87743
+ type,
87744
+ expr,
87745
+ /*addUndefined*/
87746
+ void 0,
87747
+ enclosingDeclaration,
87748
+ flags | 1024 /* MultilineObjectLiterals */,
87749
+ tracker
87750
+ );
87616
87751
  }
87617
87752
  function hasGlobalName(name) {
87618
87753
  return globals.has(escapeLeadingUnderscores(name));
@@ -94342,7 +94477,7 @@ function transformTypeScript(context) {
94342
94477
  ),
94343
94478
  valueExpression
94344
94479
  );
94345
- const outerAssignment = valueExpression.kind === 11 /* StringLiteral */ ? innerAssignment : factory2.createAssignment(
94480
+ const outerAssignment = isSyntacticallyString(valueExpression) ? innerAssignment : factory2.createAssignment(
94346
94481
  factory2.createElementAccessExpression(
94347
94482
  currentNamespaceContainerName,
94348
94483
  innerAssignment
@@ -145703,22 +145838,22 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
145703
145838
  }
145704
145839
  return [];
145705
145840
  }
145706
- function getCodeFixesAtPosition(fileName, start2, end, errorCodes65, formatOptions, preferences = emptyOptions) {
145841
+ function getCodeFixesAtPosition(fileName, start2, end, errorCodes66, formatOptions, preferences = emptyOptions) {
145707
145842
  synchronizeHostData();
145708
145843
  const sourceFile = getValidSourceFile(fileName);
145709
145844
  const span = createTextSpanFromBounds(start2, end);
145710
145845
  const formatContext = ts_formatting_exports.getFormatContext(formatOptions, host);
145711
- return flatMap(deduplicate(errorCodes65, equateValues, compareValues), (errorCode) => {
145846
+ return flatMap(deduplicate(errorCodes66, equateValues, compareValues), (errorCode) => {
145712
145847
  cancellationToken.throwIfCancellationRequested();
145713
145848
  return ts_codefix_exports.getFixes({ errorCode, sourceFile, span, program, host, cancellationToken, formatContext, preferences });
145714
145849
  });
145715
145850
  }
145716
- function getCombinedCodeFix(scope, fixId52, formatOptions, preferences = emptyOptions) {
145851
+ function getCombinedCodeFix(scope, fixId53, formatOptions, preferences = emptyOptions) {
145717
145852
  synchronizeHostData();
145718
145853
  Debug.assert(scope.type === "file");
145719
145854
  const sourceFile = getValidSourceFile(scope.fileName);
145720
145855
  const formatContext = ts_formatting_exports.getFormatContext(formatOptions, host);
145721
- return ts_codefix_exports.getAllFixes({ fixId: fixId52, sourceFile, program, host, cancellationToken, formatContext, preferences });
145856
+ return ts_codefix_exports.getAllFixes({ fixId: fixId53, sourceFile, program, host, cancellationToken, formatContext, preferences });
145722
145857
  }
145723
145858
  function organizeImports2(args, formatOptions, preferences = emptyOptions) {
145724
145859
  synchronizeHostData();
@@ -147397,14 +147532,14 @@ function createCodeFixActionWithoutFixAll(fixName8, changes, description3) {
147397
147532
  void 0
147398
147533
  );
147399
147534
  }
147400
- function createCodeFixAction(fixName8, changes, description3, fixId52, fixAllDescription, command) {
147401
- return createCodeFixActionWorker(fixName8, diagnosticToString(description3), changes, fixId52, diagnosticToString(fixAllDescription), command);
147535
+ function createCodeFixAction(fixName8, changes, description3, fixId53, fixAllDescription, command) {
147536
+ return createCodeFixActionWorker(fixName8, diagnosticToString(description3), changes, fixId53, diagnosticToString(fixAllDescription), command);
147402
147537
  }
147403
- function createCodeFixActionMaybeFixAll(fixName8, changes, description3, fixId52, fixAllDescription, command) {
147404
- return createCodeFixActionWorker(fixName8, diagnosticToString(description3), changes, fixId52, fixAllDescription && diagnosticToString(fixAllDescription), command);
147538
+ function createCodeFixActionMaybeFixAll(fixName8, changes, description3, fixId53, fixAllDescription, command) {
147539
+ return createCodeFixActionWorker(fixName8, diagnosticToString(description3), changes, fixId53, fixAllDescription && diagnosticToString(fixAllDescription), command);
147405
147540
  }
147406
- function createCodeFixActionWorker(fixName8, description3, changes, fixId52, fixAllDescription, command) {
147407
- return { fixName: fixName8, description: description3, changes, fixId: fixId52, fixAllDescription, commands: command ? [command] : void 0 };
147541
+ function createCodeFixActionWorker(fixName8, description3, changes, fixId53, fixAllDescription, command) {
147542
+ return { fixName: fixName8, description: description3, changes, fixId: fixId53, fixAllDescription, commands: command ? [command] : void 0 };
147408
147543
  }
147409
147544
  function registerCodeFix(reg) {
147410
147545
  for (const error2 of reg.errorCodes) {
@@ -147412,9 +147547,9 @@ function registerCodeFix(reg) {
147412
147547
  errorCodeToFixes.add(String(error2), reg);
147413
147548
  }
147414
147549
  if (reg.fixIds) {
147415
- for (const fixId52 of reg.fixIds) {
147416
- Debug.assert(!fixIdToRegistration.has(fixId52));
147417
- fixIdToRegistration.set(fixId52, reg);
147550
+ for (const fixId53 of reg.fixIds) {
147551
+ Debug.assert(!fixIdToRegistration.has(fixId53));
147552
+ fixIdToRegistration.set(fixId53, reg);
147418
147553
  }
147419
147554
  }
147420
147555
  }
@@ -147423,17 +147558,17 @@ function getSupportedErrorCodes() {
147423
147558
  return errorCodeToFixesArray ?? (errorCodeToFixesArray = arrayFrom(errorCodeToFixes.keys()));
147424
147559
  }
147425
147560
  function removeFixIdIfFixAllUnavailable(registration, diagnostics) {
147426
- const { errorCodes: errorCodes65 } = registration;
147561
+ const { errorCodes: errorCodes66 } = registration;
147427
147562
  let maybeFixableDiagnostics = 0;
147428
147563
  for (const diag2 of diagnostics) {
147429
- if (contains(errorCodes65, diag2.code))
147564
+ if (contains(errorCodes66, diag2.code))
147430
147565
  maybeFixableDiagnostics++;
147431
147566
  if (maybeFixableDiagnostics > 1)
147432
147567
  break;
147433
147568
  }
147434
147569
  const fixAllUnavailable = maybeFixableDiagnostics < 2;
147435
- return ({ fixId: fixId52, fixAllDescription, ...action }) => {
147436
- return fixAllUnavailable ? action : { ...action, fixId: fixId52, fixAllDescription };
147570
+ return ({ fixId: fixId53, fixAllDescription, ...action }) => {
147571
+ return fixAllUnavailable ? action : { ...action, fixId: fixId53, fixAllDescription };
147437
147572
  };
147438
147573
  }
147439
147574
  function getFixes(context) {
@@ -147450,14 +147585,14 @@ function createCombinedCodeActions(changes, commands) {
147450
147585
  function createFileTextChanges(fileName, textChanges2) {
147451
147586
  return { fileName, textChanges: textChanges2 };
147452
147587
  }
147453
- function codeFixAll(context, errorCodes65, use) {
147588
+ function codeFixAll(context, errorCodes66, use) {
147454
147589
  const commands = [];
147455
- const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => eachDiagnostic(context, errorCodes65, (diag2) => use(t, diag2, commands)));
147590
+ const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => eachDiagnostic(context, errorCodes66, (diag2) => use(t, diag2, commands)));
147456
147591
  return createCombinedCodeActions(changes, commands.length === 0 ? void 0 : commands);
147457
147592
  }
147458
- function eachDiagnostic(context, errorCodes65, cb) {
147593
+ function eachDiagnostic(context, errorCodes66, cb) {
147459
147594
  for (const diag2 of getDiagnostics(context)) {
147460
- if (contains(errorCodes65, diag2.code)) {
147595
+ if (contains(errorCodes66, diag2.code)) {
147461
147596
  cb(diag2);
147462
147597
  }
147463
147598
  }
@@ -151868,10 +152003,10 @@ registerCodeFix({
151868
152003
  const info = errorCodeFixIdMap[errorCode];
151869
152004
  if (!info)
151870
152005
  return emptyArray;
151871
- const { descriptions, fixId: fixId52, fixAllDescriptions } = info;
152006
+ const { descriptions, fixId: fixId53, fixAllDescriptions } = info;
151872
152007
  const changes = ts_textChanges_exports.ChangeTracker.with(context, (changes2) => dispatchChanges(changes2, context, errorCode, span.start));
151873
152008
  return [
151874
- createCodeFixActionMaybeFixAll(fixName, changes, descriptions, fixId52, fixAllDescriptions)
152009
+ createCodeFixActionMaybeFixAll(fixName, changes, descriptions, fixId53, fixAllDescriptions)
151875
152010
  ];
151876
152011
  },
151877
152012
  fixIds: [fixName, fixAddOverrideId, fixRemoveOverrideId],
@@ -152676,7 +152811,7 @@ registerCodeFix({
152676
152811
  },
152677
152812
  fixIds: [fixMissingMember, fixMissingFunctionDeclaration, fixMissingProperties, fixMissingAttributes],
152678
152813
  getAllCodeActions: (context) => {
152679
- const { program, fixId: fixId52 } = context;
152814
+ const { program, fixId: fixId53 } = context;
152680
152815
  const checker = program.getTypeChecker();
152681
152816
  const seen = /* @__PURE__ */ new Map();
152682
152817
  const typeDeclToMembers = /* @__PURE__ */ new Map();
@@ -152686,11 +152821,11 @@ registerCodeFix({
152686
152821
  if (!info || !addToSeen(seen, getNodeId(info.parentDeclaration) + "#" + (info.kind === 3 /* ObjectLiteral */ ? info.identifier : info.token.text))) {
152687
152822
  return;
152688
152823
  }
152689
- if (fixId52 === fixMissingFunctionDeclaration && (info.kind === 2 /* Function */ || info.kind === 5 /* Signature */)) {
152824
+ if (fixId53 === fixMissingFunctionDeclaration && (info.kind === 2 /* Function */ || info.kind === 5 /* Signature */)) {
152690
152825
  addFunctionDeclaration(changes, context, info);
152691
- } else if (fixId52 === fixMissingProperties && info.kind === 3 /* ObjectLiteral */) {
152826
+ } else if (fixId53 === fixMissingProperties && info.kind === 3 /* ObjectLiteral */) {
152692
152827
  addObjectLiteralProperties(changes, context, info);
152693
- } else if (fixId52 === fixMissingAttributes && info.kind === 4 /* JsxAttributes */) {
152828
+ } else if (fixId53 === fixMissingAttributes && info.kind === 4 /* JsxAttributes */) {
152694
152829
  addJsxAttributes(changes, context, info);
152695
152830
  } else {
152696
152831
  if (info.kind === 1 /* Enum */) {
@@ -154589,21 +154724,21 @@ registerCodeFix({
154589
154724
  actions2.push(fix(type, fixIdNullable, Diagnostics.Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types));
154590
154725
  }
154591
154726
  return actions2;
154592
- function fix(type2, fixId52, fixAllDescription) {
154727
+ function fix(type2, fixId53, fixAllDescription) {
154593
154728
  const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange29(t, sourceFile, typeNode, type2, checker));
154594
- return createCodeFixAction("jdocTypes", changes, [Diagnostics.Change_0_to_1, original, checker.typeToString(type2)], fixId52, fixAllDescription);
154729
+ return createCodeFixAction("jdocTypes", changes, [Diagnostics.Change_0_to_1, original, checker.typeToString(type2)], fixId53, fixAllDescription);
154595
154730
  }
154596
154731
  },
154597
154732
  fixIds: [fixIdPlain, fixIdNullable],
154598
154733
  getAllCodeActions(context) {
154599
- const { fixId: fixId52, program, sourceFile } = context;
154734
+ const { fixId: fixId53, program, sourceFile } = context;
154600
154735
  const checker = program.getTypeChecker();
154601
154736
  return codeFixAll(context, errorCodes45, (changes, err) => {
154602
154737
  const info = getInfo15(err.file, err.start, checker);
154603
154738
  if (!info)
154604
154739
  return;
154605
154740
  const { typeNode, type } = info;
154606
- const fixedType = typeNode.kind === 314 /* JSDocNullableType */ && fixId52 === fixIdNullable ? checker.getNullableType(type, 32768 /* Undefined */) : type;
154741
+ const fixedType = typeNode.kind === 314 /* JSDocNullableType */ && fixId53 === fixIdNullable ? checker.getNullableType(type, 32768 /* Undefined */) : type;
154607
154742
  doChange29(changes, sourceFile, typeNode, fixedType, checker);
154608
154743
  });
154609
154744
  }
@@ -157311,11 +157446,31 @@ function flattenInvalidBinaryExpr(node) {
157311
157446
  }
157312
157447
  }
157313
157448
 
157314
- // src/services/codefixes/convertToMappedObjectType.ts
157315
- var fixId45 = "fixConvertToMappedObjectType";
157316
- var errorCodes58 = [Diagnostics.An_index_signature_parameter_type_cannot_be_a_literal_type_or_generic_type_Consider_using_a_mapped_object_type_instead.code];
157449
+ // src/services/codefixes/wrapDecoratorInParentheses.ts
157450
+ var fixId45 = "wrapDecoratorInParentheses";
157451
+ var errorCodes58 = [Diagnostics.Expression_must_be_enclosed_in_parentheses_to_be_used_as_a_decorator.code];
157317
157452
  registerCodeFix({
157318
157453
  errorCodes: errorCodes58,
157454
+ getCodeActions: function getCodeActionsToWrapDecoratorExpressionInParentheses(context) {
157455
+ const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange10(t, context.sourceFile, context.span.start));
157456
+ return [createCodeFixAction(fixId45, changes, Diagnostics.Wrap_in_parentheses, fixId45, Diagnostics.Wrap_all_invalid_decorator_expressions_in_parentheses)];
157457
+ },
157458
+ fixIds: [fixId45],
157459
+ getAllCodeActions: (context) => codeFixAll(context, errorCodes58, (changes, diag2) => makeChange10(changes, diag2.file, diag2.start))
157460
+ });
157461
+ function makeChange10(changeTracker, sourceFile, pos) {
157462
+ const token = getTokenAtPosition(sourceFile, pos);
157463
+ const decorator = findAncestor(token, isDecorator);
157464
+ Debug.assert(!!decorator, "Expected position to be owned by a decorator.");
157465
+ const replacement = factory.createParenthesizedExpression(decorator.expression);
157466
+ changeTracker.replaceNode(sourceFile, decorator.expression, replacement);
157467
+ }
157468
+
157469
+ // src/services/codefixes/convertToMappedObjectType.ts
157470
+ var fixId46 = "fixConvertToMappedObjectType";
157471
+ var errorCodes59 = [Diagnostics.An_index_signature_parameter_type_cannot_be_a_literal_type_or_generic_type_Consider_using_a_mapped_object_type_instead.code];
157472
+ registerCodeFix({
157473
+ errorCodes: errorCodes59,
157319
157474
  getCodeActions: function getCodeActionsToConvertToMappedTypeObject(context) {
157320
157475
  const { sourceFile, span } = context;
157321
157476
  const info = getInfo20(sourceFile, span.start);
@@ -157323,10 +157478,10 @@ registerCodeFix({
157323
157478
  return void 0;
157324
157479
  const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange39(t, sourceFile, info));
157325
157480
  const name = idText(info.container.name);
157326
- return [createCodeFixAction(fixId45, changes, [Diagnostics.Convert_0_to_mapped_object_type, name], fixId45, [Diagnostics.Convert_0_to_mapped_object_type, name])];
157481
+ return [createCodeFixAction(fixId46, changes, [Diagnostics.Convert_0_to_mapped_object_type, name], fixId46, [Diagnostics.Convert_0_to_mapped_object_type, name])];
157327
157482
  },
157328
- fixIds: [fixId45],
157329
- getAllCodeActions: (context) => codeFixAll(context, errorCodes58, (changes, diag2) => {
157483
+ fixIds: [fixId46],
157484
+ getAllCodeActions: (context) => codeFixAll(context, errorCodes59, (changes, diag2) => {
157330
157485
  const info = getInfo20(diag2.file, diag2.start);
157331
157486
  if (info)
157332
157487
  doChange39(changes, diag2.file, info);
@@ -157374,12 +157529,12 @@ function doChange39(changes, sourceFile, { indexSignature, container }) {
157374
157529
  }
157375
157530
 
157376
157531
  // src/services/codefixes/removeAccidentalCallParentheses.ts
157377
- var fixId46 = "removeAccidentalCallParentheses";
157378
- var errorCodes59 = [
157532
+ var fixId47 = "removeAccidentalCallParentheses";
157533
+ var errorCodes60 = [
157379
157534
  Diagnostics.This_expression_is_not_callable_because_it_is_a_get_accessor_Did_you_mean_to_use_it_without.code
157380
157535
  ];
157381
157536
  registerCodeFix({
157382
- errorCodes: errorCodes59,
157537
+ errorCodes: errorCodes60,
157383
157538
  getCodeActions(context) {
157384
157539
  const callExpression = findAncestor(getTokenAtPosition(context.sourceFile, context.span.start), isCallExpression);
157385
157540
  if (!callExpression) {
@@ -157388,30 +157543,30 @@ registerCodeFix({
157388
157543
  const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => {
157389
157544
  t.deleteRange(context.sourceFile, { pos: callExpression.expression.end, end: callExpression.end });
157390
157545
  });
157391
- return [createCodeFixActionWithoutFixAll(fixId46, changes, Diagnostics.Remove_parentheses)];
157546
+ return [createCodeFixActionWithoutFixAll(fixId47, changes, Diagnostics.Remove_parentheses)];
157392
157547
  },
157393
- fixIds: [fixId46]
157548
+ fixIds: [fixId47]
157394
157549
  });
157395
157550
 
157396
157551
  // src/services/codefixes/removeUnnecessaryAwait.ts
157397
- var fixId47 = "removeUnnecessaryAwait";
157398
- var errorCodes60 = [
157552
+ var fixId48 = "removeUnnecessaryAwait";
157553
+ var errorCodes61 = [
157399
157554
  Diagnostics.await_has_no_effect_on_the_type_of_this_expression.code
157400
157555
  ];
157401
157556
  registerCodeFix({
157402
- errorCodes: errorCodes60,
157557
+ errorCodes: errorCodes61,
157403
157558
  getCodeActions: function getCodeActionsToRemoveUnnecessaryAwait(context) {
157404
- const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange10(t, context.sourceFile, context.span));
157559
+ const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange11(t, context.sourceFile, context.span));
157405
157560
  if (changes.length > 0) {
157406
- return [createCodeFixAction(fixId47, changes, Diagnostics.Remove_unnecessary_await, fixId47, Diagnostics.Remove_all_unnecessary_uses_of_await)];
157561
+ return [createCodeFixAction(fixId48, changes, Diagnostics.Remove_unnecessary_await, fixId48, Diagnostics.Remove_all_unnecessary_uses_of_await)];
157407
157562
  }
157408
157563
  },
157409
- fixIds: [fixId47],
157564
+ fixIds: [fixId48],
157410
157565
  getAllCodeActions: (context) => {
157411
- return codeFixAll(context, errorCodes60, (changes, diag2) => makeChange10(changes, diag2.file, diag2));
157566
+ return codeFixAll(context, errorCodes61, (changes, diag2) => makeChange11(changes, diag2.file, diag2));
157412
157567
  }
157413
157568
  });
157414
- function makeChange10(changeTracker, sourceFile, span) {
157569
+ function makeChange11(changeTracker, sourceFile, span) {
157415
157570
  const awaitKeyword = tryCast(getTokenAtPosition(sourceFile, span.start), (node) => node.kind === 135 /* AwaitKeyword */);
157416
157571
  const awaitExpression = awaitKeyword && tryCast(awaitKeyword.parent, isAwaitExpression);
157417
157572
  if (!awaitExpression) {
@@ -157436,20 +157591,20 @@ function makeChange10(changeTracker, sourceFile, span) {
157436
157591
  }
157437
157592
 
157438
157593
  // src/services/codefixes/splitTypeOnlyImport.ts
157439
- var errorCodes61 = [Diagnostics.A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both.code];
157440
- var fixId48 = "splitTypeOnlyImport";
157594
+ var errorCodes62 = [Diagnostics.A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both.code];
157595
+ var fixId49 = "splitTypeOnlyImport";
157441
157596
  registerCodeFix({
157442
- errorCodes: errorCodes61,
157443
- fixIds: [fixId48],
157597
+ errorCodes: errorCodes62,
157598
+ fixIds: [fixId49],
157444
157599
  getCodeActions: function getCodeActionsToSplitTypeOnlyImport(context) {
157445
157600
  const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => {
157446
157601
  return splitTypeOnlyImport(t, getImportDeclaration2(context.sourceFile, context.span), context);
157447
157602
  });
157448
157603
  if (changes.length) {
157449
- return [createCodeFixAction(fixId48, changes, Diagnostics.Split_into_two_separate_import_declarations, fixId48, Diagnostics.Split_all_invalid_type_only_imports)];
157604
+ return [createCodeFixAction(fixId49, changes, Diagnostics.Split_into_two_separate_import_declarations, fixId49, Diagnostics.Split_all_invalid_type_only_imports)];
157450
157605
  }
157451
157606
  },
157452
- getAllCodeActions: (context) => codeFixAll(context, errorCodes61, (changes, error2) => {
157607
+ getAllCodeActions: (context) => codeFixAll(context, errorCodes62, (changes, error2) => {
157453
157608
  splitTypeOnlyImport(changes, getImportDeclaration2(context.sourceFile, error2), context);
157454
157609
  })
157455
157610
  });
@@ -157498,23 +157653,23 @@ function splitTypeOnlyImport(changes, importDeclaration, context) {
157498
157653
  }
157499
157654
 
157500
157655
  // src/services/codefixes/convertConstToLet.ts
157501
- var fixId49 = "fixConvertConstToLet";
157502
- var errorCodes62 = [Diagnostics.Cannot_assign_to_0_because_it_is_a_constant.code];
157656
+ var fixId50 = "fixConvertConstToLet";
157657
+ var errorCodes63 = [Diagnostics.Cannot_assign_to_0_because_it_is_a_constant.code];
157503
157658
  registerCodeFix({
157504
- errorCodes: errorCodes62,
157659
+ errorCodes: errorCodes63,
157505
157660
  getCodeActions: function getCodeActionsToConvertConstToLet(context) {
157506
157661
  const { sourceFile, span, program } = context;
157507
157662
  const info = getInfo21(sourceFile, span.start, program);
157508
157663
  if (info === void 0)
157509
157664
  return;
157510
157665
  const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange40(t, sourceFile, info.token));
157511
- return [createCodeFixActionMaybeFixAll(fixId49, changes, Diagnostics.Convert_const_to_let, fixId49, Diagnostics.Convert_all_const_to_let)];
157666
+ return [createCodeFixActionMaybeFixAll(fixId50, changes, Diagnostics.Convert_const_to_let, fixId50, Diagnostics.Convert_all_const_to_let)];
157512
157667
  },
157513
157668
  getAllCodeActions: (context) => {
157514
157669
  const { program } = context;
157515
157670
  const seen = /* @__PURE__ */ new Map();
157516
157671
  return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => {
157517
- eachDiagnostic(context, errorCodes62, (diag2) => {
157672
+ eachDiagnostic(context, errorCodes63, (diag2) => {
157518
157673
  const info = getInfo21(diag2.file, diag2.start, program);
157519
157674
  if (info) {
157520
157675
  if (addToSeen(seen, getSymbolId(info.symbol))) {
@@ -157525,7 +157680,7 @@ registerCodeFix({
157525
157680
  });
157526
157681
  }));
157527
157682
  },
157528
- fixIds: [fixId49]
157683
+ fixIds: [fixId50]
157529
157684
  });
157530
157685
  function getInfo21(sourceFile, pos, program) {
157531
157686
  var _a;
@@ -157546,11 +157701,11 @@ function doChange40(changes, sourceFile, token) {
157546
157701
  }
157547
157702
 
157548
157703
  // src/services/codefixes/fixExpectedComma.ts
157549
- var fixId50 = "fixExpectedComma";
157704
+ var fixId51 = "fixExpectedComma";
157550
157705
  var expectedErrorCode = Diagnostics._0_expected.code;
157551
- var errorCodes63 = [expectedErrorCode];
157706
+ var errorCodes64 = [expectedErrorCode];
157552
157707
  registerCodeFix({
157553
- errorCodes: errorCodes63,
157708
+ errorCodes: errorCodes64,
157554
157709
  getCodeActions(context) {
157555
157710
  const { sourceFile } = context;
157556
157711
  const info = getInfo22(sourceFile, context.span.start, context.errorCode);
@@ -157558,15 +157713,15 @@ registerCodeFix({
157558
157713
  return void 0;
157559
157714
  const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange41(t, sourceFile, info));
157560
157715
  return [createCodeFixAction(
157561
- fixId50,
157716
+ fixId51,
157562
157717
  changes,
157563
157718
  [Diagnostics.Change_0_to_1, ";", ","],
157564
- fixId50,
157719
+ fixId51,
157565
157720
  [Diagnostics.Change_0_to_1, ";", ","]
157566
157721
  )];
157567
157722
  },
157568
- fixIds: [fixId50],
157569
- getAllCodeActions: (context) => codeFixAll(context, errorCodes63, (changes, diag2) => {
157723
+ fixIds: [fixId51],
157724
+ getAllCodeActions: (context) => codeFixAll(context, errorCodes64, (changes, diag2) => {
157570
157725
  const info = getInfo22(diag2.file, diag2.start, diag2.code);
157571
157726
  if (info)
157572
157727
  doChange41(changes, context.sourceFile, info);
@@ -157583,25 +157738,25 @@ function doChange41(changes, sourceFile, { node }) {
157583
157738
 
157584
157739
  // src/services/codefixes/fixAddVoidToPromise.ts
157585
157740
  var fixName7 = "addVoidToPromise";
157586
- var fixId51 = "addVoidToPromise";
157587
- var errorCodes64 = [
157741
+ var fixId52 = "addVoidToPromise";
157742
+ var errorCodes65 = [
157588
157743
  Diagnostics.Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_without_arguments.code,
157589
157744
  Diagnostics.Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise.code
157590
157745
  ];
157591
157746
  registerCodeFix({
157592
- errorCodes: errorCodes64,
157593
- fixIds: [fixId51],
157747
+ errorCodes: errorCodes65,
157748
+ fixIds: [fixId52],
157594
157749
  getCodeActions(context) {
157595
- const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange11(t, context.sourceFile, context.span, context.program));
157750
+ const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange12(t, context.sourceFile, context.span, context.program));
157596
157751
  if (changes.length > 0) {
157597
- return [createCodeFixAction(fixName7, changes, Diagnostics.Add_void_to_Promise_resolved_without_a_value, fixId51, Diagnostics.Add_void_to_all_Promises_resolved_without_a_value)];
157752
+ return [createCodeFixAction(fixName7, changes, Diagnostics.Add_void_to_Promise_resolved_without_a_value, fixId52, Diagnostics.Add_void_to_all_Promises_resolved_without_a_value)];
157598
157753
  }
157599
157754
  },
157600
157755
  getAllCodeActions(context) {
157601
- return codeFixAll(context, errorCodes64, (changes, diag2) => makeChange11(changes, diag2.file, diag2, context.program, /* @__PURE__ */ new Set()));
157756
+ return codeFixAll(context, errorCodes65, (changes, diag2) => makeChange12(changes, diag2.file, diag2, context.program, /* @__PURE__ */ new Set()));
157602
157757
  }
157603
157758
  });
157604
- function makeChange11(changes, sourceFile, span, program, seen) {
157759
+ function makeChange12(changes, sourceFile, span, program, seen) {
157605
157760
  const node = getTokenAtPosition(sourceFile, span.start);
157606
157761
  if (!isIdentifier(node) || !isCallExpression(node.parent) || node.parent.expression !== node || node.parent.arguments.length !== 0)
157607
157762
  return;
@@ -175086,6 +175241,7 @@ __export(ts_exports2, {
175086
175241
  isSuperProperty: () => isSuperProperty,
175087
175242
  isSupportedSourceFileName: () => isSupportedSourceFileName,
175088
175243
  isSwitchStatement: () => isSwitchStatement,
175244
+ isSyntacticallyString: () => isSyntacticallyString,
175089
175245
  isSyntaxList: () => isSyntaxList,
175090
175246
  isSyntheticExpression: () => isSyntheticExpression,
175091
175247
  isSyntheticReference: () => isSyntheticReference,
@@ -186089,10 +186245,10 @@ ${e.message}`;
186089
186245
  }
186090
186246
  return simplifiedResult ? codeActions.map((codeAction) => this.mapCodeFixAction(codeAction)) : codeActions;
186091
186247
  }
186092
- getCombinedCodeFix({ scope, fixId: fixId52 }, simplifiedResult) {
186248
+ getCombinedCodeFix({ scope, fixId: fixId53 }, simplifiedResult) {
186093
186249
  Debug.assert(scope.type === "file");
186094
186250
  const { file, project } = this.getFileAndProject(scope.args);
186095
- const res = project.getLanguageService().getCombinedCodeFix({ type: "file", fileName: file }, fixId52, this.getFormatOptions(file), this.getPreferences(file));
186251
+ const res = project.getLanguageService().getCombinedCodeFix({ type: "file", fileName: file }, fixId53, this.getFormatOptions(file), this.getPreferences(file));
186096
186252
  if (simplifiedResult) {
186097
186253
  return { changes: this.mapTextChangesToCodeEdits(res.changes), commands: res.commands };
186098
186254
  } else {
@@ -186131,8 +186287,8 @@ ${e.message}`;
186131
186287
  mapCodeAction({ description: description3, changes, commands }) {
186132
186288
  return { description: description3, changes: this.mapTextChangesToCodeEdits(changes), commands };
186133
186289
  }
186134
- mapCodeFixAction({ fixName: fixName8, description: description3, changes, commands, fixId: fixId52, fixAllDescription }) {
186135
- return { fixName: fixName8, description: description3, changes: this.mapTextChangesToCodeEdits(changes), commands, fixId: fixId52, fixAllDescription };
186290
+ mapCodeFixAction({ fixName: fixName8, description: description3, changes, commands, fixId: fixId53, fixAllDescription }) {
186291
+ return { fixName: fixName8, description: description3, changes: this.mapTextChangesToCodeEdits(changes), commands, fixId: fixId53, fixAllDescription };
186136
186292
  }
186137
186293
  mapTextChangesToCodeEdits(textChanges2) {
186138
186294
  return textChanges2.map((change) => this.mapTextChangeToCodeEdit(change));
@@ -189862,6 +190018,7 @@ start(initializeNodeSystem(), require("os").platform());
189862
190018
  isSuperProperty,
189863
190019
  isSupportedSourceFileName,
189864
190020
  isSwitchStatement,
190021
+ isSyntacticallyString,
189865
190022
  isSyntaxList,
189866
190023
  isSyntheticExpression,
189867
190024
  isSyntheticReference,