typescript 5.0.0-dev.20230216 → 5.0.0-dev.20230217
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 +37 -11
- package/lib/tsserver.js +121 -28
- package/lib/tsserverlibrary.d.ts +13 -0
- package/lib/tsserverlibrary.js +120 -28
- package/lib/typescript.d.ts +13 -0
- package/lib/typescript.js +119 -28
- package/lib/typingsInstaller.js +2 -3
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -23,7 +23,7 @@ var __export = (target, all) => {
|
|
|
23
23
|
|
|
24
24
|
// src/compiler/corePublic.ts
|
|
25
25
|
var versionMajorMinor = "5.0";
|
|
26
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
26
|
+
var version = `${versionMajorMinor}.0-dev.20230217`;
|
|
27
27
|
|
|
28
28
|
// src/compiler/core.ts
|
|
29
29
|
var emptyArray = [];
|
|
@@ -24988,7 +24988,7 @@ function canHaveIllegalDecorators(node) {
|
|
|
24988
24988
|
}
|
|
24989
24989
|
function canHaveIllegalModifiers(node) {
|
|
24990
24990
|
const kind = node.kind;
|
|
24991
|
-
return kind === 172 /* ClassStaticBlockDeclaration */ || kind === 299 /* PropertyAssignment */ || kind === 300 /* ShorthandPropertyAssignment */ || kind ===
|
|
24991
|
+
return kind === 172 /* ClassStaticBlockDeclaration */ || kind === 299 /* PropertyAssignment */ || kind === 300 /* ShorthandPropertyAssignment */ || kind === 279 /* MissingDeclaration */ || kind === 267 /* NamespaceExportDeclaration */;
|
|
24992
24992
|
}
|
|
24993
24993
|
function isQuestionOrExclamationToken(node) {
|
|
24994
24994
|
return isQuestionToken(node) || isExclamationToken(node);
|
|
@@ -28280,6 +28280,7 @@ var Parser;
|
|
|
28280
28280
|
const hasJSDoc = hasPrecedingJSDocComment();
|
|
28281
28281
|
const modifiers = parseModifiersForConstructorType();
|
|
28282
28282
|
const isConstructorType = parseOptional(103 /* NewKeyword */);
|
|
28283
|
+
Debug.assert(!modifiers || isConstructorType, "Per isStartOfFunctionOrConstructorType, a function type cannot have modifiers.");
|
|
28283
28284
|
const typeParameters = parseTypeParameters();
|
|
28284
28285
|
const parameters = parseParameters(4 /* Type */);
|
|
28285
28286
|
const type = parseReturnType(
|
|
@@ -28288,8 +28289,6 @@ var Parser;
|
|
|
28288
28289
|
false
|
|
28289
28290
|
);
|
|
28290
28291
|
const node = isConstructorType ? factory2.createConstructorTypeNode(modifiers, typeParameters, parameters, type) : factory2.createFunctionTypeNode(typeParameters, parameters, type);
|
|
28291
|
-
if (!isConstructorType)
|
|
28292
|
-
node.modifiers = modifiers;
|
|
28293
28292
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
28294
28293
|
}
|
|
28295
28294
|
function parseKeywordAndNoDot() {
|
|
@@ -42585,6 +42584,7 @@ function createTypeChecker(host) {
|
|
|
42585
42584
|
let inlineLevel = 0;
|
|
42586
42585
|
let currentNode;
|
|
42587
42586
|
let varianceTypeParameter;
|
|
42587
|
+
let isInferencePartiallyBlocked = false;
|
|
42588
42588
|
const emptySymbols = createSymbolTable();
|
|
42589
42589
|
const arrayVariances = [1 /* Covariant */];
|
|
42590
42590
|
const compilerOptions = host.getCompilerOptions();
|
|
@@ -43016,7 +43016,9 @@ function createTypeChecker(host) {
|
|
|
43016
43016
|
toMarkSkip = toMarkSkip.parent;
|
|
43017
43017
|
} while (toMarkSkip && toMarkSkip !== containingCall);
|
|
43018
43018
|
}
|
|
43019
|
+
isInferencePartiallyBlocked = true;
|
|
43019
43020
|
const result = runWithoutResolvedSignatureCaching(node, fn);
|
|
43021
|
+
isInferencePartiallyBlocked = false;
|
|
43020
43022
|
if (containingCall) {
|
|
43021
43023
|
let toMarkSkip = node;
|
|
43022
43024
|
do {
|
|
@@ -53062,6 +53064,7 @@ function createTypeChecker(host) {
|
|
|
53062
53064
|
const typeParameter = getTypeParameterFromMappedType(type);
|
|
53063
53065
|
const constraintType = getConstraintTypeFromMappedType(type);
|
|
53064
53066
|
const nameType = getNameTypeFromMappedType(type.target || type);
|
|
53067
|
+
const isFilteringMappedType = nameType && isTypeAssignableTo(nameType, typeParameter);
|
|
53065
53068
|
const templateType = getTemplateTypeFromMappedType(type.target || type);
|
|
53066
53069
|
const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
|
|
53067
53070
|
const templateModifiers = getMappedTypeModifiers(type);
|
|
@@ -53099,7 +53102,7 @@ function createTypeChecker(host) {
|
|
|
53099
53102
|
prop.links.keyType = keyType;
|
|
53100
53103
|
if (modifiersProp) {
|
|
53101
53104
|
prop.links.syntheticOrigin = modifiersProp;
|
|
53102
|
-
prop.declarations = nameType
|
|
53105
|
+
prop.declarations = !nameType || isFilteringMappedType ? modifiersProp.declarations : void 0;
|
|
53103
53106
|
}
|
|
53104
53107
|
members.set(propName, prop);
|
|
53105
53108
|
}
|
|
@@ -61831,6 +61834,9 @@ function createTypeChecker(host) {
|
|
|
61831
61834
|
const key = `B${getTypeId(type)}`;
|
|
61832
61835
|
return (_a2 = getCachedType(key)) != null ? _a2 : setCachedType(key, mapType(type, getBaseTypeOfLiteralType));
|
|
61833
61836
|
}
|
|
61837
|
+
function getBaseTypeOfLiteralTypeForComparison(type) {
|
|
61838
|
+
return type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ? stringType : type.flags & (256 /* NumberLiteral */ | 32 /* Enum */) ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 512 /* BooleanLiteral */ ? booleanType : type.flags & 1048576 /* Union */ ? mapType(type, getBaseTypeOfLiteralTypeForComparison) : type;
|
|
61839
|
+
}
|
|
61834
61840
|
function getWidenedLiteralType(type) {
|
|
61835
61841
|
return type.flags & 1056 /* EnumLike */ && isFreshLiteralType(type) ? getBaseTypeOfEnumLikeType(type) : type.flags & 128 /* StringLiteral */ && isFreshLiteralType(type) ? stringType : type.flags & 256 /* NumberLiteral */ && isFreshLiteralType(type) ? numberType : type.flags & 2048 /* BigIntLiteral */ && isFreshLiteralType(type) ? bigintType : type.flags & 512 /* BooleanLiteral */ && isFreshLiteralType(type) ? booleanType : type.flags & 1048576 /* Union */ ? mapType(type, getWidenedLiteralType) : type;
|
|
61836
61842
|
}
|
|
@@ -69655,7 +69661,7 @@ function createTypeChecker(host) {
|
|
|
69655
69661
|
const isTaggedTemplate = node.kind === 212 /* TaggedTemplateExpression */;
|
|
69656
69662
|
const isDecorator2 = node.kind === 167 /* Decorator */;
|
|
69657
69663
|
const isJsxOpeningOrSelfClosingElement = isJsxOpeningLikeElement(node);
|
|
69658
|
-
const reportErrors2 = !candidatesOutArray;
|
|
69664
|
+
const reportErrors2 = !isInferencePartiallyBlocked && !candidatesOutArray;
|
|
69659
69665
|
let typeArguments;
|
|
69660
69666
|
if (!isDecorator2 && !isSuperCall(node)) {
|
|
69661
69667
|
typeArguments = node.typeArguments;
|
|
@@ -72896,8 +72902,8 @@ function createTypeChecker(host) {
|
|
|
72896
72902
|
case 32 /* LessThanEqualsToken */:
|
|
72897
72903
|
case 33 /* GreaterThanEqualsToken */:
|
|
72898
72904
|
if (checkForDisallowedESSymbolOperand(operator)) {
|
|
72899
|
-
leftType =
|
|
72900
|
-
rightType =
|
|
72905
|
+
leftType = getBaseTypeOfLiteralTypeForComparison(checkNonNullType(leftType, left));
|
|
72906
|
+
rightType = getBaseTypeOfLiteralTypeForComparison(checkNonNullType(rightType, right));
|
|
72901
72907
|
reportOperatorErrorUnless((left2, right2) => {
|
|
72902
72908
|
if (isTypeAny(left2) || isTypeAny(right2)) {
|
|
72903
72909
|
return true;
|
|
@@ -74733,6 +74739,17 @@ function createTypeChecker(host) {
|
|
|
74733
74739
|
lastSeenNonAmbientDeclaration = node;
|
|
74734
74740
|
}
|
|
74735
74741
|
}
|
|
74742
|
+
if (isInJSFile(current) && isFunctionLike(current) && current.jsDoc) {
|
|
74743
|
+
for (const node2 of current.jsDoc) {
|
|
74744
|
+
if (node2.tags) {
|
|
74745
|
+
for (const tag of node2.tags) {
|
|
74746
|
+
if (isJSDocOverloadTag(tag)) {
|
|
74747
|
+
hasOverloads = true;
|
|
74748
|
+
}
|
|
74749
|
+
}
|
|
74750
|
+
}
|
|
74751
|
+
}
|
|
74752
|
+
}
|
|
74736
74753
|
}
|
|
74737
74754
|
}
|
|
74738
74755
|
if (multipleConstructorImplementation) {
|
|
@@ -74770,8 +74787,9 @@ function createTypeChecker(host) {
|
|
|
74770
74787
|
const bodySignature = getSignatureFromDeclaration(bodyDeclaration);
|
|
74771
74788
|
for (const signature of signatures) {
|
|
74772
74789
|
if (!isImplementationCompatibleWithOverload(bodySignature, signature)) {
|
|
74790
|
+
const errorNode = signature.declaration && isJSDocSignature(signature.declaration) ? signature.declaration.parent.tagName : signature.declaration;
|
|
74773
74791
|
addRelatedInfo(
|
|
74774
|
-
error(
|
|
74792
|
+
error(errorNode, Diagnostics.This_overload_signature_is_not_compatible_with_its_implementation_signature),
|
|
74775
74793
|
createDiagnosticForNode(bodyDeclaration, Diagnostics.The_implementation_signature_is_declared_here)
|
|
74776
74794
|
);
|
|
74777
74795
|
break;
|
|
@@ -81387,7 +81405,6 @@ function createTypeChecker(host) {
|
|
|
81387
81405
|
case 299 /* PropertyAssignment */:
|
|
81388
81406
|
case 300 /* ShorthandPropertyAssignment */:
|
|
81389
81407
|
case 267 /* NamespaceExportDeclaration */:
|
|
81390
|
-
case 181 /* FunctionType */:
|
|
81391
81408
|
case 279 /* MissingDeclaration */:
|
|
81392
81409
|
return find(node.modifiers, isModifier);
|
|
81393
81410
|
default:
|
|
@@ -87634,7 +87651,16 @@ function transformClassFields(context) {
|
|
|
87634
87651
|
visitNode(node.initializer, (child) => namedEvaluationVisitor(child, referencedName), isExpression)
|
|
87635
87652
|
);
|
|
87636
87653
|
}
|
|
87637
|
-
return
|
|
87654
|
+
return factory2.updatePropertyDeclaration(
|
|
87655
|
+
node,
|
|
87656
|
+
visitNodes2(node.modifiers, modifierVisitor, isModifier),
|
|
87657
|
+
visitNode(node.name, propertyNameVisitor, isPropertyName),
|
|
87658
|
+
/*questionOrExclamationToken*/
|
|
87659
|
+
void 0,
|
|
87660
|
+
/*type*/
|
|
87661
|
+
void 0,
|
|
87662
|
+
visitNode(node.initializer, visitor, isExpression)
|
|
87663
|
+
);
|
|
87638
87664
|
}
|
|
87639
87665
|
function transformPublicFieldInitializer(node) {
|
|
87640
87666
|
if (shouldTransformInitializers && !isAutoAccessorPropertyDeclaration(node)) {
|
package/lib/tsserver.js
CHANGED
|
@@ -1351,6 +1351,7 @@ __export(server_exports, {
|
|
|
1351
1351
|
isGetOrSetAccessorDeclaration: () => isGetOrSetAccessorDeclaration,
|
|
1352
1352
|
isGlobalDeclaration: () => isGlobalDeclaration,
|
|
1353
1353
|
isGlobalScopeAugmentation: () => isGlobalScopeAugmentation,
|
|
1354
|
+
isGrammarError: () => isGrammarError,
|
|
1354
1355
|
isHeritageClause: () => isHeritageClause,
|
|
1355
1356
|
isHoistedFunction: () => isHoistedFunction,
|
|
1356
1357
|
isHoistedVariableStatement: () => isHoistedVariableStatement,
|
|
@@ -2287,7 +2288,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2287
2288
|
|
|
2288
2289
|
// src/compiler/corePublic.ts
|
|
2289
2290
|
var versionMajorMinor = "5.0";
|
|
2290
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2291
|
+
var version = `${versionMajorMinor}.0-dev.20230217`;
|
|
2291
2292
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2292
2293
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2293
2294
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -15193,6 +15194,36 @@ function nodeIsMissing(node) {
|
|
|
15193
15194
|
function nodeIsPresent(node) {
|
|
15194
15195
|
return !nodeIsMissing(node);
|
|
15195
15196
|
}
|
|
15197
|
+
function isGrammarError(parent2, child) {
|
|
15198
|
+
if (isTypeParameterDeclaration(parent2))
|
|
15199
|
+
return child === parent2.expression;
|
|
15200
|
+
if (isClassStaticBlockDeclaration(parent2))
|
|
15201
|
+
return child === parent2.modifiers;
|
|
15202
|
+
if (isPropertySignature(parent2))
|
|
15203
|
+
return child === parent2.initializer;
|
|
15204
|
+
if (isPropertyDeclaration(parent2))
|
|
15205
|
+
return child === parent2.questionToken && isAutoAccessorPropertyDeclaration(parent2);
|
|
15206
|
+
if (isPropertyAssignment(parent2))
|
|
15207
|
+
return child === parent2.modifiers || child === parent2.questionToken || child === parent2.exclamationToken || isGrammarErrorElement(parent2.modifiers, child, isModifierLike);
|
|
15208
|
+
if (isShorthandPropertyAssignment(parent2))
|
|
15209
|
+
return child === parent2.equalsToken || child === parent2.modifiers || child === parent2.questionToken || child === parent2.exclamationToken || isGrammarErrorElement(parent2.modifiers, child, isModifierLike);
|
|
15210
|
+
if (isMethodDeclaration(parent2))
|
|
15211
|
+
return child === parent2.exclamationToken;
|
|
15212
|
+
if (isConstructorDeclaration(parent2))
|
|
15213
|
+
return child === parent2.typeParameters || child === parent2.type || isGrammarErrorElement(parent2.typeParameters, child, isTypeParameterDeclaration);
|
|
15214
|
+
if (isGetAccessorDeclaration(parent2))
|
|
15215
|
+
return child === parent2.typeParameters || isGrammarErrorElement(parent2.typeParameters, child, isTypeParameterDeclaration);
|
|
15216
|
+
if (isSetAccessorDeclaration(parent2))
|
|
15217
|
+
return child === parent2.typeParameters || child === parent2.type || isGrammarErrorElement(parent2.typeParameters, child, isTypeParameterDeclaration);
|
|
15218
|
+
if (isNamespaceExportDeclaration(parent2))
|
|
15219
|
+
return child === parent2.modifiers || isGrammarErrorElement(parent2.modifiers, child, isModifierLike);
|
|
15220
|
+
return false;
|
|
15221
|
+
}
|
|
15222
|
+
function isGrammarErrorElement(nodeArray, child, isElement) {
|
|
15223
|
+
if (!nodeArray || isArray(child) || !isElement(child))
|
|
15224
|
+
return false;
|
|
15225
|
+
return contains(nodeArray, child);
|
|
15226
|
+
}
|
|
15196
15227
|
function insertStatementsAfterPrologue(to, from, isPrologueDirective2) {
|
|
15197
15228
|
if (from === void 0 || from.length === 0)
|
|
15198
15229
|
return to;
|
|
@@ -29280,7 +29311,7 @@ function canHaveIllegalDecorators(node) {
|
|
|
29280
29311
|
}
|
|
29281
29312
|
function canHaveIllegalModifiers(node) {
|
|
29282
29313
|
const kind = node.kind;
|
|
29283
|
-
return kind === 172 /* ClassStaticBlockDeclaration */ || kind === 299 /* PropertyAssignment */ || kind === 300 /* ShorthandPropertyAssignment */ || kind ===
|
|
29314
|
+
return kind === 172 /* ClassStaticBlockDeclaration */ || kind === 299 /* PropertyAssignment */ || kind === 300 /* ShorthandPropertyAssignment */ || kind === 279 /* MissingDeclaration */ || kind === 267 /* NamespaceExportDeclaration */;
|
|
29284
29315
|
}
|
|
29285
29316
|
function isQuestionOrExclamationToken(node) {
|
|
29286
29317
|
return isQuestionToken(node) || isExclamationToken(node);
|
|
@@ -32595,6 +32626,7 @@ var Parser;
|
|
|
32595
32626
|
const hasJSDoc = hasPrecedingJSDocComment();
|
|
32596
32627
|
const modifiers = parseModifiersForConstructorType();
|
|
32597
32628
|
const isConstructorType = parseOptional(103 /* NewKeyword */);
|
|
32629
|
+
Debug.assert(!modifiers || isConstructorType, "Per isStartOfFunctionOrConstructorType, a function type cannot have modifiers.");
|
|
32598
32630
|
const typeParameters = parseTypeParameters();
|
|
32599
32631
|
const parameters = parseParameters(4 /* Type */);
|
|
32600
32632
|
const type = parseReturnType(
|
|
@@ -32603,8 +32635,6 @@ var Parser;
|
|
|
32603
32635
|
false
|
|
32604
32636
|
);
|
|
32605
32637
|
const node = isConstructorType ? factory2.createConstructorTypeNode(modifiers, typeParameters, parameters, type) : factory2.createFunctionTypeNode(typeParameters, parameters, type);
|
|
32606
|
-
if (!isConstructorType)
|
|
32607
|
-
node.modifiers = modifiers;
|
|
32608
32638
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
32609
32639
|
}
|
|
32610
32640
|
function parseKeywordAndNoDot() {
|
|
@@ -47161,6 +47191,7 @@ function createTypeChecker(host) {
|
|
|
47161
47191
|
let inlineLevel = 0;
|
|
47162
47192
|
let currentNode;
|
|
47163
47193
|
let varianceTypeParameter;
|
|
47194
|
+
let isInferencePartiallyBlocked = false;
|
|
47164
47195
|
const emptySymbols = createSymbolTable();
|
|
47165
47196
|
const arrayVariances = [1 /* Covariant */];
|
|
47166
47197
|
const compilerOptions = host.getCompilerOptions();
|
|
@@ -47592,7 +47623,9 @@ function createTypeChecker(host) {
|
|
|
47592
47623
|
toMarkSkip = toMarkSkip.parent;
|
|
47593
47624
|
} while (toMarkSkip && toMarkSkip !== containingCall);
|
|
47594
47625
|
}
|
|
47626
|
+
isInferencePartiallyBlocked = true;
|
|
47595
47627
|
const result = runWithoutResolvedSignatureCaching(node, fn);
|
|
47628
|
+
isInferencePartiallyBlocked = false;
|
|
47596
47629
|
if (containingCall) {
|
|
47597
47630
|
let toMarkSkip = node;
|
|
47598
47631
|
do {
|
|
@@ -57638,6 +57671,7 @@ function createTypeChecker(host) {
|
|
|
57638
57671
|
const typeParameter = getTypeParameterFromMappedType(type);
|
|
57639
57672
|
const constraintType = getConstraintTypeFromMappedType(type);
|
|
57640
57673
|
const nameType = getNameTypeFromMappedType(type.target || type);
|
|
57674
|
+
const isFilteringMappedType = nameType && isTypeAssignableTo(nameType, typeParameter);
|
|
57641
57675
|
const templateType = getTemplateTypeFromMappedType(type.target || type);
|
|
57642
57676
|
const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
|
|
57643
57677
|
const templateModifiers = getMappedTypeModifiers(type);
|
|
@@ -57675,7 +57709,7 @@ function createTypeChecker(host) {
|
|
|
57675
57709
|
prop.links.keyType = keyType;
|
|
57676
57710
|
if (modifiersProp) {
|
|
57677
57711
|
prop.links.syntheticOrigin = modifiersProp;
|
|
57678
|
-
prop.declarations = nameType
|
|
57712
|
+
prop.declarations = !nameType || isFilteringMappedType ? modifiersProp.declarations : void 0;
|
|
57679
57713
|
}
|
|
57680
57714
|
members.set(propName, prop);
|
|
57681
57715
|
}
|
|
@@ -66407,6 +66441,9 @@ function createTypeChecker(host) {
|
|
|
66407
66441
|
const key = `B${getTypeId(type)}`;
|
|
66408
66442
|
return (_a2 = getCachedType(key)) != null ? _a2 : setCachedType(key, mapType(type, getBaseTypeOfLiteralType));
|
|
66409
66443
|
}
|
|
66444
|
+
function getBaseTypeOfLiteralTypeForComparison(type) {
|
|
66445
|
+
return type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ? stringType : type.flags & (256 /* NumberLiteral */ | 32 /* Enum */) ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 512 /* BooleanLiteral */ ? booleanType : type.flags & 1048576 /* Union */ ? mapType(type, getBaseTypeOfLiteralTypeForComparison) : type;
|
|
66446
|
+
}
|
|
66410
66447
|
function getWidenedLiteralType(type) {
|
|
66411
66448
|
return type.flags & 1056 /* EnumLike */ && isFreshLiteralType(type) ? getBaseTypeOfEnumLikeType(type) : type.flags & 128 /* StringLiteral */ && isFreshLiteralType(type) ? stringType : type.flags & 256 /* NumberLiteral */ && isFreshLiteralType(type) ? numberType : type.flags & 2048 /* BigIntLiteral */ && isFreshLiteralType(type) ? bigintType : type.flags & 512 /* BooleanLiteral */ && isFreshLiteralType(type) ? booleanType : type.flags & 1048576 /* Union */ ? mapType(type, getWidenedLiteralType) : type;
|
|
66412
66449
|
}
|
|
@@ -74231,7 +74268,7 @@ function createTypeChecker(host) {
|
|
|
74231
74268
|
const isTaggedTemplate = node.kind === 212 /* TaggedTemplateExpression */;
|
|
74232
74269
|
const isDecorator2 = node.kind === 167 /* Decorator */;
|
|
74233
74270
|
const isJsxOpeningOrSelfClosingElement = isJsxOpeningLikeElement(node);
|
|
74234
|
-
const reportErrors2 = !candidatesOutArray;
|
|
74271
|
+
const reportErrors2 = !isInferencePartiallyBlocked && !candidatesOutArray;
|
|
74235
74272
|
let typeArguments;
|
|
74236
74273
|
if (!isDecorator2 && !isSuperCall(node)) {
|
|
74237
74274
|
typeArguments = node.typeArguments;
|
|
@@ -77472,8 +77509,8 @@ function createTypeChecker(host) {
|
|
|
77472
77509
|
case 32 /* LessThanEqualsToken */:
|
|
77473
77510
|
case 33 /* GreaterThanEqualsToken */:
|
|
77474
77511
|
if (checkForDisallowedESSymbolOperand(operator)) {
|
|
77475
|
-
leftType =
|
|
77476
|
-
rightType =
|
|
77512
|
+
leftType = getBaseTypeOfLiteralTypeForComparison(checkNonNullType(leftType, left));
|
|
77513
|
+
rightType = getBaseTypeOfLiteralTypeForComparison(checkNonNullType(rightType, right));
|
|
77477
77514
|
reportOperatorErrorUnless((left2, right2) => {
|
|
77478
77515
|
if (isTypeAny(left2) || isTypeAny(right2)) {
|
|
77479
77516
|
return true;
|
|
@@ -79309,6 +79346,17 @@ function createTypeChecker(host) {
|
|
|
79309
79346
|
lastSeenNonAmbientDeclaration = node;
|
|
79310
79347
|
}
|
|
79311
79348
|
}
|
|
79349
|
+
if (isInJSFile(current) && isFunctionLike(current) && current.jsDoc) {
|
|
79350
|
+
for (const node2 of current.jsDoc) {
|
|
79351
|
+
if (node2.tags) {
|
|
79352
|
+
for (const tag of node2.tags) {
|
|
79353
|
+
if (isJSDocOverloadTag(tag)) {
|
|
79354
|
+
hasOverloads = true;
|
|
79355
|
+
}
|
|
79356
|
+
}
|
|
79357
|
+
}
|
|
79358
|
+
}
|
|
79359
|
+
}
|
|
79312
79360
|
}
|
|
79313
79361
|
}
|
|
79314
79362
|
if (multipleConstructorImplementation) {
|
|
@@ -79346,8 +79394,9 @@ function createTypeChecker(host) {
|
|
|
79346
79394
|
const bodySignature = getSignatureFromDeclaration(bodyDeclaration);
|
|
79347
79395
|
for (const signature of signatures) {
|
|
79348
79396
|
if (!isImplementationCompatibleWithOverload(bodySignature, signature)) {
|
|
79397
|
+
const errorNode = signature.declaration && isJSDocSignature(signature.declaration) ? signature.declaration.parent.tagName : signature.declaration;
|
|
79349
79398
|
addRelatedInfo(
|
|
79350
|
-
error(
|
|
79399
|
+
error(errorNode, Diagnostics.This_overload_signature_is_not_compatible_with_its_implementation_signature),
|
|
79351
79400
|
createDiagnosticForNode(bodyDeclaration, Diagnostics.The_implementation_signature_is_declared_here)
|
|
79352
79401
|
);
|
|
79353
79402
|
break;
|
|
@@ -85963,7 +86012,6 @@ function createTypeChecker(host) {
|
|
|
85963
86012
|
case 299 /* PropertyAssignment */:
|
|
85964
86013
|
case 300 /* ShorthandPropertyAssignment */:
|
|
85965
86014
|
case 267 /* NamespaceExportDeclaration */:
|
|
85966
|
-
case 181 /* FunctionType */:
|
|
85967
86015
|
case 279 /* MissingDeclaration */:
|
|
85968
86016
|
return find(node.modifiers, isModifier);
|
|
85969
86017
|
default:
|
|
@@ -92381,7 +92429,16 @@ function transformClassFields(context) {
|
|
|
92381
92429
|
visitNode(node.initializer, (child) => namedEvaluationVisitor(child, referencedName), isExpression)
|
|
92382
92430
|
);
|
|
92383
92431
|
}
|
|
92384
|
-
return
|
|
92432
|
+
return factory2.updatePropertyDeclaration(
|
|
92433
|
+
node,
|
|
92434
|
+
visitNodes2(node.modifiers, modifierVisitor, isModifier),
|
|
92435
|
+
visitNode(node.name, propertyNameVisitor, isPropertyName),
|
|
92436
|
+
/*questionOrExclamationToken*/
|
|
92437
|
+
void 0,
|
|
92438
|
+
/*type*/
|
|
92439
|
+
void 0,
|
|
92440
|
+
visitNode(node.initializer, visitor, isExpression)
|
|
92441
|
+
);
|
|
92385
92442
|
}
|
|
92386
92443
|
function transformPublicFieldInitializer(node) {
|
|
92387
92444
|
if (shouldTransformInitializers && !isAutoAccessorPropertyDeclaration(node)) {
|
|
@@ -135428,7 +135485,8 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
|
135428
135485
|
options.triggerCharacter,
|
|
135429
135486
|
options.triggerKind,
|
|
135430
135487
|
cancellationToken,
|
|
135431
|
-
formattingSettings && ts_formatting_exports.getFormatContext(formattingSettings, host)
|
|
135488
|
+
formattingSettings && ts_formatting_exports.getFormatContext(formattingSettings, host),
|
|
135489
|
+
options.includeSymbol
|
|
135432
135490
|
);
|
|
135433
135491
|
}
|
|
135434
135492
|
function getCompletionEntryDetails2(fileName, position, name, formattingOptions, source, preferences = emptyOptions, data) {
|
|
@@ -147236,7 +147294,14 @@ function updatePropertyDeclaration(changeTracker, file, declaration, type, field
|
|
|
147236
147294
|
changeTracker.replaceNode(file, declaration, property);
|
|
147237
147295
|
}
|
|
147238
147296
|
function updatePropertyAssignmentDeclaration(changeTracker, file, declaration, fieldName) {
|
|
147239
|
-
|
|
147297
|
+
let assignment = factory.updatePropertyAssignment(declaration, fieldName, declaration.initializer);
|
|
147298
|
+
if (assignment.modifiers || assignment.questionToken || assignment.exclamationToken) {
|
|
147299
|
+
if (assignment === declaration)
|
|
147300
|
+
assignment = factory.cloneNode(assignment);
|
|
147301
|
+
assignment.modifiers = void 0;
|
|
147302
|
+
assignment.questionToken = void 0;
|
|
147303
|
+
assignment.exclamationToken = void 0;
|
|
147304
|
+
}
|
|
147240
147305
|
changeTracker.replacePropertyAssignment(file, declaration, assignment);
|
|
147241
147306
|
}
|
|
147242
147307
|
function updateFieldDeclaration(changeTracker, file, declaration, type, fieldName, modifiers) {
|
|
@@ -148256,7 +148321,7 @@ function resolvingModuleSpecifiers(logPrefix, host, resolver, program, position,
|
|
|
148256
148321
|
return result2 || (needsFullResolution ? "failed" : "skipped");
|
|
148257
148322
|
}
|
|
148258
148323
|
}
|
|
148259
|
-
function getCompletionsAtPosition(host, program, log, sourceFile, position, preferences, triggerCharacter, completionKind, cancellationToken, formatContext) {
|
|
148324
|
+
function getCompletionsAtPosition(host, program, log, sourceFile, position, preferences, triggerCharacter, completionKind, cancellationToken, formatContext, includeSymbol = false) {
|
|
148260
148325
|
var _a2;
|
|
148261
148326
|
const { previousToken } = getRelevantTokens(position, sourceFile);
|
|
148262
148327
|
if (triggerCharacter && !isInString(sourceFile, position, previousToken) && !isValidTrigger(sourceFile, triggerCharacter, previousToken, position)) {
|
|
@@ -148278,7 +148343,7 @@ function getCompletionsAtPosition(host, program, log, sourceFile, position, pref
|
|
|
148278
148343
|
} else {
|
|
148279
148344
|
incompleteCompletionsCache == null ? void 0 : incompleteCompletionsCache.clear();
|
|
148280
148345
|
}
|
|
148281
|
-
const stringCompletions = ts_Completions_StringCompletions_exports.getStringLiteralCompletions(sourceFile, position, previousToken, compilerOptions, host, program, log, preferences);
|
|
148346
|
+
const stringCompletions = ts_Completions_StringCompletions_exports.getStringLiteralCompletions(sourceFile, position, previousToken, compilerOptions, host, program, log, preferences, includeSymbol);
|
|
148282
148347
|
if (stringCompletions) {
|
|
148283
148348
|
return stringCompletions;
|
|
148284
148349
|
}
|
|
@@ -148303,7 +148368,7 @@ function getCompletionsAtPosition(host, program, log, sourceFile, position, pref
|
|
|
148303
148368
|
}
|
|
148304
148369
|
switch (completionData.kind) {
|
|
148305
148370
|
case 0 /* Data */:
|
|
148306
|
-
const response = completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position);
|
|
148371
|
+
const response = completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position, includeSymbol);
|
|
148307
148372
|
if (response == null ? void 0 : response.isIncomplete) {
|
|
148308
148373
|
incompleteCompletionsCache == null ? void 0 : incompleteCompletionsCache.set(response);
|
|
148309
148374
|
}
|
|
@@ -148433,7 +148498,7 @@ function keywordFiltersFromSyntaxKind(keywordCompletion) {
|
|
|
148433
148498
|
function getOptionalReplacementSpan(location) {
|
|
148434
148499
|
return (location == null ? void 0 : location.kind) === 79 /* Identifier */ ? createTextSpanFromNode(location) : void 0;
|
|
148435
148500
|
}
|
|
148436
|
-
function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position) {
|
|
148501
|
+
function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position, includeSymbol) {
|
|
148437
148502
|
const {
|
|
148438
148503
|
symbols,
|
|
148439
148504
|
contextToken,
|
|
@@ -148507,7 +148572,8 @@ function completionInfoFromData(sourceFile, host, program, compilerOptions, log,
|
|
|
148507
148572
|
symbolToOriginInfoMap,
|
|
148508
148573
|
symbolToSortTextMap,
|
|
148509
148574
|
isJsxIdentifierExpected,
|
|
148510
|
-
isRightOfOpenTag
|
|
148575
|
+
isRightOfOpenTag,
|
|
148576
|
+
includeSymbol
|
|
148511
148577
|
);
|
|
148512
148578
|
if (keywordFilters !== 0 /* None */) {
|
|
148513
148579
|
for (const keywordEntry of getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && isSourceFileJS(sourceFile))) {
|
|
@@ -148756,7 +148822,7 @@ function completionNameForLiteral(sourceFile, preferences, literal) {
|
|
|
148756
148822
|
function createCompletionEntryForLiteral(sourceFile, preferences, literal) {
|
|
148757
148823
|
return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* string */, kindModifiers: "" /* none */, sortText: SortText.LocationPriority };
|
|
148758
148824
|
}
|
|
148759
|
-
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) {
|
|
148825
|
+
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) {
|
|
148760
148826
|
let insertText;
|
|
148761
148827
|
let replacementSpan = getReplacementSpanForContextToken(replacementToken);
|
|
148762
148828
|
let data;
|
|
@@ -148800,7 +148866,9 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
|
|
|
148800
148866
|
}
|
|
148801
148867
|
awaitText += `(await ${propertyAccessToConvert.expression.getText()})`;
|
|
148802
148868
|
insertText = needsConvertPropertyAccess ? `${awaitText}${insertText}` : `${awaitText}${insertQuestionDot ? "?." : "."}${insertText}`;
|
|
148803
|
-
|
|
148869
|
+
const isInAwaitExpression = tryCast(propertyAccessToConvert.parent, isAwaitExpression);
|
|
148870
|
+
const wrapNode = isInAwaitExpression ? propertyAccessToConvert.parent : propertyAccessToConvert.expression;
|
|
148871
|
+
replacementSpan = createTextSpanFromBounds(wrapNode.getStart(sourceFile), propertyAccessToConvert.end);
|
|
148804
148872
|
}
|
|
148805
148873
|
if (originIsResolvedExport(origin)) {
|
|
148806
148874
|
sourceDisplay = [textPart(origin.moduleSpecifier)];
|
|
@@ -148868,7 +148936,8 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
|
|
|
148868
148936
|
isSnippet,
|
|
148869
148937
|
isPackageJsonImport: originIsPackageJsonImport(origin) || void 0,
|
|
148870
148938
|
isImportStatementCompletion: !!importStatementCompletion || void 0,
|
|
148871
|
-
data
|
|
148939
|
+
data,
|
|
148940
|
+
...includeSymbol ? { symbol } : void 0
|
|
148872
148941
|
};
|
|
148873
148942
|
}
|
|
148874
148943
|
function isClassLikeMemberCompletion(symbol, location, sourceFile) {
|
|
@@ -149338,7 +149407,7 @@ function getSourceFromOrigin(origin) {
|
|
|
149338
149407
|
return "TypeOnlyAlias/" /* TypeOnlyAlias */;
|
|
149339
149408
|
}
|
|
149340
149409
|
}
|
|
149341
|
-
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) {
|
|
149410
|
+
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) {
|
|
149342
149411
|
var _a2;
|
|
149343
149412
|
const start2 = timestamp();
|
|
149344
149413
|
const variableDeclaration = getVariableDeclaration(location);
|
|
@@ -149378,7 +149447,8 @@ function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, con
|
|
|
149378
149447
|
kind,
|
|
149379
149448
|
formatContext,
|
|
149380
149449
|
isJsxIdentifierExpected,
|
|
149381
|
-
isRightOfOpenTag
|
|
149450
|
+
isRightOfOpenTag,
|
|
149451
|
+
includeSymbol
|
|
149382
149452
|
);
|
|
149383
149453
|
if (!entry) {
|
|
149384
149454
|
continue;
|
|
@@ -151577,7 +151647,7 @@ function createNameAndKindSet() {
|
|
|
151577
151647
|
values: map2.values.bind(map2)
|
|
151578
151648
|
};
|
|
151579
151649
|
}
|
|
151580
|
-
function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program, log, preferences) {
|
|
151650
|
+
function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program, log, preferences, includeSymbol) {
|
|
151581
151651
|
if (isInReferenceComment(sourceFile, position)) {
|
|
151582
151652
|
const entries = getTripleSlashReferenceCompletion(sourceFile, position, options, host);
|
|
151583
151653
|
return entries && convertPathCompletions(entries);
|
|
@@ -151586,10 +151656,10 @@ function getStringLiteralCompletions(sourceFile, position, contextToken, options
|
|
|
151586
151656
|
if (!contextToken || !isStringLiteralLike(contextToken))
|
|
151587
151657
|
return void 0;
|
|
151588
151658
|
const entries = getStringLiteralCompletionEntries(sourceFile, contextToken, position, program.getTypeChecker(), options, host, preferences);
|
|
151589
|
-
return convertStringLiteralCompletions(entries, contextToken, sourceFile, host, program, log, options, preferences, position);
|
|
151659
|
+
return convertStringLiteralCompletions(entries, contextToken, sourceFile, host, program, log, options, preferences, position, includeSymbol);
|
|
151590
151660
|
}
|
|
151591
151661
|
}
|
|
151592
|
-
function convertStringLiteralCompletions(completion, contextToken, sourceFile, host, program, log, options, preferences, position) {
|
|
151662
|
+
function convertStringLiteralCompletions(completion, contextToken, sourceFile, host, program, log, options, preferences, position, includeSymbol) {
|
|
151593
151663
|
if (completion === void 0) {
|
|
151594
151664
|
return void 0;
|
|
151595
151665
|
}
|
|
@@ -151615,7 +151685,28 @@ function convertStringLiteralCompletions(completion, contextToken, sourceFile, h
|
|
|
151615
151685
|
preferences,
|
|
151616
151686
|
options,
|
|
151617
151687
|
/*formatContext*/
|
|
151618
|
-
void 0
|
|
151688
|
+
void 0,
|
|
151689
|
+
/*isTypeOnlyLocation */
|
|
151690
|
+
void 0,
|
|
151691
|
+
/*propertyAccessToConvert*/
|
|
151692
|
+
void 0,
|
|
151693
|
+
/*jsxIdentifierExpected*/
|
|
151694
|
+
void 0,
|
|
151695
|
+
/*isJsxInitializer*/
|
|
151696
|
+
void 0,
|
|
151697
|
+
/*importStatementCompletion*/
|
|
151698
|
+
void 0,
|
|
151699
|
+
/*recommendedCompletion*/
|
|
151700
|
+
void 0,
|
|
151701
|
+
/*symbolToOriginInfoMap*/
|
|
151702
|
+
void 0,
|
|
151703
|
+
/*symbolToSortTextMap*/
|
|
151704
|
+
void 0,
|
|
151705
|
+
/*isJsxIdentifierExpected*/
|
|
151706
|
+
void 0,
|
|
151707
|
+
/*isRightOfOpenTag*/
|
|
151708
|
+
void 0,
|
|
151709
|
+
includeSymbol
|
|
151619
151710
|
);
|
|
151620
151711
|
return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: completion.hasIndexSignature, optionalReplacementSpan, entries };
|
|
151621
151712
|
}
|
|
@@ -166366,7 +166457,7 @@ function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delt
|
|
|
166366
166457
|
}
|
|
166367
166458
|
function processChildNode(child, inheritedIndentation, parent2, parentDynamicIndentation, parentStartLine, undecoratedParentStartLine, isListItem, isFirstListItem) {
|
|
166368
166459
|
Debug.assert(!nodeIsSynthesized(child));
|
|
166369
|
-
if (nodeIsMissing(child)) {
|
|
166460
|
+
if (nodeIsMissing(child) || isGrammarError(parent2, child)) {
|
|
166370
166461
|
return inheritedIndentation;
|
|
166371
166462
|
}
|
|
166372
166463
|
const childStartPos = child.getStart(sourceFile);
|
|
@@ -168779,6 +168870,7 @@ __export(ts_exports3, {
|
|
|
168779
168870
|
isGetOrSetAccessorDeclaration: () => isGetOrSetAccessorDeclaration,
|
|
168780
168871
|
isGlobalDeclaration: () => isGlobalDeclaration,
|
|
168781
168872
|
isGlobalScopeAugmentation: () => isGlobalScopeAugmentation,
|
|
168873
|
+
isGrammarError: () => isGrammarError,
|
|
168782
168874
|
isHeritageClause: () => isHeritageClause,
|
|
168783
168875
|
isHoistedFunction: () => isHoistedFunction,
|
|
168784
168876
|
isHoistedVariableStatement: () => isHoistedVariableStatement,
|
|
@@ -182728,6 +182820,7 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
182728
182820
|
isGetOrSetAccessorDeclaration,
|
|
182729
182821
|
isGlobalDeclaration,
|
|
182730
182822
|
isGlobalScopeAugmentation,
|
|
182823
|
+
isGrammarError,
|
|
182731
182824
|
isHeritageClause,
|
|
182732
182825
|
isHoistedFunction,
|
|
182733
182826
|
isHoistedVariableStatement,
|
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
|