@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.
@@ -294,7 +294,7 @@ var ts;
294
294
  // The following is baselined as a literal template type without intervention
295
295
  /** The version of the TypeScript compiler release */
296
296
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
297
- ts.version = ts.versionMajorMinor + ".0-insiders.20220614";
297
+ ts.version = ts.versionMajorMinor + ".0-insiders.20220615";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -8668,9 +8668,11 @@ var ts;
8668
8668
  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),
8669
8669
  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."),
8670
8670
  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."),
8671
- 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."),
8671
+ 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."),
8672
8672
  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."),
8673
8673
  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."),
8674
+ Add_extends_constraint: diag(2211, ts.DiagnosticCategory.Message, "Add_extends_constraint_2211", "Add `extends` constraint."),
8675
+ 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"),
8674
8676
  Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."),
8675
8677
  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."),
8676
8678
  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."),
@@ -34713,10 +34715,10 @@ var ts;
34713
34715
  setDecoratorContext(/*val*/ false);
34714
34716
  }
34715
34717
  var pos = getNodePos();
34716
- var expr = parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false);
34718
+ var expr = parseAssignmentExpressionOrHigher();
34717
34719
  var operatorToken;
34718
34720
  while ((operatorToken = parseOptionalToken(27 /* CommaToken */))) {
34719
- expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false), pos);
34721
+ expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher(), pos);
34720
34722
  }
34721
34723
  if (saveDecoratorContext) {
34722
34724
  setDecoratorContext(/*val*/ true);
@@ -34724,9 +34726,9 @@ var ts;
34724
34726
  return expr;
34725
34727
  }
34726
34728
  function parseInitializer() {
34727
- return parseOptional(63 /* EqualsToken */) ? parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false) : undefined;
34729
+ return parseOptional(63 /* EqualsToken */) ? parseAssignmentExpressionOrHigher() : undefined;
34728
34730
  }
34729
- function parseAssignmentExpressionOrHigher(disallowReturnTypeInArrowFunction) {
34731
+ function parseAssignmentExpressionOrHigher() {
34730
34732
  // AssignmentExpression[in,yield]:
34731
34733
  // 1) ConditionalExpression[?in,?yield]
34732
34734
  // 2) LeftHandSideExpression = AssignmentExpression[?in,?yield]
@@ -34752,7 +34754,7 @@ var ts;
34752
34754
  // If we do successfully parse arrow-function, we must *not* recurse for productions 1, 2 or 3. An ArrowFunction is
34753
34755
  // not a LeftHandSideExpression, nor does it start a ConditionalExpression. So we are done
34754
34756
  // with AssignmentExpression if we see one.
34755
- var arrowExpression = tryParseParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction) || tryParseAsyncSimpleArrowFunctionExpression(disallowReturnTypeInArrowFunction);
34757
+ var arrowExpression = tryParseParenthesizedArrowFunctionExpression() || tryParseAsyncSimpleArrowFunctionExpression();
34756
34758
  if (arrowExpression) {
34757
34759
  return arrowExpression;
34758
34760
  }
@@ -34771,7 +34773,7 @@ var ts;
34771
34773
  // parameter ('x => ...') above. We handle it here by checking if the parsed expression was a single
34772
34774
  // identifier and the current token is an arrow.
34773
34775
  if (expr.kind === 79 /* Identifier */ && token() === 38 /* EqualsGreaterThanToken */) {
34774
- return parseSimpleArrowFunctionExpression(pos, expr, disallowReturnTypeInArrowFunction, /*asyncModifier*/ undefined);
34776
+ return parseSimpleArrowFunctionExpression(pos, expr, /*asyncModifier*/ undefined);
34775
34777
  }
34776
34778
  // Now see if we might be in cases '2' or '3'.
34777
34779
  // If the expression was a LHS expression, and we have an assignment operator, then
@@ -34780,7 +34782,7 @@ var ts;
34780
34782
  // Note: we call reScanGreaterToken so that we get an appropriately merged token
34781
34783
  // for cases like `> > =` becoming `>>=`
34782
34784
  if (ts.isLeftHandSideExpression(expr) && ts.isAssignmentOperator(reScanGreaterToken())) {
34783
- return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(disallowReturnTypeInArrowFunction), pos);
34785
+ return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(), pos);
34784
34786
  }
