typescript 4.8.0-dev.20220717 → 4.8.0-dev.20220720
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 +42 -25
- package/lib/tsserver.js +60 -35
- package/lib/tsserverlibrary.d.ts +6 -0
- package/lib/tsserverlibrary.js +60 -35
- package/lib/typescript.d.ts +6 -0
- package/lib/typescript.js +58 -35
- package/lib/typescriptServices.d.ts +6 -0
- package/lib/typescriptServices.js +58 -35
- package/lib/typingsInstaller.js +48 -25
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
69
69
|
var ts;
|
|
70
70
|
(function (ts) {
|
|
71
71
|
ts.versionMajorMinor = "4.8";
|
|
72
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
72
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220720";
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
var globals = typeof globalThis !== "undefined" ? globalThis :
|
|
@@ -28486,6 +28486,9 @@ var ts;
|
|
|
28486
28486
|
var typeArguments = tryParse(parseTypeArgumentsInExpression);
|
|
28487
28487
|
if (typeArguments !== undefined) {
|
|
28488
28488
|
parseErrorAt(startPos, getNodePos(), ts.Diagnostics.super_may_not_use_type_arguments);
|
|
28489
|
+
if (!isTemplateStartOfTaggedTemplate()) {
|
|
28490
|
+
expression = factory.createExpressionWithTypeArguments(expression, typeArguments);
|
|
28491
|
+
}
|
|
28489
28492
|
}
|
|
28490
28493
|
}
|
|
28491
28494
|
if (token() === 20 || token() === 24 || token() === 22) {
|
|
@@ -49034,6 +49037,9 @@ var ts;
|
|
|
49034
49037
|
else if (type.objectFlags & 32) {
|
|
49035
49038
|
resolveMappedTypeMembers(type);
|
|
49036
49039
|
}
|
|
49040
|
+
else {
|
|
49041
|
+
ts.Debug.fail("Unhandled object type " + ts.Debug.formatObjectFlags(type.objectFlags));
|
|
49042
|
+
}
|
|
49037
49043
|
}
|
|
49038
49044
|
else if (type.flags & 1048576) {
|
|
49039
49045
|
resolveUnionTypeMembers(type);
|
|
@@ -49041,6 +49047,9 @@ var ts;
|
|
|
49041
49047
|
else if (type.flags & 2097152) {
|
|
49042
49048
|
resolveIntersectionTypeMembers(type);
|
|
49043
49049
|
}
|
|
49050
|
+
else {
|
|
49051
|
+
ts.Debug.fail("Unhandled type " + ts.Debug.formatTypeFlags(type.flags));
|
|
49052
|
+
}
|
|
49044
49053
|
}
|
|
49045
49054
|
return type;
|
|
49046
49055
|
}
|
|
@@ -49710,12 +49719,15 @@ var ts;
|
|
|
49710
49719
|
return getApplicableIndexInfo(type, isLateBoundName(name) ? esSymbolType : getStringLiteralType(ts.unescapeLeadingUnderscores(name)));
|
|
49711
49720
|
}
|
|
49712
49721
|
function getTypeParametersFromDeclaration(declaration) {
|
|
49722
|
+
var _a;
|
|
49713
49723
|
var result;
|
|
49714
|
-
for (var _i = 0,
|
|
49715
|
-
var node =
|
|
49724
|
+
for (var _i = 0, _b = ts.getEffectiveTypeParameterDeclarations(declaration); _i < _b.length; _i++) {
|
|
49725
|
+
var node = _b[_i];
|
|
49716
49726
|
result = ts.appendIfUnique(result, getDeclaredTypeOfTypeParameter(node.symbol));
|
|
49717
49727
|
}
|
|
49718
|
-
return result
|
|
49728
|
+
return (result === null || result === void 0 ? void 0 : result.length) ? result
|
|
49729
|
+
: ts.isFunctionDeclaration(declaration) ? (_a = getSignatureOfTypeTag(declaration)) === null || _a === void 0 ? void 0 : _a.typeParameters
|
|
49730
|
+
: undefined;
|
|
49719
49731
|
}
|
|
49720
49732
|
function symbolsToArray(symbols) {
|
|
49721
49733
|
var result = [];
|
|
@@ -57761,15 +57773,11 @@ var ts;
|
|
|
57761
57773
|
inferFromTypeArguments(getTypeArguments(source), getTypeArguments(target), getVariances(source.target));
|
|
57762
57774
|
}
|
|
57763
57775
|
else if (source.flags & 4194304 && target.flags & 4194304) {
|
|
57764
|
-
|
|
57765
|
-
inferFromTypes(source.type, target.type);
|
|
57766
|
-
contravariant = !contravariant;
|
|
57776
|
+
inferFromContravariantTypes(source.type, target.type);
|
|
57767
57777
|
}
|
|
57768
57778
|
else if ((isLiteralType(source) || source.flags & 4) && target.flags & 4194304) {
|
|
57769
57779
|
var empty = createEmptyObjectTypeFromStringLiteral(source);
|
|
57770
|
-
|
|
57771
|
-
inferWithPriority(empty, target.type, 256);
|
|
57772
|
-
contravariant = !contravariant;
|
|
57780
|
+
inferFromContravariantTypesWithPriority(empty, target.type, 256);
|
|
57773
57781
|
}
|
|
57774
57782
|
else if (source.flags & 8388608 && target.flags & 8388608) {
|
|
57775
57783
|
inferFromTypes(source.objectType, target.objectType);
|
|
@@ -57782,10 +57790,7 @@ var ts;
|
|
|
57782
57790
|
}
|
|
57783
57791
|
else if (source.flags & 33554432) {
|
|
57784
57792
|
inferFromTypes(source.baseType, target);
|
|
57785
|
-
|
|
57786
|
-
priority |= 4;
|
|
57787
|
-
inferFromTypes(source.substitute, target);
|
|
57788
|
-
priority = oldPriority;
|
|
57793
|
+
inferWithPriority(source.substitute, target, 4);
|
|
57789
57794
|
}
|
|
57790
57795
|
else if (target.flags & 16777216) {
|
|
57791
57796
|
invokeOnce(source, target, inferToConditionalType);
|
|
@@ -57824,6 +57829,18 @@ var ts;
|
|
|
57824
57829
|
inferFromTypes(source, target);
|
|
57825
57830
|
priority = savePriority;
|
|
57826
57831
|
}
|
|
57832
|
+
function inferFromContravariantTypesWithPriority(source, target, newPriority) {
|
|
57833
|
+
var savePriority = priority;
|
|
57834
|
+
priority |= newPriority;
|
|
57835
|
+
inferFromContravariantTypes(source, target);
|
|
57836
|
+
priority = savePriority;
|
|
57837
|
+
}
|
|
57838
|
+
function inferToMultipleTypesWithPriority(source, targets, targetFlags, newPriority) {
|
|
57839
|
+
var savePriority = priority;
|
|
57840
|
+
priority |= newPriority;
|
|
57841
|
+
inferToMultipleTypes(source, targets, targetFlags);
|
|
57842
|
+
priority = savePriority;
|
|
57843
|
+
}
|
|
57827
57844
|
function invokeOnce(source, target, action) {
|
|
57828
57845
|
var key = source.id + "," + target.id;
|
|
57829
57846
|
var status = visited && visited.get(key);
|
|
@@ -57886,10 +57903,13 @@ var ts;
|
|
|
57886
57903
|
}
|
|
57887
57904
|
}
|
|
57888
57905
|
function inferFromContravariantTypes(source, target) {
|
|
57906
|
+
contravariant = !contravariant;
|
|
57907
|
+
inferFromTypes(source, target);
|
|
57908
|
+
contravariant = !contravariant;
|
|
57909
|
+
}
|
|
57910
|
+
function inferFromContravariantTypesIfStrictFunctionTypes(source, target) {
|
|
57889
57911
|
if (strictFunctionTypes || priority & 1024) {
|
|
57890
|
-
|
|
57891
|
-
inferFromTypes(source, target);
|
|
57892
|
-
contravariant = !contravariant;
|
|
57912
|
+
inferFromContravariantTypes(source, target);
|
|
57893
57913
|
}
|
|
57894
57914
|
else {
|
|
57895
57915
|
inferFromTypes(source, target);
|
|
@@ -58020,11 +58040,8 @@ var ts;
|
|
|
58020
58040
|
inferFromTypes(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target));
|
|
58021
58041
|
}
|
|
58022
58042
|
else {
|
|
58023
|
-
var savePriority = priority;
|
|
58024
|
-
priority |= contravariant ? 64 : 0;
|
|
58025
58043
|
var targetTypes = [getTrueTypeFromConditionalType(target), getFalseTypeFromConditionalType(target)];
|
|
58026
|
-
|
|
58027
|
-
priority = savePriority;
|
|
58044
|
+
inferToMultipleTypesWithPriority(source, targetTypes, target.flags, contravariant ? 64 : 0);
|
|
58028
58045
|
}
|
|
58029
58046
|
}
|
|
58030
58047
|
function inferToTemplateLiteralType(source, target) {
|
|
@@ -58183,7 +58200,7 @@ var ts;
|
|
|
58183
58200
|
var saveBivariant = bivariant;
|
|
58184
58201
|
var kind = target.declaration ? target.declaration.kind : 0;
|
|
58185
58202
|
bivariant = bivariant || kind === 169 || kind === 168 || kind === 171;
|
|
58186
|
-
applyToParameterTypes(source, target,
|
|
58203
|
+
applyToParameterTypes(source, target, inferFromContravariantTypesIfStrictFunctionTypes);
|
|
58187
58204
|
bivariant = saveBivariant;
|
|
58188
58205
|
applyToReturnTypes(source, target, inferFromTypes);
|
|
58189
58206
|
}
|
|
@@ -59510,7 +59527,7 @@ var ts;
|
|
|
59510
59527
|
return declaredType;
|
|
59511
59528
|
}
|
|
59512
59529
|
if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 243 && isMatchingReference(reference, node.parent.parent.expression)) {
|
|
59513
|
-
return getNonNullableTypeIfNeeded(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent)));
|
|
59530
|
+
return getNonNullableTypeIfNeeded(finalizeEvolvingArrayType(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent))));
|
|
59514
59531
|
}
|
|
59515
59532
|
return undefined;
|
|
59516
59533
|
}
|
|
@@ -64226,7 +64243,7 @@ var ts;
|
|
|
64226
64243
|
var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node);
|
|
64227
64244
|
var reportErrors = !candidatesOutArray;
|
|
64228
64245
|
var typeArguments;
|
|
64229
|
-
if (!isDecorator) {
|
|
64246
|
+
if (!isDecorator && !ts.isSuperCall(node)) {
|
|
64230
64247
|
typeArguments = node.typeArguments;
|
|
64231
64248
|
if (isTaggedTemplate || isJsxOpeningOrSelfClosingElement || node.expression.kind !== 106) {
|
|
64232
64249
|
ts.forEach(typeArguments, checkSourceElement);
|
|
@@ -66334,7 +66351,7 @@ var ts;
|
|
|
66334
66351
|
error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator));
|
|
66335
66352
|
}
|
|
66336
66353
|
if (node.operator === 39) {
|
|
66337
|
-
if (
|
|
66354
|
+
if (maybeTypeOfKindConsideringBaseConstraint(operandType, 2112)) {
|
|
66338
66355
|
error(node.operand, ts.Diagnostics.Operator_0_cannot_be_applied_to_type_1, ts.tokenToString(node.operator), typeToString(getBaseTypeOfLiteralType(operandType)));
|
|
66339
66356
|
}
|
|
66340
66357
|
return numberType;
|
package/lib/tsserver.js
CHANGED
|
@@ -109,7 +109,7 @@ var ts;
|
|
|
109
109
|
// The following is baselined as a literal template type without intervention
|
|
110
110
|
/** The version of the TypeScript compiler release */
|
|
111
111
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
112
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
112
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220720";
|
|
113
113
|
/* @internal */
|
|
114
114
|
var Comparison;
|
|
115
115
|
(function (Comparison) {
|
|
@@ -13217,6 +13217,12 @@ var ts;
|
|
|
13217
13217
|
/**
|
|
13218
13218
|
* Gets the effective type parameters. If the node was parsed in a
|
|
13219
13219
|
* JavaScript file, gets the type parameters from the `@template` tag from JSDoc.
|
|
13220
|
+
*
|
|
13221
|
+
* This does *not* return type parameters from a jsdoc reference to a generic type, eg
|
|
13222
|
+
*
|
|
13223
|
+
* type Id = <T>(x: T) => T
|
|
13224
|
+
* /** @type {Id} /
|
|
13225
|
+
* function id(x) { return x }
|
|
13220
13226
|
*/
|
|
13221
13227
|
function getEffectiveTypeParameterDeclarations(node) {
|
|
13222
13228
|
if (ts.isJSDocSignature(node)) {
|
|
@@ -35477,6 +35483,9 @@ var ts;
|
|
|
35477
35483
|
var typeArguments = tryParse(parseTypeArgumentsInExpression);
|
|
35478
35484
|
if (typeArguments !== undefined) {
|
|
35479
35485
|
parseErrorAt(startPos, getNodePos(), ts.Diagnostics.super_may_not_use_type_arguments);
|
|
35486
|
+
if (!isTemplateStartOfTaggedTemplate()) {
|
|
35487
|
+
expression = factory.createExpressionWithTypeArguments(expression, typeArguments);
|
|
35488
|
+
}
|
|
35480
35489
|
}
|
|
35481
35490
|
}
|
|
35482
35491
|
if (token() === 20 /* OpenParenToken */ || token() === 24 /* DotToken */ || token() === 22 /* OpenBracketToken */) {
|
|
@@ -59194,6 +59203,9 @@ var ts;
|
|
|
59194
59203
|
else if (type.objectFlags & 32 /* Mapped */) {
|
|
59195
59204
|
resolveMappedTypeMembers(type);
|
|
59196
59205
|
}
|
|
59206
|
+
else {
|
|
59207
|
+
ts.Debug.fail("Unhandled object type " + ts.Debug.formatObjectFlags(type.objectFlags));
|
|
59208
|
+
}
|
|
59197
59209
|
}
|
|
59198
59210
|
else if (type.flags & 1048576 /* Union */) {
|
|
59199
59211
|
resolveUnionTypeMembers(type);
|
|
@@ -59201,6 +59213,9 @@ var ts;
|
|
|
59201
59213
|
else if (type.flags & 2097152 /* Intersection */) {
|
|
59202
59214
|
resolveIntersectionTypeMembers(type);
|
|
59203
59215
|
}
|
|
59216
|
+
else {
|
|
59217
|
+
ts.Debug.fail("Unhandled type " + ts.Debug.formatTypeFlags(type.flags));
|
|
59218
|
+
}
|
|
59204
59219
|
}
|
|
59205
59220
|
return type;
|
|
59206
59221
|
}
|
|
@@ -59992,12 +60007,15 @@ var ts;
|
|
|
59992
60007
|
// Return list of type parameters with duplicates removed (duplicate identifier errors are generated in the actual
|
|
59993
60008
|
// type checking functions).
|
|
59994
60009
|
function getTypeParametersFromDeclaration(declaration) {
|
|
60010
|
+
var _a;
|
|
59995
60011
|
var result;
|
|
59996
|
-
for (var _i = 0,
|
|
59997
|
-
var node =
|
|
60012
|
+
for (var _i = 0, _b = ts.getEffectiveTypeParameterDeclarations(declaration); _i < _b.length; _i++) {
|
|
60013
|
+
var node = _b[_i];
|
|
59998
60014
|
result = ts.appendIfUnique(result, getDeclaredTypeOfTypeParameter(node.symbol));
|
|
59999
60015
|
}
|
|
60000
|
-
return result
|
|
60016
|
+
return (result === null || result === void 0 ? void 0 : result.length) ? result
|
|
60017
|
+
: ts.isFunctionDeclaration(declaration) ? (_a = getSignatureOfTypeTag(declaration)) === null || _a === void 0 ? void 0 : _a.typeParameters
|
|
60018
|
+
: undefined;
|
|
60001
60019
|
}
|
|
60002
60020
|
function symbolsToArray(symbols) {
|
|
60003
60021
|
var result = [];
|
|
@@ -69218,15 +69236,11 @@ var ts;
|
|
|
69218
69236
|
inferFromTypeArguments(getTypeArguments(source), getTypeArguments(target), getVariances(source.target));
|
|
69219
69237
|
}
|
|
69220
69238
|
else if (source.flags & 4194304 /* Index */ && target.flags & 4194304 /* Index */) {
|
|
69221
|
-
|
|
69222
|
-
inferFromTypes(source.type, target.type);
|
|
69223
|
-
contravariant = !contravariant;
|
|
69239
|
+
inferFromContravariantTypes(source.type, target.type);
|
|
69224
69240
|
}
|
|
69225
69241
|
else if ((isLiteralType(source) || source.flags & 4 /* String */) && target.flags & 4194304 /* Index */) {
|
|
69226
69242
|
var empty = createEmptyObjectTypeFromStringLiteral(source);
|
|
69227
|
-
|
|
69228
|
-
inferWithPriority(empty, target.type, 256 /* LiteralKeyof */);
|
|
69229
|
-
contravariant = !contravariant;
|
|
69243
|
+
inferFromContravariantTypesWithPriority(empty, target.type, 256 /* LiteralKeyof */);
|
|
69230
69244
|
}
|
|
69231
69245
|
else if (source.flags & 8388608 /* IndexedAccess */ && target.flags & 8388608 /* IndexedAccess */) {
|
|
69232
69246
|
inferFromTypes(source.objectType, target.objectType);
|
|
@@ -69239,10 +69253,7 @@ var ts;
|
|
|
69239
69253
|
}
|
|
69240
69254
|
else if (source.flags & 33554432 /* Substitution */) {
|
|
69241
69255
|
inferFromTypes(source.baseType, target);
|
|
69242
|
-
|
|
69243
|
-
priority |= 4 /* SubstituteSource */;
|
|
69244
|
-
inferFromTypes(source.substitute, target); // Make substitute inference at a lower priority
|
|
69245
|
-
priority = oldPriority;
|
|
69256
|
+
inferWithPriority(source.substitute, target, 4 /* SubstituteSource */); // Make substitute inference at a lower priority
|
|
69246
69257
|
}
|
|
69247
69258
|
else if (target.flags & 16777216 /* Conditional */) {
|
|
69248
69259
|
invokeOnce(source, target, inferToConditionalType);
|
|
@@ -69292,6 +69303,18 @@ var ts;
|
|
|
69292
69303
|
inferFromTypes(source, target);
|
|
69293
69304
|
priority = savePriority;
|
|
69294
69305
|
}
|
|
69306
|
+
function inferFromContravariantTypesWithPriority(source, target, newPriority) {
|
|
69307
|
+
var savePriority = priority;
|
|
69308
|
+
priority |= newPriority;
|
|
69309
|
+
inferFromContravariantTypes(source, target);
|
|
69310
|
+
priority = savePriority;
|
|
69311
|
+
}
|
|
69312
|
+
function inferToMultipleTypesWithPriority(source, targets, targetFlags, newPriority) {
|
|
69313
|
+
var savePriority = priority;
|
|
69314
|
+
priority |= newPriority;
|
|
69315
|
+
inferToMultipleTypes(source, targets, targetFlags);
|
|
69316
|
+
priority = savePriority;
|
|
69317
|
+
}
|
|
69295
69318
|
function invokeOnce(source, target, action) {
|
|
69296
69319
|
var key = source.id + "," + target.id;
|
|
69297
69320
|
var status = visited && visited.get(key);
|
|
@@ -69356,10 +69379,13 @@ var ts;
|
|
|
69356
69379
|
}
|
|
69357
69380
|
}
|
|
69358
69381
|
function inferFromContravariantTypes(source, target) {
|
|
69382
|
+
contravariant = !contravariant;
|
|
69383
|
+
inferFromTypes(source, target);
|
|
69384
|
+
contravariant = !contravariant;
|
|
69385
|
+
}
|
|
69386
|
+
function inferFromContravariantTypesIfStrictFunctionTypes(source, target) {
|
|
69359
69387
|
if (strictFunctionTypes || priority & 1024 /* AlwaysStrict */) {
|
|
69360
|
-
|
|
69361
|
-
inferFromTypes(source, target);
|
|
69362
|
-
contravariant = !contravariant;
|
|
69388
|
+
inferFromContravariantTypes(source, target);
|
|
69363
69389
|
}
|
|
69364
69390
|
else {
|
|
69365
69391
|
inferFromTypes(source, target);
|
|
@@ -69523,11 +69549,8 @@ var ts;
|
|
|
69523
69549
|
inferFromTypes(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target));
|
|
69524
69550
|
}
|
|
69525
69551
|
else {
|
|
69526
|
-
var savePriority = priority;
|
|
69527
|
-
priority |= contravariant ? 64 /* ContravariantConditional */ : 0;
|
|
69528
69552
|
var targetTypes = [getTrueTypeFromConditionalType(target), getFalseTypeFromConditionalType(target)];
|
|
69529
|
-
|
|
69530
|
-
priority = savePriority;
|
|
69553
|
+
inferToMultipleTypesWithPriority(source, targetTypes, target.flags, contravariant ? 64 /* ContravariantConditional */ : 0);
|
|
69531
69554
|
}
|
|
69532
69555
|
}
|
|
69533
69556
|
function inferToTemplateLiteralType(source, target) {
|
|
@@ -69713,7 +69736,7 @@ var ts;
|
|
|
69713
69736
|
var kind = target.declaration ? target.declaration.kind : 0 /* Unknown */;
|
|
69714
69737
|
// Once we descend into a bivariant signature we remain bivariant for all nested inferences
|
|
69715
69738
|
bivariant = bivariant || kind === 169 /* MethodDeclaration */ || kind === 168 /* MethodSignature */ || kind === 171 /* Constructor */;
|
|
69716
|
-
applyToParameterTypes(source, target,
|
|
69739
|
+
applyToParameterTypes(source, target, inferFromContravariantTypesIfStrictFunctionTypes);
|
|
69717
69740
|
bivariant = saveBivariant;
|
|
69718
69741
|
applyToReturnTypes(source, target, inferFromTypes);
|
|
69719
69742
|
}
|
|
@@ -71166,7 +71189,7 @@ var ts;
|
|
|
71166
71189
|
}
|
|
71167
71190
|
// for (const _ in ref) acts as a nonnull on ref
|
|
71168
71191
|
if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 243 /* ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) {
|
|
71169
|
-
return getNonNullableTypeIfNeeded(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent)));
|
|
71192
|
+
return getNonNullableTypeIfNeeded(finalizeEvolvingArrayType(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent))));
|
|
71170
71193
|
}
|
|
71171
71194
|
// Assignment doesn't affect reference
|
|
71172
71195
|
return undefined;
|
|
@@ -76755,7 +76778,7 @@ var ts;
|
|
|
76755
76778
|
var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node);
|
|
76756
76779
|
var reportErrors = !candidatesOutArray;
|
|
76757
76780
|
var typeArguments;
|
|
76758
|
-
if (!isDecorator) {
|
|
76781
|
+
if (!isDecorator && !ts.isSuperCall(node)) {
|
|
76759
76782
|
typeArguments = node.typeArguments;
|
|
76760
76783
|
// We already perform checking on the type arguments on the class declaration itself.
|
|
76761
76784
|
if (isTaggedTemplate || isJsxOpeningOrSelfClosingElement || node.expression.kind !== 106 /* SuperKeyword */) {
|
|
@@ -79171,7 +79194,7 @@ var ts;
|
|
|
79171
79194
|
error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator));
|
|
79172
79195
|
}
|
|
79173
79196
|
if (node.operator === 39 /* PlusToken */) {
|
|
79174
|
-
if (
|
|
79197
|
+
if (maybeTypeOfKindConsideringBaseConstraint(operandType, 2112 /* BigIntLike */)) {
|
|
79175
79198
|
error(node.operand, ts.Diagnostics.Operator_0_cannot_be_applied_to_type_1, ts.tokenToString(node.operator), typeToString(getBaseTypeOfLiteralType(operandType)));
|
|
79176
79199
|
}
|
|
79177
79200
|
return numberType;
|
|
@@ -132528,11 +132551,11 @@ var ts;
|
|
|
132528
132551
|
var parent = walkUpParentheses(node.parent);
|
|
132529
132552
|
switch (parent.kind) {
|
|
132530
132553
|
case 196 /* LiteralType */: {
|
|
132531
|
-
var
|
|
132532
|
-
switch (
|
|
132554
|
+
var grandParent_1 = walkUpParentheses(parent.parent);
|
|
132555
|
+
switch (grandParent_1.kind) {
|
|
132556
|
+
case 228 /* ExpressionWithTypeArguments */:
|
|
132533
132557
|
case 178 /* TypeReference */: {
|
|
132534
|
-
var
|
|
132535
|
-
var typeArgument = ts.findAncestor(parent, function (n) { return n.parent === typeReference_1; });
|
|
132558
|
+
var typeArgument = ts.findAncestor(parent, function (n) { return n.parent === grandParent_1; });
|
|
132536
132559
|
if (typeArgument) {
|
|
132537
132560
|
return { kind: 2 /* Types */, types: getStringLiteralTypes(typeChecker.getTypeArgumentConstraint(typeArgument)), isNewIdentifier: false };
|
|
132538
132561
|
}
|
|
@@ -132545,7 +132568,7 @@ var ts;
|
|
|
132545
132568
|
// bar: string;
|
|
132546
132569
|
// }
|
|
132547
132570
|
// let x: Foo["/*completion position*/"]
|
|
132548
|
-
var _a =
|
|
132571
|
+
var _a = grandParent_1, indexType = _a.indexType, objectType = _a.objectType;
|
|
132549
132572
|
if (!ts.rangeContainsPosition(indexType, position)) {
|
|
132550
132573
|
return undefined;
|
|
132551
132574
|
}
|
|
@@ -132553,11 +132576,11 @@ var ts;
|
|
|
132553
132576
|
case 200 /* ImportType */:
|
|
132554
132577
|
return { kind: 0 /* Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker, preferences) };
|
|
132555
132578
|
case 187 /* UnionType */: {
|
|
132556
|
-
if (!ts.isTypeReferenceNode(
|
|
132579
|
+
if (!ts.isTypeReferenceNode(grandParent_1.parent)) {
|
|
132557
132580
|
return undefined;
|
|
132558
132581
|
}
|
|
132559
|
-
var alreadyUsedTypes_1 = getAlreadyUsedTypesInStringLiteralUnion(
|
|
132560
|
-
var types = getStringLiteralTypes(typeChecker.getTypeArgumentConstraint(
|
|
132582
|
+
var alreadyUsedTypes_1 = getAlreadyUsedTypesInStringLiteralUnion(grandParent_1, parent);
|
|
132583
|
+
var types = getStringLiteralTypes(typeChecker.getTypeArgumentConstraint(grandParent_1)).filter(function (t) { return !ts.contains(alreadyUsedTypes_1, t.value); });
|
|
132561
132584
|
return { kind: 2 /* Types */, types: types, isNewIdentifier: false };
|
|
132562
132585
|
}
|
|
132563
132586
|
default:
|
|
@@ -159168,7 +159191,7 @@ var ts;
|
|
|
159168
159191
|
// If there is more than one overload but no implementation signature
|
|
159169
159192
|
// (eg: an abstract method or interface declaration), there is a 1-1
|
|
159170
159193
|
// correspondence of declarations and signatures.
|
|
159171
|
-
var signatures =
|
|
159194
|
+
var signatures = type.isUnion() ? ts.flatMap(type.types, function (t) { return t.getCallSignatures(); }) : type.getCallSignatures();
|
|
159172
159195
|
if (!ts.some(signatures)) {
|
|
159173
159196
|
break;
|
|
159174
159197
|
}
|
|
@@ -161861,7 +161884,7 @@ var ts;
|
|
|
161861
161884
|
var savedPermittedJumps = permittedJumps;
|
|
161862
161885
|
switch (node.kind) {
|
|
161863
161886
|
case 239 /* IfStatement */:
|
|
161864
|
-
permittedJumps
|
|
161887
|
+
permittedJumps &= ~4 /* Return */;
|
|
161865
161888
|
break;
|
|
161866
161889
|
case 252 /* TryStatement */:
|
|
161867
161890
|
// forbid all jumps inside try blocks
|
|
@@ -176994,6 +177017,8 @@ var ts;
|
|
|
176994
177017
|
function getDefinitionLocation(defaultProject, initialLocation, isForRename) {
|
|
176995
177018
|
var infos = defaultProject.getLanguageService().getDefinitionAtPosition(initialLocation.fileName, initialLocation.pos, /*searchOtherFilesOnly*/ false, /*stopAtAlias*/ isForRename);
|
|
176996
177019
|
var info = infos && ts.firstOrUndefined(infos);
|
|
177020
|
+
// Note that the value of `isLocal` may depend on whether or not the checker has run on the containing file
|
|
177021
|
+
// (implying that FAR cascading behavior may depend on request order)
|
|
176997
177022
|
return info && !info.isLocal ? { fileName: info.fileName, pos: info.textSpan.start } : undefined;
|
|
176998
177023
|
}
|
|
176999
177024
|
function getReferencesWorker(projects, defaultProject, initialLocation, logger) {
|
package/lib/tsserverlibrary.d.ts
CHANGED
|
@@ -4464,6 +4464,12 @@ declare namespace ts {
|
|
|
4464
4464
|
/**
|
|
4465
4465
|
* Gets the effective type parameters. If the node was parsed in a
|
|
4466
4466
|
* JavaScript file, gets the type parameters from the `@template` tag from JSDoc.
|
|
4467
|
+
*
|
|
4468
|
+
* This does *not* return type parameters from a jsdoc reference to a generic type, eg
|
|
4469
|
+
*
|
|
4470
|
+
* type Id = <T>(x: T) => T
|
|
4471
|
+
* /** @type {Id} /
|
|
4472
|
+
* function id(x) { return x }
|
|
4467
4473
|
*/
|
|
4468
4474
|
function getEffectiveTypeParameterDeclarations(node: DeclarationWithTypeParameters): readonly TypeParameterDeclaration[];
|
|
4469
4475
|
function getEffectiveConstraintOfTypeParameter(node: TypeParameterDeclaration): TypeNode | undefined;
|