@typescript-deploys/pr-build 4.8.0-pr-49531-22 → 4.8.0-pr-49554-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
@@ -109,7 +109,7 @@ var ts;
109
109
  // The following is baselined as a literal template type without intervention
110
110
  /** The version of the TypeScript compiler release */
111
111
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
112
- ts.version = ts.versionMajorMinor + ".0-insiders.20220614";
112
+ ts.version = ts.versionMajorMinor + ".0-insiders.20220615";
113
113
  /* @internal */
114
114
  var Comparison;
115
115
  (function (Comparison) {
@@ -8483,9 +8483,11 @@ var ts;
8483
8483
  Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1: diag(2205, ts.DiagnosticCategory.Error, "Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1_2205", "Construct signatures with no arguments have incompatible return types '{0}' and '{1}'.", /*reportsUnnecessary*/ undefined, /*elidedInCompatabilityPyramid*/ true),
8484
8484
  The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement: diag(2206, ts.DiagnosticCategory.Error, "The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement_2206", "The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement."),
8485
8485
  The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement: diag(2207, ts.DiagnosticCategory.Error, "The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement_2207", "The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement."),
8486
- This_type_parameter_probably_needs_an_extends_object_constraint: diag(2208, ts.DiagnosticCategory.Error, "This_type_parameter_probably_needs_an_extends_object_constraint_2208", "This type parameter probably needs an `extends object` constraint."),
8486
+ This_type_parameter_might_need_an_extends_0_constraint: diag(2208, ts.DiagnosticCategory.Error, "This_type_parameter_might_need_an_extends_0_constraint_2208", "This type parameter might need an `extends {0}` constraint."),
8487
8487
  The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2209, ts.DiagnosticCategory.Error, "The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_roo_2209", "The project root is ambiguous, but is required to resolve export map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."),
8488
8488
  The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2210, ts.DiagnosticCategory.Error, "The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_roo_2210", "The project root is ambiguous, but is required to resolve import map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."),
8489
+ Add_extends_constraint: diag(2211, ts.DiagnosticCategory.Message, "Add_extends_constraint_2211", "Add `extends` constraint."),
8490
+ Add_extends_constraint_to_all_type_parameters: diag(2212, ts.DiagnosticCategory.Message, "Add_extends_constraint_to_all_type_parameters_2212", "Add `extends` constraint to all type parameters"),
8489
8491
  Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."),
8490
8492
  Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2301, ts.DiagnosticCategory.Error, "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."),
8491
8493
  Static_members_cannot_reference_class_type_parameters: diag(2302, ts.DiagnosticCategory.Error, "Static_members_cannot_reference_class_type_parameters_2302", "Static members cannot reference class type parameters."),
@@ -34528,10 +34530,10 @@ var ts;
34528
34530
  setDecoratorContext(/*val*/ false);
34529
34531
  }
34530
34532
  var pos = getNodePos();
34531
- var expr = parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false);
34533
+ var expr = parseAssignmentExpressionOrHigher();
34532
34534
  var operatorToken;
34533
34535
  while ((operatorToken = parseOptionalToken(27 /* CommaToken */))) {
34534
- expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false), pos);
34536
+ expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher(), pos);
34535
34537
  }
34536
34538
  if (saveDecoratorContext) {
34537
34539
  setDecoratorContext(/*val*/ true);
@@ -34539,9 +34541,9 @@ var ts;
34539
34541
  return expr;
34540
34542
  }
34541
34543
  function parseInitializer() {
34542
- return parseOptional(63 /* EqualsToken */) ? parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false) : undefined;
34544
+ return parseOptional(63 /* EqualsToken */) ? parseAssignmentExpressionOrHigher() : undefined;
34543
34545
  }
