typescript 5.2.0-dev.20230524 → 5.2.0-dev.20230527
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 +50 -38
- package/lib/tsserver.js +132 -76
- package/lib/tsserverlibrary.d.ts +1 -1
- package/lib/tsserverlibrary.js +132 -76
- package/lib/typescript.d.ts +1 -1
- package/lib/typescript.js +132 -76
- package/lib/typingsInstaller.js +2 -1
- package/package.json +2 -2
package/lib/tsserverlibrary.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.2";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20230527`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -50344,32 +50344,34 @@ ${lanes.join("\n")}
|
|
|
50344
50344
|
const methodDeclaration = signatureToSignatureDeclarationHelper(signature, 172 /* MethodSignature */, context, { name: propertyName, questionToken: optionalToken });
|
|
50345
50345
|
typeElements.push(preserveCommentsOn(methodDeclaration));
|
|
50346
50346
|
}
|
|
50347
|
+
if (signatures.length || !optionalToken) {
|
|
50348
|
+
return;
|
|
50349
|
+
}
|
|
50350
|
+
}
|
|
50351
|
+
let propertyTypeNode;
|
|
50352
|
+
if (shouldUsePlaceholderForProperty(propertySymbol, context)) {
|
|
50353
|
+
propertyTypeNode = createElidedInformationPlaceholder(context);
|
|
50347
50354
|
} else {
|
|
50348
|
-
|
|
50349
|
-
|
|
50350
|
-
|
|
50351
|
-
} else {
|
|
50352
|
-
if (propertyIsReverseMapped) {
|
|
50353
|
-
context.reverseMappedStack || (context.reverseMappedStack = []);
|
|
50354
|
-
context.reverseMappedStack.push(propertySymbol);
|
|
50355
|
-
}
|
|
50356
|
-
propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
50357
|
-
if (propertyIsReverseMapped) {
|
|
50358
|
-
context.reverseMappedStack.pop();
|
|
50359
|
-
}
|
|
50355
|
+
if (propertyIsReverseMapped) {
|
|
50356
|
+
context.reverseMappedStack || (context.reverseMappedStack = []);
|
|
50357
|
+
context.reverseMappedStack.push(propertySymbol);
|
|
50360
50358
|
}
|
|
50361
|
-
|
|
50362
|
-
if (
|
|
50363
|
-
context.
|
|
50359
|
+
propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
50360
|
+
if (propertyIsReverseMapped) {
|
|
50361
|
+
context.reverseMappedStack.pop();
|
|
50364
50362
|
}
|
|
50365
|
-
const propertySignature = factory.createPropertySignature(
|
|
50366
|
-
modifiers,
|
|
50367
|
-
propertyName,
|
|
50368
|
-
optionalToken,
|
|
50369
|
-
propertyTypeNode
|
|
50370
|
-
);
|
|
50371
|
-
typeElements.push(preserveCommentsOn(propertySignature));
|
|
50372
50363
|
}
|
|
50364
|
+
const modifiers = isReadonlySymbol(propertySymbol) ? [factory.createToken(148 /* ReadonlyKeyword */)] : void 0;
|
|
50365
|
+
if (modifiers) {
|
|
50366
|
+
context.approximateLength += 9;
|
|
50367
|
+
}
|
|
50368
|
+
const propertySignature = factory.createPropertySignature(
|
|
50369
|
+
modifiers,
|
|
50370
|
+
propertyName,
|
|
50371
|
+
optionalToken,
|
|
50372
|
+
propertyTypeNode
|
|
50373
|
+
);
|
|
50374
|
+
typeElements.push(preserveCommentsOn(propertySignature));
|
|
50373
50375
|
function preserveCommentsOn(node) {
|
|
50374
50376
|
var _a2;
|
|
50375
50377
|
if (some(propertySymbol.declarations, (d) => d.kind === 354 /* JSDocPropertyTag */)) {
|
|
@@ -59722,9 +59724,9 @@ ${lanes.join("\n")}
|
|
|
59722
59724
|
);
|
|
59723
59725
|
if (freshMapper) {
|
|
59724
59726
|
const freshCombinedMapper = combineTypeMappers(mapper, freshMapper);
|
|
59725
|
-
for (
|
|
59726
|
-
if (root.inferTypeParameters
|
|
59727
|
-
|
|
59727
|
+
for (let i = 0; i < freshParams.length; i++) {
|
|
59728
|
+
if (freshParams[i] !== root.inferTypeParameters[i]) {
|
|
59729
|
+
freshParams[i].mapper = freshCombinedMapper;
|
|
59728
59730
|
}
|
|
59729
59731
|
}
|
|
59730
59732
|
}
|
|
@@ -60627,6 +60629,9 @@ ${lanes.join("\n")}
|
|
|
60627
60629
|
const elementFlags = tupleType.target.elementFlags;
|
|
60628
60630
|
const elementTypes = map(getElementTypes(tupleType), (t, i) => {
|
|
60629
60631
|
const singleton = elementFlags[i] & 8 /* Variadic */ ? t : elementFlags[i] & 4 /* Rest */ ? createArrayType(t) : createTupleType([t], [elementFlags[i]]);
|
|
60632
|
+
if (singleton === typeVariable) {
|
|
60633
|
+
return mappedType;
|
|
60634
|
+
}
|
|
60630
60635
|
return instantiateMappedType(mappedType, prependTypeMapping(typeVariable, singleton, mapper));
|
|
60631
60636
|
});
|
|
60632
60637
|
const newReadonly = getModifiedReadonlyState(tupleType.target.readonly, getMappedTypeModifiers(mappedType));
|
|
@@ -60964,6 +60969,10 @@ ${lanes.join("\n")}
|
|
|
60964
60969
|
return true;
|
|
60965
60970
|
}
|
|
60966
60971
|
switch (node.kind) {
|
|
60972
|
+
case 233 /* AsExpression */:
|
|
60973
|
+
if (!isConstAssertion(node)) {
|
|
60974
|
+
break;
|
|
60975
|
+
}
|
|
60967
60976
|
case 293 /* JsxExpression */:
|
|
60968
60977
|
case 216 /* ParenthesizedExpression */:
|
|
60969
60978
|
return elaborateError(node.expression, source, target, relation, headMessage, containingMessageChain, errorOutputContainer);
|
|
@@ -67242,7 +67251,7 @@ ${lanes.join("\n")}
|
|
|
67242
67251
|
target.antecedents = saveAntecedents;
|
|
67243
67252
|
} else if (flags & 2 /* Start */) {
|
|
67244
67253
|
const container = flow.node;
|
|
67245
|
-
if (container && container !== flowContainer && reference.kind !== 210 /* PropertyAccessExpression */ && reference.kind !== 211 /* ElementAccessExpression */ && reference.kind
|
|
67254
|
+
if (container && container !== flowContainer && reference.kind !== 210 /* PropertyAccessExpression */ && reference.kind !== 211 /* ElementAccessExpression */ && !(reference.kind === 110 /* ThisKeyword */ && container.kind !== 218 /* ArrowFunction */)) {
|
|
67246
67255
|
flow = container.flowNode;
|
|
67247
67256
|
continue;
|
|
67248
67257
|
}
|
|
@@ -75729,7 +75738,7 @@ ${lanes.join("\n")}
|
|
|
75729
75738
|
Debug.assertIsDefined(leftType);
|
|
75730
75739
|
const rightType = getLastResult(state);
|
|
75731
75740
|
Debug.assertIsDefined(rightType);
|
|
75732
|
-
result = checkBinaryLikeExpressionWorker(node.left, node.operatorToken, node.right, leftType, rightType, node);
|
|
75741
|
+
result = checkBinaryLikeExpressionWorker(node.left, node.operatorToken, node.right, leftType, rightType, state.checkMode, node);
|
|
75733
75742
|
}
|
|
75734
75743
|
state.skip = false;
|
|
75735
75744
|
setLeftType(
|
|
@@ -75791,9 +75800,9 @@ ${lanes.join("\n")}
|
|
|
75791
75800
|
leftType = checkExpression(left, checkMode);
|
|
75792
75801
|
}
|
|
75793
75802
|
const rightType = checkExpression(right, checkMode);
|
|
75794
|
-
return checkBinaryLikeExpressionWorker(left, operatorToken, right, leftType, rightType, errorNode);
|
|
75803
|
+
return checkBinaryLikeExpressionWorker(left, operatorToken, right, leftType, rightType, checkMode, errorNode);
|
|
75795
75804
|
}
|
|
75796
|
-
function checkBinaryLikeExpressionWorker(left, operatorToken, right, leftType, rightType, errorNode) {
|
|
75805
|
+
function checkBinaryLikeExpressionWorker(left, operatorToken, right, leftType, rightType, checkMode, errorNode) {
|
|
75797
75806
|
const operator = operatorToken.kind;
|
|
75798
75807
|
switch (operator) {
|
|
75799
75808
|
case 42 /* AsteriskToken */:
|
|
@@ -75950,12 +75959,14 @@ ${lanes.join("\n")}
|
|
|
75950
75959
|
case 36 /* ExclamationEqualsToken */:
|
|
75951
75960
|
case 37 /* EqualsEqualsEqualsToken */:
|
|
75952
75961
|
case 38 /* ExclamationEqualsEqualsToken */:
|
|
75953
|
-
if (
|
|
75954
|
-
|
|
75955
|
-
|
|
75962
|
+
if (!(checkMode && checkMode & 128 /* TypeOnly */)) {
|
|
75963
|
+
if (isLiteralExpressionOfObject(left) || isLiteralExpressionOfObject(right)) {
|
|
75964
|
+
const eqType = operator === 35 /* EqualsEqualsToken */ || operator === 37 /* EqualsEqualsEqualsToken */;
|
|
75965
|
+
error(errorNode, Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true");
|
|
75966
|
+
}
|
|
75967
|
+
checkNaNEquality(errorNode, operator, left, right);
|
|
75968
|
+
reportOperatorErrorUnless((left2, right2) => isTypeEqualityComparableTo(left2, right2) || isTypeEqualityComparableTo(right2, left2));
|
|
75956
75969
|
}
|
|
75957
|
-
checkNaNEquality(errorNode, operator, left, right);
|
|
75958
|
-
reportOperatorErrorUnless((left2, right2) => isTypeEqualityComparableTo(left2, right2) || isTypeEqualityComparableTo(right2, left2));
|
|
75959
75970
|
return booleanType;
|
|
75960
75971
|
case 104 /* InstanceOfKeyword */:
|
|
75961
75972
|
return checkInstanceOfExpression(left, right, leftType, rightType);
|
|
@@ -76266,7 +76277,7 @@ ${lanes.join("\n")}
|
|
|
76266
76277
|
}
|
|
76267
76278
|
}
|
|
76268
76279
|
function checkConditionalExpression(node, checkMode) {
|
|
76269
|
-
const type = checkTruthinessExpression(node.condition);
|
|
76280
|
+
const type = checkTruthinessExpression(node.condition, checkMode);
|
|
76270
76281
|
checkTestingKnownTruthyCallableOrAwaitableType(node.condition, type, node.whenTrue);
|
|
76271
76282
|
const type1 = checkExpression(node.whenTrue, checkMode);
|
|
76272
76283
|
const type2 = checkExpression(node.whenFalse, checkMode);
|
|
@@ -76607,7 +76618,7 @@ ${lanes.join("\n")}
|
|
|
76607
76618
|
}
|
|
76608
76619
|
}
|
|
76609
76620
|
const startInvocationCount = flowInvocationCount;
|
|
76610
|
-
const type = checkExpression(node);
|
|
76621
|
+
const type = checkExpression(node, 128 /* TypeOnly */);
|
|
76611
76622
|
if (flowInvocationCount !== startInvocationCount) {
|
|
76612
76623
|
const cache = flowTypeCache || (flowTypeCache = []);
|
|
76613
76624
|
cache[getNodeId(node)] = type;
|
|
@@ -76683,7 +76694,7 @@ ${lanes.join("\n")}
|
|
|
76683
76694
|
if (getIsolatedModules(compilerOptions)) {
|
|
76684
76695
|
Debug.assert(!!(type.symbol.flags & 128 /* ConstEnum */));
|
|
76685
76696
|
const constEnumDeclaration = type.symbol.valueDeclaration;
|
|
76686
|
-
if (constEnumDeclaration.flags & 16777216 /* Ambient */) {
|
|
76697
|
+
if (constEnumDeclaration.flags & 16777216 /* Ambient */ && !isValidTypeOnlyAliasUseSite(node)) {
|
|
76687
76698
|
error(node, Diagnostics.Cannot_access_ambient_const_enums_when_0_is_enabled, isolatedModulesLikeFlagName);
|
|
76688
76699
|
}
|
|
76689
76700
|
}
|
|
@@ -85817,6 +85828,7 @@ ${lanes.join("\n")}
|
|
|
85817
85828
|
CheckMode3[CheckMode3["IsForSignatureHelp"] = 16] = "IsForSignatureHelp";
|
|
85818
85829
|
CheckMode3[CheckMode3["IsForStringLiteralArgumentCompletions"] = 32] = "IsForStringLiteralArgumentCompletions";
|
|
85819
85830
|
CheckMode3[CheckMode3["RestBindingElement"] = 64] = "RestBindingElement";
|
|
85831
|
+
CheckMode3[CheckMode3["TypeOnly"] = 128] = "TypeOnly";
|
|
85820
85832
|
return CheckMode3;
|
|
85821
85833
|
})(CheckMode || {});
|
|
85822
85834
|
SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
|
|
@@ -134181,12 +134193,12 @@ ${lanes.join("\n")}
|
|
|
134181
134193
|
refactorName = "Convert export";
|
|
134182
134194
|
defaultToNamedAction = {
|
|
134183
134195
|
name: "Convert default export to named export",
|
|
134184
|
-
description: Diagnostics.Convert_default_export_to_named_export
|
|
134196
|
+
description: getLocaleSpecificMessage(Diagnostics.Convert_default_export_to_named_export),
|
|
134185
134197
|
kind: "refactor.rewrite.export.named"
|
|
134186
134198
|
};
|
|
134187
134199
|
namedToDefaultAction = {
|
|
134188
134200
|
name: "Convert named export to default export",
|
|
134189
|
-
description: Diagnostics.Convert_named_export_to_default_export
|
|
134201
|
+
description: getLocaleSpecificMessage(Diagnostics.Convert_named_export_to_default_export),
|
|
134190
134202
|
kind: "refactor.rewrite.export.default"
|
|
134191
134203
|
};
|
|
134192
134204
|
registerRefactor(refactorName, {
|
|
@@ -134204,7 +134216,7 @@ ${lanes.join("\n")}
|
|
|
134204
134216
|
}
|
|
134205
134217
|
if (context.preferences.provideRefactorNotApplicableReason) {
|
|
134206
134218
|
return [
|
|
134207
|
-
{ name: refactorName, description: Diagnostics.Convert_default_export_to_named_export
|
|
134219
|
+
{ name: refactorName, description: getLocaleSpecificMessage(Diagnostics.Convert_default_export_to_named_export), actions: [
|
|
134208
134220
|
{ ...defaultToNamedAction, notApplicableReason: info.error },
|
|
134209
134221
|
{ ...namedToDefaultAction, notApplicableReason: info.error }
|
|
134210
134222
|
] }
|
|
@@ -134406,17 +134418,17 @@ ${lanes.join("\n")}
|
|
|
134406
134418
|
actions = {
|
|
134407
134419
|
[0 /* Named */]: {
|
|
134408
134420
|
name: "Convert namespace import to named imports",
|
|
134409
|
-
description: Diagnostics.Convert_namespace_import_to_named_imports
|
|
134421
|
+
description: getLocaleSpecificMessage(Diagnostics.Convert_namespace_import_to_named_imports),
|
|
134410
134422
|
kind: "refactor.rewrite.import.named"
|
|
134411
134423
|
},
|
|
134412
134424
|
[2 /* Namespace */]: {
|
|
134413
134425
|
name: "Convert named imports to namespace import",
|
|
134414
|
-
description: Diagnostics.Convert_named_imports_to_namespace_import
|
|
134426
|
+
description: getLocaleSpecificMessage(Diagnostics.Convert_named_imports_to_namespace_import),
|
|
134415
134427
|
kind: "refactor.rewrite.import.namespace"
|
|
134416
134428
|
},
|
|
134417
134429
|
[1 /* Default */]: {
|
|
134418
134430
|
name: "Convert named imports to default import",
|
|
134419
|
-
description: Diagnostics.Convert_named_imports_to_default_import
|
|
134431
|
+
description: getLocaleSpecificMessage(Diagnostics.Convert_named_imports_to_default_import),
|
|
134420
134432
|
kind: "refactor.rewrite.import.default"
|
|
134421
134433
|
}
|
|
134422
134434
|
};
|
|
@@ -134885,10 +134897,9 @@ ${lanes.join("\n")}
|
|
|
134885
134897
|
|
|
134886
134898
|
// src/services/refactors/moveToFile.ts
|
|
134887
134899
|
function doChange4(context, oldFile, targetFile, program, toMove, changes, host, preferences) {
|
|
134888
|
-
var _a;
|
|
134889
134900
|
const checker = program.getTypeChecker();
|
|
134890
134901
|
const usage = getUsageInfo(oldFile, toMove.all, checker);
|
|
134891
|
-
if (!host.fileExists(targetFile)
|
|
134902
|
+
if (!host.fileExists(targetFile)) {
|
|
134892
134903
|
changes.createNewFile(oldFile, targetFile, getNewStatementsAndRemoveFromOldFile2(oldFile, targetFile, usage, changes, toMove, program, host, preferences));
|
|
134893
134904
|
addNewFileToTsconfig(program, changes, oldFile.fileName, targetFile, hostGetCanonicalFileName(host));
|
|
134894
134905
|
} else {
|
|
@@ -134926,6 +134937,13 @@ ${lanes.join("\n")}
|
|
|
134926
134937
|
if (typeof targetFile !== "string") {
|
|
134927
134938
|
if (targetFile.statements.length > 0) {
|
|
134928
134939
|
changes.insertNodesAfter(targetFile, targetFile.statements[targetFile.statements.length - 1], body);
|
|
134940
|
+
} else {
|
|
134941
|
+
changes.insertNodesAtEndOfFile(
|
|
134942
|
+
targetFile,
|
|
134943
|
+
body,
|
|
134944
|
+
/*blankLineBetween*/
|
|
134945
|
+
false
|
|
134946
|
+
);
|
|
134929
134947
|
}
|
|
134930
134948
|
if (imports.length > 0) {
|
|
134931
134949
|
insertImports(
|
|
@@ -135512,6 +135530,10 @@ ${lanes.join("\n")}
|
|
|
135512
135530
|
if (isNamedDeclaration(startStatement) && startStatement.name && rangeContainsRange(startStatement.name, range)) {
|
|
135513
135531
|
return { toMove: [statements[startNodeIndex]], afterLast: statements[startNodeIndex + 1] };
|
|
135514
135532
|
}
|
|
135533
|
+
const overloadRangeToMove = getOverloadRangeToMove(file, startStatement);
|
|
135534
|
+
if (overloadRangeToMove) {
|
|
135535
|
+
return overloadRangeToMove;
|
|
135536
|
+
}
|
|
135515
135537
|
if (range.pos > startStatement.getStart(file))
|
|
135516
135538
|
return void 0;
|
|
135517
135539
|
const afterEndNodeIndex = findIndex(statements, (s) => s.end > range.end, startNodeIndex);
|
|
@@ -135707,6 +135729,19 @@ ${lanes.join("\n")}
|
|
|
135707
135729
|
return false;
|
|
135708
135730
|
}
|
|
135709
135731
|
}
|
|
135732
|
+
function getOverloadRangeToMove(sourceFile, statement) {
|
|
135733
|
+
if (isFunctionLikeDeclaration(statement)) {
|
|
135734
|
+
const declarations = statement.symbol.declarations;
|
|
135735
|
+
if (declarations === void 0 || length(declarations) <= 1 || !contains(declarations, statement)) {
|
|
135736
|
+
return void 0;
|
|
135737
|
+
}
|
|
135738
|
+
const lastDecl = declarations[length(declarations) - 1];
|
|
135739
|
+
const statementsToMove = mapDefined(declarations, (d) => getSourceFileOfNode(d) === sourceFile && isStatement(d) ? d : void 0);
|
|
135740
|
+
const end = findLastIndex(sourceFile.statements, (s) => s.end > lastDecl.end);
|
|
135741
|
+
return { toMove: statementsToMove, afterLast: end >= 0 ? sourceFile.statements[end] : void 0 };
|
|
135742
|
+
}
|
|
135743
|
+
return void 0;
|
|
135744
|
+
}
|
|
135710
135745
|
var refactorNameForMoveToFile, description2, moveToFileAction;
|
|
135711
135746
|
var init_moveToFile = __esm({
|
|
135712
135747
|
"src/services/refactors/moveToFile.ts"() {
|
|
@@ -135961,7 +135996,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
135961
135996
|
init_ts4();
|
|
135962
135997
|
init_ts_refactor();
|
|
135963
135998
|
refactorName5 = "Convert overload list to single signature";
|
|
135964
|
-
refactorDescription = Diagnostics.Convert_overload_list_to_single_signature
|
|
135999
|
+
refactorDescription = getLocaleSpecificMessage(Diagnostics.Convert_overload_list_to_single_signature);
|
|
135965
136000
|
functionOverloadAction = {
|
|
135966
136001
|
name: refactorName5,
|
|
135967
136002
|
description: refactorDescription,
|
|
@@ -136091,15 +136126,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
136091
136126
|
init_ts4();
|
|
136092
136127
|
init_ts_refactor();
|
|
136093
136128
|
refactorName6 = "Add or remove braces in an arrow function";
|
|
136094
|
-
refactorDescription2 = Diagnostics.Add_or_remove_braces_in_an_arrow_function
|
|
136129
|
+
refactorDescription2 = getLocaleSpecificMessage(Diagnostics.Add_or_remove_braces_in_an_arrow_function);
|
|
136095
136130
|
addBracesAction = {
|
|
136096
136131
|
name: "Add braces to arrow function",
|
|
136097
|
-
description: Diagnostics.Add_braces_to_arrow_function
|
|
136132
|
+
description: getLocaleSpecificMessage(Diagnostics.Add_braces_to_arrow_function),
|
|
136098
136133
|
kind: "refactor.rewrite.arrow.braces.add"
|
|
136099
136134
|
};
|
|
136100
136135
|
removeBracesAction = {
|
|
136101
136136
|
name: "Remove braces from arrow function",
|
|
136102
|
-
description: Diagnostics.Remove_braces_from_arrow_function
|
|
136137
|
+
description: getLocaleSpecificMessage(Diagnostics.Remove_braces_from_arrow_function),
|
|
136103
136138
|
kind: "refactor.rewrite.arrow.braces.remove"
|
|
136104
136139
|
};
|
|
136105
136140
|
registerRefactor(refactorName6, {
|
|
@@ -136970,7 +137005,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
136970
137005
|
}
|
|
136971
137006
|
}
|
|
136972
137007
|
function isNotEqualsOperator(node) {
|
|
136973
|
-
return node.operatorToken.kind
|
|
137008
|
+
return !(node.operatorToken.kind === 64 /* EqualsToken */ || node.operatorToken.kind === 65 /* PlusEqualsToken */);
|
|
136974
137009
|
}
|
|
136975
137010
|
function getParentBinaryExpression(expr) {
|
|
136976
137011
|
const container = findAncestor(expr.parent, (n) => {
|
|
@@ -139005,7 +139040,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
139005
139040
|
init_ts4();
|
|
139006
139041
|
init_ts_refactor();
|
|
139007
139042
|
actionName = "Generate 'get' and 'set' accessors";
|
|
139008
|
-
actionDescription = Diagnostics.Generate_get_and_set_accessors
|
|
139043
|
+
actionDescription = getLocaleSpecificMessage(Diagnostics.Generate_get_and_set_accessors);
|
|
139009
139044
|
generateGetSetAction = {
|
|
139010
139045
|
name: actionName,
|
|
139011
139046
|
description: actionDescription,
|
|
@@ -139157,7 +139192,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
139157
139192
|
init_ts4();
|
|
139158
139193
|
init_ts_refactor();
|
|
139159
139194
|
refactorName12 = "Infer function return type";
|
|
139160
|
-
refactorDescription6 = Diagnostics.Infer_function_return_type
|
|
139195
|
+
refactorDescription6 = getLocaleSpecificMessage(Diagnostics.Infer_function_return_type);
|
|
139161
139196
|
inferReturnTypeAction = {
|
|
139162
139197
|
name: refactorName12,
|
|
139163
139198
|
description: refactorDescription6,
|
|
@@ -139828,7 +139863,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
139828
139863
|
onUnRecoverableConfigFileDiagnostic: noop
|
|
139829
139864
|
};
|
|
139830
139865
|
const documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings);
|
|
139866
|
+
let releasedScriptKinds = /* @__PURE__ */ new Set();
|
|
139831
139867
|
if (isProgramUptoDate(program, rootFileNames, newSettings, (_path, fileName) => host.getScriptVersion(fileName), (fileName) => compilerHost.fileExists(fileName), hasInvalidatedResolutions, hasInvalidatedLibResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
139868
|
+
compilerHost = void 0;
|
|
139869
|
+
parsedCommandLines = void 0;
|
|
139870
|
+
releasedScriptKinds = void 0;
|
|
139832
139871
|
return;
|
|
139833
139872
|
}
|
|
139834
139873
|
const options = {
|
|
@@ -139841,6 +139880,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
139841
139880
|
program = createProgram(options);
|
|
139842
139881
|
compilerHost = void 0;
|
|
139843
139882
|
parsedCommandLines = void 0;
|
|
139883
|
+
releasedScriptKinds = void 0;
|
|
139844
139884
|
sourceMapper.clearCache();
|
|
139845
139885
|
program.getTypeChecker();
|
|
139846
139886
|
return;
|
|
@@ -139895,10 +139935,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
139895
139935
|
if (!shouldCreateNewSourceFile) {
|
|
139896
139936
|
const oldSourceFile = program && program.getSourceFileByPath(path);
|
|
139897
139937
|
if (oldSourceFile) {
|
|
139898
|
-
if (scriptKind === oldSourceFile.scriptKind) {
|
|
139938
|
+
if (scriptKind === oldSourceFile.scriptKind || releasedScriptKinds.has(oldSourceFile.resolvedPath)) {
|
|
139899
139939
|
return documentRegistry.updateDocumentWithKey(fileName, path, host, documentRegistryBucketKey, scriptSnapshot, scriptVersion, scriptKind, languageVersionOrOptions);
|
|
139900
139940
|
} else {
|
|
139901
139941
|
documentRegistry.releaseDocumentWithKey(oldSourceFile.resolvedPath, documentRegistry.getKeyForCompilationSettings(program.getCompilerOptions()), oldSourceFile.scriptKind, oldSourceFile.impliedNodeFormat);
|
|
139942
|
+
releasedScriptKinds.add(oldSourceFile.resolvedPath);
|
|
139902
139943
|
}
|
|
139903
139944
|
}
|
|
139904
139945
|
}
|
|
@@ -149194,9 +149235,6 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
149194
149235
|
if (call === void 0) {
|
|
149195
149236
|
return void 0;
|
|
149196
149237
|
}
|
|
149197
|
-
if (isPrivateIdentifier(token)) {
|
|
149198
|
-
return void 0;
|
|
149199
|
-
}
|
|
149200
149238
|
const methodName = token.text;
|
|
149201
149239
|
const addMethodDeclarationChanges = (modifierFlags2) => ts_textChanges_exports.ChangeTracker.with(context, (t) => addMethodDeclaration(context, t, call, token, modifierFlags2, parentDeclaration, declSourceFile));
|
|
149202
149240
|
const actions2 = [createCodeFixAction(fixMissingMember, addMethodDeclarationChanges(modifierFlags & 32 /* Static */), [modifierFlags & 32 /* Static */ ? Diagnostics.Declare_static_method_0 : Diagnostics.Declare_method_0, methodName], fixMissingMember, Diagnostics.Add_all_missing_members)];
|
|
@@ -152533,6 +152571,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
152533
152571
|
type === void 0 ? factory.createKeywordTypeNode(159 /* UnknownKeyword */) : type
|
|
152534
152572
|
);
|
|
152535
152573
|
case 261 /* FunctionDeclaration */:
|
|
152574
|
+
Debug.assert(typeof name === "string" || isIdentifier(name), "Unexpected name");
|
|
152536
152575
|
return factory.createFunctionDeclaration(
|
|
152537
152576
|
modifiers,
|
|
152538
152577
|
asteriskToken,
|
|
@@ -160818,9 +160857,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
160818
160857
|
if (refNode.parent.kind === 303 /* ShorthandPropertyAssignment */) {
|
|
160819
160858
|
getReferenceEntriesForShorthandPropertyAssignment(refNode, state.checker, addReference2);
|
|
160820
160859
|
}
|
|
160821
|
-
const
|
|
160822
|
-
if (
|
|
160823
|
-
addReference2(
|
|
160860
|
+
const containingNode = getContainingNodeIfInHeritageClause(refNode);
|
|
160861
|
+
if (containingNode) {
|
|
160862
|
+
addReference2(containingNode);
|
|
160824
160863
|
return;
|
|
160825
160864
|
}
|
|
160826
160865
|
const typeNode = findAncestor(refNode, (a) => !isQualifiedName(a.parent) && !isTypeNode(a.parent) && !isTypeElement(a.parent));
|
|
@@ -160847,8 +160886,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
160847
160886
|
addReference2(e);
|
|
160848
160887
|
}
|
|
160849
160888
|
}
|
|
160850
|
-
function
|
|
160851
|
-
return isIdentifier(node) || isPropertyAccessExpression(node) ?
|
|
160889
|
+
function getContainingNodeIfInHeritageClause(node) {
|
|
160890
|
+
return isIdentifier(node) || isPropertyAccessExpression(node) ? getContainingNodeIfInHeritageClause(node.parent) : isExpressionWithTypeArguments(node) ? tryCast(node.parent.parent, or(isClassLike, isInterfaceDeclaration)) : void 0;
|
|
160852
160891
|
}
|
|
160853
160892
|
function isImplementationExpression(node) {
|
|
160854
160893
|
switch (node.kind) {
|
|
@@ -162360,7 +162399,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
162360
162399
|
const tags = (parameters ? parameterDocComments(parameters || [], isJavaScriptFile, indentationStr, newLine) : "") + (hasReturn2 ? returnsDocComment(indentationStr, newLine) : "");
|
|
162361
162400
|
const openComment = "/**";
|
|
162362
162401
|
const closeComment = " */";
|
|
162363
|
-
const hasTag = (
|
|
162402
|
+
const hasTag = length(getJSDocTags(commentOwner)) > 0;
|
|
162364
162403
|
if (tags && !hasTag) {
|
|
162365
162404
|
const preamble = openComment + newLine + indentationStr + " * ";
|
|
162366
162405
|
const endLine = tokenStart === position ? newLine + indentationStr : "";
|
|
@@ -165881,6 +165920,17 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
165881
165920
|
this.insertNodeAt(sourceFile, pos, insert, options);
|
|
165882
165921
|
}
|
|
165883
165922
|
}
|
|
165923
|
+
insertNodesAtEndOfFile(sourceFile, newNodes, blankLineBetween) {
|
|
165924
|
+
this.insertAtEndOfFile(sourceFile, newNodes, blankLineBetween);
|
|
165925
|
+
}
|
|
165926
|
+
insertAtEndOfFile(sourceFile, insert, blankLineBetween) {
|
|
165927
|
+
const pos = sourceFile.end + 1;
|
|
165928
|
+
const options = {
|
|
165929
|
+
prefix: this.newLineCharacter,
|
|
165930
|
+
suffix: this.newLineCharacter + (blankLineBetween ? this.newLineCharacter : "")
|
|
165931
|
+
};
|
|
165932
|
+
this.insertNodesAt(sourceFile, pos, insert, options);
|
|
165933
|
+
}
|
|
165884
165934
|
insertStatementsInNewFile(fileName, statements, oldFile) {
|
|
165885
165935
|
if (!this.newFileChanges) {
|
|
165886
165936
|
this.newFileChanges = createMultiMap();
|
|
@@ -167913,7 +167963,8 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
167913
167963
|
}
|
|
167914
167964
|
processNode(enclosingNode, enclosingNode, startLine, undecoratedStartLine, initialIndentation, delta);
|
|
167915
167965
|
}
|
|
167916
|
-
|
|
167966
|
+
const remainingTrivia = formattingScanner.getCurrentLeadingTrivia();
|
|
167967
|
+
if (remainingTrivia) {
|
|
167917
167968
|
const indentation = SmartIndenter.nodeWillIndentChild(
|
|
167918
167969
|
options,
|
|
167919
167970
|
enclosingNode,
|
|
@@ -167923,25 +167974,30 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
167923
167974
|
/*indentByDefault*/
|
|
167924
167975
|
false
|
|
167925
167976
|
) ? initialIndentation + options.indentSize : initialIndentation;
|
|
167926
|
-
|
|
167927
|
-
|
|
167928
|
-
|
|
167929
|
-
|
|
167930
|
-
|
|
167931
|
-
|
|
167932
|
-
|
|
167933
|
-
(item) => processRange(
|
|
167977
|
+
indentTriviaItems(
|
|
167978
|
+
remainingTrivia,
|
|
167979
|
+
indentation,
|
|
167980
|
+
/*indentNextTokenOrTrivia*/
|
|
167981
|
+
true,
|
|
167982
|
+
(item) => {
|
|
167983
|
+
processRange(
|
|
167934
167984
|
item,
|
|
167935
167985
|
sourceFile.getLineAndCharacterOfPosition(item.pos),
|
|
167936
167986
|
enclosingNode,
|
|
167937
167987
|
enclosingNode,
|
|
167938
167988
|
/*dynamicIndentation*/
|
|
167939
167989
|
void 0
|
|
167940
|
-
)
|
|
167941
|
-
|
|
167942
|
-
|
|
167943
|
-
|
|
167990
|
+
);
|
|
167991
|
+
insertIndentation(
|
|
167992
|
+
item.pos,
|
|
167993
|
+
indentation,
|
|
167994
|
+
/*lineAdded*/
|
|
167995
|
+
false
|
|
167996
|
+
);
|
|
167944
167997
|
}
|
|
167998
|
+
);
|
|
167999
|
+
if (options.trimTrailingWhitespace !== false) {
|
|
168000
|
+
trimTrailingWhitespacesForRemainingRange(remainingTrivia);
|
|
167945
168001
|
}
|
|
167946
168002
|
}
|
|
167947
168003
|
if (previousRange && formattingScanner.getTokenFullStart() >= originalRange.end) {
|
package/lib/typescript.d.ts
CHANGED
|
@@ -6227,7 +6227,7 @@ declare namespace ts {
|
|
|
6227
6227
|
* arguments for any interactive action before offering it.
|
|
6228
6228
|
*/
|
|
6229
6229
|
getApplicableRefactors(fileName: string, positionOrRange: number | TextRange, preferences: UserPreferences | undefined, triggerReason?: RefactorTriggerReason, kind?: string, includeInteractiveActions?: boolean): ApplicableRefactorInfo[];
|
|
6230
|
-
getEditsForRefactor(fileName: string, formatOptions: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, actionName: string, preferences: UserPreferences | undefined,
|
|
6230
|
+
getEditsForRefactor(fileName: string, formatOptions: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, actionName: string, preferences: UserPreferences | undefined, interactiveRefactorArguments?: InteractiveRefactorArguments): RefactorEditInfo | undefined;
|
|
6231
6231
|
getMoveToRefactoringFileSuggestions(fileName: string, positionOrRange: number | TextRange, preferences: UserPreferences | undefined, triggerReason?: RefactorTriggerReason, kind?: string): {
|
|
6232
6232
|
newFileName: string;
|
|
6233
6233
|
files: string[];
|