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
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220720";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -13402,6 +13402,12 @@ var ts;
|
|
|
13402
13402
|
/**
|
|
13403
13403
|
* Gets the effective type parameters. If the node was parsed in a
|
|
13404
13404
|
* JavaScript file, gets the type parameters from the `@template` tag from JSDoc.
|
|
13405
|
+
*
|
|
13406
|
+
* This does *not* return type parameters from a jsdoc reference to a generic type, eg
|
|
13407
|
+
*
|
|
13408
|
+
* type Id = <T>(x: T) => T
|
|
13409
|
+
* /** @type {Id} /
|
|
13410
|
+
* function id(x) { return x }
|
|
13405
13411
|
*/
|
|
13406
13412
|
function getEffectiveTypeParameterDeclarations(node) {
|
|
13407
13413
|
if (ts.isJSDocSignature(node)) {
|
|
@@ -35662,6 +35668,9 @@ var ts;
|
|
|
35662
35668
|
var typeArguments = tryParse(parseTypeArgumentsInExpression);
|
|
35663
35669
|
if (typeArguments !== undefined) {
|
|
35664
35670
|
parseErrorAt(startPos, getNodePos(), ts.Diagnostics.super_may_not_use_type_arguments);
|
|
35671
|
+
if (!isTemplateStartOfTaggedTemplate()) {
|
|
35672
|
+
expression = factory.createExpressionWithTypeArguments(expression, typeArguments);
|
|
35673
|
+
}
|
|
35665
35674
|
}
|
|
35666
35675
|
}
|
|
35667
35676
|
if (token() === 20 /* OpenParenToken */ || token() === 24 /* DotToken */ || token() === 22 /* OpenBracketToken */) {
|
|
@@ -59379,6 +59388,9 @@ var ts;
|
|
|
59379
59388
|
else if (type.objectFlags & 32 /* Mapped */) {
|
|
59380
59389
|
resolveMappedTypeMembers(type);
|
|
59381
59390
|
}
|
|
59391
|
+
else {
|
|
59392
|
+
ts.Debug.fail("Unhandled object type " + ts.Debug.formatObjectFlags(type.objectFlags));
|
|
59393
|
+
}
|
|
59382
59394
|
}
|
|
59383
59395
|
else if (type.flags & 1048576 /* Union */) {
|
|
59384
59396
|
resolveUnionTypeMembers(type);
|
|
@@ -59386,6 +59398,9 @@ var ts;
|
|
|
59386
59398
|
else if (type.flags & 2097152 /* Intersection */) {
|
|
59387
59399
|
resolveIntersectionTypeMembers(type);
|
|
59388
59400
|
}
|
|
59401
|
+
else {
|
|
59402
|
+
ts.Debug.fail("Unhandled type " + ts.Debug.formatTypeFlags(type.flags));
|
|
59403
|
+
}
|
|
59389
59404
|
}
|
|
59390
59405
|
return type;
|
|
59391
59406
|
}
|
|
@@ -60177,12 +60192,15 @@ var ts;
|
|
|
60177
60192
|
// Return list of type parameters with duplicates removed (duplicate identifier errors are generated in the actual
|
|
60178
60193
|
// type checking functions).
|
|
60179
60194
|
function getTypeParametersFromDeclaration(declaration) {
|
|
60195
|
+
var _a;
|
|
60180
60196
|
var result;
|
|
60181
|
-
for (var _i = 0,
|
|
60182
|
-
var node =
|
|
60197
|
+
for (var _i = 0, _b = ts.getEffectiveTypeParameterDeclarations(declaration); _i < _b.length; _i++) {
|
|
60198
|
+
var node = _b[_i];
|
|
60183
60199
|
result = ts.appendIfUnique(result, getDeclaredTypeOfTypeParameter(node.symbol));
|
|
60184
60200
|
}
|
|
60185
|
-
return result
|
|
60201
|
+
return (result === null || result === void 0 ? void 0 : result.length) ? result
|
|
60202
|
+
: ts.isFunctionDeclaration(declaration) ? (_a = getSignatureOfTypeTag(declaration)) === null || _a === void 0 ? void 0 : _a.typeParameters
|
|
60203
|
+
: undefined;
|
|
60186
60204
|
}
|
|
60187
60205
|
function symbolsToArray(symbols) {
|
|
60188
60206
|
var result = [];
|
|
@@ -69403,15 +69421,11 @@ var ts;
|
|
|
69403
69421
|
inferFromTypeArguments(getTypeArguments(source), getTypeArguments(target), getVariances(source.target));
|
|
69404
69422
|
}
|
|
69405
69423
|
else if (source.flags & 4194304 /* Index */ && target.flags & 4194304 /* Index */) {
|
|
69406
|
-
|
|
69407
|
-
inferFromTypes(source.type, target.type);
|
|
69408
|
-
contravariant = !contravariant;
|
|
69424
|
+
inferFromContravariantTypes(source.type, target.type);
|
|
69409
69425
|
}
|
|
69410
69426
|
else if ((isLiteralType(source) || source.flags & 4 /* String */) && target.flags & 4194304 /* Index */) {
|
|
69411
69427
|
var empty = createEmptyObjectTypeFromStringLiteral(source);
|
|
69412
|
-
|
|
69413
|
-
inferWithPriority(empty, target.type, 256 /* LiteralKeyof */);
|
|
69414
|
-
contravariant = !contravariant;
|
|
69428
|
+
inferFromContravariantTypesWithPriority(empty, target.type, 256 /* LiteralKeyof */);
|
|
69415
69429
|
}
|
|
69416
69430
|
else if (source.flags & 8388608 /* IndexedAccess */ && target.flags & 8388608 /* IndexedAccess */) {
|
|
69417
69431
|
inferFromTypes(source.objectType, target.objectType);
|
|
@@ -69424,10 +69438,7 @@ var ts;
|
|
|
69424
69438
|
}
|
|
69425
69439
|
else if (source.flags & 33554432 /* Substitution */) {
|
|
69426
69440
|
inferFromTypes(source.baseType, target);
|
|
69427
|
-
|
|
69428
|
-
priority |= 4 /* SubstituteSource */;
|
|
69429
|
-
inferFromTypes(source.substitute, target); // Make substitute inference at a lower priority
|
|
69430
|
-
priority = oldPriority;
|
|
69441
|
+
inferWithPriority(source.substitute, target, 4 /* SubstituteSource */); // Make substitute inference at a lower priority
|
|
69431
69442
|
}
|
|
69432
69443
|
else if (target.flags & 16777216 /* Conditional */) {
|
|
69433
69444
|
invokeOnce(source, target, inferToConditionalType);
|
|
@@ -69477,6 +69488,18 @@ var ts;
|
|
|
69477
69488
|
inferFromTypes(source, target);
|
|
69478
69489
|
priority = savePriority;
|
|
69479
69490
|
}
|
|
69491
|
+
function inferFromContravariantTypesWithPriority(source, target, newPriority) {
|
|
69492
|
+
var savePriority = priority;
|
|
69493
|
+
priority |= newPriority;
|
|
69494
|
+
inferFromContravariantTypes(source, target);
|
|
69495
|
+
priority = savePriority;
|
|
69496
|
+
}
|
|
69497
|
+
function inferToMultipleTypesWithPriority(source, targets, targetFlags, newPriority) {
|
|
69498
|
+
var savePriority = priority;
|
|
69499
|
+
priority |= newPriority;
|
|
69500
|
+
inferToMultipleTypes(source, targets, targetFlags);
|
|
69501
|
+
priority = savePriority;
|
|
69502
|
+
}
|
|
69480
69503
|
function invokeOnce(source, target, action) {
|
|
69481
69504
|
var key = source.id + "," + target.id;
|
|
69482
69505
|
var status = visited && visited.get(key);
|
|
@@ -69541,10 +69564,13 @@ var ts;
|
|
|
69541
69564
|
}
|
|
69542
69565
|
}
|
|
69543
69566
|
function inferFromContravariantTypes(source, target) {
|
|
69567
|
+
contravariant = !contravariant;
|
|
69568
|
+
inferFromTypes(source, target);
|
|
69569
|
+
contravariant = !contravariant;
|
|
69570
|
+
}
|
|
69571
|
+
function inferFromContravariantTypesIfStrictFunctionTypes(source, target) {
|
|
69544
69572
|
if (strictFunctionTypes || priority & 1024 /* AlwaysStrict */) {
|
|
69545
|
-
|
|
69546
|
-
inferFromTypes(source, target);
|
|
69547
|
-
contravariant = !contravariant;
|
|
69573
|
+
inferFromContravariantTypes(source, target);
|
|
69548
69574
|
}
|
|
69549
69575
|
else {
|
|
69550
69576
|
inferFromTypes(source, target);
|
|
@@ -69708,11 +69734,8 @@ var ts;
|
|
|
69708
69734
|
inferFromTypes(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target));
|
|
69709
69735
|
}
|
|
69710
69736
|
else {
|
|
69711
|
-
var savePriority = priority;
|
|
69712
|
-
priority |= contravariant ? 64 /* ContravariantConditional */ : 0;
|
|
69713
69737
|
var targetTypes = [getTrueTypeFromConditionalType(target), getFalseTypeFromConditionalType(target)];
|
|
69714
|
-
|
|
69715
|
-
priority = savePriority;
|
|
69738
|
+
inferToMultipleTypesWithPriority(source, targetTypes, target.flags, contravariant ? 64 /* ContravariantConditional */ : 0);
|
|
69716
69739
|
}
|
|
69717
69740
|
}
|
|
69718
69741
|
function inferToTemplateLiteralType(source, target) {
|
|
@@ -69898,7 +69921,7 @@ var ts;
|
|
|
69898
69921
|
var kind = target.declaration ? target.declaration.kind : 0 /* Unknown */;
|
|
69899
69922
|
// Once we descend into a bivariant signature we remain bivariant for all nested inferences
|
|
69900
69923
|
bivariant = bivariant || kind === 169 /* MethodDeclaration */ || kind === 168 /* MethodSignature */ || kind === 171 /* Constructor */;
|
|
69901
|
-
applyToParameterTypes(source, target,
|
|
69924
|
+
applyToParameterTypes(source, target, inferFromContravariantTypesIfStrictFunctionTypes);
|
|
69902
69925
|
bivariant = saveBivariant;
|
|
69903
69926
|
applyToReturnTypes(source, target, inferFromTypes);
|
|
69904
69927
|
}
|
|
@@ -71351,7 +71374,7 @@ var ts;
|
|
|
71351
71374
|
}
|
|
71352
71375
|
// for (const _ in ref) acts as a nonnull on ref
|
|
71353
71376
|
if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 243 /* ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) {
|
|
71354
|
-
return getNonNullableTypeIfNeeded(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent)));
|
|
71377
|
+
return getNonNullableTypeIfNeeded(finalizeEvolvingArrayType(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent))));
|
|
71355
71378
|
}
|
|
71356
71379
|
// Assignment doesn't affect reference
|
|
71357
71380
|
return undefined;
|
|
@@ -76940,7 +76963,7 @@ var ts;
|
|
|
76940
76963
|
var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node);
|
|
76941
76964
|
var reportErrors = !candidatesOutArray;
|
|
76942
76965
|
var typeArguments;
|
|
76943
|
-
if (!isDecorator) {
|
|
76966
|
+
if (!isDecorator && !ts.isSuperCall(node)) {
|
|
76944
76967
|
typeArguments = node.typeArguments;
|
|
76945
76968
|
// We already perform checking on the type arguments on the class declaration itself.
|
|
76946
76969
|
if (isTaggedTemplate || isJsxOpeningOrSelfClosingElement || node.expression.kind !== 106 /* SuperKeyword */) {
|
|
@@ -79356,7 +79379,7 @@ var ts;
|
|
|
79356
79379
|
error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator));
|
|
79357
79380
|
}
|
|
79358
79381
|
if (node.operator === 39 /* PlusToken */) {
|
|
79359
|
-
if (
|
|
79382
|
+
if (maybeTypeOfKindConsideringBaseConstraint(operandType, 2112 /* BigIntLike */)) {
|
|
79360
79383
|
error(node.operand, ts.Diagnostics.Operator_0_cannot_be_applied_to_type_1, ts.tokenToString(node.operator), typeToString(getBaseTypeOfLiteralType(operandType)));
|
|
79361
79384
|
}
|
|
79362
79385
|
return numberType;
|
|
@@ -133132,11 +133155,11 @@ var ts;
|
|
|
133132
133155
|
var parent = walkUpParentheses(node.parent);
|
|
133133
133156
|
switch (parent.kind) {
|
|
133134
133157
|
case 196 /* LiteralType */: {
|
|
133135
|
-
var
|
|
133136
|
-
switch (
|
|
133158
|
+
var grandParent_1 = walkUpParentheses(parent.parent);
|
|
133159
|
+
switch (grandParent_1.kind) {
|
|
133160
|
+
case 228 /* ExpressionWithTypeArguments */:
|
|
133137
133161
|
case 178 /* TypeReference */: {
|
|
133138
|
-
var
|
|
133139
|
-
var typeArgument = ts.findAncestor(parent, function (n) { return n.parent === typeReference_1; });
|
|
133162
|
+
var typeArgument = ts.findAncestor(parent, function (n) { return n.parent === grandParent_1; });
|
|
133140
133163
|
if (typeArgument) {
|
|
133141
133164
|
return { kind: 2 /* Types */, types: getStringLiteralTypes(typeChecker.getTypeArgumentConstraint(typeArgument)), isNewIdentifier: false };
|
|
133142
133165
|
}
|
|
@@ -133149,7 +133172,7 @@ var ts;
|
|
|
133149
133172
|
// bar: string;
|
|
133150
133173
|
// }
|
|
133151
133174
|
// let x: Foo["/*completion position*/"]
|
|
133152
|
-
var _a =
|
|
133175
|
+
var _a = grandParent_1, indexType = _a.indexType, objectType = _a.objectType;
|
|
133153
133176
|
if (!ts.rangeContainsPosition(indexType, position)) {
|
|
133154
133177
|
return undefined;
|
|
133155
133178
|
}
|
|
@@ -133157,11 +133180,11 @@ var ts;
|
|
|
133157
133180
|
case 200 /* ImportType */:
|
|
133158
133181
|
return { kind: 0 /* Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker, preferences) };
|
|
133159
133182
|
case 187 /* UnionType */: {
|
|
133160
|
-
if (!ts.isTypeReferenceNode(
|
|
133183
|
+
if (!ts.isTypeReferenceNode(grandParent_1.parent)) {
|
|
133161
133184
|
return undefined;
|
|
133162
133185
|
}
|
|
133163
|
-
var alreadyUsedTypes_1 = getAlreadyUsedTypesInStringLiteralUnion(
|
|
133164
|
-
var types = getStringLiteralTypes(typeChecker.getTypeArgumentConstraint(
|
|
133186
|
+
var alreadyUsedTypes_1 = getAlreadyUsedTypesInStringLiteralUnion(grandParent_1, parent);
|
|
133187
|
+
var types = getStringLiteralTypes(typeChecker.getTypeArgumentConstraint(grandParent_1)).filter(function (t) { return !ts.contains(alreadyUsedTypes_1, t.value); });
|
|
133165
133188
|
return { kind: 2 /* Types */, types: types, isNewIdentifier: false };
|
|
133166
133189
|
}
|
|
133167
133190
|
default:
|
|
@@ -159772,7 +159795,7 @@ var ts;
|
|
|
159772
159795
|
// If there is more than one overload but no implementation signature
|
|
159773
159796
|
// (eg: an abstract method or interface declaration), there is a 1-1
|
|
159774
159797
|
// correspondence of declarations and signatures.
|
|
159775
|
-
var signatures =
|
|
159798
|
+
var signatures = type.isUnion() ? ts.flatMap(type.types, function (t) { return t.getCallSignatures(); }) : type.getCallSignatures();
|
|
159776
159799
|
if (!ts.some(signatures)) {
|
|
159777
159800
|
break;
|
|
159778
159801
|
}
|
|
@@ -162465,7 +162488,7 @@ var ts;
|
|
|
162465
162488
|
var savedPermittedJumps = permittedJumps;
|
|
162466
162489
|
switch (node.kind) {
|
|
162467
162490
|
case 239 /* IfStatement */:
|
|
162468
|
-
permittedJumps
|
|
162491
|
+
permittedJumps &= ~4 /* Return */;
|
|
162469
162492
|
break;
|
|
162470
162493
|
case 252 /* TryStatement */:
|
|
162471
162494
|
// forbid all jumps inside try blocks
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -89,7 +89,7 @@ var ts;
|
|
|
89
89
|
// The following is baselined as a literal template type without intervention
|
|
90
90
|
/** The version of the TypeScript compiler release */
|
|
91
91
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
92
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
92
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220720";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -13197,6 +13197,12 @@ var ts;
|
|
|
13197
13197
|
/**
|
|
13198
13198
|
* Gets the effective type parameters. If the node was parsed in a
|
|
13199
13199
|
* JavaScript file, gets the type parameters from the `@template` tag from JSDoc.
|
|
13200
|
+
*
|
|
13201
|
+
* This does *not* return type parameters from a jsdoc reference to a generic type, eg
|
|
13202
|
+
*
|
|
13203
|
+
* type Id = <T>(x: T) => T
|
|
13204
|
+
* /** @type {Id} /
|
|
13205
|
+
* function id(x) { return x }
|
|
13200
13206
|
*/
|
|
13201
13207
|
function getEffectiveTypeParameterDeclarations(node) {
|
|
13202
13208
|
if (ts.isJSDocSignature(node)) {
|
|
@@ -35457,6 +35463,9 @@ var ts;
|
|
|
35457
35463
|
var typeArguments = tryParse(parseTypeArgumentsInExpression);
|
|
35458
35464
|
if (typeArguments !== undefined) {
|
|
35459
35465
|
parseErrorAt(startPos, getNodePos(), ts.Diagnostics.super_may_not_use_type_arguments);
|
|
35466
|
+
if (!isTemplateStartOfTaggedTemplate()) {
|
|
35467
|
+
expression = factory.createExpressionWithTypeArguments(expression, typeArguments);
|
|
35468
|
+
}
|
|
35460
35469
|
}
|
|
35461
35470
|
}
|
|
35462
35471
|
if (token() === 20 /* OpenParenToken */ || token() === 24 /* DotToken */ || token() === 22 /* OpenBracketToken */) {
|
|
@@ -59174,6 +59183,9 @@ var ts;
|
|
|
59174
59183
|
else if (type.objectFlags & 32 /* Mapped */) {
|
|
59175
59184
|
resolveMappedTypeMembers(type);
|
|
59176
59185
|
}
|
|
59186
|
+
else {
|
|
59187
|
+
ts.Debug.fail("Unhandled object type " + ts.Debug.formatObjectFlags(type.objectFlags));
|
|
59188
|
+
}
|
|
59177
59189
|
}
|
|
59178
59190
|
else if (type.flags & 1048576 /* Union */) {
|
|
59179
59191
|
resolveUnionTypeMembers(type);
|
|
@@ -59181,6 +59193,9 @@ var ts;
|
|
|
59181
59193
|
else if (type.flags & 2097152 /* Intersection */) {
|
|
59182
59194
|
resolveIntersectionTypeMembers(type);
|
|
59183
59195
|
}
|
|
59196
|
+
else {
|
|
59197
|
+
ts.Debug.fail("Unhandled type " + ts.Debug.formatTypeFlags(type.flags));
|
|
59198
|
+
}
|
|
59184
59199
|
}
|
|
59185
59200
|
return type;
|
|
59186
59201
|
}
|
|
@@ -59972,12 +59987,15 @@ var ts;
|
|
|
59972
59987
|
// Return list of type parameters with duplicates removed (duplicate identifier errors are generated in the actual
|
|
59973
59988
|
// type checking functions).
|
|
59974
59989
|
function getTypeParametersFromDeclaration(declaration) {
|
|
59990
|
+
var _a;
|
|
59975
59991
|
var result;
|
|
59976
|
-
for (var _i = 0,
|
|
59977
|
-
var node =
|
|
59992
|
+
for (var _i = 0, _b = ts.getEffectiveTypeParameterDeclarations(declaration); _i < _b.length; _i++) {
|
|
59993
|
+
var node = _b[_i];
|
|
59978
59994
|
result = ts.appendIfUnique(result, getDeclaredTypeOfTypeParameter(node.symbol));
|
|
59979
59995
|
}
|
|
59980
|
-
return result
|
|
59996
|
+
return (result === null || result === void 0 ? void 0 : result.length) ? result
|
|
59997
|
+
: ts.isFunctionDeclaration(declaration) ? (_a = getSignatureOfTypeTag(declaration)) === null || _a === void 0 ? void 0 : _a.typeParameters
|
|
59998
|
+
: undefined;
|
|
59981
59999
|
}
|
|
59982
60000
|
function symbolsToArray(symbols) {
|
|
59983
60001
|
var result = [];
|
|
@@ -69198,15 +69216,11 @@ var ts;
|
|
|
69198
69216
|
inferFromTypeArguments(getTypeArguments(source), getTypeArguments(target), getVariances(source.target));
|
|
69199
69217
|
}
|
|
69200
69218
|
else if (source.flags & 4194304 /* Index */ && target.flags & 4194304 /* Index */) {
|
|
69201
|
-
|
|
69202
|
-
inferFromTypes(source.type, target.type);
|
|
69203
|
-
contravariant = !contravariant;
|
|
69219
|
+
inferFromContravariantTypes(source.type, target.type);
|
|
69204
69220
|
}
|
|
69205
69221
|
else if ((isLiteralType(source) || source.flags & 4 /* String */) && target.flags & 4194304 /* Index */) {
|
|
69206
69222
|
var empty = createEmptyObjectTypeFromStringLiteral(source);
|
|
69207
|
-
|
|
69208
|
-
inferWithPriority(empty, target.type, 256 /* LiteralKeyof */);
|
|
69209
|
-
contravariant = !contravariant;
|
|
69223
|
+
inferFromContravariantTypesWithPriority(empty, target.type, 256 /* LiteralKeyof */);
|
|
69210
69224
|
}
|
|
69211
69225
|
else if (source.flags & 8388608 /* IndexedAccess */ && target.flags & 8388608 /* IndexedAccess */) {
|
|
69212
69226
|
inferFromTypes(source.objectType, target.objectType);
|
|
@@ -69219,10 +69233,7 @@ var ts;
|
|
|
69219
69233
|
}
|
|
69220
69234
|
else if (source.flags & 33554432 /* Substitution */) {
|
|
69221
69235
|
inferFromTypes(source.baseType, target);
|
|
69222
|
-
|
|
69223
|
-
priority |= 4 /* SubstituteSource */;
|
|
69224
|
-
inferFromTypes(source.substitute, target); // Make substitute inference at a lower priority
|
|
69225
|
-
priority = oldPriority;
|
|
69236
|
+
inferWithPriority(source.substitute, target, 4 /* SubstituteSource */); // Make substitute inference at a lower priority
|
|
69226
69237
|
}
|
|
69227
69238
|
else if (target.flags & 16777216 /* Conditional */) {
|
|
69228
69239
|
invokeOnce(source, target, inferToConditionalType);
|
|
@@ -69272,6 +69283,18 @@ var ts;
|
|
|
69272
69283
|
inferFromTypes(source, target);
|
|
69273
69284
|
priority = savePriority;
|
|
69274
69285
|
}
|
|
69286
|
+
function inferFromContravariantTypesWithPriority(source, target, newPriority) {
|
|
69287
|
+
var savePriority = priority;
|
|
69288
|
+
priority |= newPriority;
|
|
69289
|
+
inferFromContravariantTypes(source, target);
|
|
69290
|
+
priority = savePriority;
|
|
69291
|
+
}
|
|
69292
|
+
function inferToMultipleTypesWithPriority(source, targets, targetFlags, newPriority) {
|
|
69293
|
+
var savePriority = priority;
|
|
69294
|
+
priority |= newPriority;
|
|
69295
|
+
inferToMultipleTypes(source, targets, targetFlags);
|
|
69296
|
+
priority = savePriority;
|
|
69297
|
+
}
|
|
69275
69298
|
function invokeOnce(source, target, action) {
|
|
69276
69299
|
var key = source.id + "," + target.id;
|
|
69277
69300
|
var status = visited && visited.get(key);
|
|
@@ -69336,10 +69359,13 @@ var ts;
|
|
|
69336
69359
|
}
|
|
69337
69360
|
}
|
|
69338
69361
|
function inferFromContravariantTypes(source, target) {
|
|
69362
|
+
contravariant = !contravariant;
|
|
69363
|
+
inferFromTypes(source, target);
|
|
69364
|
+
contravariant = !contravariant;
|
|
69365
|
+
}
|
|
69366
|
+
function inferFromContravariantTypesIfStrictFunctionTypes(source, target) {
|
|
69339
69367
|
if (strictFunctionTypes || priority & 1024 /* AlwaysStrict */) {
|
|
69340
|
-
|
|
69341
|
-
inferFromTypes(source, target);
|
|
69342
|
-
contravariant = !contravariant;
|
|
69368
|
+
inferFromContravariantTypes(source, target);
|
|
69343
69369
|
}
|
|
69344
69370
|
else {
|
|
69345
69371
|
inferFromTypes(source, target);
|
|
@@ -69503,11 +69529,8 @@ var ts;
|
|
|
69503
69529
|
inferFromTypes(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target));
|
|
69504
69530
|
}
|
|
69505
69531
|
else {
|
|
69506
|
-
var savePriority = priority;
|
|
69507
|
-
priority |= contravariant ? 64 /* ContravariantConditional */ : 0;
|
|
69508
69532
|
var targetTypes = [getTrueTypeFromConditionalType(target), getFalseTypeFromConditionalType(target)];
|
|
69509
|
-
|
|
69510
|
-
priority = savePriority;
|
|
69533
|
+
inferToMultipleTypesWithPriority(source, targetTypes, target.flags, contravariant ? 64 /* ContravariantConditional */ : 0);
|
|
69511
69534
|
}
|
|
69512
69535
|
}
|
|
69513
69536
|
function inferToTemplateLiteralType(source, target) {
|
|
@@ -69693,7 +69716,7 @@ var ts;
|
|
|
69693
69716
|
var kind = target.declaration ? target.declaration.kind : 0 /* Unknown */;
|
|
69694
69717
|
// Once we descend into a bivariant signature we remain bivariant for all nested inferences
|
|
69695
69718
|
bivariant = bivariant || kind === 169 /* MethodDeclaration */ || kind === 168 /* MethodSignature */ || kind === 171 /* Constructor */;
|
|
69696
|
-
applyToParameterTypes(source, target,
|
|
69719
|
+
applyToParameterTypes(source, target, inferFromContravariantTypesIfStrictFunctionTypes);
|
|
69697
69720
|
bivariant = saveBivariant;
|
|
69698
69721
|
applyToReturnTypes(source, target, inferFromTypes);
|
|
69699
69722
|
}
|
|
@@ -71146,7 +71169,7 @@ var ts;
|
|
|
71146
71169
|
}
|
|
71147
71170
|
// for (const _ in ref) acts as a nonnull on ref
|
|
71148
71171
|
if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 243 /* ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) {
|
|
71149
|
-
return getNonNullableTypeIfNeeded(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent)));
|
|
71172
|
+
return getNonNullableTypeIfNeeded(finalizeEvolvingArrayType(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent))));
|
|
71150
71173
|
}
|
|
71151
71174
|
// Assignment doesn't affect reference
|
|
71152
71175
|
return undefined;
|
|
@@ -76735,7 +76758,7 @@ var ts;
|
|
|
76735
76758
|
var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node);
|
|
76736
76759
|
var reportErrors = !candidatesOutArray;
|
|
76737
76760
|
var typeArguments;
|
|
76738
|
-
if (!isDecorator) {
|
|
76761
|
+
if (!isDecorator && !ts.isSuperCall(node)) {
|
|
76739
76762
|
typeArguments = node.typeArguments;
|
|
76740
76763
|
// We already perform checking on the type arguments on the class declaration itself.
|
|
76741
76764
|
if (isTaggedTemplate || isJsxOpeningOrSelfClosingElement || node.expression.kind !== 106 /* SuperKeyword */) {
|
|
@@ -79151,7 +79174,7 @@ var ts;
|
|
|
79151
79174
|
error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator));
|
|
79152
79175
|
}
|
|
79153
79176
|
if (node.operator === 39 /* PlusToken */) {
|
|
79154
|
-
if (
|
|
79177
|
+
if (maybeTypeOfKindConsideringBaseConstraint(operandType, 2112 /* BigIntLike */)) {
|
|
79155
79178
|
error(node.operand, ts.Diagnostics.Operator_0_cannot_be_applied_to_type_1, ts.tokenToString(node.operator), typeToString(getBaseTypeOfLiteralType(operandType)));
|
|
79156
79179
|
}
|
|
79157
79180
|
return numberType;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "typescript",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "4.8.0-dev.
|
|
5
|
+
"version": "4.8.0-dev.20220720",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|