34785
34787
  // It wasn't an assignment or a lambda. This is a conditional expression:
34786
34788
  return parseConditionalExpressionRest(expr, pos);
@@ -34823,7 +34825,7 @@ var ts;
34823
34825
  nextToken();
34824
34826
  if (!scanner.hasPrecedingLineBreak() &&
34825
34827
  (token() === 41 /* AsteriskToken */ || isStartOfExpression())) {
34826
- return finishNode(factory.createYieldExpression(parseOptionalToken(41 /* AsteriskToken */), parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false)), pos);
34828
+ return finishNode(factory.createYieldExpression(parseOptionalToken(41 /* AsteriskToken */), parseAssignmentExpressionOrHigher()), pos);
34827
34829
  }
34828
34830
  else {
34829
34831
  // if the next token is not on the same line as yield. or we don't have an '*' or
@@ -34831,7 +34833,7 @@ var ts;
34831
34833
  return finishNode(factory.createYieldExpression(/*asteriskToken*/ undefined, /*expression*/ undefined), pos);
34832
34834
  }
34833
34835
  }
34834
- function parseSimpleArrowFunctionExpression(pos, identifier, disallowReturnTypeInArrowFunction, asyncModifier) {
34836
+ function parseSimpleArrowFunctionExpression(pos, identifier, asyncModifier) {
34835
34837
  ts.Debug.assert(token() === 38 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
34836
34838
  var parameter = factory.createParameterDeclaration(
34837
34839
  /*modifiers*/ undefined,
@@ -34842,11 +34844,11 @@ var ts;
34842
34844
  finishNode(parameter, identifier.pos);
34843
34845
  var parameters = createNodeArray([parameter], parameter.pos, parameter.end);
34844
34846
  var equalsGreaterThanToken = parseExpectedToken(38 /* EqualsGreaterThanToken */);
34845
- var body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier, disallowReturnTypeInArrowFunction);
34847
+ var body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier);
34846
34848
  var node = factory.createArrowFunction(asyncModifier, /*typeParameters*/ undefined, parameters, /*type*/ undefined, equalsGreaterThanToken, body);
34847
34849
  return addJSDocComment(finishNode(node, pos));
34848
34850
  }
34849
- function tryParseParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction) {
34851
+ function tryParseParenthesizedArrowFunctionExpression() {
34850
34852
  var triState = isParenthesizedArrowFunctionExpression();
34851
34853
  if (triState === 0 /* False */) {
34852
34854
  // It's definitely not a parenthesized arrow function expression.
@@ -34857,8 +34859,8 @@ var ts;
34857
34859
  // it out, but don't allow any ambiguity, and return 'undefined' if this could be an
34858
34860
  // expression instead.
34859
34861
  return triState === 1 /* True */ ?
34860
- parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true, /*disallowReturnTypeInArrowFunction*/ false) :
34861
- tryParse(function () { return parsePossibleParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction); });
34862
+ parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true) :
34863
+ tryParse(parsePossibleParenthesizedArrowFunctionExpression);
34862
34864
  }
34863
34865
  // True -> We definitely expect a parenthesized arrow function here.
34864
34866
  // False -> There *cannot* be a parenthesized arrow function here.
@@ -34992,25 +34994,25 @@ var ts;
34992
34994
  return 2 /* Unknown */;
34993
34995
  }
34994
34996
  }
34995
- function parsePossibleParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction) {
34997
+ function parsePossibleParenthesizedArrowFunctionExpression() {
34996
34998
  var tokenPos = scanner.getTokenPos();
34997
34999
  if (notParenthesizedArrow === null || notParenthesizedArrow === void 0 ? void 0 : notParenthesizedArrow.has(tokenPos)) {
34998
35000
  return undefined;
34999
35001
  }
35000
- var result = parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ false, disallowReturnTypeInArrowFunction);
35002
+ var result = parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ false);
35001
35003
  if (!result) {
35002
35004
  (notParenthesizedArrow || (notParenthesizedArrow = new ts.Set())).add(tokenPos);
35003
35005
  }
35004
35006
  return result;
35005
35007
  }