34544
- function parseAssignmentExpressionOrHigher(disallowReturnTypeInArrowFunction) {
34546
+ function parseAssignmentExpressionOrHigher() {
34545
34547
  // AssignmentExpression[in,yield]:
34546
34548
  // 1) ConditionalExpression[?in,?yield]
34547
34549
  // 2) LeftHandSideExpression = AssignmentExpression[?in,?yield]
@@ -34567,7 +34569,7 @@ var ts;
34567
34569
  // If we do successfully parse arrow-function, we must *not* recurse for productions 1, 2 or 3. An ArrowFunction is
34568
34570
  // not a LeftHandSideExpression, nor does it start a ConditionalExpression. So we are done
34569
34571
  // with AssignmentExpression if we see one.
34570
- var arrowExpression = tryParseParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction) || tryParseAsyncSimpleArrowFunctionExpression(disallowReturnTypeInArrowFunction);
34572
+ var arrowExpression = tryParseParenthesizedArrowFunctionExpression() || tryParseAsyncSimpleArrowFunctionExpression();
34571
34573
  if (arrowExpression) {
34572
34574
  return arrowExpression;
34573
34575
  }
@@ -34586,7 +34588,7 @@ var ts;
34586
34588
  // parameter ('x => ...') above. We handle it here by checking if the parsed expression was a single
34587
34589
  // identifier and the current token is an arrow.
34588
34590
  if (expr.kind === 79 /* Identifier */ && token() === 38 /* EqualsGreaterThanToken */) {
34589
- return parseSimpleArrowFunctionExpression(pos, expr, disallowReturnTypeInArrowFunction, /*asyncModifier*/ undefined);
34591
+ return parseSimpleArrowFunctionExpression(pos, expr, /*asyncModifier*/ undefined);
34590
34592
  }
34591
34593
  // Now see if we might be in cases '2' or '3'.
34592
34594
  // If the expression was a LHS expression, and we have an assignment operator, then
@@ -34595,7 +34597,7 @@ var ts;
34595
34597
  // Note: we call reScanGreaterToken so that we get an appropriately merged token
34596
34598
  // for cases like `> > =` becoming `>>=`
34597
34599
  if (ts.isLeftHandSideExpression(expr) && ts.isAssignmentOperator(reScanGreaterToken())) {
34598
- return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(disallowReturnTypeInArrowFunction), pos);
34600
+ return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(), pos);
34599
34601
  }
34600
34602
  // It wasn't an assignment or a lambda. This is a conditional expression:
34601
34603
  return parseConditionalExpressionRest(expr, pos);
@@ -34638,7 +34640,7 @@ var ts;
34638
34640
  nextToken();
34639
34641
  if (!scanner.hasPrecedingLineBreak() &&
34640
34642
  (token() === 41 /* AsteriskToken */ || isStartOfExpression())) {
34641
- return finishNode(factory.createYieldExpression(parseOptionalToken(41 /* AsteriskToken */), parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false)), pos);
34643
+ return finishNode(factory.createYieldExpression(parseOptionalToken(41 /* AsteriskToken */), parseAssignmentExpressionOrHigher()), pos);
34642
34644
  }
34643
34645
  else {
34644
34646
  // if the next token is not on the same line as yield. or we don't have an '*' or
@@ -34646,7 +34648,7 @@ var ts;
34646
34648
  return finishNode(factory.createYieldExpression(/*asteriskToken*/ undefined, /*expression*/ undefined), pos);
34647
34649
  }
34648
34650
  }
