@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/tsserver.js
CHANGED
|
@@ -2304,7 +2304,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2304
2304
|
|
|
2305
2305
|
// src/compiler/corePublic.ts
|
|
2306
2306
|
var versionMajorMinor = "5.2";
|
|
2307
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2307
|
+
var version = `${versionMajorMinor}.0-insiders.20230524`;
|
|
2308
2308
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2309
2309
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2310
2310
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -11212,6 +11212,7 @@ var Diagnostics = {
|
|
|
11212
11212
|
Convert_typedef_to_TypeScript_type: diag(95176, 3 /* Message */, "Convert_typedef_to_TypeScript_type_95176", "Convert typedef to TypeScript type."),
|
|
11213
11213
|
Convert_all_typedef_to_TypeScript_types: diag(95177, 3 /* Message */, "Convert_all_typedef_to_TypeScript_types_95177", "Convert all typedef to TypeScript types."),
|
|
11214
11214
|
Move_to_file: diag(95178, 3 /* Message */, "Move_to_file_95178", "Move to file"),
|
|
11215
|
+
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"),
|
|
11215
11216
|
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."),
|
|
11216
11217
|
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'."),
|
|
11217
11218
|
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?"),
|
|
@@ -22754,7 +22755,8 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
22754
22755
|
ensureUseStrict,
|
|
22755
22756
|
liftToBlock,
|
|
22756
22757
|
mergeLexicalEnvironment,
|
|
22757
|
-
updateModifiers
|
|
22758
|
+
updateModifiers,
|
|
22759
|
+
updateModifierLike
|
|
22758
22760
|
};
|
|
22759
22761
|
forEach(nodeFactoryPatchers, (fn) => fn(factory2));
|
|
22760
22762
|
return factory2;
|
|
@@ -26236,6 +26238,9 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
26236
26238
|
}
|
|
26237
26239
|
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);
|
|
26238
26240
|
}
|
|
26241
|
+
function updateModifierLike(node, modifierArray) {
|
|
26242
|
+
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);
|
|
26243
|
+
}
|
|
26239
26244
|
function asNodeArray(array) {
|
|
26240
26245
|
return array ? createNodeArray(array) : void 0;
|
|
26241
26246
|
}
|
|
@@ -27617,10 +27622,10 @@ var esDecorateHelper = {
|
|
|
27617
27622
|
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
27618
27623
|
if (_ = accept(result.get)) descriptor.get = _;
|
|
27619
27624
|
if (_ = accept(result.set)) descriptor.set = _;
|
|
27620
|
-
if (_ = accept(result.init)) initializers.
|
|
27625
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
27621
27626
|
}
|
|
27622
27627
|
else if (_ = accept(result)) {
|
|
27623
|
-
if (kind === "field") initializers.
|
|
27628
|
+
if (kind === "field") initializers.unshift(_);
|
|
27624
27629
|
else descriptor[key] = _;
|
|
27625
27630
|
}
|
|
27626
27631
|
}
|
|
@@ -37748,6 +37753,7 @@ var libEntries = [
|
|
|
37748
37753
|
["es2015.symbol", "lib.es2015.symbol.d.ts"],
|
|
37749
37754
|
["es2015.symbol.wellknown", "lib.es2015.symbol.wellknown.d.ts"],
|
|
37750
37755
|
["es2016.array.include", "lib.es2016.array.include.d.ts"],
|
|
37756
|
+
["es2017.date", "lib.es2017.date.d.ts"],
|
|
37751
37757
|
["es2017.object", "lib.es2017.object.d.ts"],
|
|
37752
37758
|
["es2017.sharedmemory", "lib.es2017.sharedmemory.d.ts"],
|
|
37753
37759
|
["es2017.string", "lib.es2017.string.d.ts"],
|
|
@@ -52547,32 +52553,34 @@ function createTypeChecker(host) {
|
|
|
52547
52553
|
const methodDeclaration = signatureToSignatureDeclarationHelper(signature, 172 /* MethodSignature */, context, { name: propertyName, questionToken: optionalToken });
|
|
52548
52554
|
typeElements.push(preserveCommentsOn(methodDeclaration));
|
|
52549
52555
|
}
|
|
52556
|
+
if (signatures.length || !optionalToken) {
|
|
52557
|
+
return;
|
|
52558
|
+
}
|
|
52559
|
+
}
|
|
52560
|
+
let propertyTypeNode;
|
|
52561
|
+
if (shouldUsePlaceholderForProperty(propertySymbol, context)) {
|
|
52562
|
+
propertyTypeNode = createElidedInformationPlaceholder(context);
|
|
52550
52563
|
} else {
|
|
52551
|
-
|
|
52552
|
-
|
|
52553
|
-
|
|
52554
|
-
} else {
|
|
52555
|
-
if (propertyIsReverseMapped) {
|
|
52556
|
-
context.reverseMappedStack || (context.reverseMappedStack = []);
|
|
52557
|
-
context.reverseMappedStack.push(propertySymbol);
|
|
52558
|
-
}
|
|
52559
|
-
propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
52560
|
-
if (propertyIsReverseMapped) {
|
|
52561
|
-
context.reverseMappedStack.pop();
|
|
52562
|
-
}
|
|
52564
|
+
if (propertyIsReverseMapped) {
|
|
52565
|
+
context.reverseMappedStack || (context.reverseMappedStack = []);
|
|
52566
|
+
context.reverseMappedStack.push(propertySymbol);
|
|
52563
52567
|
}
|
|
52564
|
-
|
|
52565
|
-
if (
|
|
52566
|
-
context.
|
|
52568
|
+
propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
52569
|
+
if (propertyIsReverseMapped) {
|
|
52570
|
+
context.reverseMappedStack.pop();
|
|
52567
52571
|
}
|
|
52568
|
-
const propertySignature = factory.createPropertySignature(
|
|
52569
|
-
modifiers,
|
|
52570
|
-
propertyName,
|
|
52571
|
-
optionalToken,
|
|
52572
|
-
propertyTypeNode
|
|
52573
|
-
);
|
|
52574
|
-
typeElements.push(preserveCommentsOn(propertySignature));
|
|
52575
52572
|
}
|
|
52573
|
+
const modifiers = isReadonlySymbol(propertySymbol) ? [factory.createToken(148 /* ReadonlyKeyword */)] : void 0;
|
|
52574
|
+
if (modifiers) {
|
|
52575
|
+
context.approximateLength += 9;
|
|
52576
|
+
}
|
|
52577
|
+
const propertySignature = factory.createPropertySignature(
|
|
52578
|
+
modifiers,
|
|
52579
|
+
propertyName,
|
|
52580
|
+
optionalToken,
|
|
52581
|
+
propertyTypeNode
|
|
52582
|
+
);
|
|
52583
|
+
typeElements.push(preserveCommentsOn(propertySignature));
|
|
52576
52584
|
function preserveCommentsOn(node) {
|
|
52577
52585
|
var _a2;
|
|
52578
52586
|
if (some(propertySymbol.declarations, (d) => d.kind === 354 /* JSDocPropertyTag */)) {
|
|
@@ -58635,7 +58643,7 @@ function createTypeChecker(host) {
|
|
|
58635
58643
|
} else if (type !== firstType) {
|
|
58636
58644
|
checkFlags |= 64 /* HasNonUniformType */;
|
|
58637
58645
|
}
|
|
58638
|
-
if (isLiteralType(type) || isPatternLiteralType(type)
|
|
58646
|
+
if (isLiteralType(type) || isPatternLiteralType(type)) {
|
|
58639
58647
|
checkFlags |= 128 /* HasLiteralType */;
|
|
58640
58648
|
}
|
|
58641
58649
|
if (type.flags & 131072 /* Never */ && type !== uniqueLiteralType) {
|
|
@@ -60862,31 +60870,28 @@ function createTypeChecker(host) {
|
|
|
60862
60870
|
return getUnionTypeFromSortedList(typeSet, objectFlags, aliasSymbol, aliasTypeArguments, origin);
|
|
60863
60871
|
}
|
|
60864
60872
|
function getUnionOrIntersectionTypePredicate(signatures, kind) {
|
|
60865
|
-
let
|
|
60873
|
+
let last2;
|
|
60866
60874
|
const types = [];
|
|
60867
60875
|
for (const sig of signatures) {
|
|
60868
60876
|
const pred = getTypePredicateOfSignature(sig);
|
|
60869
|
-
if (
|
|
60870
|
-
if (kind !==
|
|
60871
|
-
continue;
|
|
60872
|
-
} else {
|
|
60873
|
-
return;
|
|
60874
|
-
}
|
|
60875
|
-
}
|
|
60876
|
-
if (first2) {
|
|
60877
|
-
if (!typePredicateKindsMatch(first2, pred)) {
|
|
60877
|
+
if (pred) {
|
|
60878
|
+
if (pred.kind !== 0 /* This */ && pred.kind !== 1 /* Identifier */ || last2 && !typePredicateKindsMatch(last2, pred)) {
|
|
60878
60879
|
return void 0;
|
|
60879
60880
|
}
|
|
60881
|
+
last2 = pred;
|
|
60882
|
+
types.push(pred.type);
|
|
60880
60883
|
} else {
|
|
60881
|
-
|
|
60884
|
+
const returnType = kind !== 2097152 /* Intersection */ ? getReturnTypeOfSignature(sig) : void 0;
|
|
60885
|
+
if (returnType !== falseType && returnType !== regularFalseType) {
|
|
60886
|
+
return void 0;
|
|
60887
|
+
}
|
|
60882
60888
|
}
|
|
60883
|
-
types.push(pred.type);
|
|
60884
60889
|
}
|
|
60885
|
-
if (!
|
|
60890
|
+
if (!last2) {
|
|
60886
60891
|
return void 0;
|
|
60887
60892
|
}
|
|
60888
60893
|
const compositeType = getUnionOrIntersectionType(types, kind);
|
|
60889
|
-
return createTypePredicate(
|
|
60894
|
+
return createTypePredicate(last2.kind, last2.parameterName, last2.parameterIndex, compositeType);
|
|
60890
60895
|
}
|
|
60891
60896
|
function typePredicateKindsMatch(a, b) {
|
|
60892
60897
|
return a.kind === b.kind && a.parameterIndex === b.parameterIndex;
|
|
@@ -61928,9 +61933,9 @@ function createTypeChecker(host) {
|
|
|
61928
61933
|
);
|
|
61929
61934
|
if (freshMapper) {
|
|
61930
61935
|
const freshCombinedMapper = combineTypeMappers(mapper, freshMapper);
|
|
61931
|
-
for (
|
|
61932
|
-
if (root.inferTypeParameters
|
|
61933
|
-
|
|
61936
|
+
for (let i = 0; i < freshParams.length; i++) {
|
|
61937
|
+
if (freshParams[i] !== root.inferTypeParameters[i]) {
|
|
61938
|
+
freshParams[i].mapper = freshCombinedMapper;
|
|
61934
61939
|
}
|
|
61935
61940
|
}
|
|
61936
61941
|
}
|
|
@@ -62767,18 +62772,19 @@ function createTypeChecker(host) {
|
|
|
62767
62772
|
case 185 /* TypeQuery */:
|
|
62768
62773
|
const entityName = node2.exprName;
|
|
62769
62774
|
const firstIdentifier = getFirstIdentifier(entityName);
|
|
62770
|
-
|
|
62771
|
-
|
|
62772
|
-
|
|
62773
|
-
|
|
62774
|
-
|
|
62775
|
-
|
|
62776
|
-
|
|
62777
|
-
|
|
62778
|
-
|
|
62779
|
-
|
|
62780
|
-
|
|
62781
|
-
|
|
62775
|
+
if (!isThisIdentifier(firstIdentifier)) {
|
|
62776
|
+
const firstIdentifierSymbol = getResolvedSymbol(firstIdentifier);
|
|
62777
|
+
const tpDeclaration = tp.symbol.declarations[0];
|
|
62778
|
+
const tpScope = tpDeclaration.kind === 167 /* TypeParameter */ ? tpDeclaration.parent : (
|
|
62779
|
+
// Type parameter is a regular type parameter, e.g. foo<T>
|
|
62780
|
+
tp.isThisType ? tpDeclaration : (
|
|
62781
|
+
// Type parameter is the this type, and its declaration is the class declaration.
|
|
62782
|
+
void 0
|
|
62783
|
+
)
|
|
62784
|
+
);
|
|
62785
|
+
if (firstIdentifierSymbol.declarations && tpScope) {
|
|
62786
|
+
return some(firstIdentifierSymbol.declarations, (idDecl) => isNodeDescendantOf(idDecl, tpScope)) || some(node2.typeArguments, containsReference);
|
|
62787
|
+
}
|
|
62782
62788
|
}
|
|
62783
62789
|
return true;
|
|
62784
62790
|
case 173 /* MethodDeclaration */:
|
|
@@ -62832,6 +62838,9 @@ function createTypeChecker(host) {
|
|
|
62832
62838
|
const elementFlags = tupleType.target.elementFlags;
|
|
62833
62839
|
const elementTypes = map(getElementTypes(tupleType), (t, i) => {
|
|
62834
62840
|
const singleton = elementFlags[i] & 8 /* Variadic */ ? t : elementFlags[i] & 4 /* Rest */ ? createArrayType(t) : createTupleType([t], [elementFlags[i]]);
|
|
62841
|
+
if (singleton === typeVariable) {
|
|
62842
|
+
return mappedType;
|
|
62843
|
+
}
|
|
62835
62844
|
return instantiateMappedType(mappedType, prependTypeMapping(typeVariable, singleton, mapper));
|
|
62836
62845
|
});
|
|
62837
62846
|
const newReadonly = getModifiedReadonlyState(tupleType.target.readonly, getMappedTypeModifiers(mappedType));
|
|
@@ -66620,7 +66629,7 @@ function createTypeChecker(host) {
|
|
|
66620
66629
|
}
|
|
66621
66630
|
function getRecursionIdentity(type) {
|
|
66622
66631
|
if (type.flags & 524288 /* Object */ && !isObjectOrArrayLiteralType(type)) {
|
|
66623
|
-
if (getObjectFlags(type)
|
|
66632
|
+
if (getObjectFlags(type) & 4 /* Reference */ && type.node) {
|
|
66624
66633
|
return type.node;
|
|
66625
66634
|
}
|
|
66626
66635
|
if (type.symbol && !(getObjectFlags(type) & 16 /* Anonymous */ && type.symbol.flags & 32 /* Class */)) {
|
|
@@ -67395,6 +67404,8 @@ function createTypeChecker(host) {
|
|
|
67395
67404
|
return context && context.mapper;
|
|
67396
67405
|
}
|
|
67397
67406
|
function couldContainTypeVariables(type) {
|
|
67407
|
+
if (type.flags & 67359327 /* Intrinsic */)
|
|
67408
|
+
return false;
|
|
67398
67409
|
const objectFlags = getObjectFlags(type);
|
|
67399
67410
|
if (objectFlags & 524288 /* CouldContainTypeVariablesComputed */) {
|
|
67400
67411
|
return !!(objectFlags & 1048576 /* CouldContainTypeVariables */);
|
|
@@ -74322,7 +74333,7 @@ function createTypeChecker(host) {
|
|
|
74322
74333
|
}
|
|
74323
74334
|
const typeArgument = typeArgumentTypes[i];
|
|
74324
74335
|
if (!checkTypeAssignableTo(
|
|
74325
|
-
|
|
74336
|
+
typeArgument,
|
|
74326
74337
|
getTypeWithThisArgument(instantiateType(constraint, mapper), typeArgument),
|
|
74327
74338
|
reportErrors2 ? typeArgumentNodes[i] : void 0,
|
|
74328
74339
|
typeArgumentHeadMessage,
|
|
@@ -78888,7 +78899,7 @@ function createTypeChecker(host) {
|
|
|
78888
78899
|
if (getIsolatedModules(compilerOptions)) {
|
|
78889
78900
|
Debug.assert(!!(type.symbol.flags & 128 /* ConstEnum */));
|
|
78890
78901
|
const constEnumDeclaration = type.symbol.valueDeclaration;
|
|
78891
|
-
if (constEnumDeclaration.flags & 16777216 /* Ambient */) {
|
|
78902
|
+
if (constEnumDeclaration.flags & 16777216 /* Ambient */ && !isValidTypeOnlyAliasUseSite(node)) {
|
|
78892
78903
|
error(node, Diagnostics.Cannot_access_ambient_const_enums_when_0_is_enabled, isolatedModulesLikeFlagName);
|
|
78893
78904
|
}
|
|
78894
78905
|
}
|
|
@@ -79317,6 +79328,9 @@ function createTypeChecker(host) {
|
|
|
79317
79328
|
case "length":
|
|
79318
79329
|
case "caller":
|
|
79319
79330
|
case "arguments":
|
|
79331
|
+
if (compilerOptions.useDefineForClassFields) {
|
|
79332
|
+
break;
|
|
79333
|
+
}
|
|
79320
79334
|
case "prototype":
|
|
79321
79335
|
const message = Diagnostics.Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1;
|
|
79322
79336
|
const className = getNameOfSymbolAsWritten(getSymbolOfDeclaration(node));
|
|
@@ -86323,7 +86337,7 @@ function createTypeChecker(host) {
|
|
|
86323
86337
|
if (requestedExternalEmitHelperNames.has(name))
|
|
86324
86338
|
continue;
|
|
86325
86339
|
requestedExternalEmitHelperNames.add(name);
|
|
86326
|
-
const symbol = getSymbol2(helpersModule
|
|
86340
|
+
const symbol = getSymbol2(getExportsOfModule(helpersModule), escapeLeadingUnderscores(name), 111551 /* Value */);
|
|
86327
86341
|
if (!symbol) {
|
|
86328
86342
|
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);
|
|
86329
86343
|
} else if (helper & 524288 /* ClassPrivateFieldGet */) {
|
|
@@ -136490,15 +136504,18 @@ registerRefactor(refactorNameForMoveToFile, {
|
|
|
136490
136504
|
Debug.assert(actionName2 === refactorNameForMoveToFile, "Wrong refactor invoked");
|
|
136491
136505
|
const statements = Debug.checkDefined(getStatementsToMove(context));
|
|
136492
136506
|
Debug.assert(interactiveRefactorArguments, "No interactive refactor arguments available");
|
|
136493
|
-
const
|
|
136494
|
-
|
|
136507
|
+
const targetFile = interactiveRefactorArguments.targetFile;
|
|
136508
|
+
if (hasJSFileExtension(targetFile) || hasTSFileExtension(targetFile)) {
|
|
136509
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange4(context, context.file, interactiveRefactorArguments.targetFile, context.program, statements, t, context.host, context.preferences));
|
|
136510
|
+
return { edits, renameFilename: void 0, renameLocation: void 0 };
|
|
136511
|
+
}
|
|
136512
|
+
return { edits: [], renameFilename: void 0, renameLocation: void 0, notApplicableReason: getLocaleSpecificMessage(Diagnostics.Cannot_move_to_file_selected_file_is_invalid) };
|
|
136495
136513
|
}
|
|
136496
136514
|
});
|
|
136497
136515
|
function doChange4(context, oldFile, targetFile, program, toMove, changes, host, preferences) {
|
|
136498
|
-
var _a;
|
|
136499
136516
|
const checker = program.getTypeChecker();
|
|
136500
136517
|
const usage = getUsageInfo(oldFile, toMove.all, checker);
|
|
136501
|
-
if (!host.fileExists(targetFile)
|
|
136518
|
+
if (!host.fileExists(targetFile)) {
|
|
136502
136519
|
changes.createNewFile(oldFile, targetFile, getNewStatementsAndRemoveFromOldFile2(oldFile, targetFile, usage, changes, toMove, program, host, preferences));
|
|
136503
136520
|
addNewFileToTsconfig(program, changes, oldFile.fileName, targetFile, hostGetCanonicalFileName(host));
|
|
136504
136521
|
} else {
|
|
@@ -136536,6 +136553,13 @@ function getNewStatementsAndRemoveFromOldFile2(oldFile, targetFile, usage, chang
|
|
|
136536
136553
|
if (typeof targetFile !== "string") {
|
|
136537
136554
|
if (targetFile.statements.length > 0) {
|
|
136538
136555
|
changes.insertNodesAfter(targetFile, targetFile.statements[targetFile.statements.length - 1], body);
|
|
136556
|
+
} else {
|
|
136557
|
+
changes.insertNodesAtEndOfFile(
|
|
136558
|
+
targetFile,
|
|
136559
|
+
body,
|
|
136560
|
+
/*blankLineBetween*/
|
|
136561
|
+
false
|
|
136562
|
+
);
|
|
136539
136563
|
}
|
|
136540
136564
|
if (imports.length > 0) {
|
|
136541
136565
|
insertImports(
|
|
@@ -153173,7 +153197,8 @@ function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, con
|
|
|
153173
153197
|
false
|
|
153174
153198
|
);
|
|
153175
153199
|
const effectiveModifierFlags = declaration ? getEffectiveModifierFlags(declaration) : 0 /* None */;
|
|
153176
|
-
let modifierFlags = effectiveModifierFlags &
|
|
153200
|
+
let modifierFlags = effectiveModifierFlags & 32 /* Static */;
|
|
153201
|
+
modifierFlags |= effectiveModifierFlags & 4 /* Public */ ? 4 /* Public */ : effectiveModifierFlags & 16 /* Protected */ ? 16 /* Protected */ : 0 /* None */;
|
|
153177
153202
|
if (declaration && isAutoAccessorPropertyDeclaration(declaration)) {
|
|
153178
153203
|
modifierFlags |= 128 /* Accessor */;
|
|
153179
153204
|
}
|
|
@@ -155745,6 +155770,7 @@ function createCompletionEntryForLiteral(sourceFile, preferences, literal) {
|
|
|
155745
155770
|
}
|
|
155746
155771
|
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) {
|
|
155747
155772
|
let insertText;
|
|
155773
|
+
let filterText;
|
|
155748
155774
|
let replacementSpan = getReplacementSpanForContextToken(replacementToken);
|
|
155749
155775
|
let data;
|
|
155750
155776
|
let isSnippet;
|
|
@@ -155803,11 +155829,15 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
|
|
|
155803
155829
|
}
|
|
155804
155830
|
if (preferences.includeCompletionsWithClassMemberSnippets && preferences.includeCompletionsWithInsertText && completionKind === 3 /* MemberLike */ && isClassLikeMemberCompletion(symbol, location, sourceFile)) {
|
|
155805
155831
|
let importAdder;
|
|
155806
|
-
|
|
155807
|
-
|
|
155808
|
-
|
|
155809
|
-
|
|
155810
|
-
|
|
155832
|
+
const memberCompletionEntry = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, position, contextToken, formatContext);
|
|
155833
|
+
if (memberCompletionEntry) {
|
|
155834
|
+
({ insertText, filterText, isSnippet, importAdder } = memberCompletionEntry);
|
|
155835
|
+
if (importAdder == null ? void 0 : importAdder.hasFixes()) {
|
|
155836
|
+
hasAction = true;
|
|
155837
|
+
source = "ClassMemberSnippet/" /* ClassMemberSnippet */;
|
|
155838
|
+
}
|
|
155839
|
+
} else {
|
|
155840
|
+
return void 0;
|
|
155811
155841
|
}
|
|
155812
155842
|
}
|
|
155813
155843
|
if (origin && originIsObjectLiteralMethod(origin)) {
|
|
@@ -155851,6 +155881,7 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
|
|
|
155851
155881
|
hasAction: hasAction ? true : void 0,
|
|
155852
155882
|
isRecommended: isRecommendedCompletionMatch(symbol, recommendedCompletion, typeChecker) || void 0,
|
|
155853
155883
|
insertText,
|
|
155884
|
+
filterText,
|
|
155854
155885
|
replacementSpan,
|
|
155855
155886
|
sourceDisplay,
|
|
155856
155887
|
labelDetails,
|
|
@@ -155871,11 +155902,11 @@ function isClassLikeMemberCompletion(symbol, location, sourceFile) {
|
|
|
155871
155902
|
function getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, position, contextToken, formatContext) {
|
|
155872
155903
|
const classLikeDeclaration = findAncestor(location, isClassLike);
|
|
155873
155904
|
if (!classLikeDeclaration) {
|
|
155874
|
-
return
|
|
155905
|
+
return void 0;
|
|
155875
155906
|
}
|
|
155876
155907
|
let isSnippet;
|
|
155877
|
-
let replacementSpan;
|
|
155878
155908
|
let insertText = name;
|
|
155909
|
+
const filterText = name;
|
|
155879
155910
|
const checker = program.getTypeChecker();
|
|
155880
155911
|
const sourceFile = location.getSourceFile();
|
|
155881
155912
|
const printer = createSnippetPrinter({
|
|
@@ -155904,9 +155935,9 @@ function getEntryForMemberCompletion(host, program, options, preferences, name,
|
|
|
155904
155935
|
);
|
|
155905
155936
|
}
|
|
155906
155937
|
let modifiers = 0 /* None */;
|
|
155907
|
-
const { modifiers: presentModifiers,
|
|
155908
|
-
const isAbstract =
|
|
155909
|
-
|
|
155938
|
+
const { modifiers: presentModifiers, range: eraseRange, decorators: presentDecorators } = getPresentModifiers(contextToken, sourceFile, position);
|
|
155939
|
+
const isAbstract = presentModifiers & 256 /* Abstract */ && classLikeDeclaration.modifierFlagsCache & 256 /* Abstract */;
|
|
155940
|
+
let completionNodes = [];
|
|
155910
155941
|
ts_codefix_exports.addNewNodeForMemberSymbol(
|
|
155911
155942
|
symbol,
|
|
155912
155943
|
classLikeDeclaration,
|
|
@@ -155930,18 +155961,42 @@ function getEntryForMemberCompletion(host, program, options, preferences, name,
|
|
|
155930
155961
|
requiredModifiers |= 16384 /* Override */;
|
|
155931
155962
|
}
|
|
155932
155963
|
if (!completionNodes.length) {
|
|
155933
|
-
modifiers = node.modifierFlagsCache | requiredModifiers
|
|
155964
|
+
modifiers = node.modifierFlagsCache | requiredModifiers;
|
|
155934
155965
|
}
|
|
155935
155966
|
node = factory.updateModifiers(node, modifiers);
|
|
155936
155967
|
completionNodes.push(node);
|
|
155937
155968
|
},
|
|
155938
155969
|
body,
|
|
155939
155970
|
ts_codefix_exports.PreserveOptionalFlags.Property,
|
|
155940
|
-
isAbstract
|
|
155971
|
+
!!isAbstract
|
|
155941
155972
|
);
|
|
155942
155973
|
if (completionNodes.length) {
|
|
155974
|
+
const isMethod = symbol.flags & 8192 /* Method */;
|
|
155975
|
+
let allowedModifiers = modifiers | 16384 /* Override */ | 4 /* Public */;
|
|
155976
|
+
if (!isMethod) {
|
|
155977
|
+
allowedModifiers |= 2 /* Ambient */ | 64 /* Readonly */;
|
|
155978
|
+
} else {
|
|
155979
|
+
allowedModifiers |= 512 /* Async */;
|
|
155980
|
+
}
|
|
155981
|
+
const allowedAndPresent = presentModifiers & allowedModifiers;
|
|
155982
|
+
if (presentModifiers & ~allowedModifiers) {
|
|
155983
|
+
return void 0;
|
|
155984
|
+
}
|
|
155985
|
+
if (modifiers & 16 /* Protected */ && allowedAndPresent & 4 /* Public */) {
|
|
155986
|
+
modifiers &= ~16 /* Protected */;
|
|
155987
|
+
}
|
|
155988
|
+
if (allowedAndPresent !== 0 /* None */ && !(allowedAndPresent & 4 /* Public */)) {
|
|
155989
|
+
modifiers &= ~4 /* Public */;
|
|
155990
|
+
}
|
|
155991
|
+
modifiers |= allowedAndPresent;
|
|
155992
|
+
completionNodes = completionNodes.map((node) => factory.updateModifiers(node, modifiers));
|
|
155993
|
+
if (presentDecorators == null ? void 0 : presentDecorators.length) {
|
|
155994
|
+
const lastNode = completionNodes[completionNodes.length - 1];
|
|
155995
|
+
if (canHaveDecorators(lastNode)) {
|
|
155996
|
+
completionNodes[completionNodes.length - 1] = factory.updateModifierLike(lastNode, presentDecorators.concat(getModifiers(lastNode) || []));
|
|
155997
|
+
}
|
|
155998
|
+
}
|
|
155943
155999
|
const format = 1 /* MultiLine */ | 131072 /* NoTrailingNewLine */;
|
|
155944
|
-
replacementSpan = modifiersSpan;
|
|
155945
156000
|
if (formatContext) {
|
|
155946
156001
|
insertText = printer.printAndFormatSnippetList(
|
|
155947
156002
|
format,
|
|
@@ -155957,24 +156012,29 @@ function getEntryForMemberCompletion(host, program, options, preferences, name,
|
|
|
155957
156012
|
);
|
|
155958
156013
|
}
|
|
155959
156014
|
}
|
|
155960
|
-
return { insertText, isSnippet, importAdder,
|
|
156015
|
+
return { insertText, filterText, isSnippet, importAdder, eraseRange };
|
|
155961
156016
|
}
|
|
155962
156017
|
function getPresentModifiers(contextToken, sourceFile, position) {
|
|
155963
156018
|
if (!contextToken || getLineAndCharacterOfPosition(sourceFile, position).line > getLineAndCharacterOfPosition(sourceFile, contextToken.getEnd()).line) {
|
|
155964
156019
|
return { modifiers: 0 /* None */ };
|
|
155965
156020
|
}
|
|
155966
156021
|
let modifiers = 0 /* None */;
|
|
155967
|
-
let
|
|
156022
|
+
let decorators;
|
|
155968
156023
|
let contextMod;
|
|
155969
|
-
|
|
155970
|
-
|
|
155971
|
-
span = createTextSpanFromNode(contextToken);
|
|
155972
|
-
}
|
|
155973
|
-
if (isPropertyDeclaration(contextToken.parent)) {
|
|
156024
|
+
const range = { pos: position, end: position };
|
|
156025
|
+
if (isPropertyDeclaration(contextToken.parent) && contextToken.parent.modifiers) {
|
|
155974
156026
|
modifiers |= modifiersToFlags(contextToken.parent.modifiers) & 126975 /* Modifier */;
|
|
155975
|
-
|
|
156027
|
+
decorators = contextToken.parent.modifiers.filter(isDecorator) || [];
|
|
156028
|
+
range.pos = Math.min(range.pos, contextToken.parent.modifiers.pos);
|
|
155976
156029
|
}
|
|
155977
|
-
|
|
156030
|
+
if (contextMod = isModifierLike2(contextToken)) {
|
|
156031
|
+
const contextModifierFlag = modifierToFlag(contextMod);
|
|
156032
|
+
if (!(modifiers & contextModifierFlag)) {
|
|
156033
|
+
modifiers |= contextModifierFlag;
|
|
156034
|
+
range.pos = Math.min(range.pos, contextToken.pos);
|
|
156035
|
+
}
|
|
156036
|
+
}
|
|
156037
|
+
return { modifiers, decorators, range: range.pos !== position ? range : void 0 };
|
|
155978
156038
|
}
|
|
155979
156039
|
function isModifierLike2(node) {
|
|
155980
156040
|
if (isModifier(node)) {
|
|
@@ -156597,7 +156657,7 @@ function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextTo
|
|
|
156597
156657
|
}
|
|
156598
156658
|
}
|
|
156599
156659
|
if (source === "ClassMemberSnippet/" /* ClassMemberSnippet */) {
|
|
156600
|
-
const { importAdder } = getEntryForMemberCompletion(
|
|
156660
|
+
const { importAdder, eraseRange } = getEntryForMemberCompletion(
|
|
156601
156661
|
host,
|
|
156602
156662
|
program,
|
|
156603
156663
|
compilerOptions,
|
|
@@ -156609,10 +156669,17 @@ function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextTo
|
|
|
156609
156669
|
contextToken,
|
|
156610
156670
|
formatContext
|
|
156611
156671
|
);
|
|
156612
|
-
if (importAdder) {
|
|
156672
|
+
if (importAdder || eraseRange) {
|
|
156613
156673
|
const changes = ts_textChanges_exports.ChangeTracker.with(
|
|
156614
156674
|
{ host, formatContext, preferences },
|
|
156615
|
-
|
|
156675
|
+
(tracker) => {
|
|
156676
|
+
if (importAdder) {
|
|
156677
|
+
importAdder.writeFixes(tracker);
|
|
156678
|
+
}
|
|
156679
|
+
if (eraseRange) {
|
|
156680
|
+
tracker.deleteRange(sourceFile, eraseRange);
|
|
156681
|
+
}
|
|
156682
|
+
}
|
|
156616
156683
|
);
|
|
156617
156684
|
return {
|
|
156618
156685
|
sourceDisplay: void 0,
|
|
@@ -165957,6 +166024,17 @@ var ChangeTracker = class {
|
|
|
165957
166024
|
this.insertNodeAt(sourceFile, pos, insert, options);
|
|
165958
166025
|
}
|
|
165959
166026
|
}
|
|
166027
|
+
insertNodesAtEndOfFile(sourceFile, newNodes, blankLineBetween) {
|
|
166028
|
+
this.insertAtEndOfFile(sourceFile, newNodes, blankLineBetween);
|
|
166029
|
+
}
|
|
166030
|
+
insertAtEndOfFile(sourceFile, insert, blankLineBetween) {
|
|
166031
|
+
const pos = sourceFile.end + 1;
|
|
166032
|
+
const options = {
|
|
166033
|
+
prefix: this.newLineCharacter,
|
|
166034
|
+
suffix: this.newLineCharacter + (blankLineBetween ? this.newLineCharacter : "")
|
|
166035
|
+
};
|
|
166036
|
+
this.insertNodesAt(sourceFile, pos, insert, options);
|
|
166037
|
+
}
|
|
165960
166038
|
insertStatementsInNewFile(fileName, statements, oldFile) {
|
|
165961
166039
|
if (!this.newFileChanges) {
|
|
165962
166040
|
this.newFileChanges = createMultiMap();
|
|
@@ -181679,6 +181757,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
181679
181757
|
kindModifiers,
|
|
181680
181758
|
sortText,
|
|
181681
181759
|
insertText,
|
|
181760
|
+
filterText,
|
|
181682
181761
|
replacementSpan,
|
|
181683
181762
|
hasAction,
|
|
181684
181763
|
source,
|
|
@@ -181697,6 +181776,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
181697
181776
|
kindModifiers,
|
|
181698
181777
|
sortText,
|
|
181699
181778
|
insertText,
|
|
181779
|
+
filterText,
|
|
181700
181780
|
replacementSpan: convertedSpan,
|
|
181701
181781
|
isSnippet,
|
|
181702
181782
|
hasAction: hasAction || void 0,
|
|
@@ -182068,7 +182148,8 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
182068
182148
|
return {
|
|
182069
182149
|
renameLocation: mappedRenameLocation,
|
|
182070
182150
|
renameFilename,
|
|
182071
|
-
edits: this.mapTextChangesToCodeEdits(edits)
|
|
182151
|
+
edits: this.mapTextChangesToCodeEdits(edits),
|
|
182152
|
+
notApplicableReason: result.notApplicableReason
|
|
182072
182153
|
};
|
|
182073
182154
|
}
|
|
182074
182155
|
return result;
|
package/lib/tsserverlibrary.d.ts
CHANGED
|
@@ -619,6 +619,7 @@ declare namespace ts {
|
|
|
619
619
|
*/
|
|
620
620
|
renameLocation?: Location;
|
|
621
621
|
renameFilename?: string;
|
|
622
|
+
notApplicableReason?: string;
|
|
622
623
|
}
|
|
623
624
|
/**
|
|
624
625
|
* Organize imports by:
|
|
@@ -1829,6 +1830,11 @@ declare namespace ts {
|
|
|
1829
1830
|
* coupled with `replacementSpan` to replace a dotted access with a bracket access.
|
|
1830
1831
|
*/
|
|
1831
1832
|
insertText?: string;
|
|
1833
|
+
/**
|
|
1834
|
+
* A string that should be used when filtering a set of
|
|
1835
|
+
* completion items.
|
|
1836
|
+
*/
|
|
1837
|
+
filterText?: string;
|
|
1832
1838
|
/**
|
|
1833
1839
|
* `insertText` should be interpreted as a snippet if true.
|
|
1834
1840
|
*/
|
|
@@ -10190,7 +10196,7 @@ declare namespace ts {
|
|
|
10190
10196
|
* arguments for any interactive action before offering it.
|
|
10191
10197
|
*/
|
|
10192
10198
|
getApplicableRefactors(fileName: string, positionOrRange: number | TextRange, preferences: UserPreferences | undefined, triggerReason?: RefactorTriggerReason, kind?: string, includeInteractiveActions?: boolean): ApplicableRefactorInfo[];
|
|
10193
|
-
getEditsForRefactor(fileName: string, formatOptions: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, actionName: string, preferences: UserPreferences | undefined,
|
|
10199
|
+
getEditsForRefactor(fileName: string, formatOptions: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, actionName: string, preferences: UserPreferences | undefined, interactiveRefactorArguments?: InteractiveRefactorArguments): RefactorEditInfo | undefined;
|
|
10194
10200
|
getMoveToRefactoringFileSuggestions(fileName: string, positionOrRange: number | TextRange, preferences: UserPreferences | undefined, triggerReason?: RefactorTriggerReason, kind?: string): {
|
|
10195
10201
|
newFileName: string;
|
|
10196
10202
|
files: string[];
|
|
@@ -10480,6 +10486,7 @@ declare namespace ts {
|
|
|
10480
10486
|
renameFilename?: string;
|
|
10481
10487
|
renameLocation?: number;
|
|
10482
10488
|
commands?: CodeActionCommand[];
|
|
10489
|
+
notApplicableReason?: string;
|
|
10483
10490
|
}
|
|
10484
10491
|
type RefactorTriggerReason = "implicit" | "invoked";
|
|
10485
10492
|
interface TextInsertion {
|
|
@@ -10801,6 +10808,7 @@ declare namespace ts {
|
|
|
10801
10808
|
kindModifiers?: string;
|
|
10802
10809
|
sortText: string;
|
|
10803
10810
|
insertText?: string;
|
|
10811
|
+
filterText?: string;
|
|
10804
10812
|
isSnippet?: true;
|
|
10805
10813
|
/**
|
|
10806
10814
|
* An optional span that indicates the text to be replaced by this completion item.
|