35006
- function tryParseAsyncSimpleArrowFunctionExpression(disallowReturnTypeInArrowFunction) {
35008
+ function tryParseAsyncSimpleArrowFunctionExpression() {
35007
35009
  // We do a check here so that we won't be doing unnecessarily call to "lookAhead"
35008
35010
  if (token() === 131 /* AsyncKeyword */) {
35009
35011
  if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* True */) {
35010
35012
  var pos = getNodePos();
35011
35013
  var asyncModifier = parseModifiersForArrowFunction();
35012
35014
  var expr = parseBinaryExpressionOrHigher(0 /* Lowest */);
35013
- return parseSimpleArrowFunctionExpression(pos, expr, disallowReturnTypeInArrowFunction, asyncModifier);
35015
+ return parseSimpleArrowFunctionExpression(pos, expr, asyncModifier);
35014
35016
  }
35015
35017
  }
35016
35018
  return undefined;
@@ -35034,7 +35036,7 @@ var ts;
35034
35036
  }
35035
35037
  return 0 /* False */;
35036
35038
  }
35037
- function parseParenthesizedArrowFunctionExpression(allowAmbiguity, disallowReturnTypeInArrowFunction) {
35039
+ function parseParenthesizedArrowFunctionExpression(allowAmbiguity) {
35038
35040
  var pos = getNodePos();
35039
35041
  var hasJSDoc = hasPrecedingJSDocComment();
35040
35042
  var modifiers = parseModifiersForArrowFunction();
@@ -35069,7 +35071,6 @@ var ts;
35069
35071
  return undefined;
35070
35072
  }
35071
35073
  }
35072
- var hasReturnColon = token() === 58 /* ColonToken */;
35073
35074
  var type = parseReturnType(58 /* ColonToken */, /*isType*/ false);
35074
35075
  if (type && !allowAmbiguity && typeHasArrowFunctionBlockingParseError(type)) {
35075
35076
  return undefined;
@@ -35098,36 +35099,12 @@ var ts;
35098
35099
  var lastToken = token();
35099
35100
  var equalsGreaterThanToken = parseExpectedToken(38 /* EqualsGreaterThanToken */);
35100
35101
  var body = (lastToken === 38 /* EqualsGreaterThanToken */ || lastToken === 18 /* OpenBraceToken */)
35101
- ? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier), disallowReturnTypeInArrowFunction)
35102
+ ? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier))
35102
35103
  : parseIdentifier();
35103
- // Given:
35104
- // x ? y => ({ y }) : z => ({ z })
35105
- // We try to parse the body of the first arrow function by looking at:
35106
- // ({ y }) : z => ({ z })
35107
- // This is a valid arrow function with "z" as the return type.
35108
- //
35109
- // But, if we're in the true side of a conditional expression, this colon
35110
- // terminates the expression, so we cannot allow a return type if we aren't
35111
- // certain whether or not the preceding text was parsed as a parameter list.
35112
- //
35113
- // For example,
35114
- // a() ? (b: number, c?: string): void => d() : e
35115
- // is determined by isParenthesizedArrowFunctionExpression to unambiguously
35116
- // be an arrow expression, so we allow a return type.
35117
- if (disallowReturnTypeInArrowFunction && hasReturnColon) {
35118
- // However, if the arrow function we were able to parse is followed by another colon
35119
- // as in:
35120
- // a ? (x): string => x : null
35121
- // Then allow the arrow function, and treat the second colon as terminating
35122
- // the conditional expression.
35123
- if (token() !== 58 /* ColonToken */) {
35124
- return undefined;
35125
- }
35126
- }
35127
35104
  var node = factory.createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body);
35128
35105
  return withJSDoc(finishNode(node, pos), hasJSDoc);
35129
35106
  }