34649
- function parseSimpleArrowFunctionExpression(pos, identifier, disallowReturnTypeInArrowFunction, asyncModifier) {
34651
+ function parseSimpleArrowFunctionExpression(pos, identifier, asyncModifier) {
34650
34652
  ts.Debug.assert(token() === 38 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
34651
34653
  var parameter = factory.createParameterDeclaration(
34652
34654
  /*modifiers*/ undefined,
@@ -34657,11 +34659,11 @@ var ts;
34657
34659
  finishNode(parameter, identifier.pos);
34658
34660
  var parameters = createNodeArray([parameter], parameter.pos, parameter.end);
34659
34661
  var equalsGreaterThanToken = parseExpectedToken(38 /* EqualsGreaterThanToken */);
34660
- var body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier, disallowReturnTypeInArrowFunction);
34662
+ var body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier);
34661
34663
  var node = factory.createArrowFunction(asyncModifier, /*typeParameters*/ undefined, parameters, /*type*/ undefined, equalsGreaterThanToken, body);
34662
34664
  return addJSDocComment(finishNode(node, pos));
34663
34665
  }
34664
- function tryParseParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction) {
34666
+ function tryParseParenthesizedArrowFunctionExpression() {
34665
34667
  var triState = isParenthesizedArrowFunctionExpression();
34666
34668
  if (triState === 0 /* False */) {
34667
34669
  // It's definitely not a parenthesized arrow function expression.
@@ -34672,8 +34674,8 @@ var ts;
34672
34674
  // it out, but don't allow any ambiguity, and return 'undefined' if this could be an
34673
34675
  // expression instead.
34674
34676
  return triState === 1 /* True */ ?
34675
- parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true, /*disallowReturnTypeInArrowFunction*/ false) :
34676
- tryParse(function () { return parsePossibleParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction); });
34677
+ parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true) :
34678
+ tryParse(parsePossibleParenthesizedArrowFunctionExpression);
34677
34679
  }
34678
34680
  // True -> We definitely expect a parenthesized arrow function here.
34679
34681
  // False -> There *cannot* be a parenthesized arrow function here.
@@ -34807,25 +34809,25 @@ var ts;
34807
34809
  return 2 /* Unknown */;
34808
34810
  }
34809
34811
  }
34810
- function parsePossibleParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction) {
34812
+ function parsePossibleParenthesizedArrowFunctionExpression() {
34811
34813
  var tokenPos = scanner.getTokenPos();
34812
34814
  if (notParenthesizedArrow === null || notParenthesizedArrow === void 0 ? void 0 : notParenthesizedArrow.has(tokenPos)) {
34813
34815
  return undefined;
34814
34816
  }
34815
- var result = parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ false, disallowReturnTypeInArrowFunction);
34817
+ var result = parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ false);
34816
34818
  if (!result) {
34817
34819
  (notParenthesizedArrow || (notParenthesizedArrow = new ts.Set())).add(tokenPos);
34818
34820
  }
34819
34821
  return result;
34820
34822
  }
34821
- function tryParseAsyncSimpleArrowFunctionExpression(disallowReturnTypeInArrowFunction) {
34823
+ function tryParseAsyncSimpleArrowFunctionExpression() {
34822
34824
  // We do a check here so that we won't be doing unnecessarily call to "lookAhead"
34823
34825
  if (token() === 131 /* AsyncKeyword */) {
34824
34826
  if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* True */) {
34825
34827
  var pos = getNodePos();
34826
34828
  var asyncModifier = parseModifiersForArrowFunction();
34827
34829
  var expr = parseBinaryExpressionOrHigher(0 /* Lowest */);
34828
- return parseSimpleArrowFunctionExpression(pos, expr, disallowReturnTypeInArrowFunction, asyncModifier);
34830
+ return parseSimpleArrowFunctionExpression(pos, expr, asyncModifier);
34829
34831
  }
34830
34832
  }
34831
34833
  return undefined;
@@ -34849,7 +34851,7 @@ var ts;
34849
34851
  }
34850
34852
  return 0 /* False */;
34851
34853
  }
34852
- function parseParenthesizedArrowFunctionExpression(allowAmbiguity, disallowReturnTypeInArrowFunction) {
34854
+ function parseParenthesizedArrowFunctionExpression(allowAmbiguity) {
34853
34855
  var pos = getNodePos();
34854
34856
  var hasJSDoc = hasPrecedingJSDocComment();
34855
34857
  var modifiers = parseModifiersForArrowFunction();
@@ -34884,7 +34886,6 @@ var ts;
34884
34886
  return undefined;
34885
34887
  }
34886
34888
  }
34887
- var hasReturnColon = token() === 58 /* ColonToken */;
34888
34889
  var type = parseReturnType(58 /* ColonToken */, /*isType*/ false);
