typescript 4.7.0-dev.20220217 → 4.7.0-dev.20220221
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/cs/diagnosticMessages.generated.json +5 -1
- package/lib/de/diagnosticMessages.generated.json +6 -2
- package/lib/es/diagnosticMessages.generated.json +5 -1
- package/lib/fr/diagnosticMessages.generated.json +6 -2
- package/lib/it/diagnosticMessages.generated.json +5 -1
- package/lib/ja/diagnosticMessages.generated.json +6 -2
- package/lib/ko/diagnosticMessages.generated.json +6 -2
- package/lib/lib.es2015.core.d.ts +3 -3
- package/lib/lib.es2021.intl.d.ts +6 -6
- package/lib/lib.es5.d.ts +3 -1
- package/lib/lib.esnext.intl.d.ts +4 -4
- package/lib/pl/diagnosticMessages.generated.json +5 -1
- package/lib/pt-br/diagnosticMessages.generated.json +6 -2
- package/lib/ru/diagnosticMessages.generated.json +6 -2
- package/lib/tr/diagnosticMessages.generated.json +6 -2
- package/lib/tsc.js +56 -48
- package/lib/tsserver.js +101 -68
- package/lib/tsserverlibrary.js +95 -63
- package/lib/typescript.js +95 -63
- package/lib/typescriptServices.js +95 -63
- package/lib/typingsInstaller.js +59 -52
- package/lib/zh-cn/diagnosticMessages.generated.json +6 -2
- package/lib/zh-tw/diagnosticMessages.generated.json +6 -2
- package/package.json +1 -1
package/lib/tsserverlibrary.js
CHANGED
|
@@ -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-dev.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220221";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -2617,7 +2617,7 @@ var ts;
|
|
|
2617
2617
|
Debug.checkEachDefined = checkEachDefined;
|
|
2618
2618
|
function assertNever(member, message, stackCrawlMark) {
|
|
2619
2619
|
if (message === void 0) { message = "Illegal value:"; }
|
|
2620
|
-
var detail = typeof member === "object" && ts.hasProperty(member, "kind") && ts.hasProperty(member, "pos")
|
|
2620
|
+
var detail = typeof member === "object" && ts.hasProperty(member, "kind") && ts.hasProperty(member, "pos") ? "SyntaxKind: " + formatSyntaxKind(member.kind) : JSON.stringify(member);
|
|
2621
2621
|
return fail(message + " " + detail, stackCrawlMark || assertNever);
|
|
2622
2622
|
}
|
|
2623
2623
|
Debug.assertNever = assertNever;
|
|
@@ -9770,7 +9770,7 @@ var ts;
|
|
|
9770
9770
|
Fix_all_implicit_this_errors: diag(95107, ts.DiagnosticCategory.Message, "Fix_all_implicit_this_errors_95107", "Fix all implicit-'this' errors"),
|
|
9771
9771
|
Wrap_invalid_character_in_an_expression_container: diag(95108, ts.DiagnosticCategory.Message, "Wrap_invalid_character_in_an_expression_container_95108", "Wrap invalid character in an expression container"),
|
|
9772
9772
|
Wrap_all_invalid_characters_in_an_expression_container: diag(95109, ts.DiagnosticCategory.Message, "Wrap_all_invalid_characters_in_an_expression_container_95109", "Wrap all invalid characters in an expression container"),
|
|
9773
|
-
|
|
9773
|
+
Visit_https_Colon_Slash_Slashaka_ms_Slashtsconfig_to_read_more_about_this_file: diag(95110, ts.DiagnosticCategory.Message, "Visit_https_Colon_Slash_Slashaka_ms_Slashtsconfig_to_read_more_about_this_file_95110", "Visit https://aka.ms/tsconfig to read more about this file"),
|
|
9774
9774
|
Add_a_return_statement: diag(95111, ts.DiagnosticCategory.Message, "Add_a_return_statement_95111", "Add a return statement"),
|
|
9775
9775
|
Remove_braces_from_arrow_function_body: diag(95112, ts.DiagnosticCategory.Message, "Remove_braces_from_arrow_function_body_95112", "Remove braces from arrow function body"),
|
|
9776
9776
|
Wrap_the_following_body_with_parentheses_which_should_be_an_object_literal: diag(95113, ts.DiagnosticCategory.Message, "Wrap_the_following_body_with_parentheses_which_should_be_an_object_literal_95113", "Wrap the following body with parentheses which should be an object literal"),
|
|
@@ -40657,7 +40657,7 @@ var ts;
|
|
|
40657
40657
|
var result = [];
|
|
40658
40658
|
result.push("{");
|
|
40659
40659
|
result.push(tab + "\"compilerOptions\": {");
|
|
40660
|
-
result.push("" + tab + tab + "/* " + ts.getLocaleSpecificMessage(ts.Diagnostics.
|
|
40660
|
+
result.push("" + tab + tab + "/* " + ts.getLocaleSpecificMessage(ts.Diagnostics.Visit_https_Colon_Slash_Slashaka_ms_Slashtsconfig_to_read_more_about_this_file) + " */");
|
|
40661
40661
|
result.push("");
|
|
40662
40662
|
// Print out each row, aligning all the descriptions on the same column.
|
|
40663
40663
|
for (var _a = 0, entries_2 = entries; _a < entries_2.length; _a++) {
|
|
@@ -63189,10 +63189,6 @@ var ts;
|
|
|
63189
63189
|
if (sourceRestType || targetRestType) {
|
|
63190
63190
|
void instantiateType(sourceRestType || targetRestType, reportUnreliableMarkers);
|
|
63191
63191
|
}
|
|
63192
|
-
if (sourceRestType && targetRestType && sourceCount !== targetCount) {
|
|
63193
|
-
// We're not able to relate misaligned complex rest parameters
|
|
63194
|
-
return 0 /* False */;
|
|
63195
|
-
}
|
|
63196
63192
|
var kind = target.declaration ? target.declaration.kind : 0 /* Unknown */;
|
|
63197
63193
|
var strictVariance = !(checkMode & 3 /* Callback */) && strictFunctionTypes && kind !== 168 /* MethodDeclaration */ &&
|
|
63198
63194
|
kind !== 167 /* MethodSignature */ && kind !== 170 /* Constructor */;
|
|
@@ -70250,7 +70246,7 @@ var ts;
|
|
|
70250
70246
|
var substituteConstraints = !(checkMode && checkMode & 2 /* Inferential */) &&
|
|
70251
70247
|
someType(type, isGenericTypeWithUnionConstraint) &&
|
|
70252
70248
|
(isConstraintPosition(type, reference) || hasContextualTypeWithNoGenericTypes(reference, checkMode));
|
|
70253
|
-
return substituteConstraints ? mapType(type, function (t) { return t.flags & 465829888 /* Instantiable */
|
|
70249
|
+
return substituteConstraints ? mapType(type, function (t) { return t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOrType(t) : t; }) : type;
|
|
70254
70250
|
}
|
|
70255
70251
|
function isExportOrExportExpression(location) {
|
|
70256
70252
|
return !!ts.findAncestor(location, function (n) {
|
|
@@ -77571,7 +77567,7 @@ var ts;
|
|
|
77571
77567
|
if (operator === 55 /* AmpersandAmpersandToken */ || operator === 56 /* BarBarToken */ || operator === 60 /* QuestionQuestionToken */) {
|
|
77572
77568
|
if (operator === 55 /* AmpersandAmpersandToken */) {
|
|
77573
77569
|
var parent = ts.walkUpParenthesizedExpressions(node.parent);
|
|
77574
|
-
checkTestingKnownTruthyCallableOrAwaitableType(node.left,
|
|
77570
|
+
checkTestingKnownTruthyCallableOrAwaitableType(node.left, ts.isIfStatement(parent) ? parent.thenStatement : undefined);
|
|
77575
77571
|
}
|
|
77576
77572
|
checkTruthinessOfType(leftType, node.left);
|
|
77577
77573
|
}
|
|
@@ -78078,8 +78074,8 @@ var ts;
|
|
|
78078
78074
|
return type;
|
|
78079
78075
|
}
|
|
78080
78076
|
function checkConditionalExpression(node, checkMode) {
|
|
78081
|
-
|
|
78082
|
-
checkTestingKnownTruthyCallableOrAwaitableType(node.condition,
|
|
78077
|
+
checkTruthinessExpression(node.condition);
|
|
78078
|
+
checkTestingKnownTruthyCallableOrAwaitableType(node.condition, node.whenTrue);
|
|
78083
78079
|
var type1 = checkExpression(node.whenTrue, checkMode);
|
|
78084
78080
|
var type2 = checkExpression(node.whenFalse, checkMode);
|
|
78085
78081
|
return getUnionType([type1, type2], 2 /* Subtype */);
|
|
@@ -81235,50 +81231,59 @@ var ts;
|
|
|
81235
81231
|
function checkIfStatement(node) {
|
|
81236
81232
|
// Grammar checking
|
|
81237
81233
|
checkGrammarStatementInAmbientContext(node);
|
|
81238
|
-
|
|
81239
|
-
checkTestingKnownTruthyCallableOrAwaitableType(node.expression,
|
|
81234
|
+
checkTruthinessExpression(node.expression);
|
|
81235
|
+
checkTestingKnownTruthyCallableOrAwaitableType(node.expression, node.thenStatement);
|
|
81240
81236
|
checkSourceElement(node.thenStatement);
|
|
81241
81237
|
if (node.thenStatement.kind === 235 /* EmptyStatement */) {
|
|
81242
81238
|
error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement);
|
|
81243
81239
|
}
|
|
81244
81240
|
checkSourceElement(node.elseStatement);
|
|
81245
81241
|
}
|
|
81246
|
-
function checkTestingKnownTruthyCallableOrAwaitableType(condExpr,
|
|
81242
|
+
function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, body) {
|
|
81247
81243
|
if (!strictNullChecks)
|
|
81248
81244
|
return;
|
|
81249
|
-
|
|
81250
|
-
|
|
81251
|
-
|
|
81252
|
-
|
|
81253
|
-
|
|
81254
|
-
|
|
81255
|
-
|
|
81256
|
-
|
|
81257
|
-
|
|
81258
|
-
|
|
81259
|
-
|
|
81260
|
-
|
|
81261
|
-
|
|
81262
|
-
|
|
81263
|
-
|
|
81264
|
-
|
|
81265
|
-
|
|
81266
|
-
|
|
81267
|
-
|
|
81268
|
-
|
|
81269
|
-
|
|
81270
|
-
|
|
81271
|
-
|
|
81272
|
-
}
|
|
81273
|
-
var isUsed = testedSymbol && ts.isBinaryExpression(condExpr.parent) && isSymbolUsedInBinaryExpressionChain(condExpr.parent, testedSymbol)
|
|
81274
|
-
|| testedSymbol && body && isSymbolUsedInConditionBody(condExpr, body, testedNode, testedSymbol);
|
|
81275
|
-
if (!isUsed) {
|
|
81276
|
-
if (isPromise) {
|
|
81277
|
-
errorAndMaybeSuggestAwait(location,
|
|
81278
|
-
/*maybeMissingAwait*/ true, ts.Diagnostics.This_condition_will_always_return_true_since_this_0_is_always_defined, getTypeNameForErrorDisplay(type));
|
|
81245
|
+
helper(condExpr, body);
|
|
81246
|
+
while (ts.isBinaryExpression(condExpr) && condExpr.operatorToken.kind === 56 /* BarBarToken */) {
|
|
81247
|
+
condExpr = condExpr.left;
|
|
81248
|
+
helper(condExpr, body);
|
|
81249
|
+
}
|
|
81250
|
+
function helper(condExpr, body) {
|
|
81251
|
+
var location = ts.isBinaryExpression(condExpr) &&
|
|
81252
|
+
(condExpr.operatorToken.kind === 56 /* BarBarToken */ || condExpr.operatorToken.kind === 55 /* AmpersandAmpersandToken */)
|
|
81253
|
+
? condExpr.right
|
|
81254
|
+
: condExpr;
|
|
81255
|
+
var type = checkTruthinessExpression(location);
|
|
81256
|
+
var isPropertyExpressionCast = ts.isPropertyAccessExpression(location) && isTypeAssertion(location.expression);
|
|
81257
|
+
if (getFalsyFlags(type) || isPropertyExpressionCast)
|
|
81258
|
+
return;
|
|
81259
|
+
// While it technically should be invalid for any known-truthy value
|
|
81260
|
+
// to be tested, we de-scope to functions and Promises unreferenced in
|
|
81261
|
+
// the block as a heuristic to identify the most common bugs. There
|
|
81262
|
+
// are too many false positives for values sourced from type
|
|
81263
|
+
// definitions without strictNullChecks otherwise.
|
|
81264
|
+
var callSignatures = getSignaturesOfType(type, 0 /* Call */);
|
|
81265
|
+
var isPromise = !!getAwaitedTypeOfPromise(type);
|
|
81266
|
+
if (callSignatures.length === 0 && !isPromise) {
|
|
81267
|
+
return;
|
|
81279
81268
|
}
|
|
81280
|
-
|
|
81281
|
-
|
|
81269
|
+
var testedNode = ts.isIdentifier(location) ? location
|
|
81270
|
+
: ts.isPropertyAccessExpression(location) ? location.name
|
|
81271
|
+
: ts.isBinaryExpression(location) && ts.isIdentifier(location.right) ? location.right
|
|
81272
|
+
: undefined;
|
|
81273
|
+
var testedSymbol = testedNode && getSymbolAtLocation(testedNode);
|
|
81274
|
+
if (!testedSymbol && !isPromise) {
|
|
81275
|
+
return;
|
|
81276
|
+
}
|
|
81277
|
+
var isUsed = testedSymbol && ts.isBinaryExpression(condExpr.parent) && isSymbolUsedInBinaryExpressionChain(condExpr.parent, testedSymbol)
|
|
81278
|
+
|| testedSymbol && body && isSymbolUsedInConditionBody(condExpr, body, testedNode, testedSymbol);
|
|
81279
|
+
if (!isUsed) {
|
|
81280
|
+
if (isPromise) {
|
|
81281
|
+
errorAndMaybeSuggestAwait(location,
|
|
81282
|
+
/*maybeMissingAwait*/ true, ts.Diagnostics.This_condition_will_always_return_true_since_this_0_is_always_defined, getTypeNameForErrorDisplay(type));
|
|
81283
|
+
}
|
|
81284
|
+
else {
|
|
81285
|
+
error(location, ts.Diagnostics.This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_instead);
|
|
81286
|
+
}
|
|
81282
81287
|
}
|
|
81283
81288
|
}
|
|
81284
81289
|
}
|
|
@@ -82467,9 +82472,9 @@ var ts;
|
|
|
82467
82472
|
var containsArguments = containsArgumentsReference(node);
|
|
82468
82473
|
if (containsArguments) {
|
|
82469
82474
|
var lastJSDocParam = ts.lastOrUndefined(jsdocParameters);
|
|
82470
|
-
if (lastJSDocParam && ts.isIdentifier(lastJSDocParam.name) && lastJSDocParam.typeExpression &&
|
|
82475
|
+
if (isJs && lastJSDocParam && ts.isIdentifier(lastJSDocParam.name) && lastJSDocParam.typeExpression &&
|
|
82471
82476
|
lastJSDocParam.typeExpression.type && !parameters.has(lastJSDocParam.name.escapedText) && !isArrayType(getTypeFromTypeNode(lastJSDocParam.typeExpression.type))) {
|
|
82472
|
-
|
|
82477
|
+
error(lastJSDocParam.name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_had_an_array_type, ts.idText(lastJSDocParam.name));
|
|
82473
82478
|
}
|
|
82474
82479
|
}
|
|
82475
82480
|
else {
|
|
@@ -82479,7 +82484,9 @@ var ts;
|
|
|
82479
82484
|
return;
|
|
82480
82485
|
}
|
|
82481
82486
|
if (ts.isQualifiedName(name)) {
|
|
82482
|
-
|
|
82487
|
+
if (isJs) {
|
|
82488
|
+
error(name, ts.Diagnostics.Qualified_name_0_is_not_allowed_without_a_leading_param_object_1, ts.entityNameToString(name), ts.entityNameToString(name.left));
|
|
82489
|
+
}
|
|
82483
82490
|
}
|
|
82484
82491
|
else {
|
|
82485
82492
|
errorOrSuggestion(isJs, name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(name));
|
|
@@ -84072,10 +84079,10 @@ var ts;
|
|
|
84072
84079
|
}
|
|
84073
84080
|
// ECMA262: 15.2.1.1 It is a Syntax Error if the ExportedNames of ModuleItemList contains any duplicate entries.
|
|
84074
84081
|
// (TS Exceptions: namespaces, function overloads, enums, and interfaces)
|
|
84075
|
-
if (flags & (1920 /* Namespace */ |
|
|
84082
|
+
if (flags & (1920 /* Namespace */ | 384 /* Enum */)) {
|
|
84076
84083
|
return;
|
|
84077
84084
|
}
|
|
84078
|
-
var exportedDeclarationsCount = ts.countWhere(declarations, isNotOverloadAndNotAccessor);
|
|
84085
|
+
var exportedDeclarationsCount = ts.countWhere(declarations, ts.and(isNotOverloadAndNotAccessor, ts.not(ts.isInterfaceDeclaration)));
|
|
84079
84086
|
if (flags & 524288 /* TypeAlias */ && exportedDeclarationsCount <= 2) {
|
|
84080
84087
|
// it is legal to merge type alias with other values
|
|
84081
84088
|
// so count should be either 1 (just type alias) or 2 (type alias + merged value)
|
|
@@ -126784,14 +126791,15 @@ var ts;
|
|
|
126784
126791
|
: "linkplain";
|
|
126785
126792
|
var parts = [linkPart("{@" + prefix + " ")];
|
|
126786
126793
|
if (!link.name) {
|
|
126787
|
-
if (link.text)
|
|
126794
|
+
if (link.text) {
|
|
126788
126795
|
parts.push(linkTextPart(link.text));
|
|
126796
|
+
}
|
|
126789
126797
|
}
|
|
126790
126798
|
else {
|
|
126791
126799
|
var symbol = checker === null || checker === void 0 ? void 0 : checker.getSymbolAtLocation(link.name);
|
|
126792
126800
|
var suffix = findLinkNameEnd(link.text);
|
|
126793
126801
|
var name = ts.getTextOfNode(link.name) + link.text.slice(0, suffix);
|
|
126794
|
-
var text = link.text.slice(suffix);
|
|
126802
|
+
var text = skipSeparatorFromLinkText(link.text.slice(suffix));
|
|
126795
126803
|
var decl = (symbol === null || symbol === void 0 ? void 0 : symbol.valueDeclaration) || ((_a = symbol === null || symbol === void 0 ? void 0 : symbol.declarations) === null || _a === void 0 ? void 0 : _a[0]);
|
|
126796
126804
|
if (decl) {
|
|
126797
126805
|
parts.push(linkNamePart(name, decl));
|
|
@@ -126806,6 +126814,15 @@ var ts;
|
|
|
126806
126814
|
return parts;
|
|
126807
126815
|
}
|
|
126808
126816
|
ts.buildLinkParts = buildLinkParts;
|
|
126817
|
+
function skipSeparatorFromLinkText(text) {
|
|
126818
|
+
var pos = 0;
|
|
126819
|
+
if (text.charCodeAt(pos++) === 124 /* bar */) {
|
|
126820
|
+
while (pos < text.length && text.charCodeAt(pos) === 32 /* space */)
|
|
126821
|
+
pos++;
|
|
126822
|
+
return text.slice(pos);
|
|
126823
|
+
}
|
|
126824
|
+
return text;
|
|
126825
|
+
}
|
|
126809
126826
|
function findLinkNameEnd(text) {
|
|
126810
126827
|
if (text.indexOf("()") === 0)
|
|
126811
126828
|
return 2;
|
|
@@ -138042,9 +138059,18 @@ var ts;
|
|
|
138042
138059
|
JsDoc.getJsDocTagsFromDeclarations = getJsDocTagsFromDeclarations;
|
|
138043
138060
|
function getDisplayPartsFromComment(comment, checker) {
|
|
138044
138061
|
if (typeof comment === "string") {
|
|
138045
|
-
return [ts.textPart(comment)];
|
|
138062
|
+
return [ts.textPart(skipSeparatorFromComment(comment))];
|
|
138046
138063
|
}
|
|
138047
|
-
return ts.flatMap(comment, function (node) { return node.kind === 319 /* JSDocText */ ? [ts.textPart(node.text)] : ts.buildLinkParts(node, checker); });
|
|
138064
|
+
return ts.flatMap(comment, function (node) { return node.kind === 319 /* JSDocText */ ? [ts.textPart(skipSeparatorFromComment(node.text))] : ts.buildLinkParts(node, checker); });
|
|
138065
|
+
}
|
|
138066
|
+
function skipSeparatorFromComment(text) {
|
|
138067
|
+
var pos = 0;
|
|
138068
|
+
if (text.charCodeAt(pos++) === 45 /* minus */) {
|
|
138069
|
+
while (pos < text.length && text.charCodeAt(pos) === 32 /* space */)
|
|
138070
|
+
pos++;
|
|
138071
|
+
return text.slice(pos);
|
|
138072
|
+
}
|
|
138073
|
+
return text;
|
|
138048
138074
|
}
|
|
138049
138075
|
function getCommentDisplayParts(tag, checker) {
|
|
138050
138076
|
var comment = tag.comment, kind = tag.kind;
|
|
@@ -155422,7 +155448,7 @@ var ts;
|
|
|
155422
155448
|
/*dotDotDotToken*/ undefined,
|
|
155423
155449
|
/*name*/ names && names[i] || "arg" + i,
|
|
155424
155450
|
/*questionToken*/ minArgumentCount !== undefined && i >= minArgumentCount ? ts.factory.createToken(57 /* QuestionToken */) : undefined,
|
|
155425
|
-
/*type*/ inJs ? undefined : types && types[i] || ts.factory.createKeywordTypeNode(
|
|
155451
|
+
/*type*/ inJs ? undefined : types && types[i] || ts.factory.createKeywordTypeNode(154 /* UnknownKeyword */),
|
|
155426
155452
|
/*initializer*/ undefined);
|
|
155427
155453
|
parameters.push(newParameter);
|
|
155428
155454
|
}
|
|
@@ -155450,11 +155476,10 @@ var ts;
|
|
|
155450
155476
|
var maxArgsParameterSymbolNames = maxArgsSignature.parameters.map(function (symbol) { return symbol.name; });
|
|
155451
155477
|
var parameters = createDummyParameters(maxNonRestArgs, maxArgsParameterSymbolNames, /* types */ undefined, minArgumentCount, /*inJs*/ false);
|
|
155452
155478
|
if (someSigHasRestParameter) {
|
|
155453
|
-
var anyArrayType = ts.factory.createArrayTypeNode(ts.factory.createKeywordTypeNode(130 /* AnyKeyword */));
|
|
155454
155479
|
var restParameter = ts.factory.createParameterDeclaration(
|
|
155455
155480
|
/*decorators*/ undefined,
|
|
155456
155481
|
/*modifiers*/ undefined, ts.factory.createToken(25 /* DotDotDotToken */), maxArgsParameterSymbolNames[maxNonRestArgs] || "rest",
|
|
155457
|
-
/*questionToken*/ maxNonRestArgs >= minArgumentCount ? ts.factory.createToken(57 /* QuestionToken */) : undefined,
|
|
155482
|
+
/*questionToken*/ maxNonRestArgs >= minArgumentCount ? ts.factory.createToken(57 /* QuestionToken */) : undefined, ts.factory.createArrayTypeNode(ts.factory.createKeywordTypeNode(154 /* UnknownKeyword */)),
|
|
155458
155483
|
/*initializer*/ undefined);
|
|
155459
155484
|
parameters.push(restParameter);
|
|
155460
155485
|
}
|
|
@@ -157823,7 +157848,7 @@ var ts;
|
|
|
157823
157848
|
ts.Debug.assert(nodeToCheck.pos <= nodeToCheck.end, "This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809 (1)");
|
|
157824
157849
|
// For understanding how skipTrivia functioned:
|
|
157825
157850
|
ts.Debug.assert(!ts.positionIsSynthesized(nodeToCheck.pos), "This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809 (2)");
|
|
157826
|
-
if (!ts.isStatement(nodeToCheck) && !(ts.isExpressionNode(nodeToCheck) && isExtractableExpression(nodeToCheck))) {
|
|
157851
|
+
if (!ts.isStatement(nodeToCheck) && !(ts.isExpressionNode(nodeToCheck) && isExtractableExpression(nodeToCheck)) && !isStringLiteralJsxAttribute(nodeToCheck)) {
|
|
157827
157852
|
return [ts.createDiagnosticForNode(nodeToCheck, Messages.statementOrExpressionExpected)];
|
|
157828
157853
|
}
|
|
157829
157854
|
if (nodeToCheck.flags & 8388608 /* Ambient */) {
|
|
@@ -158003,13 +158028,16 @@ var ts;
|
|
|
158003
158028
|
if (ts.isStatement(node)) {
|
|
158004
158029
|
return [node];
|
|
158005
158030
|
}
|
|
158006
|
-
|
|
158031
|
+
if (ts.isExpressionNode(node)) {
|
|
158007
158032
|
// If our selection is the expression in an ExpressionStatement, expand
|
|
158008
158033
|
// the selection to include the enclosing Statement (this stops us
|
|
158009
158034
|
// from trying to care about the return value of the extracted function
|
|
158010
158035
|
// and eliminates double semicolon insertion in certain scenarios)
|
|
158011
158036
|
return ts.isExpressionStatement(node.parent) ? [node.parent] : node;
|
|
158012
158037
|
}
|
|
158038
|
+
if (isStringLiteralJsxAttribute(node)) {
|
|
158039
|
+
return node;
|
|
158040
|
+
}
|
|
158013
158041
|
return undefined;
|
|
158014
158042
|
}
|
|
158015
158043
|
function isScope(node) {
|
|
@@ -158819,7 +158847,7 @@ var ts;
|
|
|
158819
158847
|
// Unfortunately, this code takes advantage of the knowledge that the generated method
|
|
158820
158848
|
// will use the contextual type of an expression as the return type of the extracted
|
|
158821
158849
|
// method (and will therefore "use" all the types involved).
|
|
158822
|
-
if (inGenericContext && !isReadonlyArray(targetRange.range)) {
|
|
158850
|
+
if (inGenericContext && !isReadonlyArray(targetRange.range) && !ts.isJsxAttribute(targetRange.range)) {
|
|
158823
158851
|
var contextualType = checker.getContextualType(targetRange.range); // TODO: GH#18217
|
|
158824
158852
|
recordTypeParameterUsages(contextualType);
|
|
158825
158853
|
}
|
|
@@ -159144,7 +159172,11 @@ var ts;
|
|
|
159144
159172
|
}
|
|
159145
159173
|
}
|
|
159146
159174
|
function isInJSXContent(node) {
|
|
159147
|
-
return (
|
|
159175
|
+
return isStringLiteralJsxAttribute(node) ||
|
|
159176
|
+
(ts.isJsxElement(node) || ts.isJsxSelfClosingElement(node) || ts.isJsxFragment(node)) && (ts.isJsxElement(node.parent) || ts.isJsxFragment(node.parent));
|
|
159177
|
+
}
|
|
159178
|
+
function isStringLiteralJsxAttribute(node) {
|
|
159179
|
+
return ts.isStringLiteral(node) && node.parent && ts.isJsxAttribute(node.parent);
|
|
159148
159180
|
}
|
|
159149
159181
|
})(extractSymbol = refactor.extractSymbol || (refactor.extractSymbol = {}));
|
|
159150
159182
|
})(refactor = ts.refactor || (ts.refactor = {}));
|