35130
- function parseArrowFunctionExpressionBody(isAsync, disallowReturnTypeInArrowFunction) {
35107
+ function parseArrowFunctionExpressionBody(isAsync) {
35131
35108
  if (token() === 18 /* OpenBraceToken */) {
35132
35109
  return parseFunctionBlock(isAsync ? 2 /* Await */ : 0 /* None */);
35133
35110
  }
@@ -35155,8 +35132,8 @@ var ts;
35155
35132
  var savedTopLevel = topLevel;
35156
35133
  topLevel = false;
35157
35134
  var node = isAsync
35158
- ? doInAwaitContext(function () { return parseAssignmentExpressionOrHigher(disallowReturnTypeInArrowFunction); })
35159
- : doOutsideOfAwaitContext(function () { return parseAssignmentExpressionOrHigher(disallowReturnTypeInArrowFunction); });
35135
+ ? doInAwaitContext(parseAssignmentExpressionOrHigher)
35136
+ : doOutsideOfAwaitContext(parseAssignmentExpressionOrHigher);
35160
35137
  topLevel = savedTopLevel;
35161
35138
  return node;
35162
35139
  }
@@ -35169,8 +35146,8 @@ var ts;
35169
35146
  // Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and
35170
35147
  // we do not that for the 'whenFalse' part.
35171
35148
  var colonToken;
35172
- return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, function () { return parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ true); }), colonToken = parseExpectedToken(58 /* ColonToken */), ts.nodeIsPresent(colonToken)
35173
- ? parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ true)
35149
+ return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher), colonToken = parseExpectedToken(58 /* ColonToken */), ts.nodeIsPresent(colonToken)
35150
+ ? parseAssignmentExpressionOrHigher()
35174
35151
  : createMissingNode(79 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(58 /* ColonToken */))), pos);
35175
35152
  }
35176
35153
  function parseBinaryExpressionOrHigher(precedence) {
@@ -35997,10 +35974,11 @@ var ts;
35997
35974
  }
35998
35975
  nextToken();
35999
35976
  var typeArguments = parseDelimitedList(20 /* TypeArguments */, parseType);
36000
- if (!parseExpected(31 /* GreaterThanToken */)) {
35977
+ if (reScanGreaterToken() !== 31 /* GreaterThanToken */) {
36001
35978
  // If it doesn't have the closing `>` then it's definitely not an type argument list.
36002
35979
  return undefined;
36003
35980
  }
35981
+ nextToken();
36004
35982
  // We successfully parsed a type argument list. The next token determines whether we want to
36005
35983
  // treat it as such. If the type argument list is followed by `(` or a template literal, as in
36006
35984
  // `f<number>(42)`, we favor the type argument interpretation even though JavaScript would view
@@ -36084,13 +36062,13 @@ var ts;
36084
36062
  function parseSpreadElement() {
36085
36063
  var pos = getNodePos();
36086
36064
  parseExpected(25 /* DotDotDotToken */);
36087
- var expression = parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false);
36065
+ var expression = parseAssignmentExpressionOrHigher();
36088
36066
  return finishNode(factory.createSpreadElement(expression), pos);
36089
36067
  }
36090
36068
  function parseArgumentOrArrayLiteralElement() {
36091
36069
  return token() === 25 /* DotDotDotToken */ ? parseSpreadElement() :
36092
36070
  token() === 27 /* CommaToken */ ? finishNode(factory.createOmittedExpression(), getNodePos()) :
36093
- parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false);
36071
+ parseAssignmentExpressionOrHigher();
36094
36072
  }
36095
36073
  function parseArgumentExpression() {
36096
36074
  return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement);
@@ -36108,7 +36086,7 @@ var ts;
36108
36086
  var pos = getNodePos();
36109
36087
  var hasJSDoc = hasPrecedingJSDocComment();
36110
36088
  if (parseOptionalToken(25 /* DotDotDotToken */)) {
36111
- var expression = parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false);
36089
+ var expression = parseAssignmentExpressionOrHigher();
36112
36090
  return withJSDoc(finishNode(factory.createSpreadAssignment(expression), pos), hasJSDoc);
36113
36091
  }
36114
36092
  var decorators = parseDecorators();
@@ -36137,7 +36115,7 @@ var ts;
36137
36115
  var isShorthandPropertyAssignment = tokenIsIdentifier && (token() !== 58 /* ColonToken */);
36138
36116
  if (isShorthandPropertyAssignment) {
36139
36117
  var equalsToken = parseOptionalToken(63 /* EqualsToken */);
36140
- var objectAssignmentInitializer = equalsToken ? allowInAnd(function () { return parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false); }) : undefined;
36118
+ var objectAssignmentInitializer = equalsToken ? allowInAnd(parseAssignmentExpressionOrHigher) : undefined;
36141
36119
  node = factory.createShorthandPropertyAssignment(name, objectAssignmentInitializer);
36142
36120
  // Save equals token for error reporting.
