@typescript-deploys/pr-build 5.0.0-pr-52737-7 → 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 +45 -22
- package/lib/tsserver.js +87 -37
- package/lib/tsserverlibrary.d.ts +13 -0
- package/lib/tsserverlibrary.js +87 -37
- package/lib/typescript.d.ts +13 -0
- package/lib/typescript.js +87 -37
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -47824,7 +47824,7 @@ function createTypeChecker(host) {
|
|
|
47824
47824
|
);
|
|
47825
47825
|
}
|
|
47826
47826
|
function signatureToSignatureDeclarationHelper(signature, kind, context, options) {
|
|
47827
|
-
var _a2, _b, _c, _d;
|
|
47827
|
+
var _a2, _b, _c, _d, _e;
|
|
47828
47828
|
const suppressAny = context.flags & 256 /* SuppressAnyReturnType */;
|
|
47829
47829
|
if (suppressAny)
|
|
47830
47830
|
context.flags &= ~256 /* SuppressAnyReturnType */;
|
|
@@ -47841,6 +47841,29 @@ function createTypeChecker(host) {
|
|
|
47841
47841
|
/*skipUnionExpanding*/
|
|
47842
47842
|
true
|
|
47843
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
|
+
}
|
|
47844
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));
|
|
47845
47868
|
const thisParameter = context.flags & 33554432 /* OmitThisParameter */ ? void 0 : tryGetThisParameterDeclaration(signature, context);
|
|
47846
47869
|
if (thisParameter) {
|
|
@@ -47866,11 +47889,11 @@ function createTypeChecker(host) {
|
|
|
47866
47889
|
const flags = modifiersToFlags(modifiers);
|
|
47867
47890
|
modifiers = factory.createModifiersFromModifierFlags(flags | 256 /* Abstract */);
|
|
47868
47891
|
}
|
|
47869
|
-
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(
|
|
47870
47893
|
modifiers,
|
|
47871
47894
|
/*asteriskToken*/
|
|
47872
47895
|
void 0,
|
|
47873
|
-
(
|
|
47896
|
+
(_c = options == null ? void 0 : options.name) != null ? _c : factory.createIdentifier(""),
|
|
47874
47897
|
/*questionToken*/
|
|
47875
47898
|
void 0,
|
|
47876
47899
|
typeParameters,
|
|
@@ -47885,14 +47908,14 @@ function createTypeChecker(host) {
|
|
|
47885
47908
|
void 0
|
|
47886
47909
|
) : kind === 174 /* GetAccessor */ ? factory.createGetAccessorDeclaration(
|
|
47887
47910
|
modifiers,
|
|
47888
|
-
(
|
|
47911
|
+
(_d = options == null ? void 0 : options.name) != null ? _d : factory.createIdentifier(""),
|
|
47889
47912
|
parameters,
|
|
47890
47913
|
returnTypeNode,
|
|
47891
47914
|
/*body*/
|
|
47892
47915
|
void 0
|
|
47893
47916
|
) : kind === 175 /* SetAccessor */ ? factory.createSetAccessorDeclaration(
|
|
47894
47917
|
modifiers,
|
|
47895
|
-
(
|
|
47918
|
+
(_e = options == null ? void 0 : options.name) != null ? _e : factory.createIdentifier(""),
|
|
47896
47919
|
parameters,
|
|
47897
47920
|
/*body*/
|
|
47898
47921
|
void 0
|
|
@@ -47927,6 +47950,7 @@ function createTypeChecker(host) {
|
|
|
47927
47950
|
if (typeArguments) {
|
|
47928
47951
|
node.typeArguments = factory.createNodeArray(typeArguments);
|
|
47929
47952
|
}
|
|
47953
|
+
restoreEnclosingDeclaration == null ? void 0 : restoreEnclosingDeclaration();
|
|
47930
47954
|
return node;
|
|
47931
47955
|
}
|
|
47932
47956
|
function tryGetThisParameterDeclaration(signature, context) {
|
|
@@ -48541,9 +48565,12 @@ function createTypeChecker(host) {
|
|
|
48541
48565
|
function existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type) {
|
|
48542
48566
|
return !(getObjectFlags(type) & 4 /* Reference */) || !isTypeReferenceNode(existing) || length(existing.typeArguments) >= getMinTypeArgumentCount(type.target.typeParameters);
|
|
48543
48567
|
}
|
|
48568
|
+
function getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration) {
|
|
48569
|
+
return findAncestor(enclosingDeclaration, (n) => !getNodeLinks(n).fakeScopeForSignatureDeclaration);
|
|
48570
|
+
}
|
|
48544
48571
|
function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled) {
|
|
48545
48572
|
if (!isErrorType(type) && enclosingDeclaration) {
|
|
48546
|
-
const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, enclosingDeclaration);
|
|
48573
|
+
const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
|
|
48547
48574
|
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
48548
48575
|
const existing = getEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
48549
48576
|
if (typeNodeIsEquivalentToType(existing, declWithExistingAnnotation, type) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
|
|
@@ -48575,7 +48602,8 @@ function createTypeChecker(host) {
|
|
|
48575
48602
|
function serializeReturnTypeForSignature(context, type, signature, includePrivateSymbol, bundled) {
|
|
48576
48603
|
if (!isErrorType(type) && context.enclosingDeclaration) {
|
|
48577
48604
|
const annotation = signature.declaration && getEffectiveReturnTypeNode(signature.declaration);
|
|
48578
|
-
|
|
48605
|
+
const enclosingDeclarationIgnoringFakeScope = getEnclosingDeclarationIgnoringFakeScope(context.enclosingDeclaration);
|
|
48606
|
+
if (!!findAncestor(annotation, (n) => n === enclosingDeclarationIgnoringFakeScope) && annotation) {
|
|
48579
48607
|
const annotated = getTypeFromTypeNode(annotation);
|
|
48580
48608
|
const thisInstantiated = annotated.flags & 262144 /* TypeParameter */ && annotated.isThisType ? instantiateType(annotated, signature.mapper) : annotated;
|
|
48581
48609
|
if (thisInstantiated === type && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(annotation, type)) {
|
|
@@ -63066,7 +63094,6 @@ function createTypeChecker(host) {
|
|
|
63066
63094
|
if (getObjectFlags(target) & 32 /* Mapped */ && !target.declaration.nameType) {
|
|
63067
63095
|
const constraintType = getConstraintTypeFromMappedType(target);
|
|
63068
63096
|
if (inferToMappedType(source, target, constraintType)) {
|
|
63069
|
-
inferFromMappedProperties(source, target);
|
|
63070
63097
|
return;
|
|
63071
63098
|
}
|
|
63072
63099
|
}
|
|
@@ -63167,19 +63194,6 @@ function createTypeChecker(host) {
|
|
|
63167
63194
|
}
|
|
63168
63195
|
}
|
|
63169
63196
|
}
|
|
63170
|
-
function inferFromMappedProperties(source, target) {
|
|
63171
|
-
const properties = getPropertiesOfObjectType(source);
|
|
63172
|
-
for (const sourceProp of properties) {
|
|
63173
|
-
if (!some(sourceProp.declarations, hasSkipDirectInferenceFlag)) {
|
|
63174
|
-
const sourcePropType = getTypeOfSymbol(sourceProp);
|
|
63175
|
-
if (!couldContainTypeVariables(sourcePropType)) {
|
|
63176
|
-
continue;
|
|
63177
|
-
}
|
|
63178
|
-
const targetPropType = substituteIndexedMappedType(target, getStringLiteralType(unescapeLeadingUnderscores(sourceProp.escapedName)));
|
|
63179
|
-
inferFromTypes(sourcePropType, targetPropType);
|
|
63180
|
-
}
|
|
63181
|
-
}
|
|
63182
|
-
}
|
|
63183
63197
|
function inferFromSignatures(source, target, kind) {
|
|
63184
63198
|
const sourceSignatures = getSignaturesOfType(source, kind);
|
|
63185
63199
|
const targetSignatures = getSignaturesOfType(target, kind);
|
|
@@ -87651,7 +87665,16 @@ function transformClassFields(context) {
|
|
|
87651
87665
|
visitNode(node.initializer, (child) => namedEvaluationVisitor(child, referencedName), isExpression)
|
|
87652
87666
|
);
|
|
87653
87667
|
}
|
|
87654
|
-
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
|
+
);
|
|
87655
87678
|
}
|
|
87656
87679
|
function transformPublicFieldInitializer(node) {
|
|
87657
87680
|
if (shouldTransformInitializers && !isAutoAccessorPropertyDeclaration(node)) {
|
package/lib/tsserver.js
CHANGED
|
@@ -52400,7 +52400,7 @@ function createTypeChecker(host) {
|
|
|
52400
52400
|
);
|
|
52401
52401
|
}
|
|
52402
52402
|
function signatureToSignatureDeclarationHelper(signature, kind, context, options) {
|
|
52403
|
-
var _a2, _b, _c, _d;
|
|
52403
|
+
var _a2, _b, _c, _d, _e;
|
|
52404
52404
|
const suppressAny = context.flags & 256 /* SuppressAnyReturnType */;
|
|
52405
52405
|
if (suppressAny)
|
|
52406
52406
|
context.flags &= ~256 /* SuppressAnyReturnType */;
|
|
@@ -52417,6 +52417,29 @@ function createTypeChecker(host) {
|
|
|
52417
52417
|
/*skipUnionExpanding*/
|
|
52418
52418
|
true
|
|
52419
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
|
+
}
|
|
52420
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));
|
|
52421
52444
|
const thisParameter = context.flags & 33554432 /* OmitThisParameter */ ? void 0 : tryGetThisParameterDeclaration(signature, context);
|
|
52422
52445
|
if (thisParameter) {
|
|
@@ -52442,11 +52465,11 @@ function createTypeChecker(host) {
|
|
|
52442
52465
|
const flags = modifiersToFlags(modifiers);
|
|
52443
52466
|
modifiers = factory.createModifiersFromModifierFlags(flags | 256 /* Abstract */);
|
|
52444
52467
|
}
|
|
52445
|
-
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(
|
|
52446
52469
|
modifiers,
|
|
52447
52470
|
/*asteriskToken*/
|
|
52448
52471
|
void 0,
|
|
52449
|
-
(
|
|
52472
|
+
(_c = options == null ? void 0 : options.name) != null ? _c : factory.createIdentifier(""),
|
|
52450
52473
|
/*questionToken*/
|
|
52451
52474
|
void 0,
|
|
52452
52475
|
typeParameters,
|
|
@@ -52461,14 +52484,14 @@ function createTypeChecker(host) {
|
|
|
52461
52484
|
void 0
|
|
52462
52485
|
) : kind === 174 /* GetAccessor */ ? factory.createGetAccessorDeclaration(
|
|
52463
52486
|
modifiers,
|
|
52464
|
-
(
|
|
52487
|
+
(_d = options == null ? void 0 : options.name) != null ? _d : factory.createIdentifier(""),
|
|
52465
52488
|
parameters,
|
|
52466
52489
|
returnTypeNode,
|
|
52467
52490
|
/*body*/
|
|
52468
52491
|
void 0
|
|
52469
52492
|
) : kind === 175 /* SetAccessor */ ? factory.createSetAccessorDeclaration(
|
|
52470
52493
|
modifiers,
|
|
52471
|
-
(
|
|
52494
|
+
(_e = options == null ? void 0 : options.name) != null ? _e : factory.createIdentifier(""),
|
|
52472
52495
|
parameters,
|
|
52473
52496
|
/*body*/
|
|
52474
52497
|
void 0
|
|
@@ -52503,6 +52526,7 @@ function createTypeChecker(host) {
|
|
|
52503
52526
|
if (typeArguments) {
|
|
52504
52527
|
node.typeArguments = factory.createNodeArray(typeArguments);
|
|
52505
52528
|
}
|
|
52529
|
+
restoreEnclosingDeclaration == null ? void 0 : restoreEnclosingDeclaration();
|
|
52506
52530
|
return node;
|
|
52507
52531
|
}
|
|
52508
52532
|
function tryGetThisParameterDeclaration(signature, context) {
|
|
@@ -53117,9 +53141,12 @@ function createTypeChecker(host) {
|
|
|
53117
53141
|
function existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type) {
|
|
53118
53142
|
return !(getObjectFlags(type) & 4 /* Reference */) || !isTypeReferenceNode(existing) || length(existing.typeArguments) >= getMinTypeArgumentCount(type.target.typeParameters);
|
|
53119
53143
|
}
|
|
53144
|
+
function getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration) {
|
|
53145
|
+
return findAncestor(enclosingDeclaration, (n) => !getNodeLinks(n).fakeScopeForSignatureDeclaration);
|
|
53146
|
+
}
|
|
53120
53147
|
function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled) {
|
|
53121
53148
|
if (!isErrorType(type) && enclosingDeclaration) {
|
|
53122
|
-
const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, enclosingDeclaration);
|
|
53149
|
+
const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
|
|
53123
53150
|
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
53124
53151
|
const existing = getEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
53125
53152
|
if (typeNodeIsEquivalentToType(existing, declWithExistingAnnotation, type) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
|
|
@@ -53151,7 +53178,8 @@ function createTypeChecker(host) {
|
|
|
53151
53178
|
function serializeReturnTypeForSignature(context, type, signature, includePrivateSymbol, bundled) {
|
|
53152
53179
|
if (!isErrorType(type) && context.enclosingDeclaration) {
|
|
53153
53180
|
const annotation = signature.declaration && getEffectiveReturnTypeNode(signature.declaration);
|
|
53154
|
-
|
|
53181
|
+
const enclosingDeclarationIgnoringFakeScope = getEnclosingDeclarationIgnoringFakeScope(context.enclosingDeclaration);
|
|
53182
|
+
if (!!findAncestor(annotation, (n) => n === enclosingDeclarationIgnoringFakeScope) && annotation) {
|
|
53155
53183
|
const annotated = getTypeFromTypeNode(annotation);
|
|
53156
53184
|
const thisInstantiated = annotated.flags & 262144 /* TypeParameter */ && annotated.isThisType ? instantiateType(annotated, signature.mapper) : annotated;
|
|
53157
53185
|
if (thisInstantiated === type && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(annotation, type)) {
|
|
@@ -67642,7 +67670,6 @@ function createTypeChecker(host) {
|
|
|
67642
67670
|
if (getObjectFlags(target) & 32 /* Mapped */ && !target.declaration.nameType) {
|
|
67643
67671
|
const constraintType = getConstraintTypeFromMappedType(target);
|
|
67644
67672
|
if (inferToMappedType(source, target, constraintType)) {
|
|
67645
|
-
inferFromMappedProperties(source, target);
|
|
67646
67673
|
return;
|
|
67647
67674
|
}
|
|
67648
67675
|
}
|
|
@@ -67743,19 +67770,6 @@ function createTypeChecker(host) {
|
|
|
67743
67770
|
}
|
|
67744
67771
|
}
|
|
67745
67772
|
}
|
|
67746
|
-
function inferFromMappedProperties(source, target) {
|
|
67747
|
-
const properties = getPropertiesOfObjectType(source);
|
|
67748
|
-
for (const sourceProp of properties) {
|
|
67749
|
-
if (!some(sourceProp.declarations, hasSkipDirectInferenceFlag)) {
|
|
67750
|
-
const sourcePropType = getTypeOfSymbol(sourceProp);
|
|
67751
|
-
if (!couldContainTypeVariables(sourcePropType)) {
|
|
67752
|
-
continue;
|
|
67753
|
-
}
|
|
67754
|
-
const targetPropType = substituteIndexedMappedType(target, getStringLiteralType(unescapeLeadingUnderscores(sourceProp.escapedName)));
|
|
67755
|
-
inferFromTypes(sourcePropType, targetPropType);
|
|
67756
|
-
}
|
|
67757
|
-
}
|
|
67758
|
-
}
|
|
67759
67773
|
function inferFromSignatures(source, target, kind) {
|
|
67760
67774
|
const sourceSignatures = getSignaturesOfType(source, kind);
|
|
67761
67775
|
const targetSignatures = getSignaturesOfType(target, kind);
|
|
@@ -92398,7 +92412,16 @@ function transformClassFields(context) {
|
|
|
92398
92412
|
visitNode(node.initializer, (child) => namedEvaluationVisitor(child, referencedName), isExpression)
|
|
92399
92413
|
);
|
|
92400
92414
|
}
|
|
92401
|
-
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
|
+
);
|
|
92402
92425
|
}
|
|
92403
92426
|
function transformPublicFieldInitializer(node) {
|
|
92404
92427
|
if (shouldTransformInitializers && !isAutoAccessorPropertyDeclaration(node)) {
|
|
@@ -135445,7 +135468,8 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
|
135445
135468
|
options.triggerCharacter,
|
|
135446
135469
|
options.triggerKind,
|
|
135447
135470
|
cancellationToken,
|
|
135448
|
-
formattingSettings && ts_formatting_exports.getFormatContext(formattingSettings, host)
|
|
135471
|
+
formattingSettings && ts_formatting_exports.getFormatContext(formattingSettings, host),
|
|
135472
|
+
options.includeSymbol
|
|
135449
135473
|
);
|
|
135450
135474
|
}
|
|
135451
135475
|
function getCompletionEntryDetails2(fileName, position, name, formattingOptions, source, preferences = emptyOptions, data) {
|
|
@@ -148273,7 +148297,7 @@ function resolvingModuleSpecifiers(logPrefix, host, resolver, program, position,
|
|
|
148273
148297
|
return result2 || (needsFullResolution ? "failed" : "skipped");
|
|
148274
148298
|
}
|
|
148275
148299
|
}
|
|
148276
|
-
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) {
|
|
148277
148301
|
var _a2;
|
|
148278
148302
|
const { previousToken } = getRelevantTokens(position, sourceFile);
|
|
148279
148303
|
if (triggerCharacter && !isInString(sourceFile, position, previousToken) && !isValidTrigger(sourceFile, triggerCharacter, previousToken, position)) {
|
|
@@ -148295,7 +148319,7 @@ function getCompletionsAtPosition(host, program, log, sourceFile, position, pref
|
|
|
148295
148319
|
} else {
|
|
148296
148320
|
incompleteCompletionsCache == null ? void 0 : incompleteCompletionsCache.clear();
|
|
148297
148321
|
}
|
|
148298
|
-
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);
|
|
148299
148323
|
if (stringCompletions) {
|
|
148300
148324
|
return stringCompletions;
|
|
148301
148325
|
}
|
|
@@ -148320,7 +148344,7 @@ function getCompletionsAtPosition(host, program, log, sourceFile, position, pref
|
|
|
148320
148344
|
}
|
|
148321
148345
|
switch (completionData.kind) {
|
|
148322
148346
|
case 0 /* Data */:
|
|
148323
|
-
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);
|
|
148324
148348
|
if (response == null ? void 0 : response.isIncomplete) {
|
|
148325
148349
|
incompleteCompletionsCache == null ? void 0 : incompleteCompletionsCache.set(response);
|
|
148326
148350
|
}
|
|
@@ -148450,7 +148474,7 @@ function keywordFiltersFromSyntaxKind(keywordCompletion) {
|
|
|
148450
148474
|
function getOptionalReplacementSpan(location) {
|
|
148451
148475
|
return (location == null ? void 0 : location.kind) === 79 /* Identifier */ ? createTextSpanFromNode(location) : void 0;
|
|
148452
148476
|
}
|
|
148453
|
-
function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position) {
|
|
148477
|
+
function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position, includeSymbol) {
|
|
148454
148478
|
const {
|
|
148455
148479
|
symbols,
|
|
148456
148480
|
contextToken,
|
|
@@ -148524,7 +148548,8 @@ function completionInfoFromData(sourceFile, host, program, compilerOptions, log,
|
|
|
148524
148548
|
symbolToOriginInfoMap,
|
|
148525
148549
|
symbolToSortTextMap,
|
|
148526
148550
|
isJsxIdentifierExpected,
|
|
148527
|
-
isRightOfOpenTag
|
|
148551
|
+
isRightOfOpenTag,
|
|
148552
|
+
includeSymbol
|
|
148528
148553
|
);
|
|
148529
148554
|
if (keywordFilters !== 0 /* None */) {
|
|
148530
148555
|
for (const keywordEntry of getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && isSourceFileJS(sourceFile))) {
|
|
@@ -148773,7 +148798,7 @@ function completionNameForLiteral(sourceFile, preferences, literal) {
|
|
|
148773
148798
|
function createCompletionEntryForLiteral(sourceFile, preferences, literal) {
|
|
148774
148799
|
return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* string */, kindModifiers: "" /* none */, sortText: SortText.LocationPriority };
|
|
148775
148800
|
}
|
|
148776
|
-
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) {
|
|
148777
148802
|
let insertText;
|
|
148778
148803
|
let replacementSpan = getReplacementSpanForContextToken(replacementToken);
|
|
148779
148804
|
let data;
|
|
@@ -148817,7 +148842,9 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
|
|
|
148817
148842
|
}
|
|
148818
148843
|
awaitText += `(await ${propertyAccessToConvert.expression.getText()})`;
|
|
148819
148844
|
insertText = needsConvertPropertyAccess ? `${awaitText}${insertText}` : `${awaitText}${insertQuestionDot ? "?." : "."}${insertText}`;
|
|
148820
|
-
|
|
148845
|
+
const isInAwaitExpression = tryCast(propertyAccessToConvert.parent, isAwaitExpression);
|
|
148846
|
+
const wrapNode = isInAwaitExpression ? propertyAccessToConvert.parent : propertyAccessToConvert.expression;
|
|
148847
|
+
replacementSpan = createTextSpanFromBounds(wrapNode.getStart(sourceFile), propertyAccessToConvert.end);
|
|
148821
148848
|
}
|
|
148822
148849
|
if (originIsResolvedExport(origin)) {
|
|
148823
148850
|
sourceDisplay = [textPart(origin.moduleSpecifier)];
|
|
@@ -148885,7 +148912,8 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
|
|
|
148885
148912
|
isSnippet,
|
|
148886
148913
|
isPackageJsonImport: originIsPackageJsonImport(origin) || void 0,
|
|
148887
148914
|
isImportStatementCompletion: !!importStatementCompletion || void 0,
|
|
148888
|
-
data
|
|
148915
|
+
data,
|
|
148916
|
+
...includeSymbol ? { symbol } : void 0
|
|
148889
148917
|
};
|
|
148890
148918
|
}
|
|
148891
148919
|
function isClassLikeMemberCompletion(symbol, location, sourceFile) {
|
|
@@ -149355,7 +149383,7 @@ function getSourceFromOrigin(origin) {
|
|
|
149355
149383
|
return "TypeOnlyAlias/" /* TypeOnlyAlias */;
|
|
149356
149384
|
}
|
|
149357
149385
|
}
|
|
149358
|
-
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) {
|
|
149359
149387
|
var _a2;
|
|
149360
149388
|
const start2 = timestamp();
|
|
149361
149389
|
const variableDeclaration = getVariableDeclaration(location);
|
|
@@ -149395,7 +149423,8 @@ function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, con
|
|
|
149395
149423
|
kind,
|
|
149396
149424
|
formatContext,
|
|
149397
149425
|
isJsxIdentifierExpected,
|
|
149398
|
-
isRightOfOpenTag
|
|
149426
|
+
isRightOfOpenTag,
|
|
149427
|
+
includeSymbol
|
|
149399
149428
|
);
|
|
149400
149429
|
if (!entry) {
|
|
149401
149430
|
continue;
|
|
@@ -151594,7 +151623,7 @@ function createNameAndKindSet() {
|
|
|
151594
151623
|
values: map2.values.bind(map2)
|
|
151595
151624
|
};
|
|
151596
151625
|
}
|
|
151597
|
-
function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program, log, preferences) {
|
|
151626
|
+
function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program, log, preferences, includeSymbol) {
|
|
151598
151627
|
if (isInReferenceComment(sourceFile, position)) {
|
|
151599
151628
|
const entries = getTripleSlashReferenceCompletion(sourceFile, position, options, host);
|
|
151600
151629
|
return entries && convertPathCompletions(entries);
|
|
@@ -151603,10 +151632,10 @@ function getStringLiteralCompletions(sourceFile, position, contextToken, options
|
|
|
151603
151632
|
if (!contextToken || !isStringLiteralLike(contextToken))
|
|
151604
151633
|
return void 0;
|
|
151605
151634
|
const entries = getStringLiteralCompletionEntries(sourceFile, contextToken, position, program.getTypeChecker(), options, host, preferences);
|
|
151606
|
-
return convertStringLiteralCompletions(entries, contextToken, sourceFile, host, program, log, options, preferences, position);
|
|
151635
|
+
return convertStringLiteralCompletions(entries, contextToken, sourceFile, host, program, log, options, preferences, position, includeSymbol);
|
|
151607
151636
|
}
|
|
151608
151637
|
}
|
|
151609
|
-
function convertStringLiteralCompletions(completion, contextToken, sourceFile, host, program, log, options, preferences, position) {
|
|
151638
|
+
function convertStringLiteralCompletions(completion, contextToken, sourceFile, host, program, log, options, preferences, position, includeSymbol) {
|
|
151610
151639
|
if (completion === void 0) {
|
|
151611
151640
|
return void 0;
|
|
151612
151641
|
}
|
|
@@ -151632,7 +151661,28 @@ function convertStringLiteralCompletions(completion, contextToken, sourceFile, h
|
|
|
151632
151661
|
preferences,
|
|
151633
151662
|
options,
|
|
151634
151663
|
/*formatContext*/
|
|
151635
|
-
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
|
|
151636
151686
|
);
|
|
151637
151687
|
return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: completion.hasIndexSignature, optionalReplacementSpan, entries };
|
|
151638
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
|
@@ -50209,7 +50209,7 @@ ${lanes.join("\n")}
|
|
|
50209
50209
|
);
|
|
50210
50210
|
}
|
|
50211
50211
|
function signatureToSignatureDeclarationHelper(signature, kind, context, options) {
|
|
50212
|
-
var _a2, _b, _c, _d;
|
|
50212
|
+
var _a2, _b, _c, _d, _e;
|
|
50213
50213
|
const suppressAny = context.flags & 256 /* SuppressAnyReturnType */;
|
|
50214
50214
|
if (suppressAny)
|
|
50215
50215
|
context.flags &= ~256 /* SuppressAnyReturnType */;
|
|
@@ -50226,6 +50226,29 @@ ${lanes.join("\n")}
|
|
|
50226
50226
|
/*skipUnionExpanding*/
|
|
50227
50227
|
true
|
|
50228
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
|
+
}
|
|
50229
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));
|
|
50230
50253
|
const thisParameter = context.flags & 33554432 /* OmitThisParameter */ ? void 0 : tryGetThisParameterDeclaration(signature, context);
|
|
50231
50254
|
if (thisParameter) {
|
|
@@ -50251,11 +50274,11 @@ ${lanes.join("\n")}
|
|
|
50251
50274
|
const flags = modifiersToFlags(modifiers);
|
|
50252
50275
|
modifiers = factory.createModifiersFromModifierFlags(flags | 256 /* Abstract */);
|
|
50253
50276
|
}
|
|
50254
|
-
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(
|
|
50255
50278
|
modifiers,
|
|
50256
50279
|
/*asteriskToken*/
|
|
50257
50280
|
void 0,
|
|
50258
|
-
(
|
|
50281
|
+
(_c = options == null ? void 0 : options.name) != null ? _c : factory.createIdentifier(""),
|
|
50259
50282
|
/*questionToken*/
|
|
50260
50283
|
void 0,
|
|
50261
50284
|
typeParameters,
|
|
@@ -50270,14 +50293,14 @@ ${lanes.join("\n")}
|
|
|
50270
50293
|
void 0
|
|
50271
50294
|
) : kind === 174 /* GetAccessor */ ? factory.createGetAccessorDeclaration(
|
|
50272
50295
|
modifiers,
|
|
50273
|
-
(
|
|
50296
|
+
(_d = options == null ? void 0 : options.name) != null ? _d : factory.createIdentifier(""),
|
|
50274
50297
|
parameters,
|
|
50275
50298
|
returnTypeNode,
|
|
50276
50299
|
/*body*/
|
|
50277
50300
|
void 0
|
|
50278
50301
|
) : kind === 175 /* SetAccessor */ ? factory.createSetAccessorDeclaration(
|
|
50279
50302
|
modifiers,
|
|
50280
|
-
(
|
|
50303
|
+
(_e = options == null ? void 0 : options.name) != null ? _e : factory.createIdentifier(""),
|
|
50281
50304
|
parameters,
|
|
50282
50305
|
/*body*/
|
|
50283
50306
|
void 0
|
|
@@ -50312,6 +50335,7 @@ ${lanes.join("\n")}
|
|
|
50312
50335
|
if (typeArguments) {
|
|
50313
50336
|
node.typeArguments = factory.createNodeArray(typeArguments);
|
|
50314
50337
|
}
|
|
50338
|
+
restoreEnclosingDeclaration == null ? void 0 : restoreEnclosingDeclaration();
|
|
50315
50339
|
return node;
|
|
50316
50340
|
}
|
|
50317
50341
|
function tryGetThisParameterDeclaration(signature, context) {
|
|
@@ -50926,9 +50950,12 @@ ${lanes.join("\n")}
|
|
|
50926
50950
|
function existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type) {
|
|
50927
50951
|
return !(getObjectFlags(type) & 4 /* Reference */) || !isTypeReferenceNode(existing) || length(existing.typeArguments) >= getMinTypeArgumentCount(type.target.typeParameters);
|
|
50928
50952
|
}
|
|
50953
|
+
function getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration) {
|
|
50954
|
+
return findAncestor(enclosingDeclaration, (n) => !getNodeLinks(n).fakeScopeForSignatureDeclaration);
|
|
50955
|
+
}
|
|
50929
50956
|
function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled) {
|
|
50930
50957
|
if (!isErrorType(type) && enclosingDeclaration) {
|
|
50931
|
-
const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, enclosingDeclaration);
|
|
50958
|
+
const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
|
|
50932
50959
|
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
50933
50960
|
const existing = getEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
50934
50961
|
if (typeNodeIsEquivalentToType(existing, declWithExistingAnnotation, type) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
|
|
@@ -50960,7 +50987,8 @@ ${lanes.join("\n")}
|
|
|
50960
50987
|
function serializeReturnTypeForSignature(context, type, signature, includePrivateSymbol, bundled) {
|
|
50961
50988
|
if (!isErrorType(type) && context.enclosingDeclaration) {
|
|
50962
50989
|
const annotation = signature.declaration && getEffectiveReturnTypeNode(signature.declaration);
|
|
50963
|
-
|
|
50990
|
+
const enclosingDeclarationIgnoringFakeScope = getEnclosingDeclarationIgnoringFakeScope(context.enclosingDeclaration);
|
|
50991
|
+
if (!!findAncestor(annotation, (n) => n === enclosingDeclarationIgnoringFakeScope) && annotation) {
|
|
50964
50992
|
const annotated = getTypeFromTypeNode(annotation);
|
|
50965
50993
|
const thisInstantiated = annotated.flags & 262144 /* TypeParameter */ && annotated.isThisType ? instantiateType(annotated, signature.mapper) : annotated;
|
|
50966
50994
|
if (thisInstantiated === type && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(annotation, type)) {
|
|
@@ -65451,7 +65479,6 @@ ${lanes.join("\n")}
|
|
|
65451
65479
|
if (getObjectFlags(target) & 32 /* Mapped */ && !target.declaration.nameType) {
|
|
65452
65480
|
const constraintType = getConstraintTypeFromMappedType(target);
|
|
65453
65481
|
if (inferToMappedType(source, target, constraintType)) {
|
|
65454
|
-
inferFromMappedProperties(source, target);
|
|
65455
65482
|
return;
|
|
65456
65483
|
}
|
|
65457
65484
|
}
|
|
@@ -65552,19 +65579,6 @@ ${lanes.join("\n")}
|
|
|
65552
65579
|
}
|
|
65553
65580
|
}
|
|
65554
65581
|
}
|
|
65555
|
-
function inferFromMappedProperties(source, target) {
|
|
65556
|
-
const properties = getPropertiesOfObjectType(source);
|
|
65557
|
-
for (const sourceProp of properties) {
|
|
65558
|
-
if (!some(sourceProp.declarations, hasSkipDirectInferenceFlag)) {
|
|
65559
|
-
const sourcePropType = getTypeOfSymbol(sourceProp);
|
|
65560
|
-
if (!couldContainTypeVariables(sourcePropType)) {
|
|
65561
|
-
continue;
|
|
65562
|
-
}
|
|
65563
|
-
const targetPropType = substituteIndexedMappedType(target, getStringLiteralType(unescapeLeadingUnderscores(sourceProp.escapedName)));
|
|
65564
|
-
inferFromTypes(sourcePropType, targetPropType);
|
|
65565
|
-
}
|
|
65566
|
-
}
|
|
65567
|
-
}
|
|
65568
65582
|
function inferFromSignatures(source, target, kind) {
|
|
65569
65583
|
const sourceSignatures = getSignaturesOfType(source, kind);
|
|
65570
65584
|
const targetSignatures = getSignaturesOfType(target, kind);
|
|
@@ -90383,7 +90397,16 @@ ${lanes.join("\n")}
|
|
|
90383
90397
|
visitNode(node.initializer, (child) => namedEvaluationVisitor(child, referencedName), isExpression)
|
|
90384
90398
|
);
|
|
90385
90399
|
}
|
|
90386
|
-
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
|
+
);
|
|
90387
90410
|
}
|
|
90388
90411
|
function transformPublicFieldInitializer(node) {
|
|
90389
90412
|
if (shouldTransformInitializers && !isAutoAccessorPropertyDeclaration(node)) {
|
|
@@ -133213,7 +133236,8 @@ ${lanes.join("\n")}
|
|
|
133213
133236
|
options.triggerCharacter,
|
|
133214
133237
|
options.triggerKind,
|
|
133215
133238
|
cancellationToken,
|
|
133216
|
-
formattingSettings && ts_formatting_exports.getFormatContext(formattingSettings, host)
|
|
133239
|
+
formattingSettings && ts_formatting_exports.getFormatContext(formattingSettings, host),
|
|
133240
|
+
options.includeSymbol
|
|
133217
133241
|
);
|
|
133218
133242
|
}
|
|
133219
133243
|
function getCompletionEntryDetails2(fileName, position, name, formattingOptions, source, preferences = emptyOptions, data) {
|
|
@@ -147328,7 +147352,7 @@ ${lanes.join("\n")}
|
|
|
147328
147352
|
return result2 || (needsFullResolution ? "failed" : "skipped");
|
|
147329
147353
|
}
|
|
147330
147354
|
}
|
|
147331
|
-
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) {
|
|
147332
147356
|
var _a2;
|
|
147333
147357
|
const { previousToken } = getRelevantTokens(position, sourceFile);
|
|
147334
147358
|
if (triggerCharacter && !isInString(sourceFile, position, previousToken) && !isValidTrigger(sourceFile, triggerCharacter, previousToken, position)) {
|
|
@@ -147350,7 +147374,7 @@ ${lanes.join("\n")}
|
|
|
147350
147374
|
} else {
|
|
147351
147375
|
incompleteCompletionsCache == null ? void 0 : incompleteCompletionsCache.clear();
|
|
147352
147376
|
}
|
|
147353
|
-
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);
|
|
147354
147378
|
if (stringCompletions) {
|
|
147355
147379
|
return stringCompletions;
|
|
147356
147380
|
}
|
|
@@ -147375,7 +147399,7 @@ ${lanes.join("\n")}
|
|
|
147375
147399
|
}
|
|
147376
147400
|
switch (completionData.kind) {
|
|
147377
147401
|
case 0 /* Data */:
|
|
147378
|
-
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);
|
|
147379
147403
|
if (response == null ? void 0 : response.isIncomplete) {
|
|
147380
147404
|
incompleteCompletionsCache == null ? void 0 : incompleteCompletionsCache.set(response);
|
|
147381
147405
|
}
|
|
@@ -147505,7 +147529,7 @@ ${lanes.join("\n")}
|
|
|
147505
147529
|
function getOptionalReplacementSpan(location) {
|
|
147506
147530
|
return (location == null ? void 0 : location.kind) === 79 /* Identifier */ ? createTextSpanFromNode(location) : void 0;
|
|
147507
147531
|
}
|
|
147508
|
-
function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position) {
|
|
147532
|
+
function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position, includeSymbol) {
|
|
147509
147533
|
const {
|
|
147510
147534
|
symbols,
|
|
147511
147535
|
contextToken,
|
|
@@ -147579,7 +147603,8 @@ ${lanes.join("\n")}
|
|
|
147579
147603
|
symbolToOriginInfoMap,
|
|
147580
147604
|
symbolToSortTextMap,
|
|
147581
147605
|
isJsxIdentifierExpected,
|
|
147582
|
-
isRightOfOpenTag
|
|
147606
|
+
isRightOfOpenTag,
|
|
147607
|
+
includeSymbol
|
|
147583
147608
|
);
|
|
147584
147609
|
if (keywordFilters !== 0 /* None */) {
|
|
147585
147610
|
for (const keywordEntry of getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && isSourceFileJS(sourceFile))) {
|
|
@@ -147828,7 +147853,7 @@ ${lanes.join("\n")}
|
|
|
147828
147853
|
function createCompletionEntryForLiteral(sourceFile, preferences, literal) {
|
|
147829
147854
|
return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* string */, kindModifiers: "" /* none */, sortText: SortText.LocationPriority };
|
|
147830
147855
|
}
|
|
147831
|
-
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) {
|
|
147832
147857
|
let insertText;
|
|
147833
147858
|
let replacementSpan = getReplacementSpanForContextToken(replacementToken);
|
|
147834
147859
|
let data;
|
|
@@ -147872,7 +147897,9 @@ ${lanes.join("\n")}
|
|
|
147872
147897
|
}
|
|
147873
147898
|
awaitText += `(await ${propertyAccessToConvert.expression.getText()})`;
|
|
147874
147899
|
insertText = needsConvertPropertyAccess ? `${awaitText}${insertText}` : `${awaitText}${insertQuestionDot ? "?." : "."}${insertText}`;
|
|
147875
|
-
|
|
147900
|
+
const isInAwaitExpression = tryCast(propertyAccessToConvert.parent, isAwaitExpression);
|
|
147901
|
+
const wrapNode = isInAwaitExpression ? propertyAccessToConvert.parent : propertyAccessToConvert.expression;
|
|
147902
|
+
replacementSpan = createTextSpanFromBounds(wrapNode.getStart(sourceFile), propertyAccessToConvert.end);
|
|
147876
147903
|
}
|
|
147877
147904
|
if (originIsResolvedExport(origin)) {
|
|
147878
147905
|
sourceDisplay = [textPart(origin.moduleSpecifier)];
|
|
@@ -147940,7 +147967,8 @@ ${lanes.join("\n")}
|
|
|
147940
147967
|
isSnippet,
|
|
147941
147968
|
isPackageJsonImport: originIsPackageJsonImport(origin) || void 0,
|
|
147942
147969
|
isImportStatementCompletion: !!importStatementCompletion || void 0,
|
|
147943
|
-
data
|
|
147970
|
+
data,
|
|
147971
|
+
...includeSymbol ? { symbol } : void 0
|
|
147944
147972
|
};
|
|
147945
147973
|
}
|
|
147946
147974
|
function isClassLikeMemberCompletion(symbol, location, sourceFile) {
|
|
@@ -148410,7 +148438,7 @@ ${lanes.join("\n")}
|
|
|
148410
148438
|
return "TypeOnlyAlias/" /* TypeOnlyAlias */;
|
|
148411
148439
|
}
|
|
148412
148440
|
}
|
|
148413
|
-
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) {
|
|
148414
148442
|
var _a2;
|
|
148415
148443
|
const start = timestamp();
|
|
148416
148444
|
const variableDeclaration = getVariableDeclaration(location);
|
|
@@ -148450,7 +148478,8 @@ ${lanes.join("\n")}
|
|
|
148450
148478
|
kind,
|
|
148451
148479
|
formatContext,
|
|
148452
148480
|
isJsxIdentifierExpected,
|
|
148453
|
-
isRightOfOpenTag
|
|
148481
|
+
isRightOfOpenTag,
|
|
148482
|
+
includeSymbol
|
|
148454
148483
|
);
|
|
148455
148484
|
if (!entry) {
|
|
148456
148485
|
continue;
|
|
@@ -150691,7 +150720,7 @@ ${lanes.join("\n")}
|
|
|
150691
150720
|
values: map2.values.bind(map2)
|
|
150692
150721
|
};
|
|
150693
150722
|
}
|
|
150694
|
-
function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program, log, preferences) {
|
|
150723
|
+
function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program, log, preferences, includeSymbol) {
|
|
150695
150724
|
if (isInReferenceComment(sourceFile, position)) {
|
|
150696
150725
|
const entries = getTripleSlashReferenceCompletion(sourceFile, position, options, host);
|
|
150697
150726
|
return entries && convertPathCompletions(entries);
|
|
@@ -150700,10 +150729,10 @@ ${lanes.join("\n")}
|
|
|
150700
150729
|
if (!contextToken || !isStringLiteralLike(contextToken))
|
|
150701
150730
|
return void 0;
|
|
150702
150731
|
const entries = getStringLiteralCompletionEntries(sourceFile, contextToken, position, program.getTypeChecker(), options, host, preferences);
|
|
150703
|
-
return convertStringLiteralCompletions(entries, contextToken, sourceFile, host, program, log, options, preferences, position);
|
|
150732
|
+
return convertStringLiteralCompletions(entries, contextToken, sourceFile, host, program, log, options, preferences, position, includeSymbol);
|
|
150704
150733
|
}
|
|
150705
150734
|
}
|
|
150706
|
-
function convertStringLiteralCompletions(completion, contextToken, sourceFile, host, program, log, options, preferences, position) {
|
|
150735
|
+
function convertStringLiteralCompletions(completion, contextToken, sourceFile, host, program, log, options, preferences, position, includeSymbol) {
|
|
150707
150736
|
if (completion === void 0) {
|
|
150708
150737
|
return void 0;
|
|
150709
150738
|
}
|
|
@@ -150729,7 +150758,28 @@ ${lanes.join("\n")}
|
|
|
150729
150758
|
preferences,
|
|
150730
150759
|
options,
|
|
150731
150760
|
/*formatContext*/
|
|
150732
|
-
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
|
|
150733
150783
|
);
|
|
150734
150784
|
return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: completion.hasIndexSignature, optionalReplacementSpan, entries };
|
|
150735
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
|
@@ -50209,7 +50209,7 @@ ${lanes.join("\n")}
|
|
|
50209
50209
|
);
|
|
50210
50210
|
}
|
|
50211
50211
|
function signatureToSignatureDeclarationHelper(signature, kind, context, options) {
|
|
50212
|
-
var _a2, _b, _c, _d;
|
|
50212
|
+
var _a2, _b, _c, _d, _e;
|
|
50213
50213
|
const suppressAny = context.flags & 256 /* SuppressAnyReturnType */;
|
|
50214
50214
|
if (suppressAny)
|
|
50215
50215
|
context.flags &= ~256 /* SuppressAnyReturnType */;
|
|
@@ -50226,6 +50226,29 @@ ${lanes.join("\n")}
|
|
|
50226
50226
|
/*skipUnionExpanding*/
|
|
50227
50227
|
true
|
|
50228
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
|
+
}
|
|
50229
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));
|
|
50230
50253
|
const thisParameter = context.flags & 33554432 /* OmitThisParameter */ ? void 0 : tryGetThisParameterDeclaration(signature, context);
|
|
50231
50254
|
if (thisParameter) {
|
|
@@ -50251,11 +50274,11 @@ ${lanes.join("\n")}
|
|
|
50251
50274
|
const flags = modifiersToFlags(modifiers);
|
|
50252
50275
|
modifiers = factory.createModifiersFromModifierFlags(flags | 256 /* Abstract */);
|
|
50253
50276
|
}
|
|
50254
|
-
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(
|
|
50255
50278
|
modifiers,
|
|
50256
50279
|
/*asteriskToken*/
|
|
50257
50280
|
void 0,
|
|
50258
|
-
(
|
|
50281
|
+
(_c = options == null ? void 0 : options.name) != null ? _c : factory.createIdentifier(""),
|
|
50259
50282
|
/*questionToken*/
|
|
50260
50283
|
void 0,
|
|
50261
50284
|
typeParameters,
|
|
@@ -50270,14 +50293,14 @@ ${lanes.join("\n")}
|
|
|
50270
50293
|
void 0
|
|
50271
50294
|
) : kind === 174 /* GetAccessor */ ? factory.createGetAccessorDeclaration(
|
|
50272
50295
|
modifiers,
|
|
50273
|
-
(
|
|
50296
|
+
(_d = options == null ? void 0 : options.name) != null ? _d : factory.createIdentifier(""),
|
|
50274
50297
|
parameters,
|
|
50275
50298
|
returnTypeNode,
|
|
50276
50299
|
/*body*/
|
|
50277
50300
|
void 0
|
|
50278
50301
|
) : kind === 175 /* SetAccessor */ ? factory.createSetAccessorDeclaration(
|
|
50279
50302
|
modifiers,
|
|
50280
|
-
(
|
|
50303
|
+
(_e = options == null ? void 0 : options.name) != null ? _e : factory.createIdentifier(""),
|
|
50281
50304
|
parameters,
|
|
50282
50305
|
/*body*/
|
|
50283
50306
|
void 0
|
|
@@ -50312,6 +50335,7 @@ ${lanes.join("\n")}
|
|
|
50312
50335
|
if (typeArguments) {
|
|
50313
50336
|
node.typeArguments = factory.createNodeArray(typeArguments);
|
|
50314
50337
|
}
|
|
50338
|
+
restoreEnclosingDeclaration == null ? void 0 : restoreEnclosingDeclaration();
|
|
50315
50339
|
return node;
|
|
50316
50340
|
}
|
|
50317
50341
|
function tryGetThisParameterDeclaration(signature, context) {
|
|
@@ -50926,9 +50950,12 @@ ${lanes.join("\n")}
|
|
|
50926
50950
|
function existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type) {
|
|
50927
50951
|
return !(getObjectFlags(type) & 4 /* Reference */) || !isTypeReferenceNode(existing) || length(existing.typeArguments) >= getMinTypeArgumentCount(type.target.typeParameters);
|
|
50928
50952
|
}
|
|
50953
|
+
function getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration) {
|
|
50954
|
+
return findAncestor(enclosingDeclaration, (n) => !getNodeLinks(n).fakeScopeForSignatureDeclaration);
|
|
50955
|
+
}
|
|
50929
50956
|
function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled) {
|
|
50930
50957
|
if (!isErrorType(type) && enclosingDeclaration) {
|
|
50931
|
-
const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, enclosingDeclaration);
|
|
50958
|
+
const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
|
|
50932
50959
|
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
50933
50960
|
const existing = getEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
50934
50961
|
if (typeNodeIsEquivalentToType(existing, declWithExistingAnnotation, type) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
|
|
@@ -50960,7 +50987,8 @@ ${lanes.join("\n")}
|
|
|
50960
50987
|
function serializeReturnTypeForSignature(context, type, signature, includePrivateSymbol, bundled) {
|
|
50961
50988
|
if (!isErrorType(type) && context.enclosingDeclaration) {
|
|
50962
50989
|
const annotation = signature.declaration && getEffectiveReturnTypeNode(signature.declaration);
|
|
50963
|
-
|
|
50990
|
+
const enclosingDeclarationIgnoringFakeScope = getEnclosingDeclarationIgnoringFakeScope(context.enclosingDeclaration);
|
|
50991
|
+
if (!!findAncestor(annotation, (n) => n === enclosingDeclarationIgnoringFakeScope) && annotation) {
|
|
50964
50992
|
const annotated = getTypeFromTypeNode(annotation);
|
|
50965
50993
|
const thisInstantiated = annotated.flags & 262144 /* TypeParameter */ && annotated.isThisType ? instantiateType(annotated, signature.mapper) : annotated;
|
|
50966
50994
|
if (thisInstantiated === type && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(annotation, type)) {
|
|
@@ -65451,7 +65479,6 @@ ${lanes.join("\n")}
|
|
|
65451
65479
|
if (getObjectFlags(target) & 32 /* Mapped */ && !target.declaration.nameType) {
|
|
65452
65480
|
const constraintType = getConstraintTypeFromMappedType(target);
|
|
65453
65481
|
if (inferToMappedType(source, target, constraintType)) {
|
|
65454
|
-
inferFromMappedProperties(source, target);
|
|
65455
65482
|
return;
|
|
65456
65483
|
}
|
|
65457
65484
|
}
|
|
@@ -65552,19 +65579,6 @@ ${lanes.join("\n")}
|
|
|
65552
65579
|
}
|
|
65553
65580
|
}
|
|
65554
65581
|
}
|
|
65555
|
-
function inferFromMappedProperties(source, target) {
|
|
65556
|
-
const properties = getPropertiesOfObjectType(source);
|
|
65557
|
-
for (const sourceProp of properties) {
|
|
65558
|
-
if (!some(sourceProp.declarations, hasSkipDirectInferenceFlag)) {
|
|
65559
|
-
const sourcePropType = getTypeOfSymbol(sourceProp);
|
|
65560
|
-
if (!couldContainTypeVariables(sourcePropType)) {
|
|
65561
|
-
continue;
|
|
65562
|
-
}
|
|
65563
|
-
const targetPropType = substituteIndexedMappedType(target, getStringLiteralType(unescapeLeadingUnderscores(sourceProp.escapedName)));
|
|
65564
|
-
inferFromTypes(sourcePropType, targetPropType);
|
|
65565
|
-
}
|
|
65566
|
-
}
|
|
65567
|
-
}
|
|
65568
65582
|
function inferFromSignatures(source, target, kind) {
|
|
65569
65583
|
const sourceSignatures = getSignaturesOfType(source, kind);
|
|
65570
65584
|
const targetSignatures = getSignaturesOfType(target, kind);
|
|
@@ -90383,7 +90397,16 @@ ${lanes.join("\n")}
|
|
|
90383
90397
|
visitNode(node.initializer, (child) => namedEvaluationVisitor(child, referencedName), isExpression)
|
|
90384
90398
|
);
|
|
90385
90399
|
}
|
|
90386
|
-
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
|
+
);
|
|
90387
90410
|
}
|
|
90388
90411
|
function transformPublicFieldInitializer(node) {
|
|
90389
90412
|
if (shouldTransformInitializers && !isAutoAccessorPropertyDeclaration(node)) {
|
|
@@ -133227,7 +133250,8 @@ ${lanes.join("\n")}
|
|
|
133227
133250
|
options.triggerCharacter,
|
|
133228
133251
|
options.triggerKind,
|
|
133229
133252
|
cancellationToken,
|
|
133230
|
-
formattingSettings && ts_formatting_exports.getFormatContext(formattingSettings, host)
|
|
133253
|
+
formattingSettings && ts_formatting_exports.getFormatContext(formattingSettings, host),
|
|
133254
|
+
options.includeSymbol
|
|
133231
133255
|
);
|
|
133232
133256
|
}
|
|
133233
133257
|
function getCompletionEntryDetails2(fileName, position, name, formattingOptions, source, preferences = emptyOptions, data) {
|
|
@@ -147342,7 +147366,7 @@ ${lanes.join("\n")}
|
|
|
147342
147366
|
return result2 || (needsFullResolution ? "failed" : "skipped");
|
|
147343
147367
|
}
|
|
147344
147368
|
}
|
|
147345
|
-
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) {
|
|
147346
147370
|
var _a2;
|
|
147347
147371
|
const { previousToken } = getRelevantTokens(position, sourceFile);
|
|
147348
147372
|
if (triggerCharacter && !isInString(sourceFile, position, previousToken) && !isValidTrigger(sourceFile, triggerCharacter, previousToken, position)) {
|
|
@@ -147364,7 +147388,7 @@ ${lanes.join("\n")}
|
|
|
147364
147388
|
} else {
|
|
147365
147389
|
incompleteCompletionsCache == null ? void 0 : incompleteCompletionsCache.clear();
|
|
147366
147390
|
}
|
|
147367
|
-
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);
|
|
147368
147392
|
if (stringCompletions) {
|
|
147369
147393
|
return stringCompletions;
|
|
147370
147394
|
}
|
|
@@ -147389,7 +147413,7 @@ ${lanes.join("\n")}
|
|
|
147389
147413
|
}
|
|
147390
147414
|
switch (completionData.kind) {
|
|
147391
147415
|
case 0 /* Data */:
|
|
147392
|
-
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);
|
|
147393
147417
|
if (response == null ? void 0 : response.isIncomplete) {
|
|
147394
147418
|
incompleteCompletionsCache == null ? void 0 : incompleteCompletionsCache.set(response);
|
|
147395
147419
|
}
|
|
@@ -147519,7 +147543,7 @@ ${lanes.join("\n")}
|
|
|
147519
147543
|
function getOptionalReplacementSpan(location) {
|
|
147520
147544
|
return (location == null ? void 0 : location.kind) === 79 /* Identifier */ ? createTextSpanFromNode(location) : void 0;
|
|
147521
147545
|
}
|
|
147522
|
-
function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position) {
|
|
147546
|
+
function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position, includeSymbol) {
|
|
147523
147547
|
const {
|
|
147524
147548
|
symbols,
|
|
147525
147549
|
contextToken,
|
|
@@ -147593,7 +147617,8 @@ ${lanes.join("\n")}
|
|
|
147593
147617
|
symbolToOriginInfoMap,
|
|
147594
147618
|
symbolToSortTextMap,
|
|
147595
147619
|
isJsxIdentifierExpected,
|
|
147596
|
-
isRightOfOpenTag
|
|
147620
|
+
isRightOfOpenTag,
|
|
147621
|
+
includeSymbol
|
|
147597
147622
|
);
|
|
147598
147623
|
if (keywordFilters !== 0 /* None */) {
|
|
147599
147624
|
for (const keywordEntry of getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && isSourceFileJS(sourceFile))) {
|
|
@@ -147842,7 +147867,7 @@ ${lanes.join("\n")}
|
|
|
147842
147867
|
function createCompletionEntryForLiteral(sourceFile, preferences, literal) {
|
|
147843
147868
|
return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* string */, kindModifiers: "" /* none */, sortText: SortText.LocationPriority };
|
|
147844
147869
|
}
|
|
147845
|
-
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) {
|
|
147846
147871
|
let insertText;
|
|
147847
147872
|
let replacementSpan = getReplacementSpanForContextToken(replacementToken);
|
|
147848
147873
|
let data;
|
|
@@ -147886,7 +147911,9 @@ ${lanes.join("\n")}
|
|
|
147886
147911
|
}
|
|
147887
147912
|
awaitText += `(await ${propertyAccessToConvert.expression.getText()})`;
|
|
147888
147913
|
insertText = needsConvertPropertyAccess ? `${awaitText}${insertText}` : `${awaitText}${insertQuestionDot ? "?." : "."}${insertText}`;
|
|
147889
|
-
|
|
147914
|
+
const isInAwaitExpression = tryCast(propertyAccessToConvert.parent, isAwaitExpression);
|
|
147915
|
+
const wrapNode = isInAwaitExpression ? propertyAccessToConvert.parent : propertyAccessToConvert.expression;
|
|
147916
|
+
replacementSpan = createTextSpanFromBounds(wrapNode.getStart(sourceFile), propertyAccessToConvert.end);
|
|
147890
147917
|
}
|
|
147891
147918
|
if (originIsResolvedExport(origin)) {
|
|
147892
147919
|
sourceDisplay = [textPart(origin.moduleSpecifier)];
|
|
@@ -147954,7 +147981,8 @@ ${lanes.join("\n")}
|
|
|
147954
147981
|
isSnippet,
|
|
147955
147982
|
isPackageJsonImport: originIsPackageJsonImport(origin) || void 0,
|
|
147956
147983
|
isImportStatementCompletion: !!importStatementCompletion || void 0,
|
|
147957
|
-
data
|
|
147984
|
+
data,
|
|
147985
|
+
...includeSymbol ? { symbol } : void 0
|
|
147958
147986
|
};
|
|
147959
147987
|
}
|
|
147960
147988
|
function isClassLikeMemberCompletion(symbol, location, sourceFile) {
|
|
@@ -148424,7 +148452,7 @@ ${lanes.join("\n")}
|
|
|
148424
148452
|
return "TypeOnlyAlias/" /* TypeOnlyAlias */;
|
|
148425
148453
|
}
|
|
148426
148454
|
}
|
|
148427
|
-
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) {
|
|
148428
148456
|
var _a2;
|
|
148429
148457
|
const start = timestamp();
|
|
148430
148458
|
const variableDeclaration = getVariableDeclaration(location);
|
|
@@ -148464,7 +148492,8 @@ ${lanes.join("\n")}
|
|
|
148464
148492
|
kind,
|
|
148465
148493
|
formatContext,
|
|
148466
148494
|
isJsxIdentifierExpected,
|
|
148467
|
-
isRightOfOpenTag
|
|
148495
|
+
isRightOfOpenTag,
|
|
148496
|
+
includeSymbol
|
|
148468
148497
|
);
|
|
148469
148498
|
if (!entry) {
|
|
148470
148499
|
continue;
|
|
@@ -150705,7 +150734,7 @@ ${lanes.join("\n")}
|
|
|
150705
150734
|
values: map2.values.bind(map2)
|
|
150706
150735
|
};
|
|
150707
150736
|
}
|
|
150708
|
-
function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program, log, preferences) {
|
|
150737
|
+
function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program, log, preferences, includeSymbol) {
|
|
150709
150738
|
if (isInReferenceComment(sourceFile, position)) {
|
|
150710
150739
|
const entries = getTripleSlashReferenceCompletion(sourceFile, position, options, host);
|
|
150711
150740
|
return entries && convertPathCompletions(entries);
|
|
@@ -150714,10 +150743,10 @@ ${lanes.join("\n")}
|
|
|
150714
150743
|
if (!contextToken || !isStringLiteralLike(contextToken))
|
|
150715
150744
|
return void 0;
|
|
150716
150745
|
const entries = getStringLiteralCompletionEntries(sourceFile, contextToken, position, program.getTypeChecker(), options, host, preferences);
|
|
150717
|
-
return convertStringLiteralCompletions(entries, contextToken, sourceFile, host, program, log, options, preferences, position);
|
|
150746
|
+
return convertStringLiteralCompletions(entries, contextToken, sourceFile, host, program, log, options, preferences, position, includeSymbol);
|
|
150718
150747
|
}
|
|
150719
150748
|
}
|
|
150720
|
-
function convertStringLiteralCompletions(completion, contextToken, sourceFile, host, program, log, options, preferences, position) {
|
|
150749
|
+
function convertStringLiteralCompletions(completion, contextToken, sourceFile, host, program, log, options, preferences, position, includeSymbol) {
|
|
150721
150750
|
if (completion === void 0) {
|
|
150722
150751
|
return void 0;
|
|
150723
150752
|
}
|
|
@@ -150743,7 +150772,28 @@ ${lanes.join("\n")}
|
|
|
150743
150772
|
preferences,
|
|
150744
150773
|
options,
|
|
150745
150774
|
/*formatContext*/
|
|
150746
|
-
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
|
|
150747
150797
|
);
|
|
150748
150798
|
return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: completion.hasIndexSignature, optionalReplacementSpan, entries };
|
|
150749
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": [
|