34889
34890
  if (type && !allowAmbiguity && typeHasArrowFunctionBlockingParseError(type)) {
34890
34891
  return undefined;
@@ -34913,36 +34914,12 @@ var ts;
34913
34914
  var lastToken = token();
34914
34915
  var equalsGreaterThanToken = parseExpectedToken(38 /* EqualsGreaterThanToken */);
34915
34916
  var body = (lastToken === 38 /* EqualsGreaterThanToken */ || lastToken === 18 /* OpenBraceToken */)
34916
- ? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier), disallowReturnTypeInArrowFunction)
34917
+ ? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier))
34917
34918
  : parseIdentifier();
34918
- // Given:
34919
- // x ? y => ({ y }) : z => ({ z })
34920
- // We try to parse the body of the first arrow function by looking at:
34921
- // ({ y }) : z => ({ z })
34922
- // This is a valid arrow function with "z" as the return type.
34923
- //
34924
- // But, if we're in the true side of a conditional expression, this colon
34925
- // terminates the expression, so we cannot allow a return type if we aren't
34926
- // certain whether or not the preceding text was parsed as a parameter list.
34927
- //
34928
- // For example,
34929
- // a() ? (b: number, c?: string): void => d() : e
34930
- // is determined by isParenthesizedArrowFunctionExpression to unambiguously
34931
- // be an arrow expression, so we allow a return type.
34932
- if (disallowReturnTypeInArrowFunction && hasReturnColon) {
34933
- // However, if the arrow function we were able to parse is followed by another colon
34934
- // as in:
34935
- // a ? (x): string => x : null
34936
- // Then allow the arrow function, and treat the second colon as terminating
34937
- // the conditional expression.
34938
- if (token() !== 58 /* ColonToken */) {
34939
- return undefined;
34940
- }
34941
- }
34942
34919
  var node = factory.createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body);
34943
34920
  return withJSDoc(finishNode(node, pos), hasJSDoc);
34944
34921
  }
34945
- function parseArrowFunctionExpressionBody(isAsync, disallowReturnTypeInArrowFunction) {
34922
+ function parseArrowFunctionExpressionBody(isAsync) {
34946
34923
  if (token() === 18 /* OpenBraceToken */) {
34947
34924
  return parseFunctionBlock(isAsync ? 2 /* Await */ : 0 /* None */);
34948
34925
  }
@@ -34970,8 +34947,8 @@ var ts;
34970
34947
  var savedTopLevel = topLevel;
34971
34948
  topLevel = false;
34972
34949
  var node = isAsync
34973
- ? doInAwaitContext(function () { return parseAssignmentExpressionOrHigher(disallowReturnTypeInArrowFunction); })
34974
- : doOutsideOfAwaitContext(function () { return parseAssignmentExpressionOrHigher(disallowReturnTypeInArrowFunction); });
34950
+ ? doInAwaitContext(parseAssignmentExpressionOrHigher)
34951
+ : doOutsideOfAwaitContext(parseAssignmentExpressionOrHigher);
34975
34952
  topLevel = savedTopLevel;
34976
34953
  return node;
34977
34954
  }
@@ -34984,8 +34961,8 @@ var ts;
34984
34961
  // Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and
34985
34962
  // we do not that for the 'whenFalse' part.
34986
34963
  var colonToken;
34987
- return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, function () { return parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ true); }), colonToken = parseExpectedToken(58 /* ColonToken */), ts.nodeIsPresent(colonToken)
34988
- ? parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ true)
34964
+ return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher), colonToken = parseExpectedToken(58 /* ColonToken */), ts.nodeIsPresent(colonToken)
34965
+ ? parseAssignmentExpressionOrHigher()
34989
34966
  : createMissingNode(79 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(58 /* ColonToken */))), pos);
34990
34967
  }
34991
34968
  function parseBinaryExpressionOrHigher(precedence) {
@@ -35812,10 +35789,11 @@ var ts;
35812
35789
  }
35813
35790
  nextToken();
35814
35791
  var typeArguments = parseDelimitedList(20 /* TypeArguments */, parseType);