36143
36121
  // TODO(rbuckton): Consider manufacturing this when we need to report an error as it is otherwise not useful.
@@ -36145,7 +36123,7 @@ var ts;
36145
36123
  }
36146
36124
  else {
36147
36125
  parseExpected(58 /* ColonToken */);
36148
- var initializer = allowInAnd(function () { return parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false); });
36126
+ var initializer = allowInAnd(parseAssignmentExpressionOrHigher);
36149
36127
  node = factory.createPropertyAssignment(name, initializer);
36150
36128
  }
36151
36129
  // Decorators, Modifiers, questionToken, and exclamationToken are not supported by property assignments and are reported in the grammar checker
@@ -36322,7 +36300,7 @@ var ts;
36322
36300
  }
36323
36301
  var node;
36324
36302
  if (awaitToken ? parseExpected(160 /* OfKeyword */) : parseOptional(160 /* OfKeyword */)) {
36325
- var expression = allowInAnd(function () { return parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false); });
36303
+ var expression = allowInAnd(parseAssignmentExpressionOrHigher);
36326
36304
  parseExpected(21 /* CloseParenToken */);
36327
36305
  node = factory.createForOfStatement(awaitToken, initializer, expression, parseStatement());
36328
36306
  }
@@ -37510,7 +37488,7 @@ var ts;
37510
37488
  var pos = getNodePos();
37511
37489
  var name = ts.tokenIsIdentifierOrKeyword(token()) ? parseIdentifierName() : parseLiteralLikeNode(10 /* StringLiteral */);
37512
37490
  parseExpected(58 /* ColonToken */);
37513
- var value = parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false);
37491
+ var value = parseAssignmentExpressionOrHigher();
37514
37492
  return finishNode(factory.createAssertEntry(name, value), pos);
37515
37493
  }
37516
37494
  function parseAssertClause(skipAssertKeyword) {
@@ -37751,7 +37729,7 @@ var ts;
37751
37729
  else {
37752
37730
  parseExpected(88 /* DefaultKeyword */);
37753
37731
  }
37754
- var expression = parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false);
37732
+ var expression = parseAssignmentExpressionOrHigher();
37755
37733
  parseSemicolon();
37756
37734
  setAwaitContext(savedAwaitContext);
37757
37735
  var node = factory.createExportAssignment(modifiers, isExportEquals, expression);
@@ -52750,6 +52728,9 @@ var ts;
52750
52728
  if (symbol && symbol.flags & 262144 /* TypeParameter */ && meaning & 788968 /* Type */) {
52751
52729
  return { accessibility: 0 /* Accessible */ };
52752
52730
  }
52731
+ if (!symbol && ts.isThisIdentifier(firstIdentifier) && isSymbolAccessible(getSymbolOfNode(ts.getThisContainer(firstIdentifier, /*includeArrowFunctions*/ false)), firstIdentifier, meaning, /*computeAliases*/ false).accessibility === 0 /* Accessible */) {
52732
+ return { accessibility: 0 /* Accessible */ };
52733
+ }
52753
52734
  // Verify if the symbol is accessible
52754
52735
  return (symbol && hasVisibleDeclarations(symbol, /*shouldComputeAliasToMakeVisible*/ true)) || {
52755
52736
  accessibility: 1 /* NotAccessible */,
@@ -65710,8 +65691,13 @@ var ts;
65710
65691
  return;
65711
65692
  }
65712
65693
  reportRelationError(headMessage, source, target);
65713
- 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 */))) {
65714
- associateRelatedInfo(ts.createDiagnosticForNode(source.symbol.declarations[0], ts.Diagnostics.This_type_parameter_probably_needs_an_extends_object_constraint));
65694
+ 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)) {
65695
+ var syntheticParam = cloneTypeParameter(source);
65696
+ syntheticParam.constraint = instantiateType(target, makeUnaryTypeMapper(source, syntheticParam));
65697
+ if (hasNonCircularBaseConstraint(syntheticParam)) {
65698
+ var targetConstraintString = typeToString(target, source.symbol.declarations[0]);
65699
+ associateRelatedInfo(ts.createDiagnosticForNode(source.symbol.declarations[0], ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint, targetConstraintString));
65700
+ }
65715
65701
  }
65716
65702
  }
