@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/tsc.js +49 -43
- package/lib/tsserver.js +141 -64
- package/lib/tsserverlibrary.js +141 -64
- package/lib/typescript.js +141 -64
- package/lib/typescriptServices.js +141 -64
- package/lib/typingsInstaller.js +49 -62
- package/package.json +2 -1
package/lib/tsserverlibrary.js
CHANGED
|
@@ -303,7 +303,7 @@ var ts;
|
|
|
303
303
|
// The following is baselined as a literal template type without intervention
|
|
304
304
|
/** The version of the TypeScript compiler release */
|
|
305
305
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
306
|
-
ts.version = ts.versionMajorMinor + ".0-insiders.
|
|
306
|
+
ts.version = ts.versionMajorMinor + ".0-insiders.20220615";
|
|
307
307
|
/* @internal */
|
|
308
308
|
var Comparison;
|
|
309
309
|
(function (Comparison) {
|
|
@@ -8677,9 +8677,11 @@ var ts;
|
|
|
8677
8677
|
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),
|
|
8678
8678
|
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."),
|
|
8679
8679
|
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."),
|
|
8680
|
-
|
|
8680
|
+
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."),
|
|
8681
8681
|
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."),
|
|
8682
8682
|
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."),
|
|
8683
|
+
Add_extends_constraint: diag(2211, ts.DiagnosticCategory.Message, "Add_extends_constraint_2211", "Add `extends` constraint."),
|
|
8684
|
+
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"),
|
|
8683
8685
|
Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."),
|
|
8684
8686
|
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."),
|
|
8685
8687
|
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."),
|
|
@@ -34722,10 +34724,10 @@ var ts;
|
|
|
34722
34724
|
setDecoratorContext(/*val*/ false);
|
|
34723
34725
|
}
|
|
34724
34726
|
var pos = getNodePos();
|
|
34725
|
-
var expr = parseAssignmentExpressionOrHigher(
|
|
34727
|
+
var expr = parseAssignmentExpressionOrHigher();
|
|
34726
34728
|
var operatorToken;
|
|
34727
34729
|
while ((operatorToken = parseOptionalToken(27 /* CommaToken */))) {
|
|
34728
|
-
expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher(
|
|
34730
|
+
expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher(), pos);
|
|
34729
34731
|
}
|
|
34730
34732
|
if (saveDecoratorContext) {
|
|
34731
34733
|
setDecoratorContext(/*val*/ true);
|
|
@@ -34733,9 +34735,9 @@ var ts;
|
|
|
34733
34735
|
return expr;
|
|
34734
34736
|
}
|
|
34735
34737
|
function parseInitializer() {
|
|
34736
|
-
return parseOptional(63 /* EqualsToken */) ? parseAssignmentExpressionOrHigher(
|
|
34738
|
+
return parseOptional(63 /* EqualsToken */) ? parseAssignmentExpressionOrHigher() : undefined;
|
|
34737
34739
|
}
|
|
34738
|
-
function parseAssignmentExpressionOrHigher(
|
|
34740
|
+
function parseAssignmentExpressionOrHigher() {
|
|
34739
34741
|
// AssignmentExpression[in,yield]:
|
|
34740
34742
|
// 1) ConditionalExpression[?in,?yield]
|
|
34741
34743
|
// 2) LeftHandSideExpression = AssignmentExpression[?in,?yield]
|
|
@@ -34761,7 +34763,7 @@ var ts;
|
|
|
34761
34763
|
// If we do successfully parse arrow-function, we must *not* recurse for productions 1, 2 or 3. An ArrowFunction is
|
|
34762
34764
|
// not a LeftHandSideExpression, nor does it start a ConditionalExpression. So we are done
|
|
34763
34765
|
// with AssignmentExpression if we see one.
|
|
34764
|
-
var arrowExpression = tryParseParenthesizedArrowFunctionExpression(
|
|
34766
|
+
var arrowExpression = tryParseParenthesizedArrowFunctionExpression() || tryParseAsyncSimpleArrowFunctionExpression();
|
|
34765
34767
|
if (arrowExpression) {
|
|
34766
34768
|
return arrowExpression;
|
|
34767
34769
|
}
|
|
@@ -34780,7 +34782,7 @@ var ts;
|
|
|
34780
34782
|
// parameter ('x => ...') above. We handle it here by checking if the parsed expression was a single
|
|
34781
34783
|
// identifier and the current token is an arrow.
|
|
34782
34784
|
if (expr.kind === 79 /* Identifier */ && token() === 38 /* EqualsGreaterThanToken */) {
|
|
34783
|
-
return parseSimpleArrowFunctionExpression(pos, expr,
|
|
34785
|
+
return parseSimpleArrowFunctionExpression(pos, expr, /*asyncModifier*/ undefined);
|
|
34784
34786
|
}
|
|
34785
34787
|
// Now see if we might be in cases '2' or '3'.
|
|
34786
34788
|
// If the expression was a LHS expression, and we have an assignment operator, then
|
|
@@ -34789,7 +34791,7 @@ var ts;
|
|
|
34789
34791
|
// Note: we call reScanGreaterToken so that we get an appropriately merged token
|
|
34790
34792
|
// for cases like `> > =` becoming `>>=`
|
|
34791
34793
|
if (ts.isLeftHandSideExpression(expr) && ts.isAssignmentOperator(reScanGreaterToken())) {
|
|
34792
|
-
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(
|
|
34794
|
+
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(), pos);
|
|
34793
34795
|
}
|
|
34794
34796
|
// It wasn't an assignment or a lambda. This is a conditional expression:
|
|
34795
34797
|
return parseConditionalExpressionRest(expr, pos);
|
|
@@ -34832,7 +34834,7 @@ var ts;
|
|
|
34832
34834
|
nextToken();
|
|
34833
34835
|
if (!scanner.hasPrecedingLineBreak() &&
|
|
34834
34836
|
(token() === 41 /* AsteriskToken */ || isStartOfExpression())) {
|
|
34835
|
-
return finishNode(factory.createYieldExpression(parseOptionalToken(41 /* AsteriskToken */), parseAssignmentExpressionOrHigher(
|
|
34837
|
+
return finishNode(factory.createYieldExpression(parseOptionalToken(41 /* AsteriskToken */), parseAssignmentExpressionOrHigher()), pos);
|
|
34836
34838
|
}
|
|
34837
34839
|
else {
|
|
34838
34840
|
// if the next token is not on the same line as yield. or we don't have an '*' or
|
|
@@ -34840,7 +34842,7 @@ var ts;
|
|
|
34840
34842
|
return finishNode(factory.createYieldExpression(/*asteriskToken*/ undefined, /*expression*/ undefined), pos);
|
|
34841
34843
|
}
|
|
34842
34844
|
}
|
|
34843
|
-
function parseSimpleArrowFunctionExpression(pos, identifier,
|
|
34845
|
+
function parseSimpleArrowFunctionExpression(pos, identifier, asyncModifier) {
|
|
34844
34846
|
ts.Debug.assert(token() === 38 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
|
|
34845
34847
|
var parameter = factory.createParameterDeclaration(
|
|
34846
34848
|
/*modifiers*/ undefined,
|
|
@@ -34851,11 +34853,11 @@ var ts;
|
|
|
34851
34853
|
finishNode(parameter, identifier.pos);
|
|
34852
34854
|
var parameters = createNodeArray([parameter], parameter.pos, parameter.end);
|
|
34853
34855
|
var equalsGreaterThanToken = parseExpectedToken(38 /* EqualsGreaterThanToken */);
|
|
34854
|
-
var body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier
|
|
34856
|
+
var body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier);
|
|
34855
34857
|
var node = factory.createArrowFunction(asyncModifier, /*typeParameters*/ undefined, parameters, /*type*/ undefined, equalsGreaterThanToken, body);
|
|
34856
34858
|
return addJSDocComment(finishNode(node, pos));
|
|
34857
34859
|
}
|
|
34858
|
-
function tryParseParenthesizedArrowFunctionExpression(
|
|
34860
|
+
function tryParseParenthesizedArrowFunctionExpression() {
|
|
34859
34861
|
var triState = isParenthesizedArrowFunctionExpression();
|
|
34860
34862
|
if (triState === 0 /* False */) {
|
|
34861
34863
|
// It's definitely not a parenthesized arrow function expression.
|
|
@@ -34866,8 +34868,8 @@ var ts;
|
|
|
34866
34868
|
// it out, but don't allow any ambiguity, and return 'undefined' if this could be an
|
|
34867
34869
|
// expression instead.
|
|
34868
34870
|
return triState === 1 /* True */ ?
|
|
34869
|
-
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true
|
|
34870
|
-
tryParse(
|
|
34871
|
+
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true) :
|
|
34872
|
+
tryParse(parsePossibleParenthesizedArrowFunctionExpression);
|
|
34871
34873
|
}
|
|
34872
34874
|
// True -> We definitely expect a parenthesized arrow function here.
|
|
34873
34875
|
// False -> There *cannot* be a parenthesized arrow function here.
|
|
@@ -35001,25 +35003,25 @@ var ts;
|
|
|
35001
35003
|
return 2 /* Unknown */;
|
|
35002
35004
|
}
|
|
35003
35005
|
}
|
|
35004
|
-
function parsePossibleParenthesizedArrowFunctionExpression(
|
|
35006
|
+
function parsePossibleParenthesizedArrowFunctionExpression() {
|
|
35005
35007
|
var tokenPos = scanner.getTokenPos();
|
|
35006
35008
|
if (notParenthesizedArrow === null || notParenthesizedArrow === void 0 ? void 0 : notParenthesizedArrow.has(tokenPos)) {
|
|
35007
35009
|
return undefined;
|
|
35008
35010
|
}
|
|
35009
|
-
var result = parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ false
|
|
35011
|
+
var result = parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ false);
|
|
35010
35012
|
if (!result) {
|
|
35011
35013
|
(notParenthesizedArrow || (notParenthesizedArrow = new ts.Set())).add(tokenPos);
|
|
35012
35014
|
}
|
|
35013
35015
|
return result;
|
|
35014
35016
|
}
|
|
35015
|
-
function tryParseAsyncSimpleArrowFunctionExpression(
|
|
35017
|
+
function tryParseAsyncSimpleArrowFunctionExpression() {
|
|
35016
35018
|
// We do a check here so that we won't be doing unnecessarily call to "lookAhead"
|
|
35017
35019
|
if (token() === 131 /* AsyncKeyword */) {
|
|
35018
35020
|
if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* True */) {
|
|
35019
35021
|
var pos = getNodePos();
|
|
35020
35022
|
var asyncModifier = parseModifiersForArrowFunction();
|
|
35021
35023
|
var expr = parseBinaryExpressionOrHigher(0 /* Lowest */);
|
|
35022
|
-
return parseSimpleArrowFunctionExpression(pos, expr,
|
|
35024
|
+
return parseSimpleArrowFunctionExpression(pos, expr, asyncModifier);
|
|
35023
35025
|
}
|
|
35024
35026
|
}
|
|
35025
35027
|
return undefined;
|
|
@@ -35043,7 +35045,7 @@ var ts;
|
|
|
35043
35045
|
}
|
|
35044
35046
|
return 0 /* False */;
|
|
35045
35047
|
}
|
|
35046
|
-
function parseParenthesizedArrowFunctionExpression(allowAmbiguity
|
|
35048
|
+
function parseParenthesizedArrowFunctionExpression(allowAmbiguity) {
|
|
35047
35049
|
var pos = getNodePos();
|
|
35048
35050
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
35049
35051
|
var modifiers = parseModifiersForArrowFunction();
|
|
@@ -35078,7 +35080,6 @@ var ts;
|
|
|
35078
35080
|
return undefined;
|
|
35079
35081
|
}
|
|
35080
35082
|
}
|
|
35081
|
-
var hasReturnColon = token() === 58 /* ColonToken */;
|
|
35082
35083
|
var type = parseReturnType(58 /* ColonToken */, /*isType*/ false);
|
|
35083
35084
|
if (type && !allowAmbiguity && typeHasArrowFunctionBlockingParseError(type)) {
|
|
35084
35085
|
return undefined;
|
|
@@ -35107,36 +35108,12 @@ var ts;
|
|
|
35107
35108
|
var lastToken = token();
|
|
35108
35109
|
var equalsGreaterThanToken = parseExpectedToken(38 /* EqualsGreaterThanToken */);
|
|
35109
35110
|
var body = (lastToken === 38 /* EqualsGreaterThanToken */ || lastToken === 18 /* OpenBraceToken */)
|
|
35110
|
-
? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier)
|
|
35111
|
+
? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier))
|
|
35111
35112
|
: parseIdentifier();
|
|
35112
|
-
// Given:
|
|
35113
|
-
// x ? y => ({ y }) : z => ({ z })
|
|
35114
|
-
// We try to parse the body of the first arrow function by looking at:
|
|
35115
|
-
// ({ y }) : z => ({ z })
|
|
35116
|
-
// This is a valid arrow function with "z" as the return type.
|
|
35117
|
-
//
|
|
35118
|
-
// But, if we're in the true side of a conditional expression, this colon
|
|
35119
|
-
// terminates the expression, so we cannot allow a return type if we aren't
|
|
35120
|
-
// certain whether or not the preceding text was parsed as a parameter list.
|
|
35121
|
-
//
|
|
35122
|
-
// For example,
|
|
35123
|
-
// a() ? (b: number, c?: string): void => d() : e
|
|
35124
|
-
// is determined by isParenthesizedArrowFunctionExpression to unambiguously
|
|
35125
|
-
// be an arrow expression, so we allow a return type.
|
|
35126
|
-
if (disallowReturnTypeInArrowFunction && hasReturnColon) {
|
|
35127
|
-
// However, if the arrow function we were able to parse is followed by another colon
|
|
35128
|
-
// as in:
|
|
35129
|
-
// a ? (x): string => x : null
|
|
35130
|
-
// Then allow the arrow function, and treat the second colon as terminating
|
|
35131
|
-
// the conditional expression.
|
|
35132
|
-
if (token() !== 58 /* ColonToken */) {
|
|
35133
|
-
return undefined;
|
|
35134
|
-
}
|
|
35135
|
-
}
|
|
35136
35113
|
var node = factory.createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body);
|
|
35137
35114
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
35138
35115
|
}
|
|
35139
|
-
function parseArrowFunctionExpressionBody(isAsync
|
|
35116
|
+
function parseArrowFunctionExpressionBody(isAsync) {
|
|
35140
35117
|
if (token() === 18 /* OpenBraceToken */) {
|
|
35141
35118
|
return parseFunctionBlock(isAsync ? 2 /* Await */ : 0 /* None */);
|
|
35142
35119
|
}
|
|
@@ -35164,8 +35141,8 @@ var ts;
|
|
|
35164
35141
|
var savedTopLevel = topLevel;
|
|
35165
35142
|
topLevel = false;
|
|
35166
35143
|
var node = isAsync
|
|
35167
|
-
? doInAwaitContext(
|
|
35168
|
-
: doOutsideOfAwaitContext(
|
|
35144
|
+
? doInAwaitContext(parseAssignmentExpressionOrHigher)
|
|
35145
|
+
: doOutsideOfAwaitContext(parseAssignmentExpressionOrHigher);
|
|
35169
35146
|
topLevel = savedTopLevel;
|
|
35170
35147
|
return node;
|
|
35171
35148
|
}
|
|
@@ -35178,8 +35155,8 @@ var ts;
|
|
|
35178
35155
|
// Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and
|
|
35179
35156
|
// we do not that for the 'whenFalse' part.
|
|
35180
35157
|
var colonToken;
|
|
35181
|
-
return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext,
|
|
35182
|
-
? parseAssignmentExpressionOrHigher(
|
|
35158
|
+
return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher), colonToken = parseExpectedToken(58 /* ColonToken */), ts.nodeIsPresent(colonToken)
|
|
35159
|
+
? parseAssignmentExpressionOrHigher()
|
|
35183
35160
|
: createMissingNode(79 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(58 /* ColonToken */))), pos);
|
|
35184
35161
|
}
|
|
35185
35162
|
function parseBinaryExpressionOrHigher(precedence) {
|
|
@@ -36006,10 +35983,11 @@ var ts;
|
|
|
36006
35983
|
}
|
|
36007
35984
|
nextToken();
|
|
36008
35985
|
var typeArguments = parseDelimitedList(20 /* TypeArguments */, parseType);
|
|
36009
|
-
if (
|
|
35986
|
+
if (reScanGreaterToken() !== 31 /* GreaterThanToken */) {
|
|
36010
35987
|
// If it doesn't have the closing `>` then it's definitely not an type argument list.
|
|
36011
35988
|
return undefined;
|
|
36012
35989
|
}
|
|
35990
|
+
nextToken();
|
|
36013
35991
|
// We successfully parsed a type argument list. The next token determines whether we want to
|
|
36014
35992
|
// treat it as such. If the type argument list is followed by `(` or a template literal, as in
|
|
36015
35993
|
// `f<number>(42)`, we favor the type argument interpretation even though JavaScript would view
|
|
@@ -36093,13 +36071,13 @@ var ts;
|
|
|
36093
36071
|
function parseSpreadElement() {
|
|
36094
36072
|
var pos = getNodePos();
|
|
36095
36073
|
parseExpected(25 /* DotDotDotToken */);
|
|
36096
|
-
var expression = parseAssignmentExpressionOrHigher(
|
|
36074
|
+
var expression = parseAssignmentExpressionOrHigher();
|
|
36097
36075
|
return finishNode(factory.createSpreadElement(expression), pos);
|
|
36098
36076
|
}
|
|
36099
36077
|
function parseArgumentOrArrayLiteralElement() {
|
|
36100
36078
|
return token() === 25 /* DotDotDotToken */ ? parseSpreadElement() :
|
|
36101
36079
|
token() === 27 /* CommaToken */ ? finishNode(factory.createOmittedExpression(), getNodePos()) :
|
|
36102
|
-
parseAssignmentExpressionOrHigher(
|
|
36080
|
+
parseAssignmentExpressionOrHigher();
|
|
36103
36081
|
}
|
|
36104
36082
|
function parseArgumentExpression() {
|
|
36105
36083
|
return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement);
|
|
@@ -36117,7 +36095,7 @@ var ts;
|
|
|
36117
36095
|
var pos = getNodePos();
|
|
36118
36096
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
36119
36097
|
if (parseOptionalToken(25 /* DotDotDotToken */)) {
|
|
36120
|
-
var expression = parseAssignmentExpressionOrHigher(
|
|
36098
|
+
var expression = parseAssignmentExpressionOrHigher();
|
|
36121
36099
|
return withJSDoc(finishNode(factory.createSpreadAssignment(expression), pos), hasJSDoc);
|
|
36122
36100
|
}
|
|
36123
36101
|
var decorators = parseDecorators();
|
|
@@ -36146,7 +36124,7 @@ var ts;
|
|
|
36146
36124
|
var isShorthandPropertyAssignment = tokenIsIdentifier && (token() !== 58 /* ColonToken */);
|
|
36147
36125
|
if (isShorthandPropertyAssignment) {
|
|
36148
36126
|
var equalsToken = parseOptionalToken(63 /* EqualsToken */);
|
|
36149
|
-
var objectAssignmentInitializer = equalsToken ? allowInAnd(
|
|
36127
|
+
var objectAssignmentInitializer = equalsToken ? allowInAnd(parseAssignmentExpressionOrHigher) : undefined;
|
|
36150
36128
|
node = factory.createShorthandPropertyAssignment(name, objectAssignmentInitializer);
|
|
36151
36129
|
// Save equals token for error reporting.
|
|
36152
36130
|
// TODO(rbuckton): Consider manufacturing this when we need to report an error as it is otherwise not useful.
|
|
@@ -36154,7 +36132,7 @@ var ts;
|
|
|
36154
36132
|
}
|
|
36155
36133
|
else {
|
|
36156
36134
|
parseExpected(58 /* ColonToken */);
|
|
36157
|
-
var initializer = allowInAnd(
|
|
36135
|
+
var initializer = allowInAnd(parseAssignmentExpressionOrHigher);
|
|
36158
36136
|
node = factory.createPropertyAssignment(name, initializer);
|
|
36159
36137
|
}
|
|
36160
36138
|
// Decorators, Modifiers, questionToken, and exclamationToken are not supported by property assignments and are reported in the grammar checker
|
|
@@ -36331,7 +36309,7 @@ var ts;
|
|
|
36331
36309
|
}
|
|
36332
36310
|
var node;
|
|
36333
36311
|
if (awaitToken ? parseExpected(160 /* OfKeyword */) : parseOptional(160 /* OfKeyword */)) {
|
|
36334
|
-
var expression = allowInAnd(
|
|
36312
|
+
var expression = allowInAnd(parseAssignmentExpressionOrHigher);
|
|
36335
36313
|
parseExpected(21 /* CloseParenToken */);
|
|
36336
36314
|
node = factory.createForOfStatement(awaitToken, initializer, expression, parseStatement());
|
|
36337
36315
|
}
|
|
@@ -37519,7 +37497,7 @@ var ts;
|
|
|
37519
37497
|
var pos = getNodePos();
|
|
37520
37498
|
var name = ts.tokenIsIdentifierOrKeyword(token()) ? parseIdentifierName() : parseLiteralLikeNode(10 /* StringLiteral */);
|
|
37521
37499
|
parseExpected(58 /* ColonToken */);
|
|
37522
|
-
var value = parseAssignmentExpressionOrHigher(
|
|
37500
|
+
var value = parseAssignmentExpressionOrHigher();
|
|
37523
37501
|
return finishNode(factory.createAssertEntry(name, value), pos);
|
|
37524
37502
|
}
|
|
37525
37503
|
function parseAssertClause(skipAssertKeyword) {
|
|
@@ -37760,7 +37738,7 @@ var ts;
|
|
|
37760
37738
|
else {
|
|
37761
37739
|
parseExpected(88 /* DefaultKeyword */);
|
|
37762
37740
|
}
|
|
37763
|
-
var expression = parseAssignmentExpressionOrHigher(
|
|
37741
|
+
var expression = parseAssignmentExpressionOrHigher();
|
|
37764
37742
|
parseSemicolon();
|
|
37765
37743
|
setAwaitContext(savedAwaitContext);
|
|
37766
37744
|
var node = factory.createExportAssignment(modifiers, isExportEquals, expression);
|
|
@@ -52759,6 +52737,9 @@ var ts;
|
|
|
52759
52737
|
if (symbol && symbol.flags & 262144 /* TypeParameter */ && meaning & 788968 /* Type */) {
|
|
52760
52738
|
return { accessibility: 0 /* Accessible */ };
|
|
52761
52739
|
}
|
|
52740
|
+
if (!symbol && ts.isThisIdentifier(firstIdentifier) && isSymbolAccessible(getSymbolOfNode(ts.getThisContainer(firstIdentifier, /*includeArrowFunctions*/ false)), firstIdentifier, meaning, /*computeAliases*/ false).accessibility === 0 /* Accessible */) {
|
|
52741
|
+
return { accessibility: 0 /* Accessible */ };
|
|
52742
|
+
}
|
|
52762
52743
|
// Verify if the symbol is accessible
|
|
52763
52744
|
return (symbol && hasVisibleDeclarations(symbol, /*shouldComputeAliasToMakeVisible*/ true)) || {
|
|
52764
52745
|
accessibility: 1 /* NotAccessible */,
|
|
@@ -65719,8 +65700,13 @@ var ts;
|
|
|
65719
65700
|
return;
|
|
65720
65701
|
}
|
|
65721
65702
|
reportRelationError(headMessage, source, target);
|
|
65722
|
-
if (
|
|
65723
|
-
|
|
65703
|
+
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)) {
|
|
65704
|
+
var syntheticParam = cloneTypeParameter(source);
|
|
65705
|
+
syntheticParam.constraint = instantiateType(target, makeUnaryTypeMapper(source, syntheticParam));
|
|
65706
|
+
if (hasNonCircularBaseConstraint(syntheticParam)) {
|
|
65707
|
+
var targetConstraintString = typeToString(target, source.symbol.declarations[0]);
|
|
65708
|
+
associateRelatedInfo(ts.createDiagnosticForNode(source.symbol.declarations[0], ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint, targetConstraintString));
|
|
65709
|
+
}
|
|
65724
65710
|
}
|
|
65725
65711
|
}
|
|
65726
65712
|
function traceUnionsOrIntersectionsTooLarge(source, target) {
|
|
@@ -117599,6 +117585,7 @@ var ts;
|
|
|
117599
117585
|
ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations.code,
|
|
117600
117586
|
ts.Diagnostics.Class_constructor_may_not_be_a_generator.code,
|
|
117601
117587
|
ts.Diagnostics.Class_constructor_may_not_be_an_accessor.code,
|
|
117588
|
+
ts.Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
|
|
117602
117589
|
]);
|
|
117603
117590
|
/**
|
|
117604
117591
|
* Determine if source file needs to be re-created even if its text hasn't changed
|
|
@@ -145853,7 +145840,7 @@ var ts;
|
|
|
145853
145840
|
return type.symbol && (type.symbol.flags & 1536 /* Module */);
|
|
145854
145841
|
}
|
|
145855
145842
|
function visitVariableLikeDeclaration(decl) {
|
|
145856
|
-
if (!decl.initializer || ts.isBindingPattern(decl.name)) {
|
|
145843
|
+
if (!decl.initializer || ts.isBindingPattern(decl.name) || ts.isVariableDeclaration(decl) && !isHintableDeclaration(decl)) {
|
|
145857
145844
|
return;
|
|
145858
145845
|
}
|
|
145859
145846
|
var effectiveTypeAnnotation = ts.getEffectiveTypeAnnotationNode(decl);
|
|
@@ -145981,6 +145968,9 @@ var ts;
|
|
|
145981
145968
|
}
|
|
145982
145969
|
for (var i = 0; i < node.parameters.length && i < signature.parameters.length; ++i) {
|
|
145983
145970
|
var param = node.parameters[i];
|
|
145971
|
+
if (!isHintableDeclaration(param)) {
|
|
145972
|
+
continue;
|
|
145973
|
+
}
|
|
145984
145974
|
var effectiveTypeAnnotation = ts.getEffectiveTypeAnnotationNode(param);
|
|
145985
145975
|
if (effectiveTypeAnnotation) {
|
|
145986
145976
|
continue;
|
|
@@ -146022,6 +146012,13 @@ var ts;
|
|
|
146022
146012
|
function isUndefined(name) {
|
|
146023
146013
|
return name === "undefined";
|
|
146024
146014
|
}
|
|
146015
|
+
function isHintableDeclaration(node) {
|
|
146016
|
+
if ((ts.isParameterDeclaration(node) || ts.isVariableDeclaration(node) && ts.isVarConst(node)) && node.initializer) {
|
|
146017
|
+
var initializer = ts.skipParentheses(node.initializer);
|
|
146018
|
+
return !(isHintableLiteral(initializer) || ts.isNewExpression(initializer) || ts.isObjectLiteralExpression(initializer) || ts.isAssertionExpression(initializer));
|
|
146019
|
+
}
|
|
146020
|
+
return true;
|
|
146021
|
+
}
|
|
146025
146022
|
}
|
|
146026
146023
|
InlayHints.provideInlayHints = provideInlayHints;
|
|
146027
146024
|
})(InlayHints = ts.InlayHints || (ts.InlayHints = {}));
|
|
@@ -155460,6 +155457,77 @@ var ts;
|
|
|
155460
155457
|
})(ts || (ts = {}));
|
|
155461
155458
|
/* @internal */
|
|
155462
155459
|
var ts;
|
|
155460
|
+
(function (ts) {
|
|
155461
|
+
var codefix;
|
|
155462
|
+
(function (codefix) {
|
|
155463
|
+
var fixId = "addMissingConstraint";
|
|
155464
|
+
var errorCodes = [
|
|
155465
|
+
// We want errors this could be attached to:
|
|
155466
|
+
// Diagnostics.This_type_parameter_probably_needs_an_extends_0_constraint
|
|
155467
|
+
ts.Diagnostics.Type_0_is_not_comparable_to_type_1.code,
|
|
155468
|
+
ts.Diagnostics.Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated.code,
|
|
155469
|
+
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,
|
|
155470
|
+
ts.Diagnostics.Type_0_is_not_assignable_to_type_1.code,
|
|
155471
|
+
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,
|
|
155472
|
+
ts.Diagnostics.Property_0_is_incompatible_with_index_signature.code,
|
|
155473
|
+
ts.Diagnostics.Property_0_in_type_1_is_not_assignable_to_type_2.code,
|
|
155474
|
+
ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1.code,
|
|
155475
|
+
];
|
|
155476
|
+
codefix.registerCodeFix({
|
|
155477
|
+
errorCodes: errorCodes,
|
|
155478
|
+
getCodeActions: function (context) {
|
|
155479
|
+
var sourceFile = context.sourceFile, span = context.span, program = context.program;
|
|
155480
|
+
var related = getDiagnosticRelatedInfo(program, sourceFile, span);
|
|
155481
|
+
if (!related) {
|
|
155482
|
+
return;
|
|
155483
|
+
}
|
|
155484
|
+
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addMissingConstraint(t, related); });
|
|
155485
|
+
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_extends_constraint, fixId, ts.Diagnostics.Add_extends_constraint_to_all_type_parameters)];
|
|
155486
|
+
},
|
|
155487
|
+
fixIds: [fixId],
|
|
155488
|
+
getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) {
|
|
155489
|
+
var info = getDiagnosticRelatedInfo(context.program, context.sourceFile, diag);
|
|
155490
|
+
if (!info)
|
|
155491
|
+
return;
|
|
155492
|
+
return addMissingConstraint(changes, info);
|
|
155493
|
+
}); },
|
|
155494
|
+
});
|
|
155495
|
+
function getDiagnosticRelatedInfo(program, sourceFile, span) {
|
|
155496
|
+
var diag = ts.find(program.getSemanticDiagnostics(sourceFile), function (diag) { return diag.start === span.start && diag.length === span.length; });
|
|
155497
|
+
if (!diag || !diag.relatedInformation)
|
|
155498
|
+
return;
|
|
155499
|
+
var related = ts.find(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint.code; });
|
|
155500
|
+
if (!related)
|
|
155501
|
+
return;
|
|
155502
|
+
return related;
|
|
155503
|
+
}
|
|
155504
|
+
function addMissingConstraint(changes, related) {
|
|
155505
|
+
var decl = findAncestorMatchingSpan(related.file, related);
|
|
155506
|
+
if (!decl)
|
|
155507
|
+
return;
|
|
155508
|
+
if (ts.isIdentifier(decl) && ts.isTypeParameterDeclaration(decl.parent)) {
|
|
155509
|
+
decl = decl.parent;
|
|
155510
|
+
}
|
|
155511
|
+
if (!ts.isTypeParameterDeclaration(decl) || ts.isMappedTypeNode(decl.parent))
|
|
155512
|
+
return; // should only issue fix on type parameters written using `extends`
|
|
155513
|
+
var newConstraint = ts.flattenDiagnosticMessageText(related.messageText, "\n", 0).match(/`extends (.*)`/);
|
|
155514
|
+
if (!newConstraint)
|
|
155515
|
+
return;
|
|
155516
|
+
var newConstraintText = newConstraint[1];
|
|
155517
|
+
changes.insertText(related.file, related.start + related.length, " extends " + newConstraintText);
|
|
155518
|
+
}
|
|
155519
|
+
function findAncestorMatchingSpan(sourceFile, span) {
|
|
155520
|
+
var token = ts.getTokenAtPosition(sourceFile, span.start);
|
|
155521
|
+
var end = ts.textSpanEnd(span);
|
|
155522
|
+
while (token.end < end) {
|
|
155523
|
+
token = token.parent;
|
|
155524
|
+
}
|
|
155525
|
+
return token;
|
|
155526
|
+
}
|
|
155527
|
+
})(codefix = ts.codefix || (ts.codefix = {}));
|
|
155528
|
+
})(ts || (ts = {}));
|
|
155529
|
+
/* @internal */
|
|
155530
|
+
var ts;
|
|
155463
155531
|
(function (ts) {
|
|
155464
155532
|
var codefix;
|
|
155465
155533
|
(function (codefix) {
|
|
@@ -156523,7 +156591,7 @@ var ts;
|
|
|
156523
156591
|
var checker = context.program.getTypeChecker();
|
|
156524
156592
|
var props = ts.map(info.properties, function (prop) {
|
|
156525
156593
|
var initializer = tryGetValueFromType(context, checker, importAdder, quotePreference, checker.getTypeOfSymbol(prop), info.parentDeclaration);
|
|
156526
|
-
return ts.factory.createPropertyAssignment(
|
|
156594
|
+
return ts.factory.createPropertyAssignment(createPropertyNameFromSymbol(prop, target, quotePreference, checker), initializer);
|
|
156527
156595
|
});
|
|
156528
156596
|
var options = {
|
|
156529
156597
|
leadingTriviaOption: ts.textChanges.LeadingTriviaOption.Exclude,
|
|
@@ -156643,6 +156711,15 @@ var ts;
|
|
|
156643
156711
|
var declaration = ts.findAncestor(callExpression, function (n) { return ts.isMethodDeclaration(n) || ts.isConstructorDeclaration(n); });
|
|
156644
156712
|
return declaration && declaration.parent === node ? declaration : undefined;
|
|
156645
156713
|
}
|
|
156714
|
+
function createPropertyNameFromSymbol(symbol, target, quotePreference, checker) {
|
|
156715
|
+
if (ts.isTransientSymbol(symbol) && symbol.nameType && symbol.nameType.flags & 8192 /* UniqueESSymbol */) {
|
|
156716
|
+
var expression = checker.symbolToExpression(symbol.nameType.symbol, 111551 /* Value */, symbol.valueDeclaration, 1048576 /* AllowUniqueESSymbolType */);
|
|
156717
|
+
if (expression) {
|
|
156718
|
+
return ts.factory.createComputedPropertyName(expression);
|
|
156719
|
+
}
|
|
156720
|
+
}
|
|
156721
|
+
return ts.createPropertyNameNodeForIdentifierOrLiteral(symbol.name, target, quotePreference === 0 /* Single */);
|
|
156722
|
+
}
|
|
156646
156723
|
})(codefix = ts.codefix || (ts.codefix = {}));
|
|
156647
156724
|
})(ts || (ts = {}));
|
|
156648
156725
|
/* @internal */
|