35815
- if (!parseExpected(31 /* GreaterThanToken */)) {
35792
+ if (reScanGreaterToken() !== 31 /* GreaterThanToken */) {
35816
35793
  // If it doesn't have the closing `>` then it's definitely not an type argument list.
35817
35794
  return undefined;
35818
35795
  }
35796
+ nextToken();
35819
35797
  // We successfully parsed a type argument list. The next token determines whether we want to
35820
35798
  // treat it as such. If the type argument list is followed by `(` or a template literal, as in
35821
35799
  // `f<number>(42)`, we favor the type argument interpretation even though JavaScript would view
@@ -35899,13 +35877,13 @@ var ts;
35899
35877
  function parseSpreadElement() {
35900
35878
  var pos = getNodePos();
35901
35879
  parseExpected(25 /* DotDotDotToken */);
35902
- var expression = parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false);
35880
+ var expression = parseAssignmentExpressionOrHigher();
35903
35881
  return finishNode(factory.createSpreadElement(expression), pos);
35904
35882
  }
35905
35883
  function parseArgumentOrArrayLiteralElement() {
35906
35884
  return token() === 25 /* DotDotDotToken */ ? parseSpreadElement() :
35907
35885
  token() === 27 /* CommaToken */ ? finishNode(factory.createOmittedExpression(), getNodePos()) :
35908
- parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false);
35886
+ parseAssignmentExpressionOrHigher();
35909
35887
  }
35910
35888
  function parseArgumentExpression() {
35911
35889
  return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement);
@@ -35923,7 +35901,7 @@ var ts;
35923
35901
  var pos = getNodePos();
35924
35902
  var hasJSDoc = hasPrecedingJSDocComment();
35925
35903
  if (parseOptionalToken(25 /* DotDotDotToken */)) {
35926
- var expression = parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false);
35904
+ var expression = parseAssignmentExpressionOrHigher();
35927
35905
  return withJSDoc(finishNode(factory.createSpreadAssignment(expression), pos), hasJSDoc);
35928
35906
  }
35929
35907
  var decorators = parseDecorators();
@@ -35952,7 +35930,7 @@ var ts;
35952
35930
  var isShorthandPropertyAssignment = tokenIsIdentifier && (token() !== 58 /* ColonToken */);
35953
35931
  if (isShorthandPropertyAssignment) {
35954
35932
  var equalsToken = parseOptionalToken(63 /* EqualsToken */);
35955
- var objectAssignmentInitializer = equalsToken ? allowInAnd(function () { return parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false); }) : undefined;
35933
+ var objectAssignmentInitializer = equalsToken ? allowInAnd(parseAssignmentExpressionOrHigher) : undefined;
35956
35934
  node = factory.createShorthandPropertyAssignment(name, objectAssignmentInitializer);
35957
35935
  // Save equals token for error reporting.
35958
35936
  // TODO(rbuckton): Consider manufacturing this when we need to report an error as it is otherwise not useful.
@@ -35960,7 +35938,7 @@ var ts;
35960
35938
  }
35961
35939
  else {
35962
35940
  parseExpected(58 /* ColonToken */);
35963
- var initializer = allowInAnd(function () { return parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false); });
35941
+ var initializer = allowInAnd(parseAssignmentExpressionOrHigher);
35964
35942
  node = factory.createPropertyAssignment(name, initializer);
35965
35943
  }
35966
35944
  // Decorators, Modifiers, questionToken, and exclamationToken are not supported by property assignments and are reported in the grammar checker
@@ -36137,7 +36115,7 @@ var ts;
36137
36115
  }
36138
36116
  var node;
36139
36117
  if (awaitToken ? parseExpected(160 /* OfKeyword */) : parseOptional(160 /* OfKeyword */)) {
36140
- var expression = allowInAnd(function () { return parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false); });
36118
+ var expression = allowInAnd(parseAssignmentExpressionOrHigher);
36141
36119
  parseExpected(21 /* CloseParenToken */);
36142
36120
  node = factory.createForOfStatement(awaitToken, initializer, expression, parseStatement());
36143
36121
  }