65717
65703
  function traceUnionsOrIntersectionsTooLarge(source, target) {
@@ -117590,6 +117576,7 @@ var ts;
117590
117576
  ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations.code,
117591
117577
  ts.Diagnostics.Class_constructor_may_not_be_a_generator.code,
117592
117578
  ts.Diagnostics.Class_constructor_may_not_be_an_accessor.code,
117579
+ ts.Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
117593
117580
  ]);
117594
117581
  /**
117595
117582
  * Determine if source file needs to be re-created even if its text hasn't changed
@@ -145844,7 +145831,7 @@ var ts;
145844
145831
  return type.symbol && (type.symbol.flags & 1536 /* Module */);
145845
145832
  }
145846
145833
  function visitVariableLikeDeclaration(decl) {
145847
- if (!decl.initializer || ts.isBindingPattern(decl.name)) {
145834
+ if (!decl.initializer || ts.isBindingPattern(decl.name) || ts.isVariableDeclaration(decl) && !isHintableDeclaration(decl)) {
145848
145835
  return;
145849
145836
  }
145850
145837
  var effectiveTypeAnnotation = ts.getEffectiveTypeAnnotationNode(decl);
@@ -145972,6 +145959,9 @@ var ts;
145972
145959
  }
145973
145960
  for (var i = 0; i < node.parameters.length && i < signature.parameters.length; ++i) {
145974
145961
  var param = node.parameters[i];
145962
+ if (!isHintableDeclaration(param)) {
145963
+ continue;
145964
+ }
145975
145965
  var effectiveTypeAnnotation = ts.getEffectiveTypeAnnotationNode(param);
145976
145966
  if (effectiveTypeAnnotation) {
145977
145967
  continue;
@@ -146013,6 +146003,13 @@ var ts;
146013
146003
  function isUndefined(name) {
146014
146004
  return name === "undefined";
146015
146005
  }
146006
+ function isHintableDeclaration(node) {
146007
+ if ((ts.isParameterDeclaration(node) || ts.isVariableDeclaration(node) && ts.isVarConst(node)) && node.initializer) {
146008
+ var initializer = ts.skipParentheses(node.initializer);
146009
+ return !(isHintableLiteral(initializer) || ts.isNewExpression(initializer) || ts.isObjectLiteralExpression(initializer) || ts.isAssertionExpression(initializer));
146010
+ }
146011
+ return true;
146012
+ }
146016
146013
  }
146017
146014
  InlayHints.provideInlayHints = provideInlayHints;
146018
146015
  })(InlayHints = ts.InlayHints || (ts.InlayHints = {}));
@@ -155451,6 +155448,77 @@ var ts;
155451
155448
  })(ts || (ts = {}));
155452
155449
  /* @internal */
155453
155450
  var ts;
