typescript 5.2.0-dev.20230804 → 5.2.0-dev.20230805
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 +69 -50
- package/lib/tsserver.js +107 -86
- package/lib/tsserverlibrary.d.ts +6 -2
- package/lib/tsserverlibrary.js +107 -86
- package/lib/typescript.d.ts +3 -1
- package/lib/typescript.js +98 -76
- package/lib/typingsInstaller.js +1 -1
- package/package.json +2 -2
package/lib/tsserver.js
CHANGED
|
@@ -2331,7 +2331,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2331
2331
|
|
|
2332
2332
|
// src/compiler/corePublic.ts
|
|
2333
2333
|
var versionMajorMinor = "5.2";
|
|
2334
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2334
|
+
var version = `${versionMajorMinor}.0-dev.20230805`;
|
|
2335
2335
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2336
2336
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2337
2337
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -6625,15 +6625,13 @@ var NodeCheckFlags = /* @__PURE__ */ ((NodeCheckFlags2) => {
|
|
|
6625
6625
|
NodeCheckFlags2[NodeCheckFlags2["ContainsCapturedBlockScopeBinding"] = 8192] = "ContainsCapturedBlockScopeBinding";
|
|
6626
6626
|
NodeCheckFlags2[NodeCheckFlags2["CapturedBlockScopedBinding"] = 16384] = "CapturedBlockScopedBinding";
|
|
6627
6627
|
NodeCheckFlags2[NodeCheckFlags2["BlockScopedBindingInLoop"] = 32768] = "BlockScopedBindingInLoop";
|
|
6628
|
-
NodeCheckFlags2[NodeCheckFlags2["
|
|
6629
|
-
NodeCheckFlags2[NodeCheckFlags2["
|
|
6630
|
-
NodeCheckFlags2[NodeCheckFlags2["
|
|
6631
|
-
NodeCheckFlags2[NodeCheckFlags2["
|
|
6632
|
-
NodeCheckFlags2[NodeCheckFlags2["
|
|
6633
|
-
NodeCheckFlags2[NodeCheckFlags2["
|
|
6634
|
-
NodeCheckFlags2[NodeCheckFlags2["
|
|
6635
|
-
NodeCheckFlags2[NodeCheckFlags2["ContainsSuperPropertyInStaticInitializer"] = 8388608] = "ContainsSuperPropertyInStaticInitializer";
|
|
6636
|
-
NodeCheckFlags2[NodeCheckFlags2["InCheckIdentifier"] = 16777216] = "InCheckIdentifier";
|
|
6628
|
+
NodeCheckFlags2[NodeCheckFlags2["NeedsLoopOutParameter"] = 65536] = "NeedsLoopOutParameter";
|
|
6629
|
+
NodeCheckFlags2[NodeCheckFlags2["AssignmentsMarked"] = 131072] = "AssignmentsMarked";
|
|
6630
|
+
NodeCheckFlags2[NodeCheckFlags2["ContainsConstructorReference"] = 262144] = "ContainsConstructorReference";
|
|
6631
|
+
NodeCheckFlags2[NodeCheckFlags2["ConstructorReference"] = 536870912] = "ConstructorReference";
|
|
6632
|
+
NodeCheckFlags2[NodeCheckFlags2["ContainsClassWithPrivateIdentifiers"] = 1048576] = "ContainsClassWithPrivateIdentifiers";
|
|
6633
|
+
NodeCheckFlags2[NodeCheckFlags2["ContainsSuperPropertyInStaticInitializer"] = 2097152] = "ContainsSuperPropertyInStaticInitializer";
|
|
6634
|
+
NodeCheckFlags2[NodeCheckFlags2["InCheckIdentifier"] = 4194304] = "InCheckIdentifier";
|
|
6637
6635
|
return NodeCheckFlags2;
|
|
6638
6636
|
})(NodeCheckFlags || {});
|
|
6639
6637
|
var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
@@ -29939,7 +29937,7 @@ function createAccessorPropertyBackingField(factory2, node, modifiers, initializ
|
|
|
29939
29937
|
initializer
|
|
29940
29938
|
);
|
|
29941
29939
|
}
|
|
29942
|
-
function createAccessorPropertyGetRedirector(factory2, node, modifiers, name) {
|
|
29940
|
+
function createAccessorPropertyGetRedirector(factory2, node, modifiers, name, receiver = factory2.createThis()) {
|
|
29943
29941
|
return factory2.createGetAccessorDeclaration(
|
|
29944
29942
|
modifiers,
|
|
29945
29943
|
name,
|
|
@@ -29949,7 +29947,7 @@ function createAccessorPropertyGetRedirector(factory2, node, modifiers, name) {
|
|
|
29949
29947
|
factory2.createBlock([
|
|
29950
29948
|
factory2.createReturnStatement(
|
|
29951
29949
|
factory2.createPropertyAccessExpression(
|
|
29952
|
-
|
|
29950
|
+
receiver,
|
|
29953
29951
|
factory2.getGeneratedPrivateNameForNode(
|
|
29954
29952
|
node.name,
|
|
29955
29953
|
/*prefix*/
|
|
@@ -29961,7 +29959,7 @@ function createAccessorPropertyGetRedirector(factory2, node, modifiers, name) {
|
|
|
29961
29959
|
])
|
|
29962
29960
|
);
|
|
29963
29961
|
}
|
|
29964
|
-
function createAccessorPropertySetRedirector(factory2, node, modifiers, name) {
|
|
29962
|
+
function createAccessorPropertySetRedirector(factory2, node, modifiers, name, receiver = factory2.createThis()) {
|
|
29965
29963
|
return factory2.createSetAccessorDeclaration(
|
|
29966
29964
|
modifiers,
|
|
29967
29965
|
name,
|
|
@@ -29976,7 +29974,7 @@ function createAccessorPropertySetRedirector(factory2, node, modifiers, name) {
|
|
|
29976
29974
|
factory2.createExpressionStatement(
|
|
29977
29975
|
factory2.createAssignment(
|
|
29978
29976
|
factory2.createPropertyAccessExpression(
|
|
29979
|
-
|
|
29977
|
+
receiver,
|
|
29980
29978
|
factory2.getGeneratedPrivateNameForNode(
|
|
29981
29979
|
node.name,
|
|
29982
29980
|
/*prefix*/
|
|
@@ -70858,8 +70856,8 @@ function createTypeChecker(host) {
|
|
|
70858
70856
|
}
|
|
70859
70857
|
const parent2 = getRootDeclaration(symbol.valueDeclaration).parent;
|
|
70860
70858
|
const links = getNodeLinks(parent2);
|
|
70861
|
-
if (!(links.flags &
|
|
70862
|
-
links.flags |=
|
|
70859
|
+
if (!(links.flags & 131072 /* AssignmentsMarked */)) {
|
|
70860
|
+
links.flags |= 131072 /* AssignmentsMarked */;
|
|
70863
70861
|
if (!hasParentWithAssignmentsMarked(parent2)) {
|
|
70864
70862
|
markNodeAssignments(parent2);
|
|
70865
70863
|
}
|
|
@@ -70867,7 +70865,7 @@ function createTypeChecker(host) {
|
|
|
70867
70865
|
return symbol.isAssigned || false;
|
|
70868
70866
|
}
|
|
70869
70867
|
function hasParentWithAssignmentsMarked(node) {
|
|
70870
|
-
return !!findAncestor(node.parent, (node2) => (isFunctionLike(node2) || isCatchClause(node2)) && !!(getNodeLinks(node2).flags &
|
|
70868
|
+
return !!findAncestor(node.parent, (node2) => (isFunctionLike(node2) || isCatchClause(node2)) && !!(getNodeLinks(node2).flags & 131072 /* AssignmentsMarked */));
|
|
70871
70869
|
}
|
|
70872
70870
|
function markNodeAssignments(node) {
|
|
70873
70871
|
if (node.kind === 80 /* Identifier */) {
|
|
@@ -70973,11 +70971,11 @@ function createTypeChecker(host) {
|
|
|
70973
70971
|
const parent2 = declaration.parent.parent;
|
|
70974
70972
|
if (parent2.kind === 260 /* VariableDeclaration */ && getCombinedNodeFlagsCached(declaration) & 6 /* Constant */ || parent2.kind === 169 /* Parameter */) {
|
|
70975
70973
|
const links = getNodeLinks(parent2);
|
|
70976
|
-
if (!(links.flags &
|
|
70977
|
-
links.flags |=
|
|
70974
|
+
if (!(links.flags & 4194304 /* InCheckIdentifier */)) {
|
|
70975
|
+
links.flags |= 4194304 /* InCheckIdentifier */;
|
|
70978
70976
|
const parentType = getTypeForBindingElementParent(parent2, 0 /* Normal */);
|
|
70979
70977
|
const parentTypeConstraint = parentType && mapType(parentType, getBaseConstraintOrType);
|
|
70980
|
-
links.flags &= ~
|
|
70978
|
+
links.flags &= ~4194304 /* InCheckIdentifier */;
|
|
70981
70979
|
if (parentTypeConstraint && parentTypeConstraint.flags & 1048576 /* Union */ && !(parent2.kind === 169 /* Parameter */ && isSymbolAssigned(symbol))) {
|
|
70982
70980
|
const pattern = declaration.parent;
|
|
70983
70981
|
const narrowedType = getFlowTypeOfReference(
|
|
@@ -71054,17 +71052,7 @@ function createTypeChecker(host) {
|
|
|
71054
71052
|
}
|
|
71055
71053
|
let declaration = localOrExportSymbol.valueDeclaration;
|
|
71056
71054
|
if (declaration && localOrExportSymbol.flags & 32 /* Class */) {
|
|
71057
|
-
if (declaration
|
|
71058
|
-
let container = getContainingClass(node);
|
|
71059
|
-
while (container !== void 0) {
|
|
71060
|
-
if (container === declaration && container.name !== node) {
|
|
71061
|
-
getNodeLinks(declaration).flags |= 1048576 /* ClassWithConstructorReference */;
|
|
71062
|
-
getNodeLinks(node).flags |= 2097152 /* ConstructorReferenceInClass */;
|
|
71063
|
-
break;
|
|
71064
|
-
}
|
|
71065
|
-
container = getContainingClass(container);
|
|
71066
|
-
}
|
|
71067
|
-
} else if (declaration.kind === 231 /* ClassExpression */) {
|
|
71055
|
+
if (isClassLike(declaration) && declaration.name !== node) {
|
|
71068
71056
|
let container = getThisContainer(
|
|
71069
71057
|
node,
|
|
71070
71058
|
/*includeArrowFunctions*/
|
|
@@ -71072,14 +71060,7 @@ function createTypeChecker(host) {
|
|
|
71072
71060
|
/*includeClassComputedPropertyName*/
|
|
71073
71061
|
false
|
|
71074
71062
|
);
|
|
71075
|
-
while (container.kind !== 312 /* SourceFile */) {
|
|
71076
|
-
if (container.parent === declaration) {
|
|
71077
|
-
if (isPropertyDeclaration(container) && isStatic(container) || isClassStaticBlockDeclaration(container)) {
|
|
71078
|
-
getNodeLinks(declaration).flags |= 1048576 /* ClassWithConstructorReference */;
|
|
71079
|
-
getNodeLinks(node).flags |= 2097152 /* ConstructorReferenceInClass */;
|
|
71080
|
-
}
|
|
71081
|
-
break;
|
|
71082
|
-
}
|
|
71063
|
+
while (container.kind !== 312 /* SourceFile */ && container.parent !== declaration) {
|
|
71083
71064
|
container = getThisContainer(
|
|
71084
71065
|
container,
|
|
71085
71066
|
/*includeArrowFunctions*/
|
|
@@ -71088,6 +71069,11 @@ function createTypeChecker(host) {
|
|
|
71088
71069
|
false
|
|
71089
71070
|
);
|
|
71090
71071
|
}
|
|
71072
|
+
if (container.kind !== 312 /* SourceFile */) {
|
|
71073
|
+
getNodeLinks(declaration).flags |= 262144 /* ContainsConstructorReference */;
|
|
71074
|
+
getNodeLinks(container).flags |= 262144 /* ContainsConstructorReference */;
|
|
71075
|
+
getNodeLinks(node).flags |= 536870912 /* ConstructorReference */;
|
|
71076
|
+
}
|
|
71091
71077
|
}
|
|
71092
71078
|
}
|
|
71093
71079
|
checkNestedBlockScopedBinding(node, symbol);
|
|
@@ -71218,7 +71204,7 @@ function createTypeChecker(host) {
|
|
|
71218
71204
|
if (isForStatement(container)) {
|
|
71219
71205
|
const varDeclList = getAncestor(symbol.valueDeclaration, 261 /* VariableDeclarationList */);
|
|
71220
71206
|
if (varDeclList && varDeclList.parent === container && isAssignedInBodyOfForStatement(node, container)) {
|
|
71221
|
-
getNodeLinks(symbol.valueDeclaration).flags |=
|
|
71207
|
+
getNodeLinks(symbol.valueDeclaration).flags |= 65536 /* NeedsLoopOutParameter */;
|
|
71222
71208
|
}
|
|
71223
71209
|
}
|
|
71224
71210
|
getNodeLinks(symbol.valueDeclaration).flags |= 32768 /* BlockScopedBindingInLoop */;
|
|
@@ -71496,7 +71482,7 @@ function createTypeChecker(host) {
|
|
|
71496
71482
|
if (!isCallExpression2 && languageVersion >= 2 /* ES2015 */ && languageVersion <= 8 /* ES2021 */ && (isPropertyDeclaration(container) || isClassStaticBlockDeclaration(container))) {
|
|
71497
71483
|
forEachEnclosingBlockScopeContainer(node.parent, (current) => {
|
|
71498
71484
|
if (!isSourceFile(current) || isExternalOrCommonJsModule(current)) {
|
|
71499
|
-
getNodeLinks(current).flags |=
|
|
71485
|
+
getNodeLinks(current).flags |= 2097152 /* ContainsSuperPropertyInStaticInitializer */;
|
|
71500
71486
|
}
|
|
71501
71487
|
});
|
|
71502
71488
|
}
|
|
@@ -75038,7 +75024,7 @@ function createTypeChecker(host) {
|
|
|
75038
75024
|
}
|
|
75039
75025
|
}
|
|
75040
75026
|
function getThisArgumentOfCall(node) {
|
|
75041
|
-
const expression = node.kind === 213 /* CallExpression */ ? node.expression : node.kind === 215 /* TaggedTemplateExpression */ ? node.tag : void 0;
|
|
75027
|
+
const expression = node.kind === 213 /* CallExpression */ ? node.expression : node.kind === 215 /* TaggedTemplateExpression */ ? node.tag : node.kind === 170 /* Decorator */ && !legacyDecorators ? node.expression : void 0;
|
|
75042
75028
|
if (expression) {
|
|
75043
75029
|
const callee = skipOuterExpressions(expression);
|
|
75044
75030
|
if (isAccessExpression(callee)) {
|
|
@@ -79945,7 +79931,7 @@ function createTypeChecker(host) {
|
|
|
79945
79931
|
function setNodeLinksForPrivateIdentifierScope(node) {
|
|
79946
79932
|
if (isPrivateIdentifier(node.name) && languageVersion < 99 /* ESNext */) {
|
|
79947
79933
|
for (let lexicalScope = getEnclosingBlockScopeContainer(node); !!lexicalScope; lexicalScope = getEnclosingBlockScopeContainer(lexicalScope)) {
|
|
79948
|
-
getNodeLinks(lexicalScope).flags |=
|
|
79934
|
+
getNodeLinks(lexicalScope).flags |= 1048576 /* ContainsClassWithPrivateIdentifiers */;
|
|
79949
79935
|
}
|
|
79950
79936
|
if (isClassExpression(node.parent)) {
|
|
79951
79937
|
const enclosingIterationStatement = getEnclosingIterationStatement(node.parent);
|
|
@@ -81698,7 +81684,7 @@ function createTypeChecker(host) {
|
|
|
81698
81684
|
}
|
|
81699
81685
|
function checkWeakMapSetCollision(node) {
|
|
81700
81686
|
const enclosingBlockScope = getEnclosingBlockScopeContainer(node);
|
|
81701
|
-
if (getNodeCheckFlags(enclosingBlockScope) &
|
|
81687
|
+
if (getNodeCheckFlags(enclosingBlockScope) & 1048576 /* ContainsClassWithPrivateIdentifiers */) {
|
|
81702
81688
|
Debug.assert(isNamedDeclaration(node) && isIdentifier(node.name) && typeof node.name.escapedText === "string", "The target of a WeakMap/WeakSet collision check should be an identifier");
|
|
81703
81689
|
errorSkippedOn("noEmit", node, Diagnostics.Compiler_reserves_name_0_when_emitting_private_identifier_downlevel, node.name.escapedText);
|
|
81704
81690
|
}
|
|
@@ -81712,18 +81698,18 @@ function createTypeChecker(host) {
|
|
|
81712
81698
|
let hasCollision = false;
|
|
81713
81699
|
if (isClassExpression(node)) {
|
|
81714
81700
|
for (const member of node.members) {
|
|
81715
|
-
if (getNodeCheckFlags(member) &
|
|
81701
|
+
if (getNodeCheckFlags(member) & 2097152 /* ContainsSuperPropertyInStaticInitializer */) {
|
|
81716
81702
|
hasCollision = true;
|
|
81717
81703
|
break;
|
|
81718
81704
|
}
|
|
81719
81705
|
}
|
|
81720
81706
|
} else if (isFunctionExpression(node)) {
|
|
81721
|
-
if (getNodeCheckFlags(node) &
|
|
81707
|
+
if (getNodeCheckFlags(node) & 2097152 /* ContainsSuperPropertyInStaticInitializer */) {
|
|
81722
81708
|
hasCollision = true;
|
|
81723
81709
|
}
|
|
81724
81710
|
} else {
|
|
81725
81711
|
const container = getEnclosingBlockScopeContainer(node);
|
|
81726
|
-
if (container && getNodeCheckFlags(container) &
|
|
81712
|
+
if (container && getNodeCheckFlags(container) & 2097152 /* ContainsSuperPropertyInStaticInitializer */) {
|
|
81727
81713
|
hasCollision = true;
|
|
81728
81714
|
}
|
|
81729
81715
|
}
|
|
@@ -94013,6 +93999,11 @@ function transformClassFields(context) {
|
|
|
94013
93999
|
}
|
|
94014
94000
|
}
|
|
94015
94001
|
}
|
|
94002
|
+
function getClassThis() {
|
|
94003
|
+
const lex = getClassLexicalEnvironment();
|
|
94004
|
+
const classThis = lex.classThis ?? lex.classConstructor ?? (currentClassContainer == null ? void 0 : currentClassContainer.name);
|
|
94005
|
+
return Debug.checkDefined(classThis);
|
|
94006
|
+
}
|
|
94016
94007
|
function transformAutoAccessor(node) {
|
|
94017
94008
|
const commentRange = getCommentRange(node);
|
|
94018
94009
|
const sourceMapRange = getSourceMapRange(node);
|
|
@@ -94039,11 +94030,13 @@ function transformClassFields(context) {
|
|
|
94039
94030
|
setOriginalNode(backingField, node);
|
|
94040
94031
|
setEmitFlags(backingField, 3072 /* NoComments */);
|
|
94041
94032
|
setSourceMapRange(backingField, sourceMapRange);
|
|
94042
|
-
const
|
|
94033
|
+
const receiver = isStatic(node) ? getClassThis() : factory2.createThis();
|
|
94034
|
+
const getter = createAccessorPropertyGetRedirector(factory2, node, modifiers, getterName, receiver);
|
|
94043
94035
|
setOriginalNode(getter, node);
|
|
94044
94036
|
setCommentRange(getter, commentRange);
|
|
94045
94037
|
setSourceMapRange(getter, sourceMapRange);
|
|
94046
|
-
const
|
|
94038
|
+
const setterModifiers = factory2.createModifiersFromModifierFlags(modifiersToFlags(modifiers));
|
|
94039
|
+
const setter = createAccessorPropertySetRedirector(factory2, node, setterModifiers, setterName, receiver);
|
|
94047
94040
|
setOriginalNode(setter, node);
|
|
94048
94041
|
setEmitFlags(setter, 3072 /* NoComments */);
|
|
94049
94042
|
setSourceMapRange(setter, sourceMapRange);
|
|
@@ -94600,6 +94593,7 @@ function transformClassFields(context) {
|
|
|
94600
94593
|
return filter(node.members, isNonStaticMethodOrAccessorWithPrivateName);
|
|
94601
94594
|
}
|
|
94602
94595
|
function getClassFacts(node) {
|
|
94596
|
+
var _a;
|
|
94603
94597
|
let facts = 0 /* None */;
|
|
94604
94598
|
const original = getOriginalNode(node);
|
|
94605
94599
|
if (isClassDeclaration(original) && classOrConstructorParameterIsDecorated(legacyDecorators, original)) {
|
|
@@ -94616,6 +94610,8 @@ function transformClassFields(context) {
|
|
|
94616
94610
|
if (isStatic(member)) {
|
|
94617
94611
|
if (member.name && (isPrivateIdentifier(member.name) || isAutoAccessorPropertyDeclaration(member)) && shouldTransformPrivateElementsOrClassStaticBlocks) {
|
|
94618
94612
|
facts |= 2 /* NeedsClassConstructorReference */;
|
|
94613
|
+
} else if (isAutoAccessorPropertyDeclaration(member) && shouldTransformAutoAccessors === -1 /* True */ && !node.name && !((_a = node.emitNode) == null ? void 0 : _a.classThis)) {
|
|
94614
|
+
facts |= 2 /* NeedsClassConstructorReference */;
|
|
94619
94615
|
}
|
|
94620
94616
|
if (isPropertyDeclaration(member) || isClassStaticBlockDeclaration(member)) {
|
|
94621
94617
|
if (shouldTransformThisInStaticInitializers && member.transformFlags & 16384 /* ContainsLexicalThis */) {
|
|
@@ -94636,6 +94632,9 @@ function transformClassFields(context) {
|
|
|
94636
94632
|
containsInstancePrivateElements || (containsInstancePrivateElements = isPrivateIdentifierClassElementDeclaration(member));
|
|
94637
94633
|
} else if (isPrivateIdentifierClassElementDeclaration(member)) {
|
|
94638
94634
|
containsInstancePrivateElements = true;
|
|
94635
|
+
if (resolver.getNodeCheckFlags(member) & 262144 /* ContainsConstructorReference */) {
|
|
94636
|
+
facts |= 2 /* NeedsClassConstructorReference */;
|
|
94637
|
+
}
|
|
94639
94638
|
} else if (isPropertyDeclaration(member)) {
|
|
94640
94639
|
containsPublicInstanceFields = true;
|
|
94641
94640
|
containsInitializedPublicInstanceFields || (containsInitializedPublicInstanceFields = !!member.initializer);
|
|
@@ -94736,10 +94735,11 @@ function transformClassFields(context) {
|
|
|
94736
94735
|
getClassLexicalEnvironment().classConstructor = factory2.cloneNode(temp);
|
|
94737
94736
|
pendingClassReferenceAssignment = factory2.createAssignment(temp, factory2.getInternalName(node));
|
|
94738
94737
|
}
|
|
94739
|
-
if ((_b = node.emitNode) == null ? void 0 : _b.classThis) {
|
|
94740
|
-
getClassLexicalEnvironment().classThis = node.emitNode.classThis;
|
|
94741
|
-
}
|
|
94742
94738
|
}
|
|
94739
|
+
if ((_b = node.emitNode) == null ? void 0 : _b.classThis) {
|
|
94740
|
+
getClassLexicalEnvironment().classThis = node.emitNode.classThis;
|
|
94741
|
+
}
|
|
94742
|
+
const isClassWithConstructorReference = resolver.getNodeCheckFlags(node) & 262144 /* ContainsConstructorReference */;
|
|
94743
94743
|
const isExport = hasSyntacticModifier(node, 1 /* Export */);
|
|
94744
94744
|
const isDefault = hasSyntacticModifier(node, 1024 /* Default */);
|
|
94745
94745
|
let modifiers = visitNodes2(node.modifiers, modifierVisitor, isModifier);
|
|
@@ -94774,6 +94774,11 @@ function transformClassFields(context) {
|
|
|
94774
94774
|
)
|
|
94775
94775
|
));
|
|
94776
94776
|
}
|
|
94777
|
+
const alias = getClassLexicalEnvironment().classConstructor;
|
|
94778
|
+
if (isClassWithConstructorReference && alias) {
|
|
94779
|
+
enableSubstitutionForClassAliases();
|
|
94780
|
+
classAliases[getOriginalNodeId(node)] = alias;
|
|
94781
|
+
}
|
|
94777
94782
|
const classDecl = factory2.updateClassDeclaration(
|
|
94778
94783
|
node,
|
|
94779
94784
|
modifiers,
|
|
@@ -94796,14 +94801,14 @@ function transformClassFields(context) {
|
|
|
94796
94801
|
var _a, _b, _c;
|
|
94797
94802
|
const isDecoratedClassDeclaration = !!(facts & 1 /* ClassWasDecorated */);
|
|
94798
94803
|
const staticPropertiesOrClassStaticBlocks = getStaticPropertiesAndClassStaticBlock(node);
|
|
94799
|
-
const
|
|
94804
|
+
const classCheckFlags = resolver.getNodeCheckFlags(node);
|
|
94805
|
+
const isClassWithConstructorReference = classCheckFlags & 262144 /* ContainsConstructorReference */;
|
|
94800
94806
|
let temp;
|
|
94801
94807
|
function createClassTempVar() {
|
|
94802
94808
|
var _a2;
|
|
94803
94809
|
if (shouldTransformPrivateElementsOrClassStaticBlocks && ((_a2 = node.emitNode) == null ? void 0 : _a2.classThis)) {
|
|
94804
94810
|
return getClassLexicalEnvironment().classConstructor = node.emitNode.classThis;
|
|
94805
94811
|
}
|
|
94806
|
-
const classCheckFlags = resolver.getNodeCheckFlags(node);
|
|
94807
94812
|
const requiresBlockScopedVar = classCheckFlags & 32768 /* BlockScopedBindingInLoop */;
|
|
94808
94813
|
const temp2 = factory2.createTempVariable(
|
|
94809
94814
|
requiresBlockScopedVar ? addBlockScopedVariable : hoistVariableDeclaration,
|
|
@@ -95770,7 +95775,7 @@ function transformClassFields(context) {
|
|
|
95770
95775
|
}
|
|
95771
95776
|
function trySubstituteClassAlias(node) {
|
|
95772
95777
|
if (enabledSubstitutions & 1 /* ClassAliases */) {
|
|
95773
|
-
if (resolver.getNodeCheckFlags(node) &
|
|
95778
|
+
if (resolver.getNodeCheckFlags(node) & 536870912 /* ConstructorReference */) {
|
|
95774
95779
|
const declaration = resolver.getReferencedValueDeclaration(node);
|
|
95775
95780
|
if (declaration) {
|
|
95776
95781
|
const classAlias = classAliases[declaration.id];
|
|
@@ -96624,7 +96629,7 @@ function transformLegacyDecorators(context) {
|
|
|
96624
96629
|
}
|
|
96625
96630
|
}
|
|
96626
96631
|
function getClassAliasIfNeeded(node) {
|
|
96627
|
-
if (resolver.getNodeCheckFlags(node) &
|
|
96632
|
+
if (resolver.getNodeCheckFlags(node) & 262144 /* ContainsConstructorReference */) {
|
|
96628
96633
|
enableSubstitutionForClassAliases();
|
|
96629
96634
|
const classAlias = factory2.createUniqueName(node.name && !isGeneratedIdentifier(node.name) ? idText(node.name) : "default");
|
|
96630
96635
|
classAliases[getOriginalNodeId(node)] = classAlias;
|
|
@@ -96657,7 +96662,7 @@ function transformLegacyDecorators(context) {
|
|
|
96657
96662
|
}
|
|
96658
96663
|
function trySubstituteClassAlias(node) {
|
|
96659
96664
|
if (classAliases) {
|
|
96660
|
-
if (resolver.getNodeCheckFlags(node) &
|
|
96665
|
+
if (resolver.getNodeCheckFlags(node) & 536870912 /* ConstructorReference */) {
|
|
96661
96666
|
const declaration = resolver.getReferencedValueDeclaration(node);
|
|
96662
96667
|
if (declaration) {
|
|
96663
96668
|
const classAlias = classAliases[declaration.id];
|
|
@@ -96683,6 +96688,7 @@ function transformESDecorators(context) {
|
|
|
96683
96688
|
endLexicalEnvironment,
|
|
96684
96689
|
hoistVariableDeclaration
|
|
96685
96690
|
} = context;
|
|
96691
|
+
const languageVersion = getEmitScriptTarget(context.getCompilerOptions());
|
|
96686
96692
|
let top;
|
|
96687
96693
|
let classInfo;
|
|
96688
96694
|
let classThis;
|
|
@@ -98184,6 +98190,17 @@ function transformESDecorators(context) {
|
|
|
98184
98190
|
function transformDecorator(decorator) {
|
|
98185
98191
|
const expression = visitNode(decorator.expression, visitor, isExpression);
|
|
98186
98192
|
setEmitFlags(expression, 3072 /* NoComments */);
|
|
98193
|
+
const innerExpression = skipOuterExpressions(expression);
|
|
98194
|
+
if (isAccessExpression(innerExpression)) {
|
|
98195
|
+
const { target, thisArg } = factory2.createCallBinding(
|
|
98196
|
+
expression,
|
|
98197
|
+
hoistVariableDeclaration,
|
|
98198
|
+
languageVersion,
|
|
98199
|
+
/*cacheIdentifiers*/
|
|
98200
|
+
true
|
|
98201
|
+
);
|
|
98202
|
+
return factory2.restoreOuterExpressions(expression, factory2.createFunctionBindCall(target, thisArg, []));
|
|
98203
|
+
}
|
|
98187
98204
|
return expression;
|
|
98188
98205
|
}
|
|
98189
98206
|
function createDescriptorMethod(original, name, modifiers, asteriskToken, kind, parameters, body) {
|
|
@@ -104827,10 +104844,10 @@ function transformES2015(context) {
|
|
|
104827
104844
|
name
|
|
104828
104845
|
));
|
|
104829
104846
|
const checkFlags = resolver.getNodeCheckFlags(decl);
|
|
104830
|
-
if (checkFlags &
|
|
104847
|
+
if (checkFlags & 65536 /* NeedsLoopOutParameter */ || hasCapturedBindingsInForHead) {
|
|
104831
104848
|
const outParamName = factory2.createUniqueName("out_" + idText(name));
|
|
104832
104849
|
let flags = 0 /* None */;
|
|
104833
|
-
if (checkFlags &
|
|
104850
|
+
if (checkFlags & 65536 /* NeedsLoopOutParameter */) {
|
|
104834
104851
|
flags |= 1 /* Body */;
|
|
104835
104852
|
}
|
|
104836
104853
|
if (isForStatement(container)) {
|
|
@@ -138396,7 +138413,7 @@ registerRefactor(refactorNameForMoveToFile, {
|
|
|
138396
138413
|
if (host.fileExists(targetFile) && program.getSourceFile(targetFile) === void 0) {
|
|
138397
138414
|
return error(getLocaleSpecificMessage(Diagnostics.Cannot_move_statements_to_the_selected_file));
|
|
138398
138415
|
}
|
|
138399
|
-
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange4(context, context.file, interactiveRefactorArguments.targetFile, program, statements, t, context.host, context.preferences));
|
|
138416
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange4(context, context.file, interactiveRefactorArguments.targetFile, context.program, statements, t, context.host, context.preferences));
|
|
138400
138417
|
return { edits, renameFilename: void 0, renameLocation: void 0 };
|
|
138401
138418
|
}
|
|
138402
138419
|
return error(getLocaleSpecificMessage(Diagnostics.Cannot_move_to_file_selected_file_is_invalid));
|
|
@@ -139032,25 +139049,25 @@ function getRangeToMove(context) {
|
|
|
139032
139049
|
const { file } = context;
|
|
139033
139050
|
const range = createTextRangeFromSpan(getRefactorContextSpan(context));
|
|
139034
139051
|
const { statements } = file;
|
|
139035
|
-
|
|
139052
|
+
let startNodeIndex = findIndex(statements, (s) => s.end > range.pos);
|
|
139036
139053
|
if (startNodeIndex === -1)
|
|
139037
139054
|
return void 0;
|
|
139038
139055
|
const startStatement = statements[startNodeIndex];
|
|
139039
|
-
if (isNamedDeclaration(startStatement) && startStatement.name && rangeContainsRange(startStatement.name, range)) {
|
|
139040
|
-
return { toMove: [statements[startNodeIndex]], afterLast: statements[startNodeIndex + 1] };
|
|
139041
|
-
}
|
|
139042
139056
|
const overloadRangeToMove = getOverloadRangeToMove(file, startStatement);
|
|
139043
139057
|
if (overloadRangeToMove) {
|
|
139044
|
-
|
|
139058
|
+
startNodeIndex = overloadRangeToMove.start;
|
|
139059
|
+
}
|
|
139060
|
+
let endNodeIndex = findIndex(statements, (s) => s.end >= range.end, startNodeIndex);
|
|
139061
|
+
if (endNodeIndex !== -1 && range.end <= statements[endNodeIndex].getStart()) {
|
|
139062
|
+
endNodeIndex--;
|
|
139063
|
+
}
|
|
139064
|
+
const endingOverloadRangeToMove = getOverloadRangeToMove(file, statements[endNodeIndex]);
|
|
139065
|
+
if (endingOverloadRangeToMove) {
|
|
139066
|
+
endNodeIndex = endingOverloadRangeToMove.end;
|
|
139045
139067
|
}
|
|
139046
|
-
if (range.pos > startStatement.getStart(file))
|
|
139047
|
-
return void 0;
|
|
139048
|
-
const afterEndNodeIndex = findIndex(statements, (s) => s.end > range.end, startNodeIndex);
|
|
139049
|
-
if (afterEndNodeIndex !== -1 && (afterEndNodeIndex === 0 || statements[afterEndNodeIndex].getStart(file) < range.end))
|
|
139050
|
-
return void 0;
|
|
139051
139068
|
return {
|
|
139052
|
-
toMove: statements.slice(startNodeIndex,
|
|
139053
|
-
afterLast:
|
|
139069
|
+
toMove: statements.slice(startNodeIndex, endNodeIndex === -1 ? statements.length : endNodeIndex + 1),
|
|
139070
|
+
afterLast: endNodeIndex === -1 ? void 0 : statements[endNodeIndex + 1]
|
|
139054
139071
|
};
|
|
139055
139072
|
}
|
|
139056
139073
|
function getStatementsToMove(context) {
|
|
@@ -139305,10 +139322,12 @@ function getOverloadRangeToMove(sourceFile, statement) {
|
|
|
139305
139322
|
if (declarations === void 0 || length(declarations) <= 1 || !contains(declarations, statement)) {
|
|
139306
139323
|
return void 0;
|
|
139307
139324
|
}
|
|
139325
|
+
const firstDecl = declarations[0];
|
|
139308
139326
|
const lastDecl = declarations[length(declarations) - 1];
|
|
139309
139327
|
const statementsToMove = mapDefined(declarations, (d) => getSourceFileOfNode(d) === sourceFile && isStatement(d) ? d : void 0);
|
|
139310
|
-
const end =
|
|
139311
|
-
|
|
139328
|
+
const end = findIndex(sourceFile.statements, (s) => s.end >= lastDecl.end);
|
|
139329
|
+
const start2 = findIndex(sourceFile.statements, (s) => s.end >= firstDecl.end);
|
|
139330
|
+
return { toMove: statementsToMove, start: start2, end };
|
|
139312
139331
|
}
|
|
139313
139332
|
return void 0;
|
|
139314
139333
|
}
|
|
@@ -164743,8 +164762,10 @@ function provideInlayHints(context) {
|
|
|
164743
164762
|
}
|
|
164744
164763
|
function addParameterHints(text, parameter, position, isFirstVariadicArgument, sourceFile) {
|
|
164745
164764
|
let hintText = `${isFirstVariadicArgument ? "..." : ""}${text}`;
|
|
164765
|
+
let displayParts;
|
|
164746
164766
|
if (shouldUseInteractiveInlayHints(preferences)) {
|
|
164747
|
-
|
|
164767
|
+
displayParts = [getNodeDisplayPart(hintText, parameter, sourceFile), { text: ":" }];
|
|
164768
|
+
hintText = "";
|
|
164748
164769
|
} else {
|
|
164749
164770
|
hintText += ":";
|
|
164750
164771
|
}
|
|
@@ -164752,7 +164773,8 @@ function provideInlayHints(context) {
|
|
|
164752
164773
|
text: hintText,
|
|
164753
164774
|
position,
|
|
164754
164775
|
kind: "Parameter" /* Parameter */,
|
|
164755
|
-
whitespaceAfter: true
|
|
164776
|
+
whitespaceAfter: true,
|
|
164777
|
+
displayParts
|
|
164756
164778
|
});
|
|
164757
164779
|
}
|
|
164758
164780
|
function addTypeHints(text, position) {
|
|
@@ -183640,19 +183662,18 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
183640
183662
|
const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file);
|
|
183641
183663
|
const hints = project.getLanguageService().provideInlayHints(file, args, this.getPreferences(file));
|
|
183642
183664
|
return hints.map((hint) => {
|
|
183643
|
-
const {
|
|
183644
|
-
const hintText = typeof text === "string" ? text : text.map(({ text: text2, span, file: file2 }) => ({
|
|
183645
|
-
text: text2,
|
|
183646
|
-
span: span && {
|
|
183647
|
-
start: scriptInfo.positionToLineOffset(span.start),
|
|
183648
|
-
end: scriptInfo.positionToLineOffset(span.start + span.length),
|
|
183649
|
-
file: file2
|
|
183650
|
-
}
|
|
183651
|
-
}));
|
|
183665
|
+
const { position, displayParts } = hint;
|
|
183652
183666
|
return {
|
|
183653
183667
|
...hint,
|
|
183654
183668
|
position: scriptInfo.positionToLineOffset(position),
|
|
183655
|
-
text:
|
|
183669
|
+
displayParts: displayParts == null ? void 0 : displayParts.map(({ text, span, file: file2 }) => ({
|
|
183670
|
+
text,
|
|
183671
|
+
span: span && {
|
|
183672
|
+
start: scriptInfo.positionToLineOffset(span.start),
|
|
183673
|
+
end: scriptInfo.positionToLineOffset(span.start + span.length),
|
|
183674
|
+
file: file2
|
|
183675
|
+
}
|
|
183676
|
+
}))
|
|
183656
183677
|
};
|
|
183657
183678
|
});
|
|
183658
183679
|
}
|
package/lib/tsserverlibrary.d.ts
CHANGED
|
@@ -2124,11 +2124,13 @@ declare namespace ts {
|
|
|
2124
2124
|
arguments: InlayHintsRequestArgs;
|
|
2125
2125
|
}
|
|
2126
2126
|
interface InlayHintItem {
|
|
2127
|
-
|
|
2127
|
+
/** This property will be the empty string when displayParts is set. */
|
|
2128
|
+
text: string;
|
|
2128
2129
|
position: Location;
|
|
2129
2130
|
kind: InlayHintKind;
|
|
2130
2131
|
whitespaceBefore?: boolean;
|
|
2131
2132
|
whitespaceAfter?: boolean;
|
|
2133
|
+
displayParts?: InlayHintItemDisplayPart[];
|
|
2132
2134
|
}
|
|
2133
2135
|
interface InlayHintItemDisplayPart {
|
|
2134
2136
|
text: string;
|
|
@@ -10390,11 +10392,13 @@ declare namespace ts {
|
|
|
10390
10392
|
Enum = "Enum"
|
|
10391
10393
|
}
|
|
10392
10394
|
interface InlayHint {
|
|
10393
|
-
|
|
10395
|
+
/** This property will be the empty string when displayParts is set. */
|
|
10396
|
+
text: string;
|
|
10394
10397
|
position: number;
|
|
10395
10398
|
kind: InlayHintKind;
|
|
10396
10399
|
whitespaceBefore?: boolean;
|
|
10397
10400
|
whitespaceAfter?: boolean;
|
|
10401
|
+
displayParts?: InlayHintDisplayPart[];
|
|
10398
10402
|
}
|
|
10399
10403
|
interface InlayHintDisplayPart {
|
|
10400
10404
|
text: string;
|