@@ -37325,7 +37303,7 @@ var ts;
37325
37303
  var pos = getNodePos();
37326
37304
  var name = ts.tokenIsIdentifierOrKeyword(token()) ? parseIdentifierName() : parseLiteralLikeNode(10 /* StringLiteral */);
37327
37305
  parseExpected(58 /* ColonToken */);
37328
- var value = parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false);
37306
+ var value = parseAssignmentExpressionOrHigher();
37329
37307
  return finishNode(factory.createAssertEntry(name, value), pos);
37330
37308
  }
37331
37309
  function parseAssertClause(skipAssertKeyword) {
@@ -37566,7 +37544,7 @@ var ts;
37566
37544
  else {
37567
37545
  parseExpected(88 /* DefaultKeyword */);
37568
37546
  }
37569
- var expression = parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false);
37547
+ var expression = parseAssignmentExpressionOrHigher();
37570
37548
  parseSemicolon();
37571
37549
  setAwaitContext(savedAwaitContext);
37572
37550
  var node = factory.createExportAssignment(modifiers, isExportEquals, expression);
@@ -52565,6 +52543,9 @@ var ts;
52565
52543
  if (symbol && symbol.flags & 262144 /* TypeParameter */ && meaning & 788968 /* Type */) {
52566
52544
  return { accessibility: 0 /* Accessible */ };
52567
52545
  }
52546
+ if (!symbol && ts.isThisIdentifier(firstIdentifier) && isSymbolAccessible(getSymbolOfNode(ts.getThisContainer(firstIdentifier, /*includeArrowFunctions*/ false)), firstIdentifier, meaning, /*computeAliases*/ false).accessibility === 0 /* Accessible */) {
52547
+ return { accessibility: 0 /* Accessible */ };
52548
+ }
52568
52549
  // Verify if the symbol is accessible
52569
52550
  return (symbol && hasVisibleDeclarations(symbol, /*shouldComputeAliasToMakeVisible*/ true)) || {
52570
52551
  accessibility: 1 /* NotAccessible */,
@@ -65525,8 +65506,13 @@ var ts;
65525
65506
  return;
65526
65507
  }
65527
65508
  reportRelationError(headMessage, source, target);
65528
- if (strictNullChecks && source.flags & 8650752 /* TypeVariable */ && ((_b = (_a = source.symbol) === null || _a === void 0 ? void 0 : _a.declarations) === null || _b === void 0 ? void 0 : _b[0]) && !getConstraintOfType(source) && isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~67108864 /* NonPrimitive */))) {
65529
- associateRelatedInfo(ts.createDiagnosticForNode(source.symbol.declarations[0], ts.Diagnostics.This_type_parameter_probably_needs_an_extends_object_constraint));
65509
+ if (source.flags & 262144 /* TypeParameter */ && ((_b = (_a = source.symbol) === null || _a === void 0 ? void 0 : _a.declarations) === null || _b === void 0 ? void 0 : _b[0]) && !getConstraintOfType(source)) {
65510
+ var syntheticParam = cloneTypeParameter(source);
65511
+ syntheticParam.constraint = instantiateType(target, makeUnaryTypeMapper(source, syntheticParam));
65512
+ if (hasNonCircularBaseConstraint(syntheticParam)) {
65513
+ var targetConstraintString = typeToString(target, source.symbol.declarations[0]);
65514
+ associateRelatedInfo(ts.createDiagnosticForNode(source.symbol.declarations[0], ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint, targetConstraintString));
65515
+ }
65530
65516
  }
65531
65517
  }
65532
65518
  function traceUnionsOrIntersectionsTooLarge(source, target) {
@@ -117405,6 +117391,7 @@ var ts;
117405
117391
  ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations.code,
117406
117392
  ts.Diagnostics.Class_constructor_may_not_be_a_generator.code,
117407
117393
  ts.Diagnostics.Class_constructor_may_not_be_an_accessor.code,
117394
+ ts.Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
117408
117395
  ]);