155451
+ (function (ts) {
155452
+ var codefix;
155453
+ (function (codefix) {
155454
+ var fixId = "addMissingConstraint";
155455
+ var errorCodes = [
155456
+ // We want errors this could be attached to:
155457
+ // Diagnostics.This_type_parameter_probably_needs_an_extends_0_constraint
155458
+ ts.Diagnostics.Type_0_is_not_comparable_to_type_1.code,
155459
+ ts.Diagnostics.Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated.code,
155460
+ 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,
155461
+ ts.Diagnostics.Type_0_is_not_assignable_to_type_1.code,
155462
+ 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,
155463
+ ts.Diagnostics.Property_0_is_incompatible_with_index_signature.code,
155464
+ ts.Diagnostics.Property_0_in_type_1_is_not_assignable_to_type_2.code,
155465
+ ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1.code,
155466
+ ];
155467
+ codefix.registerCodeFix({
155468
+ errorCodes: errorCodes,
155469
+ getCodeActions: function (context) {
155470
+ var sourceFile = context.sourceFile, span = context.span, program = context.program;
155471
+ var related = getDiagnosticRelatedInfo(program, sourceFile, span);
155472
+ if (!related) {
155473
+ return;
155474
+ }
155475
+ var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addMissingConstraint(t, related); });
155476
+ return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_extends_constraint, fixId, ts.Diagnostics.Add_extends_constraint_to_all_type_parameters)];
155477
+ },
155478
+ fixIds: [fixId],
155479
+ getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) {
155480
+ var info = getDiagnosticRelatedInfo(context.program, context.sourceFile, diag);
155481
+ if (!info)
155482
+ return;
155483
+ return addMissingConstraint(changes, info);
155484
+ }); },
155485
+ });
155486
+ function getDiagnosticRelatedInfo(program, sourceFile, span) {
155487
+ var diag = ts.find(program.getSemanticDiagnostics(sourceFile), function (diag) { return diag.start === span.start && diag.length === span.length; });
155488
+ if (!diag || !diag.relatedInformation)
155489
+ return;
155490
+ var related = ts.find(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint.code; });
155491
+ if (!related)
155492
+ return;
155493
+ return related;
155494
+ }
155495
+ function addMissingConstraint(changes, related) {
155496
+ var decl = findAncestorMatchingSpan(related.file, related);
155497
+ if (!decl)
155498
+ return;
155499
+ if (ts.isIdentifier(decl) && ts.isTypeParameterDeclaration(decl.parent)) {
155500
+ decl = decl.parent;
155501
+ }
155502
+ if (!ts.isTypeParameterDeclaration(decl) || ts.isMappedTypeNode(decl.parent))
155503
+ return; // should only issue fix on type parameters written using `extends`
155504
+ var newConstraint = ts.flattenDiagnosticMessageText(related.messageText, "\n", 0).match(/`extends (.*)`/);
155505
+ if (!newConstraint)
155506
+ return;
155507
+ var newConstraintText = newConstraint[1];
155508
+ changes.insertText(related.file, related.start + related.length, " extends " + newConstraintText);
155509
+ }
155510
+ function findAncestorMatchingSpan(sourceFile, span) {
155511
+ var token = ts.getTokenAtPosition(sourceFile, span.start);
155512
+ var end = ts.textSpanEnd(span);
155513
+ while (token.end < end) {
155514
+ token = token.parent;
155515
+ }
155516
+ return token;
155517
+ }
155518
+ })(codefix = ts.codefix || (ts.codefix = {}));
155519
+ })(ts || (ts = {}));
155520
+ /* @internal */
155521
+ var ts;
155454
155522
  (function (ts) {
155455
155523
  var codefix;
155456
155524
  (function (codefix) {
@@ -156514,7 +156582,7 @@ var ts;
156514
156582
  var checker = context.program.getTypeChecker();
156515
156583
  var props = ts.map(info.properties, function (prop) {
156516
156584
  var initializer = tryGetValueFromType(context, checker, importAdder, quotePreference, checker.getTypeOfSymbol(prop), info.parentDeclaration);
156517
- return ts.factory.createPropertyAssignment(ts.createPropertyNameNodeForIdentifierOrLiteral(prop.name, target, quotePreference === 0 /* Single */), initializer);
156585
+ return ts.factory.createPropertyAssignment(createPropertyNameFromSymbol(prop, target, quotePreference, checker), initializer);
156518
156586
  });
156519
156587
  var options = {
156520
156588
  leadingTriviaOption: ts.textChanges.LeadingTriviaOption.Exclude,
@@ -156634,6 +156702,15 @@ var ts;
156634
156702
  var declaration = ts.findAncestor(callExpression, function (n) { return ts.isMethodDeclaration(n) || ts.isConstructorDeclaration(n); });
156635
156703
  return declaration && declaration.parent === node ? declaration : undefined;
156636
156704
  }
156705
+ function createPropertyNameFromSymbol(symbol, target, quotePreference, checker) {
156706
+ if (ts.isTransientSymbol(symbol) && symbol.nameType && symbol.nameType.flags & 8192 /* UniqueESSymbol */) {
156707
+ var expression = checker.symbolToExpression(symbol.nameType.symbol, 111551 /* Value */, symbol.valueDeclaration, 1048576 /* AllowUniqueESSymbolType */);
156708
+ if (expression) {
156709
+ return ts.factory.createComputedPropertyName(expression);
156710
+ }
156711
+ }
156712
+ return ts.createPropertyNameNodeForIdentifierOrLiteral(symbol.name, target, quotePreference === 0 /* Single */);
156713
+ }
156637
156714
  })(codefix = ts.codefix || (ts.codefix = {}));
156638
156715
  })(ts || (ts = {}));
156639
156716
  /* @internal */