@typescript-deploys/pr-build 5.0.0-pr-52728-17 → 5.0.0-pr-49627-28
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 +46 -12
- package/lib/tsserver.js +85 -26
- package/lib/tsserverlibrary.d.ts +13 -0
- package/lib/tsserverlibrary.js +85 -26
- package/lib/typescript.d.ts +13 -0
- package/lib/typescript.js +85 -26
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -42585,7 +42585,6 @@ function createTypeChecker(host) {
|
|
|
42585
42585
|
let inlineLevel = 0;
|
|
42586
42586
|
let currentNode;
|
|
42587
42587
|
let varianceTypeParameter;
|
|
42588
|
-
let isInferencePartiallyBlocked = false;
|
|
42589
42588
|
const emptySymbols = createSymbolTable();
|
|
42590
42589
|
const arrayVariances = [1 /* Covariant */];
|
|
42591
42590
|
const compilerOptions = host.getCompilerOptions();
|
|
@@ -43017,9 +43016,7 @@ function createTypeChecker(host) {
|
|
|
43017
43016
|
toMarkSkip = toMarkSkip.parent;
|
|
43018
43017
|
} while (toMarkSkip && toMarkSkip !== containingCall);
|
|
43019
43018
|
}
|
|
43020
|
-
isInferencePartiallyBlocked = true;
|
|
43021
43019
|
const result = runWithoutResolvedSignatureCaching(node, fn);
|
|
43022
|
-
isInferencePartiallyBlocked = false;
|
|
43023
43020
|
if (containingCall) {
|
|
43024
43021
|
let toMarkSkip = node;
|
|
43025
43022
|
do {
|
|
@@ -47827,7 +47824,7 @@ function createTypeChecker(host) {
|
|
|
47827
47824
|
);
|
|
47828
47825
|
}
|
|
47829
47826
|
function signatureToSignatureDeclarationHelper(signature, kind, context, options) {
|
|
47830
|
-
var _a2, _b, _c, _d;
|
|
47827
|
+
var _a2, _b, _c, _d, _e;
|
|
47831
47828
|
const suppressAny = context.flags & 256 /* SuppressAnyReturnType */;
|
|
47832
47829
|
if (suppressAny)
|
|
47833
47830
|
context.flags &= ~256 /* SuppressAnyReturnType */;
|
|
@@ -47844,6 +47841,29 @@ function createTypeChecker(host) {
|
|
|
47844
47841
|
/*skipUnionExpanding*/
|
|
47845
47842
|
true
|
|
47846
47843
|
)[0];
|
|
47844
|
+
let restoreEnclosingDeclaration;
|
|
47845
|
+
if (context.enclosingDeclaration && signature.declaration && signature.declaration !== context.enclosingDeclaration && !isInJSFile(signature.declaration) && some(expandedParams)) {
|
|
47846
|
+
const locals = (_a2 = context.fakeScopeLocals) != null ? _a2 : context.fakeScopeLocals = createSymbolTable();
|
|
47847
|
+
let newLocals;
|
|
47848
|
+
for (const param of expandedParams) {
|
|
47849
|
+
if (!locals.has(param.escapedName)) {
|
|
47850
|
+
newLocals = append(newLocals, param.escapedName);
|
|
47851
|
+
locals.set(param.escapedName, param);
|
|
47852
|
+
}
|
|
47853
|
+
}
|
|
47854
|
+
if (newLocals) {
|
|
47855
|
+
const fakeScope = parseNodeFactory.createBlock(emptyArray);
|
|
47856
|
+
getNodeLinks(fakeScope).fakeScopeForSignatureDeclaration = true;
|
|
47857
|
+
fakeScope.locals = locals;
|
|
47858
|
+
const saveEnclosingDeclaration = context.enclosingDeclaration;
|
|
47859
|
+
setParent(fakeScope, saveEnclosingDeclaration);
|
|
47860
|
+
context.enclosingDeclaration = fakeScope;
|
|
47861
|
+
restoreEnclosingDeclaration = () => {
|
|
47862
|
+
context.enclosingDeclaration = saveEnclosingDeclaration;
|
|
47863
|
+
forEach(newLocals, (s) => locals.delete(s));
|
|
47864
|
+
};
|
|
47865
|
+
}
|
|
47866
|
+
}
|
|
47847
47867
|
const parameters = (some(expandedParams, (p) => p !== expandedParams[expandedParams.length - 1] && !!(getCheckFlags(p) & 32768 /* RestParameter */)) ? signature.parameters : expandedParams).map((parameter) => symbolToParameterDeclaration(parameter, context, kind === 173 /* Constructor */, options == null ? void 0 : options.privateSymbolVisitor, options == null ? void 0 : options.bundledImports));
|
|
47848
47868
|
const thisParameter = context.flags & 33554432 /* OmitThisParameter */ ? void 0 : tryGetThisParameterDeclaration(signature, context);
|
|
47849
47869
|
if (thisParameter) {
|
|
@@ -47869,11 +47889,11 @@ function createTypeChecker(host) {
|
|
|
47869
47889
|
const flags = modifiersToFlags(modifiers);
|
|
47870
47890
|
modifiers = factory.createModifiersFromModifierFlags(flags | 256 /* Abstract */);
|
|
47871
47891
|
}
|
|
47872
|
-
const node = kind === 176 /* CallSignature */ ? factory.createCallSignature(typeParameters, parameters, returnTypeNode) : kind === 177 /* ConstructSignature */ ? factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : kind === 170 /* MethodSignature */ ? factory.createMethodSignature(modifiers, (
|
|
47892
|
+
const node = kind === 176 /* CallSignature */ ? factory.createCallSignature(typeParameters, parameters, returnTypeNode) : kind === 177 /* ConstructSignature */ ? factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : kind === 170 /* MethodSignature */ ? factory.createMethodSignature(modifiers, (_b = options == null ? void 0 : options.name) != null ? _b : factory.createIdentifier(""), options == null ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : kind === 171 /* MethodDeclaration */ ? factory.createMethodDeclaration(
|
|
47873
47893
|
modifiers,
|
|
47874
47894
|
/*asteriskToken*/
|
|
47875
47895
|
void 0,
|
|
47876
|
-
(
|
|
47896
|
+
(_c = options == null ? void 0 : options.name) != null ? _c : factory.createIdentifier(""),
|
|
47877
47897
|
/*questionToken*/
|
|
47878
47898
|
void 0,
|
|
47879
47899
|
typeParameters,
|
|
@@ -47888,14 +47908,14 @@ function createTypeChecker(host) {
|
|
|
47888
47908
|
void 0
|
|
47889
47909
|
) : kind === 174 /* GetAccessor */ ? factory.createGetAccessorDeclaration(
|
|
47890
47910
|
modifiers,
|
|
47891
|
-
(
|
|
47911
|
+
(_d = options == null ? void 0 : options.name) != null ? _d : factory.createIdentifier(""),
|
|
47892
47912
|
parameters,
|
|
47893
47913
|
returnTypeNode,
|
|
47894
47914
|
/*body*/
|
|
47895
47915
|
void 0
|
|
47896
47916
|
) : kind === 175 /* SetAccessor */ ? factory.createSetAccessorDeclaration(
|
|
47897
47917
|
modifiers,
|
|
47898
|
-
(
|
|
47918
|
+
(_e = options == null ? void 0 : options.name) != null ? _e : factory.createIdentifier(""),
|
|
47899
47919
|
parameters,
|
|
47900
47920
|
/*body*/
|
|
47901
47921
|
void 0
|
|
@@ -47930,6 +47950,7 @@ function createTypeChecker(host) {
|
|
|
47930
47950
|
if (typeArguments) {
|
|
47931
47951
|
node.typeArguments = factory.createNodeArray(typeArguments);
|
|
47932
47952
|
}
|
|
47953
|
+
restoreEnclosingDeclaration == null ? void 0 : restoreEnclosingDeclaration();
|
|
47933
47954
|
return node;
|
|
47934
47955
|
}
|
|
47935
47956
|
function tryGetThisParameterDeclaration(signature, context) {
|
|
@@ -48544,9 +48565,12 @@ function createTypeChecker(host) {
|
|
|
48544
48565
|
function existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type) {
|
|
48545
48566
|
return !(getObjectFlags(type) & 4 /* Reference */) || !isTypeReferenceNode(existing) || length(existing.typeArguments) >= getMinTypeArgumentCount(type.target.typeParameters);
|
|
48546
48567
|
}
|
|
48568
|
+
function getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration) {
|
|
48569
|
+
return findAncestor(enclosingDeclaration, (n) => !getNodeLinks(n).fakeScopeForSignatureDeclaration);
|
|
48570
|
+
}
|
|
48547
48571
|
function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled) {
|
|
48548
48572
|
if (!isErrorType(type) && enclosingDeclaration) {
|
|
48549
|
-
const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, enclosingDeclaration);
|
|
48573
|
+
const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
|
|
48550
48574
|
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
48551
48575
|
const existing = getEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
48552
48576
|
if (typeNodeIsEquivalentToType(existing, declWithExistingAnnotation, type) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
|
|
@@ -48578,7 +48602,8 @@ function createTypeChecker(host) {
|
|
|
48578
48602
|
function serializeReturnTypeForSignature(context, type, signature, includePrivateSymbol, bundled) {
|
|
48579
48603
|
if (!isErrorType(type) && context.enclosingDeclaration) {
|
|
48580
48604
|
const annotation = signature.declaration && getEffectiveReturnTypeNode(signature.declaration);
|
|
48581
|
-
|
|
48605
|
+
const enclosingDeclarationIgnoringFakeScope = getEnclosingDeclarationIgnoringFakeScope(context.enclosingDeclaration);
|
|
48606
|
+
if (!!findAncestor(annotation, (n) => n === enclosingDeclarationIgnoringFakeScope) && annotation) {
|
|
48582
48607
|
const annotated = getTypeFromTypeNode(annotation);
|
|
48583
48608
|
const thisInstantiated = annotated.flags & 262144 /* TypeParameter */ && annotated.isThisType ? instantiateType(annotated, signature.mapper) : annotated;
|
|
48584
48609
|
if (thisInstantiated === type && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(annotation, type)) {
|
|
@@ -69661,7 +69686,7 @@ function createTypeChecker(host) {
|
|
|
69661
69686
|
const isTaggedTemplate = node.kind === 212 /* TaggedTemplateExpression */;
|
|
69662
69687
|
const isDecorator2 = node.kind === 167 /* Decorator */;
|
|
69663
69688
|
const isJsxOpeningOrSelfClosingElement = isJsxOpeningLikeElement(node);
|
|
69664
|
-
const reportErrors2 = !
|
|
69689
|
+
const reportErrors2 = !candidatesOutArray;
|
|
69665
69690
|
let typeArguments;
|
|
69666
69691
|
if (!isDecorator2 && !isSuperCall(node)) {
|
|
69667
69692
|
typeArguments = node.typeArguments;
|
|
@@ -87640,7 +87665,16 @@ function transformClassFields(context) {
|
|
|
87640
87665
|
visitNode(node.initializer, (child) => namedEvaluationVisitor(child, referencedName), isExpression)
|
|
87641
87666
|
);
|
|
87642
87667
|
}
|
|
87643
|
-
return
|
|
87668
|
+
return factory2.updatePropertyDeclaration(
|
|
87669
|
+
node,
|
|
87670
|
+
visitNodes2(node.modifiers, modifierVisitor, isModifier),
|
|
87671
|
+
visitNode(node.name, propertyNameVisitor, isPropertyName),
|
|
87672
|
+
/*questionOrExclamationToken*/
|
|
87673
|
+
void 0,
|
|
87674
|
+
/*type*/
|
|
87675
|
+
void 0,
|
|
87676
|
+
visitNode(node.initializer, visitor, isExpression)
|
|
87677
|
+
);
|
|
87644
87678
|
}
|
|
87645
87679
|
function transformPublicFieldInitializer(node) {
|
|
87646
87680
|
if (shouldTransformInitializers && !isAutoAccessorPropertyDeclaration(node)) {
|
package/lib/tsserver.js
CHANGED
|
@@ -47161,7 +47161,6 @@ function createTypeChecker(host) {
|
|
|
47161
47161
|
let inlineLevel = 0;
|
|
47162
47162
|
let currentNode;
|
|
47163
47163
|
let varianceTypeParameter;
|
|
47164
|
-
let isInferencePartiallyBlocked = false;
|
|
47165
47164
|
const emptySymbols = createSymbolTable();
|
|
47166
47165
|
const arrayVariances = [1 /* Covariant */];
|
|
47167
47166
|
const compilerOptions = host.getCompilerOptions();
|
|
@@ -47593,9 +47592,7 @@ function createTypeChecker(host) {
|
|
|
47593
47592
|
toMarkSkip = toMarkSkip.parent;
|
|
47594
47593
|
} while (toMarkSkip && toMarkSkip !== containingCall);
|
|
47595
47594
|
}
|
|
47596
|
-
isInferencePartiallyBlocked = true;
|
|
47597
47595
|
const result = runWithoutResolvedSignatureCaching(node, fn);
|
|
47598
|
-
isInferencePartiallyBlocked = false;
|
|
47599
47596
|
if (containingCall) {
|
|
47600
47597
|
let toMarkSkip = node;
|
|
47601
47598
|
do {
|
|
@@ -52403,7 +52400,7 @@ function createTypeChecker(host) {
|
|
|
52403
52400
|
);
|
|
52404
52401
|
}
|
|
52405
52402
|
function signatureToSignatureDeclarationHelper(signature, kind, context, options) {
|
|
52406
|
-
var _a2, _b, _c, _d;
|
|
52403
|
+
var _a2, _b, _c, _d, _e;
|
|
52407
52404
|
const suppressAny = context.flags & 256 /* SuppressAnyReturnType */;
|
|
52408
52405
|
if (suppressAny)
|
|
52409
52406
|
context.flags &= ~256 /* SuppressAnyReturnType */;
|
|
@@ -52420,6 +52417,29 @@ function createTypeChecker(host) {
|
|
|
52420
52417
|
/*skipUnionExpanding*/
|
|
52421
52418
|
true
|
|
52422
52419
|
)[0];
|
|
52420
|
+
let restoreEnclosingDeclaration;
|
|
52421
|
+
if (context.enclosingDeclaration && signature.declaration && signature.declaration !== context.enclosingDeclaration && !isInJSFile(signature.declaration) && some(expandedParams)) {
|
|
52422
|
+
const locals = (_a2 = context.fakeScopeLocals) != null ? _a2 : context.fakeScopeLocals = createSymbolTable();
|
|
52423
|
+
let newLocals;
|
|
52424
|
+
for (const param of expandedParams) {
|
|
52425
|
+
if (!locals.has(param.escapedName)) {
|
|
52426
|
+
newLocals = append(newLocals, param.escapedName);
|
|
52427
|
+
locals.set(param.escapedName, param);
|
|
52428
|
+
}
|
|
52429
|
+
}
|
|
52430
|
+
if (newLocals) {
|
|
52431
|
+
const fakeScope = parseNodeFactory.createBlock(emptyArray);
|
|
52432
|
+
getNodeLinks(fakeScope).fakeScopeForSignatureDeclaration = true;
|
|
52433
|
+
fakeScope.locals = locals;
|
|
52434
|
+
const saveEnclosingDeclaration = context.enclosingDeclaration;
|
|
52435
|
+
setParent(fakeScope, saveEnclosingDeclaration);
|
|
52436
|
+
context.enclosingDeclaration = fakeScope;
|
|
52437
|
+
restoreEnclosingDeclaration = () => {
|
|
52438
|
+
context.enclosingDeclaration = saveEnclosingDeclaration;
|
|
52439
|
+
forEach(newLocals, (s) => locals.delete(s));
|
|
52440
|
+
};
|
|
52441
|
+
}
|
|
52442
|
+
}
|
|
52423
52443
|
const parameters = (some(expandedParams, (p) => p !== expandedParams[expandedParams.length - 1] && !!(getCheckFlags(p) & 32768 /* RestParameter */)) ? signature.parameters : expandedParams).map((parameter) => symbolToParameterDeclaration(parameter, context, kind === 173 /* Constructor */, options == null ? void 0 : options.privateSymbolVisitor, options == null ? void 0 : options.bundledImports));
|
|
52424
52444
|
const thisParameter = context.flags & 33554432 /* OmitThisParameter */ ? void 0 : tryGetThisParameterDeclaration(signature, context);
|
|
52425
52445
|
if (thisParameter) {
|
|
@@ -52445,11 +52465,11 @@ function createTypeChecker(host) {
|
|
|
52445
52465
|
const flags = modifiersToFlags(modifiers);
|
|
52446
52466
|
modifiers = factory.createModifiersFromModifierFlags(flags | 256 /* Abstract */);
|
|
52447
52467
|
}
|
|
52448
|
-
const node = kind === 176 /* CallSignature */ ? factory.createCallSignature(typeParameters, parameters, returnTypeNode) : kind === 177 /* ConstructSignature */ ? factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : kind === 170 /* MethodSignature */ ? factory.createMethodSignature(modifiers, (
|
|
52468
|
+
const node = kind === 176 /* CallSignature */ ? factory.createCallSignature(typeParameters, parameters, returnTypeNode) : kind === 177 /* ConstructSignature */ ? factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : kind === 170 /* MethodSignature */ ? factory.createMethodSignature(modifiers, (_b = options == null ? void 0 : options.name) != null ? _b : factory.createIdentifier(""), options == null ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : kind === 171 /* MethodDeclaration */ ? factory.createMethodDeclaration(
|
|
52449
52469
|
modifiers,
|
|
52450
52470
|
/*asteriskToken*/
|
|
52451
52471
|
void 0,
|
|
52452
|
-
(
|
|
52472
|
+
(_c = options == null ? void 0 : options.name) != null ? _c : factory.createIdentifier(""),
|
|
52453
52473
|
/*questionToken*/
|
|
52454
52474
|
void 0,
|
|
52455
52475
|
typeParameters,
|
|
@@ -52464,14 +52484,14 @@ function createTypeChecker(host) {
|
|
|
52464
52484
|
void 0
|
|
52465
52485
|
) : kind === 174 /* GetAccessor */ ? factory.createGetAccessorDeclaration(
|
|
52466
52486
|
modifiers,
|
|
52467
|
-
(
|
|
52487
|
+
(_d = options == null ? void 0 : options.name) != null ? _d : factory.createIdentifier(""),
|
|
52468
52488
|
parameters,
|
|
52469
52489
|
returnTypeNode,
|
|
52470
52490
|
/*body*/
|
|
52471
52491
|
void 0
|
|
52472
52492
|
) : kind === 175 /* SetAccessor */ ? factory.createSetAccessorDeclaration(
|
|
52473
52493
|
modifiers,
|
|
52474
|
-
(
|
|
52494
|
+
(_e = options == null ? void 0 : options.name) != null ? _e : factory.createIdentifier(""),
|
|
52475
52495
|
parameters,
|
|
52476
52496
|
/*body*/
|
|
52477
52497
|
void 0
|
|
@@ -52506,6 +52526,7 @@ function createTypeChecker(host) {
|
|
|
52506
52526
|
if (typeArguments) {
|
|
52507
52527
|
node.typeArguments = factory.createNodeArray(typeArguments);
|
|
52508
52528
|
}
|
|
52529
|
+
restoreEnclosingDeclaration == null ? void 0 : restoreEnclosingDeclaration();
|
|
52509
52530
|
return node;
|
|
52510
52531
|
}
|
|
52511
52532
|
function tryGetThisParameterDeclaration(signature, context) {
|
|
@@ -53120,9 +53141,12 @@ function createTypeChecker(host) {
|
|
|
53120
53141
|
function existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type) {
|
|
53121
53142
|
return !(getObjectFlags(type) & 4 /* Reference */) || !isTypeReferenceNode(existing) || length(existing.typeArguments) >= getMinTypeArgumentCount(type.target.typeParameters);
|
|
53122
53143
|
}
|
|
53144
|
+
function getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration) {
|
|
53145
|
+
return findAncestor(enclosingDeclaration, (n) => !getNodeLinks(n).fakeScopeForSignatureDeclaration);
|
|
53146
|
+
}
|
|
53123
53147
|
function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled) {
|
|
53124
53148
|
if (!isErrorType(type) && enclosingDeclaration) {
|
|
53125
|
-
const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, enclosingDeclaration);
|
|
53149
|
+
const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
|
|
53126
53150
|
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
53127
53151
|
const existing = getEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
53128
53152
|
if (typeNodeIsEquivalentToType(existing, declWithExistingAnnotation, type) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
|
|
@@ -53154,7 +53178,8 @@ function createTypeChecker(host) {
|
|
|
53154
53178
|
function serializeReturnTypeForSignature(context, type, signature, includePrivateSymbol, bundled) {
|
|
53155
53179
|
if (!isErrorType(type) && context.enclosingDeclaration) {
|
|
53156
53180
|
const annotation = signature.declaration && getEffectiveReturnTypeNode(signature.declaration);
|
|
53157
|
-
|
|
53181
|
+
const enclosingDeclarationIgnoringFakeScope = getEnclosingDeclarationIgnoringFakeScope(context.enclosingDeclaration);
|
|
53182
|
+
if (!!findAncestor(annotation, (n) => n === enclosingDeclarationIgnoringFakeScope) && annotation) {
|
|
53158
53183
|
const annotated = getTypeFromTypeNode(annotation);
|
|
53159
53184
|
const thisInstantiated = annotated.flags & 262144 /* TypeParameter */ && annotated.isThisType ? instantiateType(annotated, signature.mapper) : annotated;
|
|
53160
53185
|
if (thisInstantiated === type && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(annotation, type)) {
|
|
@@ -74237,7 +74262,7 @@ function createTypeChecker(host) {
|
|
|
74237
74262
|
const isTaggedTemplate = node.kind === 212 /* TaggedTemplateExpression */;
|
|
74238
74263
|
const isDecorator2 = node.kind === 167 /* Decorator */;
|
|
74239
74264
|
const isJsxOpeningOrSelfClosingElement = isJsxOpeningLikeElement(node);
|
|
74240
|
-
const reportErrors2 = !
|
|
74265
|
+
const reportErrors2 = !candidatesOutArray;
|
|
74241
74266
|
let typeArguments;
|
|
74242
74267
|
if (!isDecorator2 && !isSuperCall(node)) {
|
|
74243
74268
|
typeArguments = node.typeArguments;
|
|
@@ -92387,7 +92412,16 @@ function transformClassFields(context) {
|
|
|
92387
92412
|
visitNode(node.initializer, (child) => namedEvaluationVisitor(child, referencedName), isExpression)
|
|
92388
92413
|
);
|
|
92389
92414
|
}
|
|
92390
|
-
return
|
|
92415
|
+
return factory2.updatePropertyDeclaration(
|
|
92416
|
+
node,
|
|
92417
|
+
visitNodes2(node.modifiers, modifierVisitor, isModifier),
|
|
92418
|
+
visitNode(node.name, propertyNameVisitor, isPropertyName),
|
|
92419
|
+
/*questionOrExclamationToken*/
|
|
92420
|
+
void 0,
|
|
92421
|
+
/*type*/
|
|
92422
|
+
void 0,
|
|
92423
|
+
visitNode(node.initializer, visitor, isExpression)
|
|
92424
|
+
);
|
|
92391
92425
|
}
|
|
92392
92426
|
function transformPublicFieldInitializer(node) {
|
|
92393
92427
|
if (shouldTransformInitializers && !isAutoAccessorPropertyDeclaration(node)) {
|
|
@@ -135434,7 +135468,8 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
|
135434
135468
|
options.triggerCharacter,
|
|
135435
135469
|
options.triggerKind,
|
|
135436
135470
|
cancellationToken,
|
|
135437
|
-
formattingSettings && ts_formatting_exports.getFormatContext(formattingSettings, host)
|
|
135471
|
+
formattingSettings && ts_formatting_exports.getFormatContext(formattingSettings, host),
|
|
135472
|
+
options.includeSymbol
|
|
135438
135473
|
);
|
|
135439
135474
|
}
|
|
135440
135475
|
function getCompletionEntryDetails2(fileName, position, name, formattingOptions, source, preferences = emptyOptions, data) {
|
|
@@ -148262,7 +148297,7 @@ function resolvingModuleSpecifiers(logPrefix, host, resolver, program, position,
|
|
|
148262
148297
|
return result2 || (needsFullResolution ? "failed" : "skipped");
|
|
148263
148298
|
}
|
|
148264
148299
|
}
|
|
148265
|
-
function getCompletionsAtPosition(host, program, log, sourceFile, position, preferences, triggerCharacter, completionKind, cancellationToken, formatContext) {
|
|
148300
|
+
function getCompletionsAtPosition(host, program, log, sourceFile, position, preferences, triggerCharacter, completionKind, cancellationToken, formatContext, includeSymbol = false) {
|
|
148266
148301
|
var _a2;
|
|
148267
148302
|
const { previousToken } = getRelevantTokens(position, sourceFile);
|
|
148268
148303
|
if (triggerCharacter && !isInString(sourceFile, position, previousToken) && !isValidTrigger(sourceFile, triggerCharacter, previousToken, position)) {
|
|
@@ -148284,7 +148319,7 @@ function getCompletionsAtPosition(host, program, log, sourceFile, position, pref
|
|
|
148284
148319
|
} else {
|
|
148285
148320
|
incompleteCompletionsCache == null ? void 0 : incompleteCompletionsCache.clear();
|
|
148286
148321
|
}
|
|
148287
|
-
const stringCompletions = ts_Completions_StringCompletions_exports.getStringLiteralCompletions(sourceFile, position, previousToken, compilerOptions, host, program, log, preferences);
|
|
148322
|
+
const stringCompletions = ts_Completions_StringCompletions_exports.getStringLiteralCompletions(sourceFile, position, previousToken, compilerOptions, host, program, log, preferences, includeSymbol);
|
|
148288
148323
|
if (stringCompletions) {
|
|
148289
148324
|
return stringCompletions;
|
|
148290
148325
|
}
|
|
@@ -148309,7 +148344,7 @@ function getCompletionsAtPosition(host, program, log, sourceFile, position, pref
|
|
|
148309
148344
|
}
|
|
148310
148345
|
switch (completionData.kind) {
|
|
148311
148346
|
case 0 /* Data */:
|
|
148312
|
-
const response = completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position);
|
|
148347
|
+
const response = completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position, includeSymbol);
|
|
148313
148348
|
if (response == null ? void 0 : response.isIncomplete) {
|
|
148314
148349
|
incompleteCompletionsCache == null ? void 0 : incompleteCompletionsCache.set(response);
|
|
148315
148350
|
}
|
|
@@ -148439,7 +148474,7 @@ function keywordFiltersFromSyntaxKind(keywordCompletion) {
|
|
|
148439
148474
|
function getOptionalReplacementSpan(location) {
|
|
148440
148475
|
return (location == null ? void 0 : location.kind) === 79 /* Identifier */ ? createTextSpanFromNode(location) : void 0;
|
|
148441
148476
|
}
|
|
148442
|
-
function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position) {
|
|
148477
|
+
function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position, includeSymbol) {
|
|
148443
148478
|
const {
|
|
148444
148479
|
symbols,
|
|
148445
148480
|
contextToken,
|
|
@@ -148513,7 +148548,8 @@ function completionInfoFromData(sourceFile, host, program, compilerOptions, log,
|
|
|
148513
148548
|
symbolToOriginInfoMap,
|
|
148514
148549
|
symbolToSortTextMap,
|
|
148515
148550
|
isJsxIdentifierExpected,
|
|
148516
|
-
isRightOfOpenTag
|
|
148551
|
+
isRightOfOpenTag,
|
|
148552
|
+
includeSymbol
|
|
148517
148553
|
);
|
|
148518
148554
|
if (keywordFilters !== 0 /* None */) {
|
|
148519
148555
|
for (const keywordEntry of getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && isSourceFileJS(sourceFile))) {
|
|
@@ -148762,7 +148798,7 @@ function completionNameForLiteral(sourceFile, preferences, literal) {
|
|
|
148762
148798
|
function createCompletionEntryForLiteral(sourceFile, preferences, literal) {
|
|
148763
148799
|
return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* string */, kindModifiers: "" /* none */, sortText: SortText.LocationPriority };
|
|
148764
148800
|
}
|
|
148765
|
-
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) {
|
|
148801
|
+
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) {
|
|
148766
148802
|
let insertText;
|
|
148767
148803
|
let replacementSpan = getReplacementSpanForContextToken(replacementToken);
|
|
148768
148804
|
let data;
|
|
@@ -148876,7 +148912,8 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
|
|
|
148876
148912
|
isSnippet,
|
|
148877
148913
|
isPackageJsonImport: originIsPackageJsonImport(origin) || void 0,
|
|
148878
148914
|
isImportStatementCompletion: !!importStatementCompletion || void 0,
|
|
148879
|
-
data
|
|
148915
|
+
data,
|
|
148916
|
+
...includeSymbol ? { symbol } : void 0
|
|
148880
148917
|
};
|
|
148881
148918
|
}
|
|
148882
148919
|
function isClassLikeMemberCompletion(symbol, location, sourceFile) {
|
|
@@ -149346,7 +149383,7 @@ function getSourceFromOrigin(origin) {
|
|
|
149346
149383
|
return "TypeOnlyAlias/" /* TypeOnlyAlias */;
|
|
149347
149384
|
}
|
|
149348
149385
|
}
|
|
149349
|
-
function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, position, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag) {
|
|
149386
|
+
function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, position, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag, includeSymbol = false) {
|
|
149350
149387
|
var _a2;
|
|
149351
149388
|
const start2 = timestamp();
|
|
149352
149389
|
const variableDeclaration = getVariableDeclaration(location);
|
|
@@ -149386,7 +149423,8 @@ function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, con
|
|
|
149386
149423
|
kind,
|
|
149387
149424
|
formatContext,
|
|
149388
149425
|
isJsxIdentifierExpected,
|
|
149389
|
-
isRightOfOpenTag
|
|
149426
|
+
isRightOfOpenTag,
|
|
149427
|
+
includeSymbol
|
|
149390
149428
|
);
|
|
149391
149429
|
if (!entry) {
|
|
149392
149430
|
continue;
|
|
@@ -151585,7 +151623,7 @@ function createNameAndKindSet() {
|
|
|
151585
151623
|
values: map2.values.bind(map2)
|
|
151586
151624
|
};
|
|
151587
151625
|
}
|
|
151588
|
-
function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program, log, preferences) {
|
|
151626
|
+
function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program, log, preferences, includeSymbol) {
|
|
151589
151627
|
if (isInReferenceComment(sourceFile, position)) {
|
|
151590
151628
|
const entries = getTripleSlashReferenceCompletion(sourceFile, position, options, host);
|
|
151591
151629
|
return entries && convertPathCompletions(entries);
|
|
@@ -151594,10 +151632,10 @@ function getStringLiteralCompletions(sourceFile, position, contextToken, options
|
|
|
151594
151632
|
if (!contextToken || !isStringLiteralLike(contextToken))
|
|
151595
151633
|
return void 0;
|
|
151596
151634
|
const entries = getStringLiteralCompletionEntries(sourceFile, contextToken, position, program.getTypeChecker(), options, host, preferences);
|
|
151597
|
-
return convertStringLiteralCompletions(entries, contextToken, sourceFile, host, program, log, options, preferences, position);
|
|
151635
|
+
return convertStringLiteralCompletions(entries, contextToken, sourceFile, host, program, log, options, preferences, position, includeSymbol);
|
|
151598
151636
|
}
|
|
151599
151637
|
}
|
|
151600
|
-
function convertStringLiteralCompletions(completion, contextToken, sourceFile, host, program, log, options, preferences, position) {
|
|
151638
|
+
function convertStringLiteralCompletions(completion, contextToken, sourceFile, host, program, log, options, preferences, position, includeSymbol) {
|
|
151601
151639
|
if (completion === void 0) {
|
|
151602
151640
|
return void 0;
|
|
151603
151641
|
}
|
|
@@ -151623,7 +151661,28 @@ function convertStringLiteralCompletions(completion, contextToken, sourceFile, h
|
|
|
151623
151661
|
preferences,
|
|
151624
151662
|
options,
|
|
151625
151663
|
/*formatContext*/
|
|
151626
|
-
void 0
|
|
151664
|
+
void 0,
|
|
151665
|
+
/*isTypeOnlyLocation */
|
|
151666
|
+
void 0,
|
|
151667
|
+
/*propertyAccessToConvert*/
|
|
151668
|
+
void 0,
|
|
151669
|
+
/*jsxIdentifierExpected*/
|
|
151670
|
+
void 0,
|
|
151671
|
+
/*isJsxInitializer*/
|
|
151672
|
+
void 0,
|
|
151673
|
+
/*importStatementCompletion*/
|
|
151674
|
+
void 0,
|
|
151675
|
+
/*recommendedCompletion*/
|
|
151676
|
+
void 0,
|
|
151677
|
+
/*symbolToOriginInfoMap*/
|
|
151678
|
+
void 0,
|
|
151679
|
+
/*symbolToSortTextMap*/
|
|
151680
|
+
void 0,
|
|
151681
|
+
/*isJsxIdentifierExpected*/
|
|
151682
|
+
void 0,
|
|
151683
|
+
/*isRightOfOpenTag*/
|
|
151684
|
+
void 0,
|
|
151685
|
+
includeSymbol
|
|
151627
151686
|
);
|
|
151628
151687
|
return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: completion.hasIndexSignature, optionalReplacementSpan, entries };
|
|
151629
151688
|
}
|
package/lib/tsserverlibrary.d.ts
CHANGED
|
@@ -10073,6 +10073,13 @@ declare namespace ts {
|
|
|
10073
10073
|
*/
|
|
10074
10074
|
triggerCharacter?: CompletionsTriggerCharacter;
|
|
10075
10075
|
triggerKind?: CompletionTriggerKind;
|
|
10076
|
+
/**
|
|
10077
|
+
* Include a `symbol` property on each completion entry object.
|
|
10078
|
+
* Symbols reference cyclic data structures and sometimes an entire TypeChecker instance,
|
|
10079
|
+
* so use caution when serializing or retaining completion entries retrieved with this option.
|
|
10080
|
+
* @default false
|
|
10081
|
+
*/
|
|
10082
|
+
includeSymbol?: boolean;
|
|
10076
10083
|
/** @deprecated Use includeCompletionsForModuleExports */
|
|
10077
10084
|
includeExternalModuleExports?: boolean;
|
|
10078
10085
|
/** @deprecated Use includeCompletionsWithInsertText */
|
|
@@ -10630,6 +10637,12 @@ declare namespace ts {
|
|
|
10630
10637
|
isFromUncheckedFile?: true;
|
|
10631
10638
|
isPackageJsonImport?: true;
|
|
10632
10639
|
isImportStatementCompletion?: true;
|
|
10640
|
+
/**
|
|
10641
|
+
* For API purposes.
|
|
10642
|
+
* Included for non-string completions only when `includeSymbol: true` option is passed to `getCompletionsAtPosition`.
|
|
10643
|
+
* @example Get declaration of completion: `symbol.valueDeclaration`
|
|
10644
|
+
*/
|
|
10645
|
+
symbol?: Symbol;
|
|
10633
10646
|
/**
|
|
10634
10647
|
* A property to be sent back to TS Server in the CompletionDetailsRequest, along with `name`,
|
|
10635
10648
|
* that allows TS Server to look up the symbol represented by the completion item, disambiguating
|
package/lib/tsserverlibrary.js
CHANGED
|
@@ -44970,7 +44970,6 @@ ${lanes.join("\n")}
|
|
|
44970
44970
|
let inlineLevel = 0;
|
|
44971
44971
|
let currentNode;
|
|
44972
44972
|
let varianceTypeParameter;
|
|
44973
|
-
let isInferencePartiallyBlocked = false;
|
|
44974
44973
|
const emptySymbols = createSymbolTable();
|
|
44975
44974
|
const arrayVariances = [1 /* Covariant */];
|
|
44976
44975
|
const compilerOptions = host.getCompilerOptions();
|
|
@@ -45402,9 +45401,7 @@ ${lanes.join("\n")}
|
|
|
45402
45401
|
toMarkSkip = toMarkSkip.parent;
|
|
45403
45402
|
} while (toMarkSkip && toMarkSkip !== containingCall);
|
|
45404
45403
|
}
|
|
45405
|
-
isInferencePartiallyBlocked = true;
|
|
45406
45404
|
const result = runWithoutResolvedSignatureCaching(node, fn);
|
|
45407
|
-
isInferencePartiallyBlocked = false;
|
|
45408
45405
|
if (containingCall) {
|
|
45409
45406
|
let toMarkSkip = node;
|
|
45410
45407
|
do {
|
|
@@ -50212,7 +50209,7 @@ ${lanes.join("\n")}
|
|
|
50212
50209
|
);
|
|
50213
50210
|
}
|
|
50214
50211
|
function signatureToSignatureDeclarationHelper(signature, kind, context, options) {
|
|
50215
|
-
var _a2, _b, _c, _d;
|
|
50212
|
+
var _a2, _b, _c, _d, _e;
|
|
50216
50213
|
const suppressAny = context.flags & 256 /* SuppressAnyReturnType */;
|
|
50217
50214
|
if (suppressAny)
|
|
50218
50215
|
context.flags &= ~256 /* SuppressAnyReturnType */;
|
|
@@ -50229,6 +50226,29 @@ ${lanes.join("\n")}
|
|
|
50229
50226
|
/*skipUnionExpanding*/
|
|
50230
50227
|
true
|
|
50231
50228
|
)[0];
|
|
50229
|
+
let restoreEnclosingDeclaration;
|
|
50230
|
+
if (context.enclosingDeclaration && signature.declaration && signature.declaration !== context.enclosingDeclaration && !isInJSFile(signature.declaration) && some(expandedParams)) {
|
|
50231
|
+
const locals = (_a2 = context.fakeScopeLocals) != null ? _a2 : context.fakeScopeLocals = createSymbolTable();
|
|
50232
|
+
let newLocals;
|
|
50233
|
+
for (const param of expandedParams) {
|
|
50234
|
+
if (!locals.has(param.escapedName)) {
|
|
50235
|
+
newLocals = append(newLocals, param.escapedName);
|
|
50236
|
+
locals.set(param.escapedName, param);
|
|
50237
|
+
}
|
|
50238
|
+
}
|
|
50239
|
+
if (newLocals) {
|
|
50240
|
+
const fakeScope = parseNodeFactory.createBlock(emptyArray);
|
|
50241
|
+
getNodeLinks(fakeScope).fakeScopeForSignatureDeclaration = true;
|
|
50242
|
+
fakeScope.locals = locals;
|
|
50243
|
+
const saveEnclosingDeclaration = context.enclosingDeclaration;
|
|
50244
|
+
setParent(fakeScope, saveEnclosingDeclaration);
|
|
50245
|
+
context.enclosingDeclaration = fakeScope;
|
|
50246
|
+
restoreEnclosingDeclaration = () => {
|
|
50247
|
+
context.enclosingDeclaration = saveEnclosingDeclaration;
|
|
50248
|
+
forEach(newLocals, (s) => locals.delete(s));
|
|
50249
|
+
};
|
|
50250
|
+
}
|
|
50251
|
+
}
|
|
50232
50252
|
const parameters = (some(expandedParams, (p) => p !== expandedParams[expandedParams.length - 1] && !!(getCheckFlags(p) & 32768 /* RestParameter */)) ? signature.parameters : expandedParams).map((parameter) => symbolToParameterDeclaration(parameter, context, kind === 173 /* Constructor */, options == null ? void 0 : options.privateSymbolVisitor, options == null ? void 0 : options.bundledImports));
|
|
50233
50253
|
const thisParameter = context.flags & 33554432 /* OmitThisParameter */ ? void 0 : tryGetThisParameterDeclaration(signature, context);
|
|
50234
50254
|
if (thisParameter) {
|
|
@@ -50254,11 +50274,11 @@ ${lanes.join("\n")}
|
|
|
50254
50274
|
const flags = modifiersToFlags(modifiers);
|
|
50255
50275
|
modifiers = factory.createModifiersFromModifierFlags(flags | 256 /* Abstract */);
|
|
50256
50276
|
}
|
|
50257
|
-
const node = kind === 176 /* CallSignature */ ? factory.createCallSignature(typeParameters, parameters, returnTypeNode) : kind === 177 /* ConstructSignature */ ? factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : kind === 170 /* MethodSignature */ ? factory.createMethodSignature(modifiers, (
|
|
50277
|
+
const node = kind === 176 /* CallSignature */ ? factory.createCallSignature(typeParameters, parameters, returnTypeNode) : kind === 177 /* ConstructSignature */ ? factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : kind === 170 /* MethodSignature */ ? factory.createMethodSignature(modifiers, (_b = options == null ? void 0 : options.name) != null ? _b : factory.createIdentifier(""), options == null ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : kind === 171 /* MethodDeclaration */ ? factory.createMethodDeclaration(
|
|
50258
50278
|
modifiers,
|
|
50259
50279
|
/*asteriskToken*/
|
|
50260
50280
|
void 0,
|
|
50261
|
-
(
|
|
50281
|
+
(_c = options == null ? void 0 : options.name) != null ? _c : factory.createIdentifier(""),
|
|
50262
50282
|
/*questionToken*/
|
|
50263
50283
|
void 0,
|
|
50264
50284
|
typeParameters,
|
|
@@ -50273,14 +50293,14 @@ ${lanes.join("\n")}
|
|
|
50273
50293
|
void 0
|
|
50274
50294
|
) : kind === 174 /* GetAccessor */ ? factory.createGetAccessorDeclaration(
|
|
50275
50295
|
modifiers,
|
|
50276
|
-
(
|
|
50296
|
+
(_d = options == null ? void 0 : options.name) != null ? _d : factory.createIdentifier(""),
|
|
50277
50297
|
parameters,
|
|
50278
50298
|
returnTypeNode,
|
|
50279
50299
|
/*body*/
|
|
50280
50300
|
void 0
|
|
50281
50301
|
) : kind === 175 /* SetAccessor */ ? factory.createSetAccessorDeclaration(
|
|
50282
50302
|
modifiers,
|
|
50283
|
-
(
|
|
50303
|
+
(_e = options == null ? void 0 : options.name) != null ? _e : factory.createIdentifier(""),
|
|
50284
50304
|
parameters,
|
|
50285
50305
|
/*body*/
|
|
50286
50306
|
void 0
|
|
@@ -50315,6 +50335,7 @@ ${lanes.join("\n")}
|
|
|
50315
50335
|
if (typeArguments) {
|
|
50316
50336
|
node.typeArguments = factory.createNodeArray(typeArguments);
|
|
50317
50337
|
}
|
|
50338
|
+
restoreEnclosingDeclaration == null ? void 0 : restoreEnclosingDeclaration();
|
|
50318
50339
|
return node;
|
|
50319
50340
|
}
|
|
50320
50341
|
function tryGetThisParameterDeclaration(signature, context) {
|
|
@@ -50929,9 +50950,12 @@ ${lanes.join("\n")}
|
|
|
50929
50950
|
function existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type) {
|
|
50930
50951
|
return !(getObjectFlags(type) & 4 /* Reference */) || !isTypeReferenceNode(existing) || length(existing.typeArguments) >= getMinTypeArgumentCount(type.target.typeParameters);
|
|
50931
50952
|
}
|
|
50953
|
+
function getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration) {
|
|
50954
|
+
return findAncestor(enclosingDeclaration, (n) => !getNodeLinks(n).fakeScopeForSignatureDeclaration);
|
|
50955
|
+
}
|
|
50932
50956
|
function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled) {
|
|
50933
50957
|
if (!isErrorType(type) && enclosingDeclaration) {
|
|
50934
|
-
const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, enclosingDeclaration);
|
|
50958
|
+
const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
|
|
50935
50959
|
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
50936
50960
|
const existing = getEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
50937
50961
|
if (typeNodeIsEquivalentToType(existing, declWithExistingAnnotation, type) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
|
|
@@ -50963,7 +50987,8 @@ ${lanes.join("\n")}
|
|
|
50963
50987
|
function serializeReturnTypeForSignature(context, type, signature, includePrivateSymbol, bundled) {
|
|
50964
50988
|
if (!isErrorType(type) && context.enclosingDeclaration) {
|
|
50965
50989
|
const annotation = signature.declaration && getEffectiveReturnTypeNode(signature.declaration);
|
|
50966
|
-
|
|
50990
|
+
const enclosingDeclarationIgnoringFakeScope = getEnclosingDeclarationIgnoringFakeScope(context.enclosingDeclaration);
|
|
50991
|
+
if (!!findAncestor(annotation, (n) => n === enclosingDeclarationIgnoringFakeScope) && annotation) {
|
|
50967
50992
|
const annotated = getTypeFromTypeNode(annotation);
|
|
50968
50993
|
const thisInstantiated = annotated.flags & 262144 /* TypeParameter */ && annotated.isThisType ? instantiateType(annotated, signature.mapper) : annotated;
|
|
50969
50994
|
if (thisInstantiated === type && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(annotation, type)) {
|
|
@@ -72046,7 +72071,7 @@ ${lanes.join("\n")}
|
|
|
72046
72071
|
const isTaggedTemplate = node.kind === 212 /* TaggedTemplateExpression */;
|
|
72047
72072
|
const isDecorator2 = node.kind === 167 /* Decorator */;
|
|
72048
72073
|
const isJsxOpeningOrSelfClosingElement = isJsxOpeningLikeElement(node);
|
|
72049
|
-
const reportErrors2 = !
|
|
72074
|
+
const reportErrors2 = !candidatesOutArray;
|
|
72050
72075
|
let typeArguments;
|
|
72051
72076
|
if (!isDecorator2 && !isSuperCall(node)) {
|
|
72052
72077
|
typeArguments = node.typeArguments;
|
|
@@ -90372,7 +90397,16 @@ ${lanes.join("\n")}
|
|
|
90372
90397
|
visitNode(node.initializer, (child) => namedEvaluationVisitor(child, referencedName), isExpression)
|
|
90373
90398
|
);
|
|
90374
90399
|
}
|
|
90375
|
-
return
|
|
90400
|
+
return factory2.updatePropertyDeclaration(
|
|
90401
|
+
node,
|
|
90402
|
+
visitNodes2(node.modifiers, modifierVisitor, isModifier),
|
|
90403
|
+
visitNode(node.name, propertyNameVisitor, isPropertyName),
|
|
90404
|
+
/*questionOrExclamationToken*/
|
|
90405
|
+
void 0,
|
|
90406
|
+
/*type*/
|
|
90407
|
+
void 0,
|
|
90408
|
+
visitNode(node.initializer, visitor, isExpression)
|
|
90409
|
+
);
|
|
90376
90410
|
}
|
|
90377
90411
|
function transformPublicFieldInitializer(node) {
|
|
90378
90412
|
if (shouldTransformInitializers && !isAutoAccessorPropertyDeclaration(node)) {
|
|
@@ -133202,7 +133236,8 @@ ${lanes.join("\n")}
|
|
|
133202
133236
|
options.triggerCharacter,
|
|
133203
133237
|
options.triggerKind,
|
|
133204
133238
|
cancellationToken,
|
|
133205
|
-
formattingSettings && ts_formatting_exports.getFormatContext(formattingSettings, host)
|
|
133239
|
+
formattingSettings && ts_formatting_exports.getFormatContext(formattingSettings, host),
|
|
133240
|
+
options.includeSymbol
|
|
133206
133241
|
);
|
|
133207
133242
|
}
|
|
133208
133243
|
function getCompletionEntryDetails2(fileName, position, name, formattingOptions, source, preferences = emptyOptions, data) {
|
|
@@ -147317,7 +147352,7 @@ ${lanes.join("\n")}
|
|
|
147317
147352
|
return result2 || (needsFullResolution ? "failed" : "skipped");
|
|
147318
147353
|
}
|
|
147319
147354
|
}
|
|
147320
|
-
function getCompletionsAtPosition(host, program, log, sourceFile, position, preferences, triggerCharacter, completionKind, cancellationToken, formatContext) {
|
|
147355
|
+
function getCompletionsAtPosition(host, program, log, sourceFile, position, preferences, triggerCharacter, completionKind, cancellationToken, formatContext, includeSymbol = false) {
|
|
147321
147356
|
var _a2;
|
|
147322
147357
|
const { previousToken } = getRelevantTokens(position, sourceFile);
|
|
147323
147358
|
if (triggerCharacter && !isInString(sourceFile, position, previousToken) && !isValidTrigger(sourceFile, triggerCharacter, previousToken, position)) {
|
|
@@ -147339,7 +147374,7 @@ ${lanes.join("\n")}
|
|
|
147339
147374
|
} else {
|
|
147340
147375
|
incompleteCompletionsCache == null ? void 0 : incompleteCompletionsCache.clear();
|
|
147341
147376
|
}
|
|
147342
|
-
const stringCompletions = ts_Completions_StringCompletions_exports.getStringLiteralCompletions(sourceFile, position, previousToken, compilerOptions, host, program, log, preferences);
|
|
147377
|
+
const stringCompletions = ts_Completions_StringCompletions_exports.getStringLiteralCompletions(sourceFile, position, previousToken, compilerOptions, host, program, log, preferences, includeSymbol);
|
|
147343
147378
|
if (stringCompletions) {
|
|
147344
147379
|
return stringCompletions;
|
|
147345
147380
|
}
|
|
@@ -147364,7 +147399,7 @@ ${lanes.join("\n")}
|
|
|
147364
147399
|
}
|
|
147365
147400
|
switch (completionData.kind) {
|
|
147366
147401
|
case 0 /* Data */:
|
|
147367
|
-
const response = completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position);
|
|
147402
|
+
const response = completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position, includeSymbol);
|
|
147368
147403
|
if (response == null ? void 0 : response.isIncomplete) {
|
|
147369
147404
|
incompleteCompletionsCache == null ? void 0 : incompleteCompletionsCache.set(response);
|
|
147370
147405
|
}
|
|
@@ -147494,7 +147529,7 @@ ${lanes.join("\n")}
|
|
|
147494
147529
|
function getOptionalReplacementSpan(location) {
|
|
147495
147530
|
return (location == null ? void 0 : location.kind) === 79 /* Identifier */ ? createTextSpanFromNode(location) : void 0;
|
|
147496
147531
|
}
|
|
147497
|
-
function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position) {
|
|
147532
|
+
function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position, includeSymbol) {
|
|
147498
147533
|
const {
|
|
147499
147534
|
symbols,
|
|
147500
147535
|
contextToken,
|
|
@@ -147568,7 +147603,8 @@ ${lanes.join("\n")}
|
|
|
147568
147603
|
symbolToOriginInfoMap,
|
|
147569
147604
|
symbolToSortTextMap,
|
|
147570
147605
|
isJsxIdentifierExpected,
|
|
147571
|
-
isRightOfOpenTag
|
|
147606
|
+
isRightOfOpenTag,
|
|
147607
|
+
includeSymbol
|
|
147572
147608
|
);
|
|
147573
147609
|
if (keywordFilters !== 0 /* None */) {
|
|
147574
147610
|
for (const keywordEntry of getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && isSourceFileJS(sourceFile))) {
|
|
@@ -147817,7 +147853,7 @@ ${lanes.join("\n")}
|
|
|
147817
147853
|
function createCompletionEntryForLiteral(sourceFile, preferences, literal) {
|
|
147818
147854
|
return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* string */, kindModifiers: "" /* none */, sortText: SortText.LocationPriority };
|
|
147819
147855
|
}
|
|
147820
|
-
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) {
|
|
147856
|
+
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) {
|
|
147821
147857
|
let insertText;
|
|
147822
147858
|
let replacementSpan = getReplacementSpanForContextToken(replacementToken);
|
|
147823
147859
|
let data;
|
|
@@ -147931,7 +147967,8 @@ ${lanes.join("\n")}
|
|
|
147931
147967
|
isSnippet,
|
|
147932
147968
|
isPackageJsonImport: originIsPackageJsonImport(origin) || void 0,
|
|
147933
147969
|
isImportStatementCompletion: !!importStatementCompletion || void 0,
|
|
147934
|
-
data
|
|
147970
|
+
data,
|
|
147971
|
+
...includeSymbol ? { symbol } : void 0
|
|
147935
147972
|
};
|
|
147936
147973
|
}
|
|
147937
147974
|
function isClassLikeMemberCompletion(symbol, location, sourceFile) {
|
|
@@ -148401,7 +148438,7 @@ ${lanes.join("\n")}
|
|
|
148401
148438
|
return "TypeOnlyAlias/" /* TypeOnlyAlias */;
|
|
148402
148439
|
}
|
|
148403
148440
|
}
|
|
148404
|
-
function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, position, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag) {
|
|
148441
|
+
function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, position, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag, includeSymbol = false) {
|
|
148405
148442
|
var _a2;
|
|
148406
148443
|
const start = timestamp();
|
|
148407
148444
|
const variableDeclaration = getVariableDeclaration(location);
|
|
@@ -148441,7 +148478,8 @@ ${lanes.join("\n")}
|
|
|
148441
148478
|
kind,
|
|
148442
148479
|
formatContext,
|
|
148443
148480
|
isJsxIdentifierExpected,
|
|
148444
|
-
isRightOfOpenTag
|
|
148481
|
+
isRightOfOpenTag,
|
|
148482
|
+
includeSymbol
|
|
148445
148483
|
);
|
|
148446
148484
|
if (!entry) {
|
|
148447
148485
|
continue;
|
|
@@ -150682,7 +150720,7 @@ ${lanes.join("\n")}
|
|
|
150682
150720
|
values: map2.values.bind(map2)
|
|
150683
150721
|
};
|
|
150684
150722
|
}
|
|
150685
|
-
function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program, log, preferences) {
|
|
150723
|
+
function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program, log, preferences, includeSymbol) {
|
|
150686
150724
|
if (isInReferenceComment(sourceFile, position)) {
|
|
150687
150725
|
const entries = getTripleSlashReferenceCompletion(sourceFile, position, options, host);
|
|
150688
150726
|
return entries && convertPathCompletions(entries);
|
|
@@ -150691,10 +150729,10 @@ ${lanes.join("\n")}
|
|
|
150691
150729
|
if (!contextToken || !isStringLiteralLike(contextToken))
|
|
150692
150730
|
return void 0;
|
|
150693
150731
|
const entries = getStringLiteralCompletionEntries(sourceFile, contextToken, position, program.getTypeChecker(), options, host, preferences);
|
|
150694
|
-
return convertStringLiteralCompletions(entries, contextToken, sourceFile, host, program, log, options, preferences, position);
|
|
150732
|
+
return convertStringLiteralCompletions(entries, contextToken, sourceFile, host, program, log, options, preferences, position, includeSymbol);
|
|
150695
150733
|
}
|
|
150696
150734
|
}
|
|
150697
|
-
function convertStringLiteralCompletions(completion, contextToken, sourceFile, host, program, log, options, preferences, position) {
|
|
150735
|
+
function convertStringLiteralCompletions(completion, contextToken, sourceFile, host, program, log, options, preferences, position, includeSymbol) {
|
|
150698
150736
|
if (completion === void 0) {
|
|
150699
150737
|
return void 0;
|
|
150700
150738
|
}
|
|
@@ -150720,7 +150758,28 @@ ${lanes.join("\n")}
|
|
|
150720
150758
|
preferences,
|
|
150721
150759
|
options,
|
|
150722
150760
|
/*formatContext*/
|
|
150723
|
-
void 0
|
|
150761
|
+
void 0,
|
|
150762
|
+
/*isTypeOnlyLocation */
|
|
150763
|
+
void 0,
|
|
150764
|
+
/*propertyAccessToConvert*/
|
|
150765
|
+
void 0,
|
|
150766
|
+
/*jsxIdentifierExpected*/
|
|
150767
|
+
void 0,
|
|
150768
|
+
/*isJsxInitializer*/
|
|
150769
|
+
void 0,
|
|
150770
|
+
/*importStatementCompletion*/
|
|
150771
|
+
void 0,
|
|
150772
|
+
/*recommendedCompletion*/
|
|
150773
|
+
void 0,
|
|
150774
|
+
/*symbolToOriginInfoMap*/
|
|
150775
|
+
void 0,
|
|
150776
|
+
/*symbolToSortTextMap*/
|
|
150777
|
+
void 0,
|
|
150778
|
+
/*isJsxIdentifierExpected*/
|
|
150779
|
+
void 0,
|
|
150780
|
+
/*isRightOfOpenTag*/
|
|
150781
|
+
void 0,
|
|
150782
|
+
includeSymbol
|
|
150724
150783
|
);
|
|
150725
150784
|
return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: completion.hasIndexSignature, optionalReplacementSpan, entries };
|
|
150726
150785
|
}
|
package/lib/typescript.d.ts
CHANGED
|
@@ -6171,6 +6171,13 @@ declare namespace ts {
|
|
|
6171
6171
|
*/
|
|
6172
6172
|
triggerCharacter?: CompletionsTriggerCharacter;
|
|
6173
6173
|
triggerKind?: CompletionTriggerKind;
|
|
6174
|
+
/**
|
|
6175
|
+
* Include a `symbol` property on each completion entry object.
|
|
6176
|
+
* Symbols reference cyclic data structures and sometimes an entire TypeChecker instance,
|
|
6177
|
+
* so use caution when serializing or retaining completion entries retrieved with this option.
|
|
6178
|
+
* @default false
|
|
6179
|
+
*/
|
|
6180
|
+
includeSymbol?: boolean;
|
|
6174
6181
|
/** @deprecated Use includeCompletionsForModuleExports */
|
|
6175
6182
|
includeExternalModuleExports?: boolean;
|
|
6176
6183
|
/** @deprecated Use includeCompletionsWithInsertText */
|
|
@@ -6728,6 +6735,12 @@ declare namespace ts {
|
|
|
6728
6735
|
isFromUncheckedFile?: true;
|
|
6729
6736
|
isPackageJsonImport?: true;
|
|
6730
6737
|
isImportStatementCompletion?: true;
|
|
6738
|
+
/**
|
|
6739
|
+
* For API purposes.
|
|
6740
|
+
* Included for non-string completions only when `includeSymbol: true` option is passed to `getCompletionsAtPosition`.
|
|
6741
|
+
* @example Get declaration of completion: `symbol.valueDeclaration`
|
|
6742
|
+
*/
|
|
6743
|
+
symbol?: Symbol;
|
|
6731
6744
|
/**
|
|
6732
6745
|
* A property to be sent back to TS Server in the CompletionDetailsRequest, along with `name`,
|
|
6733
6746
|
* that allows TS Server to look up the symbol represented by the completion item, disambiguating
|
package/lib/typescript.js
CHANGED
|
@@ -44970,7 +44970,6 @@ ${lanes.join("\n")}
|
|
|
44970
44970
|
let inlineLevel = 0;
|
|
44971
44971
|
let currentNode;
|
|
44972
44972
|
let varianceTypeParameter;
|
|
44973
|
-
let isInferencePartiallyBlocked = false;
|
|
44974
44973
|
const emptySymbols = createSymbolTable();
|
|
44975
44974
|
const arrayVariances = [1 /* Covariant */];
|
|
44976
44975
|
const compilerOptions = host.getCompilerOptions();
|
|
@@ -45402,9 +45401,7 @@ ${lanes.join("\n")}
|
|
|
45402
45401
|
toMarkSkip = toMarkSkip.parent;
|
|
45403
45402
|
} while (toMarkSkip && toMarkSkip !== containingCall);
|
|
45404
45403
|
}
|
|
45405
|
-
isInferencePartiallyBlocked = true;
|
|
45406
45404
|
const result = runWithoutResolvedSignatureCaching(node, fn);
|
|
45407
|
-
isInferencePartiallyBlocked = false;
|
|
45408
45405
|
if (containingCall) {
|
|
45409
45406
|
let toMarkSkip = node;
|
|
45410
45407
|
do {
|
|
@@ -50212,7 +50209,7 @@ ${lanes.join("\n")}
|
|
|
50212
50209
|
);
|
|
50213
50210
|
}
|
|
50214
50211
|
function signatureToSignatureDeclarationHelper(signature, kind, context, options) {
|
|
50215
|
-
var _a2, _b, _c, _d;
|
|
50212
|
+
var _a2, _b, _c, _d, _e;
|
|
50216
50213
|
const suppressAny = context.flags & 256 /* SuppressAnyReturnType */;
|
|
50217
50214
|
if (suppressAny)
|
|
50218
50215
|
context.flags &= ~256 /* SuppressAnyReturnType */;
|
|
@@ -50229,6 +50226,29 @@ ${lanes.join("\n")}
|
|
|
50229
50226
|
/*skipUnionExpanding*/
|
|
50230
50227
|
true
|
|
50231
50228
|
)[0];
|
|
50229
|
+
let restoreEnclosingDeclaration;
|
|
50230
|
+
if (context.enclosingDeclaration && signature.declaration && signature.declaration !== context.enclosingDeclaration && !isInJSFile(signature.declaration) && some(expandedParams)) {
|
|
50231
|
+
const locals = (_a2 = context.fakeScopeLocals) != null ? _a2 : context.fakeScopeLocals = createSymbolTable();
|
|
50232
|
+
let newLocals;
|
|
50233
|
+
for (const param of expandedParams) {
|
|
50234
|
+
if (!locals.has(param.escapedName)) {
|
|
50235
|
+
newLocals = append(newLocals, param.escapedName);
|
|
50236
|
+
locals.set(param.escapedName, param);
|
|
50237
|
+
}
|
|
50238
|
+
}
|
|
50239
|
+
if (newLocals) {
|
|
50240
|
+
const fakeScope = parseNodeFactory.createBlock(emptyArray);
|
|
50241
|
+
getNodeLinks(fakeScope).fakeScopeForSignatureDeclaration = true;
|
|
50242
|
+
fakeScope.locals = locals;
|
|
50243
|
+
const saveEnclosingDeclaration = context.enclosingDeclaration;
|
|
50244
|
+
setParent(fakeScope, saveEnclosingDeclaration);
|
|
50245
|
+
context.enclosingDeclaration = fakeScope;
|
|
50246
|
+
restoreEnclosingDeclaration = () => {
|
|
50247
|
+
context.enclosingDeclaration = saveEnclosingDeclaration;
|
|
50248
|
+
forEach(newLocals, (s) => locals.delete(s));
|
|
50249
|
+
};
|
|
50250
|
+
}
|
|
50251
|
+
}
|
|
50232
50252
|
const parameters = (some(expandedParams, (p) => p !== expandedParams[expandedParams.length - 1] && !!(getCheckFlags(p) & 32768 /* RestParameter */)) ? signature.parameters : expandedParams).map((parameter) => symbolToParameterDeclaration(parameter, context, kind === 173 /* Constructor */, options == null ? void 0 : options.privateSymbolVisitor, options == null ? void 0 : options.bundledImports));
|
|
50233
50253
|
const thisParameter = context.flags & 33554432 /* OmitThisParameter */ ? void 0 : tryGetThisParameterDeclaration(signature, context);
|
|
50234
50254
|
if (thisParameter) {
|
|
@@ -50254,11 +50274,11 @@ ${lanes.join("\n")}
|
|
|
50254
50274
|
const flags = modifiersToFlags(modifiers);
|
|
50255
50275
|
modifiers = factory.createModifiersFromModifierFlags(flags | 256 /* Abstract */);
|
|
50256
50276
|
}
|
|
50257
|
-
const node = kind === 176 /* CallSignature */ ? factory.createCallSignature(typeParameters, parameters, returnTypeNode) : kind === 177 /* ConstructSignature */ ? factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : kind === 170 /* MethodSignature */ ? factory.createMethodSignature(modifiers, (
|
|
50277
|
+
const node = kind === 176 /* CallSignature */ ? factory.createCallSignature(typeParameters, parameters, returnTypeNode) : kind === 177 /* ConstructSignature */ ? factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : kind === 170 /* MethodSignature */ ? factory.createMethodSignature(modifiers, (_b = options == null ? void 0 : options.name) != null ? _b : factory.createIdentifier(""), options == null ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : kind === 171 /* MethodDeclaration */ ? factory.createMethodDeclaration(
|
|
50258
50278
|
modifiers,
|
|
50259
50279
|
/*asteriskToken*/
|
|
50260
50280
|
void 0,
|
|
50261
|
-
(
|
|
50281
|
+
(_c = options == null ? void 0 : options.name) != null ? _c : factory.createIdentifier(""),
|
|
50262
50282
|
/*questionToken*/
|
|
50263
50283
|
void 0,
|
|
50264
50284
|
typeParameters,
|
|
@@ -50273,14 +50293,14 @@ ${lanes.join("\n")}
|
|
|
50273
50293
|
void 0
|
|
50274
50294
|
) : kind === 174 /* GetAccessor */ ? factory.createGetAccessorDeclaration(
|
|
50275
50295
|
modifiers,
|
|
50276
|
-
(
|
|
50296
|
+
(_d = options == null ? void 0 : options.name) != null ? _d : factory.createIdentifier(""),
|
|
50277
50297
|
parameters,
|
|
50278
50298
|
returnTypeNode,
|
|
50279
50299
|
/*body*/
|
|
50280
50300
|
void 0
|
|
50281
50301
|
) : kind === 175 /* SetAccessor */ ? factory.createSetAccessorDeclaration(
|
|
50282
50302
|
modifiers,
|
|
50283
|
-
(
|
|
50303
|
+
(_e = options == null ? void 0 : options.name) != null ? _e : factory.createIdentifier(""),
|
|
50284
50304
|
parameters,
|
|
50285
50305
|
/*body*/
|
|
50286
50306
|
void 0
|
|
@@ -50315,6 +50335,7 @@ ${lanes.join("\n")}
|
|
|
50315
50335
|
if (typeArguments) {
|
|
50316
50336
|
node.typeArguments = factory.createNodeArray(typeArguments);
|
|
50317
50337
|
}
|
|
50338
|
+
restoreEnclosingDeclaration == null ? void 0 : restoreEnclosingDeclaration();
|
|
50318
50339
|
return node;
|
|
50319
50340
|
}
|
|
50320
50341
|
function tryGetThisParameterDeclaration(signature, context) {
|
|
@@ -50929,9 +50950,12 @@ ${lanes.join("\n")}
|
|
|
50929
50950
|
function existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type) {
|
|
50930
50951
|
return !(getObjectFlags(type) & 4 /* Reference */) || !isTypeReferenceNode(existing) || length(existing.typeArguments) >= getMinTypeArgumentCount(type.target.typeParameters);
|
|
50931
50952
|
}
|
|
50953
|
+
function getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration) {
|
|
50954
|
+
return findAncestor(enclosingDeclaration, (n) => !getNodeLinks(n).fakeScopeForSignatureDeclaration);
|
|
50955
|
+
}
|
|
50932
50956
|
function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled) {
|
|
50933
50957
|
if (!isErrorType(type) && enclosingDeclaration) {
|
|
50934
|
-
const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, enclosingDeclaration);
|
|
50958
|
+
const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
|
|
50935
50959
|
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
50936
50960
|
const existing = getEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
50937
50961
|
if (typeNodeIsEquivalentToType(existing, declWithExistingAnnotation, type) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
|
|
@@ -50963,7 +50987,8 @@ ${lanes.join("\n")}
|
|
|
50963
50987
|
function serializeReturnTypeForSignature(context, type, signature, includePrivateSymbol, bundled) {
|
|
50964
50988
|
if (!isErrorType(type) && context.enclosingDeclaration) {
|
|
50965
50989
|
const annotation = signature.declaration && getEffectiveReturnTypeNode(signature.declaration);
|
|
50966
|
-
|
|
50990
|
+
const enclosingDeclarationIgnoringFakeScope = getEnclosingDeclarationIgnoringFakeScope(context.enclosingDeclaration);
|
|
50991
|
+
if (!!findAncestor(annotation, (n) => n === enclosingDeclarationIgnoringFakeScope) && annotation) {
|
|
50967
50992
|
const annotated = getTypeFromTypeNode(annotation);
|
|
50968
50993
|
const thisInstantiated = annotated.flags & 262144 /* TypeParameter */ && annotated.isThisType ? instantiateType(annotated, signature.mapper) : annotated;
|
|
50969
50994
|
if (thisInstantiated === type && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(annotation, type)) {
|
|
@@ -72046,7 +72071,7 @@ ${lanes.join("\n")}
|
|
|
72046
72071
|
const isTaggedTemplate = node.kind === 212 /* TaggedTemplateExpression */;
|
|
72047
72072
|
const isDecorator2 = node.kind === 167 /* Decorator */;
|
|
72048
72073
|
const isJsxOpeningOrSelfClosingElement = isJsxOpeningLikeElement(node);
|
|
72049
|
-
const reportErrors2 = !
|
|
72074
|
+
const reportErrors2 = !candidatesOutArray;
|
|
72050
72075
|
let typeArguments;
|
|
72051
72076
|
if (!isDecorator2 && !isSuperCall(node)) {
|
|
72052
72077
|
typeArguments = node.typeArguments;
|
|
@@ -90372,7 +90397,16 @@ ${lanes.join("\n")}
|
|
|
90372
90397
|
visitNode(node.initializer, (child) => namedEvaluationVisitor(child, referencedName), isExpression)
|
|
90373
90398
|
);
|
|
90374
90399
|
}
|
|
90375
|
-
return
|
|
90400
|
+
return factory2.updatePropertyDeclaration(
|
|
90401
|
+
node,
|
|
90402
|
+
visitNodes2(node.modifiers, modifierVisitor, isModifier),
|
|
90403
|
+
visitNode(node.name, propertyNameVisitor, isPropertyName),
|
|
90404
|
+
/*questionOrExclamationToken*/
|
|
90405
|
+
void 0,
|
|
90406
|
+
/*type*/
|
|
90407
|
+
void 0,
|
|
90408
|
+
visitNode(node.initializer, visitor, isExpression)
|
|
90409
|
+
);
|
|
90376
90410
|
}
|
|
90377
90411
|
function transformPublicFieldInitializer(node) {
|
|
90378
90412
|
if (shouldTransformInitializers && !isAutoAccessorPropertyDeclaration(node)) {
|
|
@@ -133216,7 +133250,8 @@ ${lanes.join("\n")}
|
|
|
133216
133250
|
options.triggerCharacter,
|
|
133217
133251
|
options.triggerKind,
|
|
133218
133252
|
cancellationToken,
|
|
133219
|
-
formattingSettings && ts_formatting_exports.getFormatContext(formattingSettings, host)
|
|
133253
|
+
formattingSettings && ts_formatting_exports.getFormatContext(formattingSettings, host),
|
|
133254
|
+
options.includeSymbol
|
|
133220
133255
|
);
|
|
133221
133256
|
}
|
|
133222
133257
|
function getCompletionEntryDetails2(fileName, position, name, formattingOptions, source, preferences = emptyOptions, data) {
|
|
@@ -147331,7 +147366,7 @@ ${lanes.join("\n")}
|
|
|
147331
147366
|
return result2 || (needsFullResolution ? "failed" : "skipped");
|
|
147332
147367
|
}
|
|
147333
147368
|
}
|
|
147334
|
-
function getCompletionsAtPosition(host, program, log, sourceFile, position, preferences, triggerCharacter, completionKind, cancellationToken, formatContext) {
|
|
147369
|
+
function getCompletionsAtPosition(host, program, log, sourceFile, position, preferences, triggerCharacter, completionKind, cancellationToken, formatContext, includeSymbol = false) {
|
|
147335
147370
|
var _a2;
|
|
147336
147371
|
const { previousToken } = getRelevantTokens(position, sourceFile);
|
|
147337
147372
|
if (triggerCharacter && !isInString(sourceFile, position, previousToken) && !isValidTrigger(sourceFile, triggerCharacter, previousToken, position)) {
|
|
@@ -147353,7 +147388,7 @@ ${lanes.join("\n")}
|
|
|
147353
147388
|
} else {
|
|
147354
147389
|
incompleteCompletionsCache == null ? void 0 : incompleteCompletionsCache.clear();
|
|
147355
147390
|
}
|
|
147356
|
-
const stringCompletions = ts_Completions_StringCompletions_exports.getStringLiteralCompletions(sourceFile, position, previousToken, compilerOptions, host, program, log, preferences);
|
|
147391
|
+
const stringCompletions = ts_Completions_StringCompletions_exports.getStringLiteralCompletions(sourceFile, position, previousToken, compilerOptions, host, program, log, preferences, includeSymbol);
|
|
147357
147392
|
if (stringCompletions) {
|
|
147358
147393
|
return stringCompletions;
|
|
147359
147394
|
}
|
|
@@ -147378,7 +147413,7 @@ ${lanes.join("\n")}
|
|
|
147378
147413
|
}
|
|
147379
147414
|
switch (completionData.kind) {
|
|
147380
147415
|
case 0 /* Data */:
|
|
147381
|
-
const response = completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position);
|
|
147416
|
+
const response = completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position, includeSymbol);
|
|
147382
147417
|
if (response == null ? void 0 : response.isIncomplete) {
|
|
147383
147418
|
incompleteCompletionsCache == null ? void 0 : incompleteCompletionsCache.set(response);
|
|
147384
147419
|
}
|
|
@@ -147508,7 +147543,7 @@ ${lanes.join("\n")}
|
|
|
147508
147543
|
function getOptionalReplacementSpan(location) {
|
|
147509
147544
|
return (location == null ? void 0 : location.kind) === 79 /* Identifier */ ? createTextSpanFromNode(location) : void 0;
|
|
147510
147545
|
}
|
|
147511
|
-
function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position) {
|
|
147546
|
+
function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position, includeSymbol) {
|
|
147512
147547
|
const {
|
|
147513
147548
|
symbols,
|
|
147514
147549
|
contextToken,
|
|
@@ -147582,7 +147617,8 @@ ${lanes.join("\n")}
|
|
|
147582
147617
|
symbolToOriginInfoMap,
|
|
147583
147618
|
symbolToSortTextMap,
|
|
147584
147619
|
isJsxIdentifierExpected,
|
|
147585
|
-
isRightOfOpenTag
|
|
147620
|
+
isRightOfOpenTag,
|
|
147621
|
+
includeSymbol
|
|
147586
147622
|
);
|
|
147587
147623
|
if (keywordFilters !== 0 /* None */) {
|
|
147588
147624
|
for (const keywordEntry of getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && isSourceFileJS(sourceFile))) {
|
|
@@ -147831,7 +147867,7 @@ ${lanes.join("\n")}
|
|
|
147831
147867
|
function createCompletionEntryForLiteral(sourceFile, preferences, literal) {
|
|
147832
147868
|
return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* string */, kindModifiers: "" /* none */, sortText: SortText.LocationPriority };
|
|
147833
147869
|
}
|
|
147834
|
-
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) {
|
|
147870
|
+
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) {
|
|
147835
147871
|
let insertText;
|
|
147836
147872
|
let replacementSpan = getReplacementSpanForContextToken(replacementToken);
|
|
147837
147873
|
let data;
|
|
@@ -147945,7 +147981,8 @@ ${lanes.join("\n")}
|
|
|
147945
147981
|
isSnippet,
|
|
147946
147982
|
isPackageJsonImport: originIsPackageJsonImport(origin) || void 0,
|
|
147947
147983
|
isImportStatementCompletion: !!importStatementCompletion || void 0,
|
|
147948
|
-
data
|
|
147984
|
+
data,
|
|
147985
|
+
...includeSymbol ? { symbol } : void 0
|
|
147949
147986
|
};
|
|
147950
147987
|
}
|
|
147951
147988
|
function isClassLikeMemberCompletion(symbol, location, sourceFile) {
|
|
@@ -148415,7 +148452,7 @@ ${lanes.join("\n")}
|
|
|
148415
148452
|
return "TypeOnlyAlias/" /* TypeOnlyAlias */;
|
|
148416
148453
|
}
|
|
148417
148454
|
}
|
|
148418
|
-
function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, position, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag) {
|
|
148455
|
+
function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, position, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag, includeSymbol = false) {
|
|
148419
148456
|
var _a2;
|
|
148420
148457
|
const start = timestamp();
|
|
148421
148458
|
const variableDeclaration = getVariableDeclaration(location);
|
|
@@ -148455,7 +148492,8 @@ ${lanes.join("\n")}
|
|
|
148455
148492
|
kind,
|
|
148456
148493
|
formatContext,
|
|
148457
148494
|
isJsxIdentifierExpected,
|
|
148458
|
-
isRightOfOpenTag
|
|
148495
|
+
isRightOfOpenTag,
|
|
148496
|
+
includeSymbol
|
|
148459
148497
|
);
|
|
148460
148498
|
if (!entry) {
|
|
148461
148499
|
continue;
|
|
@@ -150696,7 +150734,7 @@ ${lanes.join("\n")}
|
|
|
150696
150734
|
values: map2.values.bind(map2)
|
|
150697
150735
|
};
|
|
150698
150736
|
}
|
|
150699
|
-
function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program, log, preferences) {
|
|
150737
|
+
function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program, log, preferences, includeSymbol) {
|
|
150700
150738
|
if (isInReferenceComment(sourceFile, position)) {
|
|
150701
150739
|
const entries = getTripleSlashReferenceCompletion(sourceFile, position, options, host);
|
|
150702
150740
|
return entries && convertPathCompletions(entries);
|
|
@@ -150705,10 +150743,10 @@ ${lanes.join("\n")}
|
|
|
150705
150743
|
if (!contextToken || !isStringLiteralLike(contextToken))
|
|
150706
150744
|
return void 0;
|
|
150707
150745
|
const entries = getStringLiteralCompletionEntries(sourceFile, contextToken, position, program.getTypeChecker(), options, host, preferences);
|
|
150708
|
-
return convertStringLiteralCompletions(entries, contextToken, sourceFile, host, program, log, options, preferences, position);
|
|
150746
|
+
return convertStringLiteralCompletions(entries, contextToken, sourceFile, host, program, log, options, preferences, position, includeSymbol);
|
|
150709
150747
|
}
|
|
150710
150748
|
}
|
|
150711
|
-
function convertStringLiteralCompletions(completion, contextToken, sourceFile, host, program, log, options, preferences, position) {
|
|
150749
|
+
function convertStringLiteralCompletions(completion, contextToken, sourceFile, host, program, log, options, preferences, position, includeSymbol) {
|
|
150712
150750
|
if (completion === void 0) {
|
|
150713
150751
|
return void 0;
|
|
150714
150752
|
}
|
|
@@ -150734,7 +150772,28 @@ ${lanes.join("\n")}
|
|
|
150734
150772
|
preferences,
|
|
150735
150773
|
options,
|
|
150736
150774
|
/*formatContext*/
|
|
150737
|
-
void 0
|
|
150775
|
+
void 0,
|
|
150776
|
+
/*isTypeOnlyLocation */
|
|
150777
|
+
void 0,
|
|
150778
|
+
/*propertyAccessToConvert*/
|
|
150779
|
+
void 0,
|
|
150780
|
+
/*jsxIdentifierExpected*/
|
|
150781
|
+
void 0,
|
|
150782
|
+
/*isJsxInitializer*/
|
|
150783
|
+
void 0,
|
|
150784
|
+
/*importStatementCompletion*/
|
|
150785
|
+
void 0,
|
|
150786
|
+
/*recommendedCompletion*/
|
|
150787
|
+
void 0,
|
|
150788
|
+
/*symbolToOriginInfoMap*/
|
|
150789
|
+
void 0,
|
|
150790
|
+
/*symbolToSortTextMap*/
|
|
150791
|
+
void 0,
|
|
150792
|
+
/*isJsxIdentifierExpected*/
|
|
150793
|
+
void 0,
|
|
150794
|
+
/*isRightOfOpenTag*/
|
|
150795
|
+
void 0,
|
|
150796
|
+
includeSymbol
|
|
150738
150797
|
);
|
|
150739
150798
|
return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: completion.hasIndexSignature, optionalReplacementSpan, entries };
|
|
150740
150799
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@typescript-deploys/pr-build",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.0.0-pr-
|
|
5
|
+
"version": "5.0.0-pr-49627-28",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|