117409
117396
  /**
117410
117397
  * Determine if source file needs to be re-created even if its text hasn't changed
@@ -145240,7 +145227,7 @@ var ts;
145240
145227
  return type.symbol && (type.symbol.flags & 1536 /* Module */);
145241
145228
  }
145242
145229
  function visitVariableLikeDeclaration(decl) {
145243
- if (!decl.initializer || ts.isBindingPattern(decl.name)) {
145230
+ if (!decl.initializer || ts.isBindingPattern(decl.name) || ts.isVariableDeclaration(decl) && !isHintableDeclaration(decl)) {
145244
145231
  return;
145245
145232
  }
145246
145233
  var effectiveTypeAnnotation = ts.getEffectiveTypeAnnotationNode(decl);
@@ -145368,6 +145355,9 @@ var ts;
145368
145355
  }
145369
145356
  for (var i = 0; i < node.parameters.length && i < signature.parameters.length; ++i) {
145370
145357
  var param = node.parameters[i];
145358
+ if (!isHintableDeclaration(param)) {
145359
+ continue;
145360
+ }
145371
145361
  var effectiveTypeAnnotation = ts.getEffectiveTypeAnnotationNode(param);
145372
145362
  if (effectiveTypeAnnotation) {
145373
145363
  continue;
@@ -145409,6 +145399,13 @@ var ts;
145409
145399
  function isUndefined(name) {
145410
145400
  return name === "undefined";
145411
145401
  }
145402
+ function isHintableDeclaration(node) {
145403
+ if ((ts.isParameterDeclaration(node) || ts.isVariableDeclaration(node) && ts.isVarConst(node)) && node.initializer) {
145404
+ var initializer = ts.skipParentheses(node.initializer);
145405
+ return !(isHintableLiteral(initializer) || ts.isNewExpression(initializer) || ts.isObjectLiteralExpression(initializer) || ts.isAssertionExpression(initializer));
145406
+ }
145407
+ return true;
145408
+ }
145412
145409
  }
145413
145410
  InlayHints.provideInlayHints = provideInlayHints;
145414
145411
  })(InlayHints = ts.InlayHints || (ts.InlayHints = {}));
@@ -154847,6 +154844,77 @@ var ts;
154847
154844
  })(ts || (ts = {}));
154848
154845
  /* @internal */
154849
154846
  var ts;
