@typescript-deploys/pr-build 5.2.0-pr-54290-7 → 5.2.0-pr-54377-7
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/lib.es2017.d.ts +1 -0
- package/lib/lib.es2017.date.d.ts +31 -0
- package/lib/tsc.js +74 -60
- package/lib/tsserver.js +172 -91
- package/lib/tsserverlibrary.d.ts +9 -1
- package/lib/tsserverlibrary.js +172 -91
- package/lib/typescript.d.ts +3 -1
- package/lib/typescript.js +168 -90
- package/lib/typingsInstaller.js +8 -2
- 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-insiders.
|
|
38
|
+
version = `${versionMajorMinor}.0-insiders.20230524`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -9018,6 +9018,7 @@ ${lanes.join("\n")}
|
|
|
9018
9018
|
Convert_typedef_to_TypeScript_type: diag(95176, 3 /* Message */, "Convert_typedef_to_TypeScript_type_95176", "Convert typedef to TypeScript type."),
|
|
9019
9019
|
Convert_all_typedef_to_TypeScript_types: diag(95177, 3 /* Message */, "Convert_all_typedef_to_TypeScript_types_95177", "Convert all typedef to TypeScript types."),
|
|
9020
9020
|
Move_to_file: diag(95178, 3 /* Message */, "Move_to_file_95178", "Move to file"),
|
|
9021
|
+
Cannot_move_to_file_selected_file_is_invalid: diag(95179, 3 /* Message */, "Cannot_move_to_file_selected_file_is_invalid_95179", "Cannot move to file, selected file is invalid"),
|
|
9021
9022
|
No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, 1 /* Error */, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
|
|
9022
9023
|
Classes_may_not_have_a_field_named_constructor: diag(18006, 1 /* Error */, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
|
|
9023
9024
|
JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, 1 /* Error */, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
|
|
@@ -20592,7 +20593,8 @@ ${lanes.join("\n")}
|
|
|
20592
20593
|
ensureUseStrict,
|
|
20593
20594
|
liftToBlock,
|
|
20594
20595
|
mergeLexicalEnvironment,
|
|
20595
|
-
updateModifiers
|
|
20596
|
+
updateModifiers,
|
|
20597
|
+
updateModifierLike
|
|
20596
20598
|
};
|
|
20597
20599
|
forEach(nodeFactoryPatchers, (fn) => fn(factory2));
|
|
20598
20600
|
return factory2;
|
|
@@ -24074,6 +24076,9 @@ ${lanes.join("\n")}
|
|
|
24074
24076
|
}
|
|
24075
24077
|
return isTypeParameterDeclaration(node) ? updateTypeParameterDeclaration(node, modifierArray, node.name, node.constraint, node.default) : isParameter(node) ? updateParameterDeclaration(node, modifierArray, node.dotDotDotToken, node.name, node.questionToken, node.type, node.initializer) : isConstructorTypeNode(node) ? updateConstructorTypeNode1(node, modifierArray, node.typeParameters, node.parameters, node.type) : isPropertySignature(node) ? updatePropertySignature(node, modifierArray, node.name, node.questionToken, node.type) : isPropertyDeclaration(node) ? updatePropertyDeclaration2(node, modifierArray, node.name, node.questionToken ?? node.exclamationToken, node.type, node.initializer) : isMethodSignature(node) ? updateMethodSignature(node, modifierArray, node.name, node.questionToken, node.typeParameters, node.parameters, node.type) : isMethodDeclaration(node) ? updateMethodDeclaration(node, modifierArray, node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, node.type, node.body) : isConstructorDeclaration(node) ? updateConstructorDeclaration(node, modifierArray, node.parameters, node.body) : isGetAccessorDeclaration(node) ? updateGetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.type, node.body) : isSetAccessorDeclaration(node) ? updateSetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.body) : isIndexSignatureDeclaration(node) ? updateIndexSignature(node, modifierArray, node.parameters, node.type) : isFunctionExpression(node) ? updateFunctionExpression(node, modifierArray, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body) : isArrowFunction(node) ? updateArrowFunction(node, modifierArray, node.typeParameters, node.parameters, node.type, node.equalsGreaterThanToken, node.body) : isClassExpression(node) ? updateClassExpression(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isVariableStatement(node) ? updateVariableStatement(node, modifierArray, node.declarationList) : isFunctionDeclaration(node) ? updateFunctionDeclaration(node, modifierArray, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body) : isClassDeclaration(node) ? updateClassDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isInterfaceDeclaration(node) ? updateInterfaceDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isTypeAliasDeclaration(node) ? updateTypeAliasDeclaration(node, modifierArray, node.name, node.typeParameters, node.type) : isEnumDeclaration(node) ? updateEnumDeclaration(node, modifierArray, node.name, node.members) : isModuleDeclaration(node) ? updateModuleDeclaration(node, modifierArray, node.name, node.body) : isImportEqualsDeclaration(node) ? updateImportEqualsDeclaration(node, modifierArray, node.isTypeOnly, node.name, node.moduleReference) : isImportDeclaration(node) ? updateImportDeclaration(node, modifierArray, node.importClause, node.moduleSpecifier, node.assertClause) : isExportAssignment(node) ? updateExportAssignment(node, modifierArray, node.expression) : isExportDeclaration(node) ? updateExportDeclaration(node, modifierArray, node.isTypeOnly, node.exportClause, node.moduleSpecifier, node.assertClause) : Debug.assertNever(node);
|
|
24076
24078
|
}
|
|
24079
|
+
function updateModifierLike(node, modifierArray) {
|
|
24080
|
+
return isParameter(node) ? updateParameterDeclaration(node, modifierArray, node.dotDotDotToken, node.name, node.questionToken, node.type, node.initializer) : isPropertyDeclaration(node) ? updatePropertyDeclaration2(node, modifierArray, node.name, node.questionToken ?? node.exclamationToken, node.type, node.initializer) : isMethodDeclaration(node) ? updateMethodDeclaration(node, modifierArray, node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, node.type, node.body) : isGetAccessorDeclaration(node) ? updateGetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.type, node.body) : isSetAccessorDeclaration(node) ? updateSetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.body) : isClassExpression(node) ? updateClassExpression(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isClassDeclaration(node) ? updateClassDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : Debug.assertNever(node);
|
|
24081
|
+
}
|
|
24077
24082
|
function asNodeArray(array) {
|
|
24078
24083
|
return array ? createNodeArray(array) : void 0;
|
|
24079
24084
|
}
|
|
@@ -25516,10 +25521,10 @@ ${lanes.join("\n")}
|
|
|
25516
25521
|
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
25517
25522
|
if (_ = accept(result.get)) descriptor.get = _;
|
|
25518
25523
|
if (_ = accept(result.set)) descriptor.set = _;
|
|
25519
|
-
if (_ = accept(result.init)) initializers.
|
|
25524
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
25520
25525
|
}
|
|
25521
25526
|
else if (_ = accept(result)) {
|
|
25522
|
-
if (kind === "field") initializers.
|
|
25527
|
+
if (kind === "field") initializers.unshift(_);
|
|
25523
25528
|
else descriptor[key] = _;
|
|
25524
25529
|
}
|
|
25525
25530
|
}
|
|
@@ -37253,6 +37258,7 @@ ${lanes.join("\n")}
|
|
|
37253
37258
|
["es2015.symbol", "lib.es2015.symbol.d.ts"],
|
|
37254
37259
|
["es2015.symbol.wellknown", "lib.es2015.symbol.wellknown.d.ts"],
|
|
37255
37260
|
["es2016.array.include", "lib.es2016.array.include.d.ts"],
|
|
37261
|
+
["es2017.date", "lib.es2017.date.d.ts"],
|
|
37256
37262
|
["es2017.object", "lib.es2017.object.d.ts"],
|
|
37257
37263
|
["es2017.sharedmemory", "lib.es2017.sharedmemory.d.ts"],
|
|
37258
37264
|
["es2017.string", "lib.es2017.string.d.ts"],
|
|
@@ -50338,32 +50344,34 @@ ${lanes.join("\n")}
|
|
|
50338
50344
|
const methodDeclaration = signatureToSignatureDeclarationHelper(signature, 172 /* MethodSignature */, context, { name: propertyName, questionToken: optionalToken });
|
|
50339
50345
|
typeElements.push(preserveCommentsOn(methodDeclaration));
|
|
50340
50346
|
}
|
|
50347
|
+
if (signatures.length || !optionalToken) {
|
|
50348
|
+
return;
|
|
50349
|
+
}
|
|
50350
|
+
}
|
|
50351
|
+
let propertyTypeNode;
|
|
50352
|
+
if (shouldUsePlaceholderForProperty(propertySymbol, context)) {
|
|
50353
|
+
propertyTypeNode = createElidedInformationPlaceholder(context);
|
|
50341
50354
|
} else {
|
|
50342
|
-
|
|
50343
|
-
|
|
50344
|
-
|
|
50345
|
-
} else {
|
|
50346
|
-
if (propertyIsReverseMapped) {
|
|
50347
|
-
context.reverseMappedStack || (context.reverseMappedStack = []);
|
|
50348
|
-
context.reverseMappedStack.push(propertySymbol);
|
|
50349
|
-
}
|
|
50350
|
-
propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
50351
|
-
if (propertyIsReverseMapped) {
|
|
50352
|
-
context.reverseMappedStack.pop();
|
|
50353
|
-
}
|
|
50355
|
+
if (propertyIsReverseMapped) {
|
|
50356
|
+
context.reverseMappedStack || (context.reverseMappedStack = []);
|
|
50357
|
+
context.reverseMappedStack.push(propertySymbol);
|
|
50354
50358
|
}
|
|
50355
|
-
|
|
50356
|
-
if (
|
|
50357
|
-
context.
|
|
50359
|
+
propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
50360
|
+
if (propertyIsReverseMapped) {
|
|
50361
|
+
context.reverseMappedStack.pop();
|
|
50358
50362
|
}
|
|
50359
|
-
const propertySignature = factory.createPropertySignature(
|
|
50360
|
-
modifiers,
|
|
50361
|
-
propertyName,
|
|
50362
|
-
optionalToken,
|
|
50363
|
-
propertyTypeNode
|
|
50364
|
-
);
|
|
50365
|
-
typeElements.push(preserveCommentsOn(propertySignature));
|
|
50366
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));
|
|
50367
50375
|
function preserveCommentsOn(node) {
|
|
50368
50376
|
var _a2;
|
|
50369
50377
|
if (some(propertySymbol.declarations, (d) => d.kind === 354 /* JSDocPropertyTag */)) {
|
|
@@ -56426,7 +56434,7 @@ ${lanes.join("\n")}
|
|
|
56426
56434
|
} else if (type !== firstType) {
|
|
56427
56435
|
checkFlags |= 64 /* HasNonUniformType */;
|
|
56428
56436
|
}
|
|
56429
|
-
if (isLiteralType(type) || isPatternLiteralType(type)
|
|
56437
|
+
if (isLiteralType(type) || isPatternLiteralType(type)) {
|
|
56430
56438
|
checkFlags |= 128 /* HasLiteralType */;
|
|
56431
56439
|
}
|
|
56432
56440
|
if (type.flags & 131072 /* Never */ && type !== uniqueLiteralType) {
|
|
@@ -58653,31 +58661,28 @@ ${lanes.join("\n")}
|
|
|
58653
58661
|
return getUnionTypeFromSortedList(typeSet, objectFlags, aliasSymbol, aliasTypeArguments, origin);
|
|
58654
58662
|
}
|
|
58655
58663
|
function getUnionOrIntersectionTypePredicate(signatures, kind) {
|
|
58656
|
-
let
|
|
58664
|
+
let last2;
|
|
58657
58665
|
const types = [];
|
|
58658
58666
|
for (const sig of signatures) {
|
|
58659
58667
|
const pred = getTypePredicateOfSignature(sig);
|
|
58660
|
-
if (
|
|
58661
|
-
if (kind !==
|
|
58662
|
-
continue;
|
|
58663
|
-
} else {
|
|
58664
|
-
return;
|
|
58665
|
-
}
|
|
58666
|
-
}
|
|
58667
|
-
if (first2) {
|
|
58668
|
-
if (!typePredicateKindsMatch(first2, pred)) {
|
|
58668
|
+
if (pred) {
|
|
58669
|
+
if (pred.kind !== 0 /* This */ && pred.kind !== 1 /* Identifier */ || last2 && !typePredicateKindsMatch(last2, pred)) {
|
|
58669
58670
|
return void 0;
|
|
58670
58671
|
}
|
|
58672
|
+
last2 = pred;
|
|
58673
|
+
types.push(pred.type);
|
|
58671
58674
|
} else {
|
|
58672
|
-
|
|
58675
|
+
const returnType = kind !== 2097152 /* Intersection */ ? getReturnTypeOfSignature(sig) : void 0;
|
|
58676
|
+
if (returnType !== falseType && returnType !== regularFalseType) {
|
|
58677
|
+
return void 0;
|
|
58678
|
+
}
|
|
58673
58679
|
}
|
|
58674
|
-
types.push(pred.type);
|
|
58675
58680
|
}
|
|
58676
|
-
if (!
|
|
58681
|
+
if (!last2) {
|
|
58677
58682
|
return void 0;
|
|
58678
58683
|
}
|
|
58679
58684
|
const compositeType = getUnionOrIntersectionType(types, kind);
|
|
58680
|
-
return createTypePredicate(
|
|
58685
|
+
return createTypePredicate(last2.kind, last2.parameterName, last2.parameterIndex, compositeType);
|
|
58681
58686
|
}
|
|
58682
58687
|
function typePredicateKindsMatch(a, b) {
|
|
58683
58688
|
return a.kind === b.kind && a.parameterIndex === b.parameterIndex;
|
|
@@ -59719,9 +59724,9 @@ ${lanes.join("\n")}
|
|
|
59719
59724
|
);
|
|
59720
59725
|
if (freshMapper) {
|
|
59721
59726
|
const freshCombinedMapper = combineTypeMappers(mapper, freshMapper);
|
|
59722
|
-
for (
|
|
59723
|
-
if (root.inferTypeParameters
|
|
59724
|
-
|
|
59727
|
+
for (let i = 0; i < freshParams.length; i++) {
|
|
59728
|
+
if (freshParams[i] !== root.inferTypeParameters[i]) {
|
|
59729
|
+
freshParams[i].mapper = freshCombinedMapper;
|
|
59725
59730
|
}
|
|
59726
59731
|
}
|
|
59727
59732
|
}
|
|
@@ -60558,18 +60563,19 @@ ${lanes.join("\n")}
|
|
|
60558
60563
|
case 185 /* TypeQuery */:
|
|
60559
60564
|
const entityName = node2.exprName;
|
|
60560
60565
|
const firstIdentifier = getFirstIdentifier(entityName);
|
|
60561
|
-
|
|
60562
|
-
|
|
60563
|
-
|
|
60564
|
-
|
|
60565
|
-
|
|
60566
|
-
|
|
60567
|
-
|
|
60568
|
-
|
|
60569
|
-
|
|
60570
|
-
|
|
60571
|
-
|
|
60572
|
-
|
|
60566
|
+
if (!isThisIdentifier(firstIdentifier)) {
|
|
60567
|
+
const firstIdentifierSymbol = getResolvedSymbol(firstIdentifier);
|
|
60568
|
+
const tpDeclaration = tp.symbol.declarations[0];
|
|
60569
|
+
const tpScope = tpDeclaration.kind === 167 /* TypeParameter */ ? tpDeclaration.parent : (
|
|
60570
|
+
// Type parameter is a regular type parameter, e.g. foo<T>
|
|
60571
|
+
tp.isThisType ? tpDeclaration : (
|
|
60572
|
+
// Type parameter is the this type, and its declaration is the class declaration.
|
|
60573
|
+
void 0
|
|
60574
|
+
)
|
|
60575
|
+
);
|
|
60576
|
+
if (firstIdentifierSymbol.declarations && tpScope) {
|
|
60577
|
+
return some(firstIdentifierSymbol.declarations, (idDecl) => isNodeDescendantOf(idDecl, tpScope)) || some(node2.typeArguments, containsReference);
|
|
60578
|
+
}
|
|
60573
60579
|
}
|
|
60574
60580
|
return true;
|
|
60575
60581
|
case 173 /* MethodDeclaration */:
|
|
@@ -60623,6 +60629,9 @@ ${lanes.join("\n")}
|
|
|
60623
60629
|
const elementFlags = tupleType.target.elementFlags;
|
|
60624
60630
|
const elementTypes = map(getElementTypes(tupleType), (t, i) => {
|
|
60625
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
|
+
}
|
|
60626
60635
|
return instantiateMappedType(mappedType, prependTypeMapping(typeVariable, singleton, mapper));
|
|
60627
60636
|
});
|
|
60628
60637
|
const newReadonly = getModifiedReadonlyState(tupleType.target.readonly, getMappedTypeModifiers(mappedType));
|
|
@@ -64411,7 +64420,7 @@ ${lanes.join("\n")}
|
|
|
64411
64420
|
}
|
|
64412
64421
|
function getRecursionIdentity(type) {
|
|
64413
64422
|
if (type.flags & 524288 /* Object */ && !isObjectOrArrayLiteralType(type)) {
|
|
64414
|
-
if (getObjectFlags(type)
|
|
64423
|
+
if (getObjectFlags(type) & 4 /* Reference */ && type.node) {
|
|
64415
64424
|
return type.node;
|
|
64416
64425
|
}
|
|
64417
64426
|
if (type.symbol && !(getObjectFlags(type) & 16 /* Anonymous */ && type.symbol.flags & 32 /* Class */)) {
|
|
@@ -65186,6 +65195,8 @@ ${lanes.join("\n")}
|
|
|
65186
65195
|
return context && context.mapper;
|
|
65187
65196
|
}
|
|
65188
65197
|
function couldContainTypeVariables(type) {
|
|
65198
|
+
if (type.flags & 67359327 /* Intrinsic */)
|
|
65199
|
+
return false;
|
|
65189
65200
|
const objectFlags = getObjectFlags(type);
|
|
65190
65201
|
if (objectFlags & 524288 /* CouldContainTypeVariablesComputed */) {
|
|
65191
65202
|
return !!(objectFlags & 1048576 /* CouldContainTypeVariables */);
|
|
@@ -72113,7 +72124,7 @@ ${lanes.join("\n")}
|
|
|
72113
72124
|
}
|
|
72114
72125
|
const typeArgument = typeArgumentTypes[i];
|
|
72115
72126
|
if (!checkTypeAssignableTo(
|
|
72116
|
-
|
|
72127
|
+
typeArgument,
|
|
72117
72128
|
getTypeWithThisArgument(instantiateType(constraint, mapper), typeArgument),
|
|
72118
72129
|
reportErrors2 ? typeArgumentNodes[i] : void 0,
|
|
72119
72130
|
typeArgumentHeadMessage,
|
|
@@ -76679,7 +76690,7 @@ ${lanes.join("\n")}
|
|
|
76679
76690
|
if (getIsolatedModules(compilerOptions)) {
|
|
76680
76691
|
Debug.assert(!!(type.symbol.flags & 128 /* ConstEnum */));
|
|
76681
76692
|
const constEnumDeclaration = type.symbol.valueDeclaration;
|
|
76682
|
-
if (constEnumDeclaration.flags & 16777216 /* Ambient */) {
|
|
76693
|
+
if (constEnumDeclaration.flags & 16777216 /* Ambient */ && !isValidTypeOnlyAliasUseSite(node)) {
|
|
76683
76694
|
error(node, Diagnostics.Cannot_access_ambient_const_enums_when_0_is_enabled, isolatedModulesLikeFlagName);
|
|
76684
76695
|
}
|
|
76685
76696
|
}
|
|
@@ -77108,6 +77119,9 @@ ${lanes.join("\n")}
|
|
|
77108
77119
|
case "length":
|
|
77109
77120
|
case "caller":
|
|
77110
77121
|
case "arguments":
|
|
77122
|
+
if (compilerOptions.useDefineForClassFields) {
|
|
77123
|
+
break;
|
|
77124
|
+
}
|
|
77111
77125
|
case "prototype":
|
|
77112
77126
|
const message = Diagnostics.Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1;
|
|
77113
77127
|
const className = getNameOfSymbolAsWritten(getSymbolOfDeclaration(node));
|
|
@@ -84114,7 +84128,7 @@ ${lanes.join("\n")}
|
|
|
84114
84128
|
if (requestedExternalEmitHelperNames.has(name))
|
|
84115
84129
|
continue;
|
|
84116
84130
|
requestedExternalEmitHelperNames.add(name);
|
|
84117
|
-
const symbol = getSymbol2(helpersModule
|
|
84131
|
+
const symbol = getSymbol2(getExportsOfModule(helpersModule), escapeLeadingUnderscores(name), 111551 /* Value */);
|
|
84118
84132
|
if (!symbol) {
|
|
84119
84133
|
error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name);
|
|
84120
84134
|
} else if (helper & 524288 /* ClassPrivateFieldGet */) {
|
|
@@ -134878,10 +134892,9 @@ ${lanes.join("\n")}
|
|
|
134878
134892
|
|
|
134879
134893
|
// src/services/refactors/moveToFile.ts
|
|
134880
134894
|
function doChange4(context, oldFile, targetFile, program, toMove, changes, host, preferences) {
|
|
134881
|
-
var _a;
|
|
134882
134895
|
const checker = program.getTypeChecker();
|
|
134883
134896
|
const usage = getUsageInfo(oldFile, toMove.all, checker);
|
|
134884
|
-
if (!host.fileExists(targetFile)
|
|
134897
|
+
if (!host.fileExists(targetFile)) {
|
|
134885
134898
|
changes.createNewFile(oldFile, targetFile, getNewStatementsAndRemoveFromOldFile2(oldFile, targetFile, usage, changes, toMove, program, host, preferences));
|
|
134886
134899
|
addNewFileToTsconfig(program, changes, oldFile.fileName, targetFile, hostGetCanonicalFileName(host));
|
|
134887
134900
|
} else {
|
|
@@ -134919,6 +134932,13 @@ ${lanes.join("\n")}
|
|
|
134919
134932
|
if (typeof targetFile !== "string") {
|
|
134920
134933
|
if (targetFile.statements.length > 0) {
|
|
134921
134934
|
changes.insertNodesAfter(targetFile, targetFile.statements[targetFile.statements.length - 1], body);
|
|
134935
|
+
} else {
|
|
134936
|
+
changes.insertNodesAtEndOfFile(
|
|
134937
|
+
targetFile,
|
|
134938
|
+
body,
|
|
134939
|
+
/*blankLineBetween*/
|
|
134940
|
+
false
|
|
134941
|
+
);
|
|
134922
134942
|
}
|
|
134923
134943
|
if (imports.length > 0) {
|
|
134924
134944
|
insertImports(
|
|
@@ -135737,8 +135757,12 @@ ${lanes.join("\n")}
|
|
|
135737
135757
|
Debug.assert(actionName2 === refactorNameForMoveToFile, "Wrong refactor invoked");
|
|
135738
135758
|
const statements = Debug.checkDefined(getStatementsToMove(context));
|
|
135739
135759
|
Debug.assert(interactiveRefactorArguments, "No interactive refactor arguments available");
|
|
135740
|
-
const
|
|
135741
|
-
|
|
135760
|
+
const targetFile = interactiveRefactorArguments.targetFile;
|
|
135761
|
+
if (hasJSFileExtension(targetFile) || hasTSFileExtension(targetFile)) {
|
|
135762
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange4(context, context.file, interactiveRefactorArguments.targetFile, context.program, statements, t, context.host, context.preferences));
|
|
135763
|
+
return { edits, renameFilename: void 0, renameLocation: void 0 };
|
|
135764
|
+
}
|
|
135765
|
+
return { edits: [], renameFilename: void 0, renameLocation: void 0, notApplicableReason: getLocaleSpecificMessage(Diagnostics.Cannot_move_to_file_selected_file_is_invalid) };
|
|
135742
135766
|
}
|
|
135743
135767
|
});
|
|
135744
135768
|
}
|
|
@@ -152220,7 +152244,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
152220
152244
|
false
|
|
152221
152245
|
);
|
|
152222
152246
|
const effectiveModifierFlags = declaration ? getEffectiveModifierFlags(declaration) : 0 /* None */;
|
|
152223
|
-
let modifierFlags = effectiveModifierFlags &
|
|
152247
|
+
let modifierFlags = effectiveModifierFlags & 32 /* Static */;
|
|
152248
|
+
modifierFlags |= effectiveModifierFlags & 4 /* Public */ ? 4 /* Public */ : effectiveModifierFlags & 16 /* Protected */ ? 16 /* Protected */ : 0 /* None */;
|
|
152224
152249
|
if (declaration && isAutoAccessorPropertyDeclaration(declaration)) {
|
|
152225
152250
|
modifierFlags |= 128 /* Accessor */;
|
|
152226
152251
|
}
|
|
@@ -154977,6 +155002,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154977
155002
|
}
|
|
154978
155003
|
function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, position, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag, includeSymbol) {
|
|
154979
155004
|
let insertText;
|
|
155005
|
+
let filterText;
|
|
154980
155006
|
let replacementSpan = getReplacementSpanForContextToken(replacementToken);
|
|
154981
155007
|
let data;
|
|
154982
155008
|
let isSnippet;
|
|
@@ -155035,11 +155061,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155035
155061
|
}
|
|
155036
155062
|
if (preferences.includeCompletionsWithClassMemberSnippets && preferences.includeCompletionsWithInsertText && completionKind === 3 /* MemberLike */ && isClassLikeMemberCompletion(symbol, location, sourceFile)) {
|
|
155037
155063
|
let importAdder;
|
|
155038
|
-
|
|
155039
|
-
|
|
155040
|
-
|
|
155041
|
-
|
|
155042
|
-
|
|
155064
|
+
const memberCompletionEntry = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, position, contextToken, formatContext);
|
|
155065
|
+
if (memberCompletionEntry) {
|
|
155066
|
+
({ insertText, filterText, isSnippet, importAdder } = memberCompletionEntry);
|
|
155067
|
+
if (importAdder == null ? void 0 : importAdder.hasFixes()) {
|
|
155068
|
+
hasAction = true;
|
|
155069
|
+
source = "ClassMemberSnippet/" /* ClassMemberSnippet */;
|
|
155070
|
+
}
|
|
155071
|
+
} else {
|
|
155072
|
+
return void 0;
|
|
155043
155073
|
}
|
|
155044
155074
|
}
|
|
155045
155075
|
if (origin && originIsObjectLiteralMethod(origin)) {
|
|
@@ -155083,6 +155113,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155083
155113
|
hasAction: hasAction ? true : void 0,
|
|
155084
155114
|
isRecommended: isRecommendedCompletionMatch(symbol, recommendedCompletion, typeChecker) || void 0,
|
|
155085
155115
|
insertText,
|
|
155116
|
+
filterText,
|
|
155086
155117
|
replacementSpan,
|
|
155087
155118
|
sourceDisplay,
|
|
155088
155119
|
labelDetails,
|
|
@@ -155103,11 +155134,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155103
155134
|
function getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, position, contextToken, formatContext) {
|
|
155104
155135
|
const classLikeDeclaration = findAncestor(location, isClassLike);
|
|
155105
155136
|
if (!classLikeDeclaration) {
|
|
155106
|
-
return
|
|
155137
|
+
return void 0;
|
|
155107
155138
|
}
|
|
155108
155139
|
let isSnippet;
|
|
155109
|
-
let replacementSpan;
|
|
155110
155140
|
let insertText = name;
|
|
155141
|
+
const filterText = name;
|
|
155111
155142
|
const checker = program.getTypeChecker();
|
|
155112
155143
|
const sourceFile = location.getSourceFile();
|
|
155113
155144
|
const printer = createSnippetPrinter({
|
|
@@ -155136,9 +155167,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155136
155167
|
);
|
|
155137
155168
|
}
|
|
155138
155169
|
let modifiers = 0 /* None */;
|
|
155139
|
-
const { modifiers: presentModifiers,
|
|
155140
|
-
const isAbstract =
|
|
155141
|
-
|
|
155170
|
+
const { modifiers: presentModifiers, range: eraseRange, decorators: presentDecorators } = getPresentModifiers(contextToken, sourceFile, position);
|
|
155171
|
+
const isAbstract = presentModifiers & 256 /* Abstract */ && classLikeDeclaration.modifierFlagsCache & 256 /* Abstract */;
|
|
155172
|
+
let completionNodes = [];
|
|
155142
155173
|
ts_codefix_exports.addNewNodeForMemberSymbol(
|
|
155143
155174
|
symbol,
|
|
155144
155175
|
classLikeDeclaration,
|
|
@@ -155162,18 +155193,42 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155162
155193
|
requiredModifiers |= 16384 /* Override */;
|
|
155163
155194
|
}
|
|
155164
155195
|
if (!completionNodes.length) {
|
|
155165
|
-
modifiers = node.modifierFlagsCache | requiredModifiers
|
|
155196
|
+
modifiers = node.modifierFlagsCache | requiredModifiers;
|
|
155166
155197
|
}
|
|
155167
155198
|
node = factory.updateModifiers(node, modifiers);
|
|
155168
155199
|
completionNodes.push(node);
|
|
155169
155200
|
},
|
|
155170
155201
|
body,
|
|
155171
155202
|
ts_codefix_exports.PreserveOptionalFlags.Property,
|
|
155172
|
-
isAbstract
|
|
155203
|
+
!!isAbstract
|
|
155173
155204
|
);
|
|
155174
155205
|
if (completionNodes.length) {
|
|
155206
|
+
const isMethod = symbol.flags & 8192 /* Method */;
|
|
155207
|
+
let allowedModifiers = modifiers | 16384 /* Override */ | 4 /* Public */;
|
|
155208
|
+
if (!isMethod) {
|
|
155209
|
+
allowedModifiers |= 2 /* Ambient */ | 64 /* Readonly */;
|
|
155210
|
+
} else {
|
|
155211
|
+
allowedModifiers |= 512 /* Async */;
|
|
155212
|
+
}
|
|
155213
|
+
const allowedAndPresent = presentModifiers & allowedModifiers;
|
|
155214
|
+
if (presentModifiers & ~allowedModifiers) {
|
|
155215
|
+
return void 0;
|
|
155216
|
+
}
|
|
155217
|
+
if (modifiers & 16 /* Protected */ && allowedAndPresent & 4 /* Public */) {
|
|
155218
|
+
modifiers &= ~16 /* Protected */;
|
|
155219
|
+
}
|
|
155220
|
+
if (allowedAndPresent !== 0 /* None */ && !(allowedAndPresent & 4 /* Public */)) {
|
|
155221
|
+
modifiers &= ~4 /* Public */;
|
|
155222
|
+
}
|
|
155223
|
+
modifiers |= allowedAndPresent;
|
|
155224
|
+
completionNodes = completionNodes.map((node) => factory.updateModifiers(node, modifiers));
|
|
155225
|
+
if (presentDecorators == null ? void 0 : presentDecorators.length) {
|
|
155226
|
+
const lastNode = completionNodes[completionNodes.length - 1];
|
|
155227
|
+
if (canHaveDecorators(lastNode)) {
|
|
155228
|
+
completionNodes[completionNodes.length - 1] = factory.updateModifierLike(lastNode, presentDecorators.concat(getModifiers(lastNode) || []));
|
|
155229
|
+
}
|
|
155230
|
+
}
|
|
155175
155231
|
const format = 1 /* MultiLine */ | 131072 /* NoTrailingNewLine */;
|
|
155176
|
-
replacementSpan = modifiersSpan;
|
|
155177
155232
|
if (formatContext) {
|
|
155178
155233
|
insertText = printer.printAndFormatSnippetList(
|
|
155179
155234
|
format,
|
|
@@ -155189,24 +155244,29 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155189
155244
|
);
|
|
155190
155245
|
}
|
|
155191
155246
|
}
|
|
155192
|
-
return { insertText, isSnippet, importAdder,
|
|
155247
|
+
return { insertText, filterText, isSnippet, importAdder, eraseRange };
|
|
155193
155248
|
}
|
|
155194
155249
|
function getPresentModifiers(contextToken, sourceFile, position) {
|
|
155195
155250
|
if (!contextToken || getLineAndCharacterOfPosition(sourceFile, position).line > getLineAndCharacterOfPosition(sourceFile, contextToken.getEnd()).line) {
|
|
155196
155251
|
return { modifiers: 0 /* None */ };
|
|
155197
155252
|
}
|
|
155198
155253
|
let modifiers = 0 /* None */;
|
|
155199
|
-
let
|
|
155254
|
+
let decorators;
|
|
155200
155255
|
let contextMod;
|
|
155201
|
-
|
|
155202
|
-
|
|
155203
|
-
span = createTextSpanFromNode(contextToken);
|
|
155204
|
-
}
|
|
155205
|
-
if (isPropertyDeclaration(contextToken.parent)) {
|
|
155256
|
+
const range = { pos: position, end: position };
|
|
155257
|
+
if (isPropertyDeclaration(contextToken.parent) && contextToken.parent.modifiers) {
|
|
155206
155258
|
modifiers |= modifiersToFlags(contextToken.parent.modifiers) & 126975 /* Modifier */;
|
|
155207
|
-
|
|
155259
|
+
decorators = contextToken.parent.modifiers.filter(isDecorator) || [];
|
|
155260
|
+
range.pos = Math.min(range.pos, contextToken.parent.modifiers.pos);
|
|
155208
155261
|
}
|
|
155209
|
-
|
|
155262
|
+
if (contextMod = isModifierLike2(contextToken)) {
|
|
155263
|
+
const contextModifierFlag = modifierToFlag(contextMod);
|
|
155264
|
+
if (!(modifiers & contextModifierFlag)) {
|
|
155265
|
+
modifiers |= contextModifierFlag;
|
|
155266
|
+
range.pos = Math.min(range.pos, contextToken.pos);
|
|
155267
|
+
}
|
|
155268
|
+
}
|
|
155269
|
+
return { modifiers, decorators, range: range.pos !== position ? range : void 0 };
|
|
155210
155270
|
}
|
|
155211
155271
|
function isModifierLike2(node) {
|
|
155212
155272
|
if (isModifier(node)) {
|
|
@@ -155829,7 +155889,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155829
155889
|
}
|
|
155830
155890
|
}
|
|
155831
155891
|
if (source === "ClassMemberSnippet/" /* ClassMemberSnippet */) {
|
|
155832
|
-
const { importAdder } = getEntryForMemberCompletion(
|
|
155892
|
+
const { importAdder, eraseRange } = getEntryForMemberCompletion(
|
|
155833
155893
|
host,
|
|
155834
155894
|
program,
|
|
155835
155895
|
compilerOptions,
|
|
@@ -155841,10 +155901,17 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155841
155901
|
contextToken,
|
|
155842
155902
|
formatContext
|
|
155843
155903
|
);
|
|
155844
|
-
if (importAdder) {
|
|
155904
|
+
if (importAdder || eraseRange) {
|
|
155845
155905
|
const changes = ts_textChanges_exports.ChangeTracker.with(
|
|
155846
155906
|
{ host, formatContext, preferences },
|
|
155847
|
-
|
|
155907
|
+
(tracker) => {
|
|
155908
|
+
if (importAdder) {
|
|
155909
|
+
importAdder.writeFixes(tracker);
|
|
155910
|
+
}
|
|
155911
|
+
if (eraseRange) {
|
|
155912
|
+
tracker.deleteRange(sourceFile, eraseRange);
|
|
155913
|
+
}
|
|
155914
|
+
}
|
|
155848
155915
|
);
|
|
155849
155916
|
return {
|
|
155850
155917
|
sourceDisplay: void 0,
|
|
@@ -165827,6 +165894,17 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
165827
165894
|
this.insertNodeAt(sourceFile, pos, insert, options);
|
|
165828
165895
|
}
|
|
165829
165896
|
}
|
|
165897
|
+
insertNodesAtEndOfFile(sourceFile, newNodes, blankLineBetween) {
|
|
165898
|
+
this.insertAtEndOfFile(sourceFile, newNodes, blankLineBetween);
|
|
165899
|
+
}
|
|
165900
|
+
insertAtEndOfFile(sourceFile, insert, blankLineBetween) {
|
|
165901
|
+
const pos = sourceFile.end + 1;
|
|
165902
|
+
const options = {
|
|
165903
|
+
prefix: this.newLineCharacter,
|
|
165904
|
+
suffix: this.newLineCharacter + (blankLineBetween ? this.newLineCharacter : "")
|
|
165905
|
+
};
|
|
165906
|
+
this.insertNodesAt(sourceFile, pos, insert, options);
|
|
165907
|
+
}
|
|
165830
165908
|
insertStatementsInNewFile(fileName, statements, oldFile) {
|
|
165831
165909
|
if (!this.newFileChanges) {
|
|
165832
165910
|
this.newFileChanges = createMultiMap();
|
|
@@ -179117,6 +179195,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
179117
179195
|
kindModifiers,
|
|
179118
179196
|
sortText,
|
|
179119
179197
|
insertText,
|
|
179198
|
+
filterText,
|
|
179120
179199
|
replacementSpan,
|
|
179121
179200
|
hasAction,
|
|
179122
179201
|
source,
|
|
@@ -179135,6 +179214,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
179135
179214
|
kindModifiers,
|
|
179136
179215
|
sortText,
|
|
179137
179216
|
insertText,
|
|
179217
|
+
filterText,
|
|
179138
179218
|
replacementSpan: convertedSpan,
|
|
179139
179219
|
isSnippet,
|
|
179140
179220
|
hasAction: hasAction || void 0,
|
|
@@ -179506,7 +179586,8 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
179506
179586
|
return {
|
|
179507
179587
|
renameLocation: mappedRenameLocation,
|
|
179508
179588
|
renameFilename,
|
|
179509
|
-
edits: this.mapTextChangesToCodeEdits(edits)
|
|
179589
|
+
edits: this.mapTextChangesToCodeEdits(edits),
|
|
179590
|
+
notApplicableReason: result.notApplicableReason
|
|
179510
179591
|
};
|
|
179511
179592
|
}
|
|
179512
179593
|
return result;
|
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[];
|
|
@@ -6517,6 +6517,7 @@ declare namespace ts {
|
|
|
6517
6517
|
renameFilename?: string;
|
|
6518
6518
|
renameLocation?: number;
|
|
6519
6519
|
commands?: CodeActionCommand[];
|
|
6520
|
+
notApplicableReason?: string;
|
|
6520
6521
|
}
|
|
6521
6522
|
type RefactorTriggerReason = "implicit" | "invoked";
|
|
6522
6523
|
interface TextInsertion {
|
|
@@ -6838,6 +6839,7 @@ declare namespace ts {
|
|
|
6838
6839
|
kindModifiers?: string;
|
|
6839
6840
|
sortText: string;
|
|
6840
6841
|
insertText?: string;
|
|
6842
|
+
filterText?: string;
|
|
6841
6843
|
isSnippet?: true;
|
|
6842
6844
|
/**
|
|
6843
6845
|
* An optional span that indicates the text to be replaced by this completion item.
|