typescript 5.2.0-dev.20230804 → 5.2.0-dev.20230806
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/tsserverlibrary.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.2";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20230806`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -4387,15 +4387,13 @@ ${lanes.join("\n")}
|
|
|
4387
4387
|
NodeCheckFlags2[NodeCheckFlags2["ContainsCapturedBlockScopeBinding"] = 8192] = "ContainsCapturedBlockScopeBinding";
|
|
4388
4388
|
NodeCheckFlags2[NodeCheckFlags2["CapturedBlockScopedBinding"] = 16384] = "CapturedBlockScopedBinding";
|
|
4389
4389
|
NodeCheckFlags2[NodeCheckFlags2["BlockScopedBindingInLoop"] = 32768] = "BlockScopedBindingInLoop";
|
|
4390
|
-
NodeCheckFlags2[NodeCheckFlags2["
|
|
4391
|
-
NodeCheckFlags2[NodeCheckFlags2["
|
|
4392
|
-
NodeCheckFlags2[NodeCheckFlags2["
|
|
4393
|
-
NodeCheckFlags2[NodeCheckFlags2["
|
|
4394
|
-
NodeCheckFlags2[NodeCheckFlags2["
|
|
4395
|
-
NodeCheckFlags2[NodeCheckFlags2["
|
|
4396
|
-
NodeCheckFlags2[NodeCheckFlags2["
|
|
4397
|
-
NodeCheckFlags2[NodeCheckFlags2["ContainsSuperPropertyInStaticInitializer"] = 8388608] = "ContainsSuperPropertyInStaticInitializer";
|
|
4398
|
-
NodeCheckFlags2[NodeCheckFlags2["InCheckIdentifier"] = 16777216] = "InCheckIdentifier";
|
|
4390
|
+
NodeCheckFlags2[NodeCheckFlags2["NeedsLoopOutParameter"] = 65536] = "NeedsLoopOutParameter";
|
|
4391
|
+
NodeCheckFlags2[NodeCheckFlags2["AssignmentsMarked"] = 131072] = "AssignmentsMarked";
|
|
4392
|
+
NodeCheckFlags2[NodeCheckFlags2["ContainsConstructorReference"] = 262144] = "ContainsConstructorReference";
|
|
4393
|
+
NodeCheckFlags2[NodeCheckFlags2["ConstructorReference"] = 536870912] = "ConstructorReference";
|
|
4394
|
+
NodeCheckFlags2[NodeCheckFlags2["ContainsClassWithPrivateIdentifiers"] = 1048576] = "ContainsClassWithPrivateIdentifiers";
|
|
4395
|
+
NodeCheckFlags2[NodeCheckFlags2["ContainsSuperPropertyInStaticInitializer"] = 2097152] = "ContainsSuperPropertyInStaticInitializer";
|
|
4396
|
+
NodeCheckFlags2[NodeCheckFlags2["InCheckIdentifier"] = 4194304] = "InCheckIdentifier";
|
|
4399
4397
|
return NodeCheckFlags2;
|
|
4400
4398
|
})(NodeCheckFlags || {});
|
|
4401
4399
|
TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
@@ -27672,7 +27670,7 @@ ${lanes.join("\n")}
|
|
|
27672
27670
|
initializer
|
|
27673
27671
|
);
|
|
27674
27672
|
}
|
|
27675
|
-
function createAccessorPropertyGetRedirector(factory2, node, modifiers, name) {
|
|
27673
|
+
function createAccessorPropertyGetRedirector(factory2, node, modifiers, name, receiver = factory2.createThis()) {
|
|
27676
27674
|
return factory2.createGetAccessorDeclaration(
|
|
27677
27675
|
modifiers,
|
|
27678
27676
|
name,
|
|
@@ -27682,7 +27680,7 @@ ${lanes.join("\n")}
|
|
|
27682
27680
|
factory2.createBlock([
|
|
27683
27681
|
factory2.createReturnStatement(
|
|
27684
27682
|
factory2.createPropertyAccessExpression(
|
|
27685
|
-
|
|
27683
|
+
receiver,
|
|
27686
27684
|
factory2.getGeneratedPrivateNameForNode(
|
|
27687
27685
|
node.name,
|
|
27688
27686
|
/*prefix*/
|
|
@@ -27694,7 +27692,7 @@ ${lanes.join("\n")}
|
|
|
27694
27692
|
])
|
|
27695
27693
|
);
|
|
27696
27694
|
}
|
|
27697
|
-
function createAccessorPropertySetRedirector(factory2, node, modifiers, name) {
|
|
27695
|
+
function createAccessorPropertySetRedirector(factory2, node, modifiers, name, receiver = factory2.createThis()) {
|
|
27698
27696
|
return factory2.createSetAccessorDeclaration(
|
|
27699
27697
|
modifiers,
|
|
27700
27698
|
name,
|
|
@@ -27709,7 +27707,7 @@ ${lanes.join("\n")}
|
|
|
27709
27707
|
factory2.createExpressionStatement(
|
|
27710
27708
|
factory2.createAssignment(
|
|
27711
27709
|
factory2.createPropertyAccessExpression(
|
|
27712
|
-
|
|
27710
|
+
receiver,
|
|
27713
27711
|
factory2.getGeneratedPrivateNameForNode(
|
|
27714
27712
|
node.name,
|
|
27715
27713
|
/*prefix*/
|
|
@@ -68621,8 +68619,8 @@ ${lanes.join("\n")}
|
|
|
68621
68619
|
}
|
|
68622
68620
|
const parent2 = getRootDeclaration(symbol.valueDeclaration).parent;
|
|
68623
68621
|
const links = getNodeLinks(parent2);
|
|
68624
|
-
if (!(links.flags &
|
|
68625
|
-
links.flags |=
|
|
68622
|
+
if (!(links.flags & 131072 /* AssignmentsMarked */)) {
|
|
68623
|
+
links.flags |= 131072 /* AssignmentsMarked */;
|
|
68626
68624
|
if (!hasParentWithAssignmentsMarked(parent2)) {
|
|
68627
68625
|
markNodeAssignments(parent2);
|
|
68628
68626
|
}
|
|
@@ -68630,7 +68628,7 @@ ${lanes.join("\n")}
|
|
|
68630
68628
|
return symbol.isAssigned || false;
|
|
68631
68629
|
}
|
|
68632
68630
|
function hasParentWithAssignmentsMarked(node) {
|
|
68633
|
-
return !!findAncestor(node.parent, (node2) => (isFunctionLike(node2) || isCatchClause(node2)) && !!(getNodeLinks(node2).flags &
|
|
68631
|
+
return !!findAncestor(node.parent, (node2) => (isFunctionLike(node2) || isCatchClause(node2)) && !!(getNodeLinks(node2).flags & 131072 /* AssignmentsMarked */));
|
|
68634
68632
|
}
|
|
68635
68633
|
function markNodeAssignments(node) {
|
|
68636
68634
|
if (node.kind === 80 /* Identifier */) {
|
|
@@ -68736,11 +68734,11 @@ ${lanes.join("\n")}
|
|
|
68736
68734
|
const parent2 = declaration.parent.parent;
|
|
68737
68735
|
if (parent2.kind === 260 /* VariableDeclaration */ && getCombinedNodeFlagsCached(declaration) & 6 /* Constant */ || parent2.kind === 169 /* Parameter */) {
|
|
68738
68736
|
const links = getNodeLinks(parent2);
|
|
68739
|
-
if (!(links.flags &
|
|
68740
|
-
links.flags |=
|
|
68737
|
+
if (!(links.flags & 4194304 /* InCheckIdentifier */)) {
|
|
68738
|
+
links.flags |= 4194304 /* InCheckIdentifier */;
|
|
68741
68739
|
const parentType = getTypeForBindingElementParent(parent2, 0 /* Normal */);
|
|
68742
68740
|
const parentTypeConstraint = parentType && mapType(parentType, getBaseConstraintOrType);
|
|
68743
|
-
links.flags &= ~
|
|
68741
|
+
links.flags &= ~4194304 /* InCheckIdentifier */;
|
|
68744
68742
|
if (parentTypeConstraint && parentTypeConstraint.flags & 1048576 /* Union */ && !(parent2.kind === 169 /* Parameter */ && isSymbolAssigned(symbol))) {
|
|
68745
68743
|
const pattern = declaration.parent;
|
|
68746
68744
|
const narrowedType = getFlowTypeOfReference(
|
|
@@ -68817,17 +68815,7 @@ ${lanes.join("\n")}
|
|
|
68817
68815
|
}
|
|
68818
68816
|
let declaration = localOrExportSymbol.valueDeclaration;
|
|
68819
68817
|
if (declaration && localOrExportSymbol.flags & 32 /* Class */) {
|
|
68820
|
-
if (declaration
|
|
68821
|
-
let container = getContainingClass(node);
|
|
68822
|
-
while (container !== void 0) {
|
|
68823
|
-
if (container === declaration && container.name !== node) {
|
|
68824
|
-
getNodeLinks(declaration).flags |= 1048576 /* ClassWithConstructorReference */;
|
|
68825
|
-
getNodeLinks(node).flags |= 2097152 /* ConstructorReferenceInClass */;
|
|
68826
|
-
break;
|
|
68827
|
-
}
|
|
68828
|
-
container = getContainingClass(container);
|
|
68829
|
-
}
|
|
68830
|
-
} else if (declaration.kind === 231 /* ClassExpression */) {
|
|
68818
|
+
if (isClassLike(declaration) && declaration.name !== node) {
|
|
68831
68819
|
let container = getThisContainer(
|
|
68832
68820
|
node,
|
|
68833
68821
|
/*includeArrowFunctions*/
|
|
@@ -68835,14 +68823,7 @@ ${lanes.join("\n")}
|
|
|
68835
68823
|
/*includeClassComputedPropertyName*/
|
|
68836
68824
|
false
|
|
68837
68825
|
);
|
|
68838
|
-
while (container.kind !== 312 /* SourceFile */) {
|
|
68839
|
-
if (container.parent === declaration) {
|
|
68840
|
-
if (isPropertyDeclaration(container) && isStatic(container) || isClassStaticBlockDeclaration(container)) {
|
|
68841
|
-
getNodeLinks(declaration).flags |= 1048576 /* ClassWithConstructorReference */;
|
|
68842
|
-
getNodeLinks(node).flags |= 2097152 /* ConstructorReferenceInClass */;
|
|
68843
|
-
}
|
|
68844
|
-
break;
|
|
68845
|
-
}
|
|
68826
|
+
while (container.kind !== 312 /* SourceFile */ && container.parent !== declaration) {
|
|
68846
68827
|
container = getThisContainer(
|
|
68847
68828
|
container,
|
|
68848
68829
|
/*includeArrowFunctions*/
|
|
@@ -68851,6 +68832,11 @@ ${lanes.join("\n")}
|
|
|
68851
68832
|
false
|
|
68852
68833
|
);
|
|
68853
68834
|
}
|
|
68835
|
+
if (container.kind !== 312 /* SourceFile */) {
|
|
68836
|
+
getNodeLinks(declaration).flags |= 262144 /* ContainsConstructorReference */;
|
|
68837
|
+
getNodeLinks(container).flags |= 262144 /* ContainsConstructorReference */;
|
|
68838
|
+
getNodeLinks(node).flags |= 536870912 /* ConstructorReference */;
|
|
68839
|
+
}
|
|
68854
68840
|
}
|
|
68855
68841
|
}
|
|
68856
68842
|
checkNestedBlockScopedBinding(node, symbol);
|
|
@@ -68981,7 +68967,7 @@ ${lanes.join("\n")}
|
|
|
68981
68967
|
if (isForStatement(container)) {
|
|
68982
68968
|
const varDeclList = getAncestor(symbol.valueDeclaration, 261 /* VariableDeclarationList */);
|
|
68983
68969
|
if (varDeclList && varDeclList.parent === container && isAssignedInBodyOfForStatement(node, container)) {
|
|
68984
|
-
getNodeLinks(symbol.valueDeclaration).flags |=
|
|
68970
|
+
getNodeLinks(symbol.valueDeclaration).flags |= 65536 /* NeedsLoopOutParameter */;
|
|
68985
68971
|
}
|
|
68986
68972
|
}
|
|
68987
68973
|
getNodeLinks(symbol.valueDeclaration).flags |= 32768 /* BlockScopedBindingInLoop */;
|
|
@@ -69259,7 +69245,7 @@ ${lanes.join("\n")}
|
|
|
69259
69245
|
if (!isCallExpression2 && languageVersion >= 2 /* ES2015 */ && languageVersion <= 8 /* ES2021 */ && (isPropertyDeclaration(container) || isClassStaticBlockDeclaration(container))) {
|
|
69260
69246
|
forEachEnclosingBlockScopeContainer(node.parent, (current) => {
|
|
69261
69247
|
if (!isSourceFile(current) || isExternalOrCommonJsModule(current)) {
|
|
69262
|
-
getNodeLinks(current).flags |=
|
|
69248
|
+
getNodeLinks(current).flags |= 2097152 /* ContainsSuperPropertyInStaticInitializer */;
|
|
69263
69249
|
}
|
|
69264
69250
|
});
|
|
69265
69251
|
}
|
|
@@ -72801,7 +72787,7 @@ ${lanes.join("\n")}
|
|
|
72801
72787
|
}
|
|
72802
72788
|
}
|
|
72803
72789
|
function getThisArgumentOfCall(node) {
|
|
72804
|
-
const expression = node.kind === 213 /* CallExpression */ ? node.expression : node.kind === 215 /* TaggedTemplateExpression */ ? node.tag : void 0;
|
|
72790
|
+
const expression = node.kind === 213 /* CallExpression */ ? node.expression : node.kind === 215 /* TaggedTemplateExpression */ ? node.tag : node.kind === 170 /* Decorator */ && !legacyDecorators ? node.expression : void 0;
|
|
72805
72791
|
if (expression) {
|
|
72806
72792
|
const callee = skipOuterExpressions(expression);
|
|
72807
72793
|
if (isAccessExpression(callee)) {
|
|
@@ -77708,7 +77694,7 @@ ${lanes.join("\n")}
|
|
|
77708
77694
|
function setNodeLinksForPrivateIdentifierScope(node) {
|
|
77709
77695
|
if (isPrivateIdentifier(node.name) && languageVersion < 99 /* ESNext */) {
|
|
77710
77696
|
for (let lexicalScope = getEnclosingBlockScopeContainer(node); !!lexicalScope; lexicalScope = getEnclosingBlockScopeContainer(lexicalScope)) {
|
|
77711
|
-
getNodeLinks(lexicalScope).flags |=
|
|
77697
|
+
getNodeLinks(lexicalScope).flags |= 1048576 /* ContainsClassWithPrivateIdentifiers */;
|
|
77712
77698
|
}
|
|
77713
77699
|
if (isClassExpression(node.parent)) {
|
|
77714
77700
|
const enclosingIterationStatement = getEnclosingIterationStatement(node.parent);
|
|
@@ -79461,7 +79447,7 @@ ${lanes.join("\n")}
|
|
|
79461
79447
|
}
|
|
79462
79448
|
function checkWeakMapSetCollision(node) {
|
|
79463
79449
|
const enclosingBlockScope = getEnclosingBlockScopeContainer(node);
|
|
79464
|
-
if (getNodeCheckFlags(enclosingBlockScope) &
|
|
79450
|
+
if (getNodeCheckFlags(enclosingBlockScope) & 1048576 /* ContainsClassWithPrivateIdentifiers */) {
|
|
79465
79451
|
Debug.assert(isNamedDeclaration(node) && isIdentifier(node.name) && typeof node.name.escapedText === "string", "The target of a WeakMap/WeakSet collision check should be an identifier");
|
|
79466
79452
|
errorSkippedOn("noEmit", node, Diagnostics.Compiler_reserves_name_0_when_emitting_private_identifier_downlevel, node.name.escapedText);
|
|
79467
79453
|
}
|
|
@@ -79475,18 +79461,18 @@ ${lanes.join("\n")}
|
|
|
79475
79461
|
let hasCollision = false;
|
|
79476
79462
|
if (isClassExpression(node)) {
|
|
79477
79463
|
for (const member of node.members) {
|
|
79478
|
-
if (getNodeCheckFlags(member) &
|
|
79464
|
+
if (getNodeCheckFlags(member) & 2097152 /* ContainsSuperPropertyInStaticInitializer */) {
|
|
79479
79465
|
hasCollision = true;
|
|
79480
79466
|
break;
|
|
79481
79467
|
}
|
|
79482
79468
|
}
|
|
79483
79469
|
} else if (isFunctionExpression(node)) {
|
|
79484
|
-
if (getNodeCheckFlags(node) &
|
|
79470
|
+
if (getNodeCheckFlags(node) & 2097152 /* ContainsSuperPropertyInStaticInitializer */) {
|
|
79485
79471
|
hasCollision = true;
|
|
79486
79472
|
}
|
|
79487
79473
|
} else {
|
|
79488
79474
|
const container = getEnclosingBlockScopeContainer(node);
|
|
79489
|
-
if (container && getNodeCheckFlags(container) &
|
|
79475
|
+
if (container && getNodeCheckFlags(container) & 2097152 /* ContainsSuperPropertyInStaticInitializer */) {
|
|
79490
79476
|
hasCollision = true;
|
|
79491
79477
|
}
|
|
79492
79478
|
}
|
|
@@ -91965,6 +91951,11 @@ ${lanes.join("\n")}
|
|
|
91965
91951
|
}
|
|
91966
91952
|
}
|
|
91967
91953
|
}
|
|
91954
|
+
function getClassThis() {
|
|
91955
|
+
const lex = getClassLexicalEnvironment();
|
|
91956
|
+
const classThis = lex.classThis ?? lex.classConstructor ?? (currentClassContainer == null ? void 0 : currentClassContainer.name);
|
|
91957
|
+
return Debug.checkDefined(classThis);
|
|
91958
|
+
}
|
|
91968
91959
|
function transformAutoAccessor(node) {
|
|
91969
91960
|
const commentRange = getCommentRange(node);
|
|
91970
91961
|
const sourceMapRange = getSourceMapRange(node);
|
|
@@ -91991,11 +91982,13 @@ ${lanes.join("\n")}
|
|
|
91991
91982
|
setOriginalNode(backingField, node);
|
|
91992
91983
|
setEmitFlags(backingField, 3072 /* NoComments */);
|
|
91993
91984
|
setSourceMapRange(backingField, sourceMapRange);
|
|
91994
|
-
const
|
|
91985
|
+
const receiver = isStatic(node) ? getClassThis() : factory2.createThis();
|
|
91986
|
+
const getter = createAccessorPropertyGetRedirector(factory2, node, modifiers, getterName, receiver);
|
|
91995
91987
|
setOriginalNode(getter, node);
|
|
91996
91988
|
setCommentRange(getter, commentRange);
|
|
91997
91989
|
setSourceMapRange(getter, sourceMapRange);
|
|
91998
|
-
const
|
|
91990
|
+
const setterModifiers = factory2.createModifiersFromModifierFlags(modifiersToFlags(modifiers));
|
|
91991
|
+
const setter = createAccessorPropertySetRedirector(factory2, node, setterModifiers, setterName, receiver);
|
|
91999
91992
|
setOriginalNode(setter, node);
|
|
92000
91993
|
setEmitFlags(setter, 3072 /* NoComments */);
|
|
92001
91994
|
setSourceMapRange(setter, sourceMapRange);
|
|
@@ -92552,6 +92545,7 @@ ${lanes.join("\n")}
|
|
|
92552
92545
|
return filter(node.members, isNonStaticMethodOrAccessorWithPrivateName);
|
|
92553
92546
|
}
|
|
92554
92547
|
function getClassFacts(node) {
|
|
92548
|
+
var _a;
|
|
92555
92549
|
let facts = 0 /* None */;
|
|
92556
92550
|
const original = getOriginalNode(node);
|
|
92557
92551
|
if (isClassDeclaration(original) && classOrConstructorParameterIsDecorated(legacyDecorators, original)) {
|
|
@@ -92568,6 +92562,8 @@ ${lanes.join("\n")}
|
|
|
92568
92562
|
if (isStatic(member)) {
|
|
92569
92563
|
if (member.name && (isPrivateIdentifier(member.name) || isAutoAccessorPropertyDeclaration(member)) && shouldTransformPrivateElementsOrClassStaticBlocks) {
|
|
92570
92564
|
facts |= 2 /* NeedsClassConstructorReference */;
|
|
92565
|
+
} else if (isAutoAccessorPropertyDeclaration(member) && shouldTransformAutoAccessors === -1 /* True */ && !node.name && !((_a = node.emitNode) == null ? void 0 : _a.classThis)) {
|
|
92566
|
+
facts |= 2 /* NeedsClassConstructorReference */;
|
|
92571
92567
|
}
|
|
92572
92568
|
if (isPropertyDeclaration(member) || isClassStaticBlockDeclaration(member)) {
|
|
92573
92569
|
if (shouldTransformThisInStaticInitializers && member.transformFlags & 16384 /* ContainsLexicalThis */) {
|
|
@@ -92588,6 +92584,9 @@ ${lanes.join("\n")}
|
|
|
92588
92584
|
containsInstancePrivateElements || (containsInstancePrivateElements = isPrivateIdentifierClassElementDeclaration(member));
|
|
92589
92585
|
} else if (isPrivateIdentifierClassElementDeclaration(member)) {
|
|
92590
92586
|
containsInstancePrivateElements = true;
|
|
92587
|
+
if (resolver.getNodeCheckFlags(member) & 262144 /* ContainsConstructorReference */) {
|
|
92588
|
+
facts |= 2 /* NeedsClassConstructorReference */;
|
|
92589
|
+
}
|
|
92591
92590
|
} else if (isPropertyDeclaration(member)) {
|
|
92592
92591
|
containsPublicInstanceFields = true;
|
|
92593
92592
|
containsInitializedPublicInstanceFields || (containsInitializedPublicInstanceFields = !!member.initializer);
|
|
@@ -92688,10 +92687,11 @@ ${lanes.join("\n")}
|
|
|
92688
92687
|
getClassLexicalEnvironment().classConstructor = factory2.cloneNode(temp);
|
|
92689
92688
|
pendingClassReferenceAssignment = factory2.createAssignment(temp, factory2.getInternalName(node));
|
|
92690
92689
|
}
|
|
92691
|
-
if ((_b = node.emitNode) == null ? void 0 : _b.classThis) {
|
|
92692
|
-
getClassLexicalEnvironment().classThis = node.emitNode.classThis;
|
|
92693
|
-
}
|
|
92694
92690
|
}
|
|
92691
|
+
if ((_b = node.emitNode) == null ? void 0 : _b.classThis) {
|
|
92692
|
+
getClassLexicalEnvironment().classThis = node.emitNode.classThis;
|
|
92693
|
+
}
|
|
92694
|
+
const isClassWithConstructorReference = resolver.getNodeCheckFlags(node) & 262144 /* ContainsConstructorReference */;
|
|
92695
92695
|
const isExport = hasSyntacticModifier(node, 1 /* Export */);
|
|
92696
92696
|
const isDefault = hasSyntacticModifier(node, 1024 /* Default */);
|
|
92697
92697
|
let modifiers = visitNodes2(node.modifiers, modifierVisitor, isModifier);
|
|
@@ -92726,6 +92726,11 @@ ${lanes.join("\n")}
|
|
|
92726
92726
|
)
|
|
92727
92727
|
));
|
|
92728
92728
|
}
|
|
92729
|
+
const alias = getClassLexicalEnvironment().classConstructor;
|
|
92730
|
+
if (isClassWithConstructorReference && alias) {
|
|
92731
|
+
enableSubstitutionForClassAliases();
|
|
92732
|
+
classAliases[getOriginalNodeId(node)] = alias;
|
|
92733
|
+
}
|
|
92729
92734
|
const classDecl = factory2.updateClassDeclaration(
|
|
92730
92735
|
node,
|
|
92731
92736
|
modifiers,
|
|
@@ -92748,14 +92753,14 @@ ${lanes.join("\n")}
|
|
|
92748
92753
|
var _a, _b, _c;
|
|
92749
92754
|
const isDecoratedClassDeclaration = !!(facts & 1 /* ClassWasDecorated */);
|
|
92750
92755
|
const staticPropertiesOrClassStaticBlocks = getStaticPropertiesAndClassStaticBlock(node);
|
|
92751
|
-
const
|
|
92756
|
+
const classCheckFlags = resolver.getNodeCheckFlags(node);
|
|
92757
|
+
const isClassWithConstructorReference = classCheckFlags & 262144 /* ContainsConstructorReference */;
|
|
92752
92758
|
let temp;
|
|
92753
92759
|
function createClassTempVar() {
|
|
92754
92760
|
var _a2;
|
|
92755
92761
|
if (shouldTransformPrivateElementsOrClassStaticBlocks && ((_a2 = node.emitNode) == null ? void 0 : _a2.classThis)) {
|
|
92756
92762
|
return getClassLexicalEnvironment().classConstructor = node.emitNode.classThis;
|
|
92757
92763
|
}
|
|
92758
|
-
const classCheckFlags = resolver.getNodeCheckFlags(node);
|
|
92759
92764
|
const requiresBlockScopedVar = classCheckFlags & 32768 /* BlockScopedBindingInLoop */;
|
|
92760
92765
|
const temp2 = factory2.createTempVariable(
|
|
92761
92766
|
requiresBlockScopedVar ? addBlockScopedVariable : hoistVariableDeclaration,
|
|
@@ -93722,7 +93727,7 @@ ${lanes.join("\n")}
|
|
|
93722
93727
|
}
|
|
93723
93728
|
function trySubstituteClassAlias(node) {
|
|
93724
93729
|
if (enabledSubstitutions & 1 /* ClassAliases */) {
|
|
93725
|
-
if (resolver.getNodeCheckFlags(node) &
|
|
93730
|
+
if (resolver.getNodeCheckFlags(node) & 536870912 /* ConstructorReference */) {
|
|
93726
93731
|
const declaration = resolver.getReferencedValueDeclaration(node);
|
|
93727
93732
|
if (declaration) {
|
|
93728
93733
|
const classAlias = classAliases[declaration.id];
|
|
@@ -94588,7 +94593,7 @@ ${lanes.join("\n")}
|
|
|
94588
94593
|
}
|
|
94589
94594
|
}
|
|
94590
94595
|
function getClassAliasIfNeeded(node) {
|
|
94591
|
-
if (resolver.getNodeCheckFlags(node) &
|
|
94596
|
+
if (resolver.getNodeCheckFlags(node) & 262144 /* ContainsConstructorReference */) {
|
|
94592
94597
|
enableSubstitutionForClassAliases();
|
|
94593
94598
|
const classAlias = factory2.createUniqueName(node.name && !isGeneratedIdentifier(node.name) ? idText(node.name) : "default");
|
|
94594
94599
|
classAliases[getOriginalNodeId(node)] = classAlias;
|
|
@@ -94621,7 +94626,7 @@ ${lanes.join("\n")}
|
|
|
94621
94626
|
}
|
|
94622
94627
|
function trySubstituteClassAlias(node) {
|
|
94623
94628
|
if (classAliases) {
|
|
94624
|
-
if (resolver.getNodeCheckFlags(node) &
|
|
94629
|
+
if (resolver.getNodeCheckFlags(node) & 536870912 /* ConstructorReference */) {
|
|
94625
94630
|
const declaration = resolver.getReferencedValueDeclaration(node);
|
|
94626
94631
|
if (declaration) {
|
|
94627
94632
|
const classAlias = classAliases[declaration.id];
|
|
@@ -94653,6 +94658,7 @@ ${lanes.join("\n")}
|
|
|
94653
94658
|
endLexicalEnvironment,
|
|
94654
94659
|
hoistVariableDeclaration
|
|
94655
94660
|
} = context;
|
|
94661
|
+
const languageVersion = getEmitScriptTarget(context.getCompilerOptions());
|
|
94656
94662
|
let top;
|
|
94657
94663
|
let classInfo;
|
|
94658
94664
|
let classThis;
|
|
@@ -96154,6 +96160,17 @@ ${lanes.join("\n")}
|
|
|
96154
96160
|
function transformDecorator(decorator) {
|
|
96155
96161
|
const expression = visitNode(decorator.expression, visitor, isExpression);
|
|
96156
96162
|
setEmitFlags(expression, 3072 /* NoComments */);
|
|
96163
|
+
const innerExpression = skipOuterExpressions(expression);
|
|
96164
|
+
if (isAccessExpression(innerExpression)) {
|
|
96165
|
+
const { target, thisArg } = factory2.createCallBinding(
|
|
96166
|
+
expression,
|
|
96167
|
+
hoistVariableDeclaration,
|
|
96168
|
+
languageVersion,
|
|
96169
|
+
/*cacheIdentifiers*/
|
|
96170
|
+
true
|
|
96171
|
+
);
|
|
96172
|
+
return factory2.restoreOuterExpressions(expression, factory2.createFunctionBindCall(target, thisArg, []));
|
|
96173
|
+
}
|
|
96157
96174
|
return expression;
|
|
96158
96175
|
}
|
|
96159
96176
|
function createDescriptorMethod(original, name, modifiers, asteriskToken, kind, parameters, body) {
|
|
@@ -102852,10 +102869,10 @@ ${lanes.join("\n")}
|
|
|
102852
102869
|
name
|
|
102853
102870
|
));
|
|
102854
102871
|
const checkFlags = resolver.getNodeCheckFlags(decl);
|
|
102855
|
-
if (checkFlags &
|
|
102872
|
+
if (checkFlags & 65536 /* NeedsLoopOutParameter */ || hasCapturedBindingsInForHead) {
|
|
102856
102873
|
const outParamName = factory2.createUniqueName("out_" + idText(name));
|
|
102857
102874
|
let flags = 0 /* None */;
|
|
102858
|
-
if (checkFlags &
|
|
102875
|
+
if (checkFlags & 65536 /* NeedsLoopOutParameter */) {
|
|
102859
102876
|
flags |= 1 /* Body */;
|
|
102860
102877
|
}
|
|
102861
102878
|
if (isForStatement(container)) {
|
|
@@ -137403,25 +137420,25 @@ ${lanes.join("\n")}
|
|
|
137403
137420
|
const { file } = context;
|
|
137404
137421
|
const range = createTextRangeFromSpan(getRefactorContextSpan(context));
|
|
137405
137422
|
const { statements } = file;
|
|
137406
|
-
|
|
137423
|
+
let startNodeIndex = findIndex(statements, (s) => s.end > range.pos);
|
|
137407
137424
|
if (startNodeIndex === -1)
|
|
137408
137425
|
return void 0;
|
|
137409
137426
|
const startStatement = statements[startNodeIndex];
|
|
137410
|
-
if (isNamedDeclaration(startStatement) && startStatement.name && rangeContainsRange(startStatement.name, range)) {
|
|
137411
|
-
return { toMove: [statements[startNodeIndex]], afterLast: statements[startNodeIndex + 1] };
|
|
137412
|
-
}
|
|
137413
137427
|
const overloadRangeToMove = getOverloadRangeToMove(file, startStatement);
|
|
137414
137428
|
if (overloadRangeToMove) {
|
|
137415
|
-
|
|
137429
|
+
startNodeIndex = overloadRangeToMove.start;
|
|
137430
|
+
}
|
|
137431
|
+
let endNodeIndex = findIndex(statements, (s) => s.end >= range.end, startNodeIndex);
|
|
137432
|
+
if (endNodeIndex !== -1 && range.end <= statements[endNodeIndex].getStart()) {
|
|
137433
|
+
endNodeIndex--;
|
|
137434
|
+
}
|
|
137435
|
+
const endingOverloadRangeToMove = getOverloadRangeToMove(file, statements[endNodeIndex]);
|
|
137436
|
+
if (endingOverloadRangeToMove) {
|
|
137437
|
+
endNodeIndex = endingOverloadRangeToMove.end;
|
|
137416
137438
|
}
|
|
137417
|
-
if (range.pos > startStatement.getStart(file))
|
|
137418
|
-
return void 0;
|
|
137419
|
-
const afterEndNodeIndex = findIndex(statements, (s) => s.end > range.end, startNodeIndex);
|
|
137420
|
-
if (afterEndNodeIndex !== -1 && (afterEndNodeIndex === 0 || statements[afterEndNodeIndex].getStart(file) < range.end))
|
|
137421
|
-
return void 0;
|
|
137422
137439
|
return {
|
|
137423
|
-
toMove: statements.slice(startNodeIndex,
|
|
137424
|
-
afterLast:
|
|
137440
|
+
toMove: statements.slice(startNodeIndex, endNodeIndex === -1 ? statements.length : endNodeIndex + 1),
|
|
137441
|
+
afterLast: endNodeIndex === -1 ? void 0 : statements[endNodeIndex + 1]
|
|
137425
137442
|
};
|
|
137426
137443
|
}
|
|
137427
137444
|
function getStatementsToMove(context) {
|
|
@@ -137676,10 +137693,12 @@ ${lanes.join("\n")}
|
|
|
137676
137693
|
if (declarations === void 0 || length(declarations) <= 1 || !contains(declarations, statement)) {
|
|
137677
137694
|
return void 0;
|
|
137678
137695
|
}
|
|
137696
|
+
const firstDecl = declarations[0];
|
|
137679
137697
|
const lastDecl = declarations[length(declarations) - 1];
|
|
137680
137698
|
const statementsToMove = mapDefined(declarations, (d) => getSourceFileOfNode(d) === sourceFile && isStatement(d) ? d : void 0);
|
|
137681
|
-
const end =
|
|
137682
|
-
|
|
137699
|
+
const end = findIndex(sourceFile.statements, (s) => s.end >= lastDecl.end);
|
|
137700
|
+
const start = findIndex(sourceFile.statements, (s) => s.end >= firstDecl.end);
|
|
137701
|
+
return { toMove: statementsToMove, start, end };
|
|
137683
137702
|
}
|
|
137684
137703
|
return void 0;
|
|
137685
137704
|
}
|
|
@@ -137726,7 +137745,7 @@ ${lanes.join("\n")}
|
|
|
137726
137745
|
if (host.fileExists(targetFile) && program.getSourceFile(targetFile) === void 0) {
|
|
137727
137746
|
return error(getLocaleSpecificMessage(Diagnostics.Cannot_move_statements_to_the_selected_file));
|
|
137728
137747
|
}
|
|
137729
|
-
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange4(context, context.file, interactiveRefactorArguments.targetFile, program, statements, t, context.host, context.preferences));
|
|
137748
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange4(context, context.file, interactiveRefactorArguments.targetFile, context.program, statements, t, context.host, context.preferences));
|
|
137730
137749
|
return { edits, renameFilename: void 0, renameLocation: void 0 };
|
|
137731
137750
|
}
|
|
137732
137751
|
return error(getLocaleSpecificMessage(Diagnostics.Cannot_move_to_file_selected_file_is_invalid));
|
|
@@ -164091,8 +164110,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
164091
164110
|
}
|
|
164092
164111
|
function addParameterHints(text, parameter, position, isFirstVariadicArgument, sourceFile) {
|
|
164093
164112
|
let hintText = `${isFirstVariadicArgument ? "..." : ""}${text}`;
|
|
164113
|
+
let displayParts;
|
|
164094
164114
|
if (shouldUseInteractiveInlayHints(preferences)) {
|
|
164095
|
-
|
|
164115
|
+
displayParts = [getNodeDisplayPart(hintText, parameter, sourceFile), { text: ":" }];
|
|
164116
|
+
hintText = "";
|
|
164096
164117
|
} else {
|
|
164097
164118
|
hintText += ":";
|
|
164098
164119
|
}
|
|
@@ -164100,7 +164121,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
164100
164121
|
text: hintText,
|
|
164101
164122
|
position,
|
|
164102
164123
|
kind: "Parameter" /* Parameter */,
|
|
164103
|
-
whitespaceAfter: true
|
|
164124
|
+
whitespaceAfter: true,
|
|
164125
|
+
displayParts
|
|
164104
164126
|
});
|
|
164105
164127
|
}
|
|
164106
164128
|
function addTypeHints(text, position) {
|
|
@@ -181047,19 +181069,18 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
181047
181069
|
const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file);
|
|
181048
181070
|
const hints = project.getLanguageService().provideInlayHints(file, args, this.getPreferences(file));
|
|
181049
181071
|
return hints.map((hint) => {
|
|
181050
|
-
const {
|
|
181051
|
-
const hintText = typeof text === "string" ? text : text.map(({ text: text2, span, file: file2 }) => ({
|
|
181052
|
-
text: text2,
|
|
181053
|
-
span: span && {
|
|
181054
|
-
start: scriptInfo.positionToLineOffset(span.start),
|
|
181055
|
-
end: scriptInfo.positionToLineOffset(span.start + span.length),
|
|
181056
|
-
file: file2
|
|
181057
|
-
}
|
|
181058
|
-
}));
|
|
181072
|
+
const { position, displayParts } = hint;
|
|
181059
181073
|
return {
|
|
181060
181074
|
...hint,
|
|
181061
181075
|
position: scriptInfo.positionToLineOffset(position),
|
|
181062
|
-
text:
|
|
181076
|
+
displayParts: displayParts == null ? void 0 : displayParts.map(({ text, span, file: file2 }) => ({
|
|
181077
|
+
text,
|
|
181078
|
+
span: span && {
|
|
181079
|
+
start: scriptInfo.positionToLineOffset(span.start),
|
|
181080
|
+
end: scriptInfo.positionToLineOffset(span.start + span.length),
|
|
181081
|
+
file: file2
|
|
181082
|
+
}
|
|
181083
|
+
}))
|
|
181063
181084
|
};
|
|
181064
181085
|
});
|
|
181065
181086
|
}
|
package/lib/typescript.d.ts
CHANGED
|
@@ -6416,11 +6416,13 @@ declare namespace ts {
|
|
|
6416
6416
|
Enum = "Enum"
|
|
6417
6417
|
}
|
|
6418
6418
|
interface InlayHint {
|
|
6419
|
-
|
|
6419
|
+
/** This property will be the empty string when displayParts is set. */
|
|
6420
|
+
text: string;
|
|
6420
6421
|
position: number;
|
|
6421
6422
|
kind: InlayHintKind;
|
|
6422
6423
|
whitespaceBefore?: boolean;
|
|
6423
6424
|
whitespaceAfter?: boolean;
|
|
6425
|
+
displayParts?: InlayHintDisplayPart[];
|
|
6424
6426
|
}
|
|
6425
6427
|
interface InlayHintDisplayPart {
|
|
6426
6428
|
text: string;
|