154847
+ (function (ts) {
154848
+ var codefix;
154849
+ (function (codefix) {
154850
+ var fixId = "addMissingConstraint";
154851
+ var errorCodes = [
154852
+ // We want errors this could be attached to:
154853
+ // Diagnostics.This_type_parameter_probably_needs_an_extends_0_constraint
154854
+ ts.Diagnostics.Type_0_is_not_comparable_to_type_1.code,
154855
+ ts.Diagnostics.Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated.code,
154856
+ ts.Diagnostics.Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties.code,
154857
+ ts.Diagnostics.Type_0_is_not_assignable_to_type_1.code,
154858
+ ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties.code,
154859
+ ts.Diagnostics.Property_0_is_incompatible_with_index_signature.code,
154860
+ ts.Diagnostics.Property_0_in_type_1_is_not_assignable_to_type_2.code,
154861
+ ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1.code,
154862
+ ];
154863
+ codefix.registerCodeFix({
154864
+ errorCodes: errorCodes,
154865
+ getCodeActions: function (context) {
154866
+ var sourceFile = context.sourceFile, span = context.span, program = context.program;
154867
+ var related = getDiagnosticRelatedInfo(program, sourceFile, span);
154868
+ if (!related) {
154869
+ return;
154870
+ }
154871
+ var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addMissingConstraint(t, related); });
154872
+ return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_extends_constraint, fixId, ts.Diagnostics.Add_extends_constraint_to_all_type_parameters)];
154873
+ },
154874
+ fixIds: [fixId],
154875
+ getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) {
154876
+ var info = getDiagnosticRelatedInfo(context.program, context.sourceFile, diag);
154877
+ if (!info)
154878
+ return;
154879
+ return addMissingConstraint(changes, info);
154880
+ }); },
154881
+ });
154882
+ function getDiagnosticRelatedInfo(program, sourceFile, span) {
154883
+ var diag = ts.find(program.getSemanticDiagnostics(sourceFile), function (diag) { return diag.start === span.start && diag.length === span.length; });
154884
+ if (!diag || !diag.relatedInformation)
154885
+ return;
154886
+ var related = ts.find(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint.code; });
154887
+ if (!related)
154888
+ return;
154889
+ return related;
154890
+ }
154891
+ function addMissingConstraint(changes, related) {
154892
+ var decl = findAncestorMatchingSpan(related.file, related);
154893
+ if (!decl)
154894
+ return;
154895
+ if (ts.isIdentifier(decl) && ts.isTypeParameterDeclaration(decl.parent)) {
154896
+ decl = decl.parent;
154897
+ }
154898
+ if (!ts.isTypeParameterDeclaration(decl) || ts.isMappedTypeNode(decl.parent))
154899
+ return; // should only issue fix on type parameters written using `extends`
154900
+ var newConstraint = ts.flattenDiagnosticMessageText(related.messageText, "\n", 0).match(/`extends (.*)`/);
154901
+ if (!newConstraint)
154902
+ return;
154903
+ var newConstraintText = newConstraint[1];
154904
+ changes.insertText(related.file, related.start + related.length, " extends " + newConstraintText);
154905
+ }
154906
+ function findAncestorMatchingSpan(sourceFile, span) {
154907
+ var token = ts.getTokenAtPosition(sourceFile, span.start);
154908
+ var end = ts.textSpanEnd(span);
154909
+ while (token.end < end) {
154910
+ token = token.parent;
154911
+ }
154912
+ return token;
154913
+ }
154914
+ })(codefix = ts.codefix || (ts.codefix = {}));
154915
+ })(ts || (ts = {}));
154916
+ /* @internal */
154917
+ var ts;
154850
154918
  (function (ts) {
154851
154919
  var codefix;
154852
154920
  (function (codefix) {
@@ -155910,7 +155978,7 @@ var ts;
155910
155978
  var checker = context.program.getTypeChecker();
155911
155979
  var props = ts.map(info.properties, function (prop) {
155912
155980
  var initializer = tryGetValueFromType(context, checker, importAdder, quotePreference, checker.getTypeOfSymbol(prop), info.parentDeclaration);
155913
- return ts.factory.createPropertyAssignment(ts.createPropertyNameNodeForIdentifierOrLiteral(prop.name, target, quotePreference === 0 /* Single */), initializer);
155981
+ return ts.factory.createPropertyAssignment(createPropertyNameFromSymbol(prop, target, quotePreference, checker), initializer);
155914
155982
  });
155915
155983
  var options = {
155916
155984
  leadingTriviaOption: ts.textChanges.LeadingTriviaOption.Exclude,
@@ -156030,6 +156098,15 @@ var ts;
156030
156098
  var declaration = ts.findAncestor(callExpression, function (n) { return ts.isMethodDeclaration(n) || ts.isConstructorDeclaration(n); });
156031
156099
  return declaration && declaration.parent === node ? declaration : undefined;
156032
156100
  }
156101
+ function createPropertyNameFromSymbol(symbol, target, quotePreference, checker) {
156102
+ if (ts.isTransientSymbol(symbol) && symbol.nameType && symbol.nameType.flags & 8192 /* UniqueESSymbol */) {
156103
+ var expression = checker.symbolToExpression(symbol.nameType.symbol, 111551 /* Value */, symbol.valueDeclaration, 1048576 /* AllowUniqueESSymbolType */);
156104
+ if (expression) {
156105
+ return ts.factory.createComputedPropertyName(expression);
156106
+ }
156107
+ }
156108
+ return ts.createPropertyNameNodeForIdentifierOrLiteral(symbol.name, target, quotePreference === 0 /* Single */);
156109
+ }
156033
156110
  })(codefix = ts.codefix || (ts.codefix = {}));
156034
156111
  })(ts || (ts = {}));
156035
156112
  /* @internal */