@typescript-deploys/pr-build 5.5.0-pr-57465-17 → 5.5.0-pr-57395-9
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 +185 -103
- package/lib/tsserver.js +192 -104
- package/lib/typescript.js +192 -104
- package/lib/typingsInstaller.js +4 -2
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.5";
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20240222`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -7810,7 +7810,9 @@ var Diagnostics = {
|
|
|
7810
7810
|
Compiler_option_0_cannot_be_given_an_empty_string: diag(18051, 1 /* Error */, "Compiler_option_0_cannot_be_given_an_empty_string_18051", "Compiler option '{0}' cannot be given an empty string."),
|
|
7811
7811
|
Non_abstract_class_0_does_not_implement_all_abstract_members_of_1: diag(18052, 1 /* Error */, "Non_abstract_class_0_does_not_implement_all_abstract_members_of_1_18052", "Non-abstract class '{0}' does not implement all abstract members of '{1}'"),
|
|
7812
7812
|
Its_type_0_is_not_a_valid_JSX_element_type: diag(18053, 1 /* Error */, "Its_type_0_is_not_a_valid_JSX_element_type_18053", "Its type '{0}' is not a valid JSX element type."),
|
|
7813
|
-
await_using_statements_cannot_be_used_inside_a_class_static_block: diag(18054, 1 /* Error */, "await_using_statements_cannot_be_used_inside_a_class_static_block_18054", "'await using' statements cannot be used inside a class static block.")
|
|
7813
|
+
await_using_statements_cannot_be_used_inside_a_class_static_block: diag(18054, 1 /* Error */, "await_using_statements_cannot_be_used_inside_a_class_static_block_18054", "'await using' statements cannot be used inside a class static block."),
|
|
7814
|
+
There_is_no_signature_in_type_0_such_that_its_parameters_are_assignable_to_the_parameters_of_signature_1: diag(18055, 1 /* Error */, "There_is_no_signature_in_type_0_such_that_its_parameters_are_assignable_to_the_parameters_of_signatu_18055", "There is no signature in type {0} such that its parameters are assignable to the parameters of signature {1}"),
|
|
7815
|
+
Parameters_of_signature_0_are_not_assignable_to_the_parameters_of_any_signature_in_type_1: diag(18056, 1 /* Error */, "Parameters_of_signature_0_are_not_assignable_to_the_parameters_of_any_signature_in_type_1_18056", "Parameters of signature {0} are not assignable to the parameters of any signature in type {1}")
|
|
7814
7816
|
};
|
|
7815
7817
|
|
|
7816
7818
|
// src/compiler/scanner.ts
|
|
@@ -43669,6 +43671,8 @@ function createTypeChecker(host) {
|
|
|
43669
43671
|
var lastGetCombinedNodeFlagsResult = 0 /* None */;
|
|
43670
43672
|
var lastGetCombinedModifierFlagsNode;
|
|
43671
43673
|
var lastGetCombinedModifierFlagsResult = 0 /* None */;
|
|
43674
|
+
var checkTypeRelatedToDepth = 0;
|
|
43675
|
+
var checkTypeRelatedToCurrentlyVisitingMap;
|
|
43672
43676
|
const checker = {
|
|
43673
43677
|
getNodeCount: () => reduceLeft(host.getSourceFiles(), (n, s) => n + s.nodeCount, 0),
|
|
43674
43678
|
getIdentifierCount: () => reduceLeft(host.getSourceFiles(), (n, s) => n + s.identifierCount, 0),
|
|
@@ -45552,7 +45556,7 @@ function createTypeChecker(host) {
|
|
|
45552
45556
|
if (nameNotFoundMessage) {
|
|
45553
45557
|
addLazyDiagnostic(() => {
|
|
45554
45558
|
var _a2;
|
|
45555
|
-
if (errorLocation && (meaning & 2 /* BlockScopedVariable */ || (meaning & 32 /* Class */ || meaning & 384 /* Enum */) && (meaning & 111551 /* Value */) === 111551 /* Value */)) {
|
|
45559
|
+
if (result && errorLocation && (meaning & 2 /* BlockScopedVariable */ || (meaning & 32 /* Class */ || meaning & 384 /* Enum */) && (meaning & 111551 /* Value */) === 111551 /* Value */)) {
|
|
45556
45560
|
const exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result);
|
|
45557
45561
|
if (exportOrLocalSymbol.flags & 2 /* BlockScopedVariable */ || exportOrLocalSymbol.flags & 32 /* Class */ || exportOrLocalSymbol.flags & 384 /* Enum */) {
|
|
45558
45562
|
checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation);
|
|
@@ -56016,15 +56020,7 @@ function createTypeChecker(host) {
|
|
|
56016
56020
|
jsdocPredicate = getTypePredicateOfSignature(jsdocSignature);
|
|
56017
56021
|
}
|
|
56018
56022
|
}
|
|
56019
|
-
|
|
56020
|
-
signature.resolvedTypePredicate = type && isTypePredicateNode(type) ? createTypePredicateFromTypePredicateNode(type, signature) : jsdocPredicate || noTypePredicate;
|
|
56021
|
-
} else if (signature.declaration && isFunctionLikeDeclaration(signature.declaration) && (!signature.resolvedReturnType || signature.resolvedReturnType === booleanType)) {
|
|
56022
|
-
const { declaration } = signature;
|
|
56023
|
-
signature.resolvedTypePredicate = noTypePredicate;
|
|
56024
|
-
signature.resolvedTypePredicate = getTypePredicateFromBody(declaration, signature) || noTypePredicate;
|
|
56025
|
-
} else {
|
|
56026
|
-
signature.resolvedTypePredicate = noTypePredicate;
|
|
56027
|
-
}
|
|
56023
|
+
signature.resolvedTypePredicate = type && isTypePredicateNode(type) ? createTypePredicateFromTypePredicateNode(type, signature) : jsdocPredicate || noTypePredicate;
|
|
56028
56024
|
}
|
|
56029
56025
|
Debug.assert(!!signature.resolvedTypePredicate);
|
|
56030
56026
|
}
|
|
@@ -60609,7 +60605,7 @@ function createTypeChecker(host) {
|
|
|
60609
60605
|
}
|
|
60610
60606
|
return false;
|
|
60611
60607
|
}
|
|
60612
|
-
function compareSignaturesRelated(source, target, checkMode, reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) {
|
|
60608
|
+
function compareSignaturesRelated(source, target, checkMode, reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers, compareTypesUnilaterally = false) {
|
|
60613
60609
|
if (source === target) {
|
|
60614
60610
|
return -1 /* True */;
|
|
60615
60611
|
}
|
|
@@ -60674,12 +60670,21 @@ function createTypeChecker(host) {
|
|
|
60674
60670
|
const sourceSig = checkMode & 3 /* Callback */ || isInstantiatedGenericParameter(source, i) ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
|
|
60675
60671
|
const targetSig = checkMode & 3 /* Callback */ || isInstantiatedGenericParameter(target, i) ? void 0 : getSingleCallSignature(getNonNullableType(targetType));
|
|
60676
60672
|
const callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) && getTypeFacts(sourceType, 50331648 /* IsUndefinedOrNull */) === getTypeFacts(targetType, 50331648 /* IsUndefinedOrNull */);
|
|
60677
|
-
let related
|
|
60678
|
-
|
|
60679
|
-
|
|
60680
|
-
|
|
60681
|
-
|
|
60682
|
-
|
|
60673
|
+
let related;
|
|
60674
|
+
if (callbacks) {
|
|
60675
|
+
related = compareSignaturesRelated(targetSig, sourceSig, checkMode & 8 /* StrictArity */ | (strictVariance ? 2 /* StrictCallback */ : 1 /* BivariantCallback */), reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers);
|
|
60676
|
+
} else {
|
|
60677
|
+
if (!compareTypesUnilaterally) {
|
|
60678
|
+
related = !(checkMode & 3 /* Callback */) && !strictVariance && compareTypes(
|
|
60679
|
+
sourceType,
|
|
60680
|
+
targetType,
|
|
60681
|
+
/*reportErrors*/
|
|
60682
|
+
false
|
|
60683
|
+
) || compareTypes(targetType, sourceType, reportErrors2);
|
|
60684
|
+
} else {
|
|
60685
|
+
related = compareTypes(sourceType, targetType, reportErrors2);
|
|
60686
|
+
}
|
|
60687
|
+
}
|
|
60683
60688
|
if (related && checkMode & 8 /* StrictArity */ && i >= getMinArgumentCount(source) && i < getMinArgumentCount(target) && compareTypes(
|
|
60684
60689
|
sourceType,
|
|
60685
60690
|
targetType,
|
|
@@ -60998,6 +61003,33 @@ function createTypeChecker(host) {
|
|
|
60998
61003
|
let incompatibleStack;
|
|
60999
61004
|
let relationCount = 16e6 - relation.size >> 3;
|
|
61000
61005
|
Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking");
|
|
61006
|
+
const visitingKey = getRelationKey(
|
|
61007
|
+
source,
|
|
61008
|
+
target,
|
|
61009
|
+
/*intersectionState*/
|
|
61010
|
+
0 /* None */,
|
|
61011
|
+
relation,
|
|
61012
|
+
/*ignoreConstraints*/
|
|
61013
|
+
false
|
|
61014
|
+
);
|
|
61015
|
+
if (checkTypeRelatedToDepth === 0) {
|
|
61016
|
+
checkTypeRelatedToCurrentlyVisitingMap = /* @__PURE__ */ new Map();
|
|
61017
|
+
}
|
|
61018
|
+
if (!errorNode && !headMessage) {
|
|
61019
|
+
let got = checkTypeRelatedToCurrentlyVisitingMap.get(visitingKey);
|
|
61020
|
+
const maxSameKey = 1;
|
|
61021
|
+
if (got && got >= maxSameKey) {
|
|
61022
|
+
relation.set(visitingKey, 1 /* Succeeded */);
|
|
61023
|
+
return true;
|
|
61024
|
+
} else {
|
|
61025
|
+
if (!got)
|
|
61026
|
+
got = 1;
|
|
61027
|
+
else
|
|
61028
|
+
got = got + 1;
|
|
61029
|
+
checkTypeRelatedToCurrentlyVisitingMap.set(visitingKey, got);
|
|
61030
|
+
}
|
|
61031
|
+
}
|
|
61032
|
+
checkTypeRelatedToDepth++;
|
|
61001
61033
|
const result = isRelatedTo(
|
|
61002
61034
|
source,
|
|
61003
61035
|
target,
|
|
@@ -61065,6 +61097,18 @@ function createTypeChecker(host) {
|
|
|
61065
61097
|
if (errorNode && errorOutputContainer && errorOutputContainer.skipLogging && result === 0 /* False */) {
|
|
61066
61098
|
Debug.assert(!!errorOutputContainer.errors, "missed opportunity to interact with error.");
|
|
61067
61099
|
}
|
|
61100
|
+
checkTypeRelatedToDepth--;
|
|
61101
|
+
if (checkTypeRelatedToDepth === 0) {
|
|
61102
|
+
checkTypeRelatedToCurrentlyVisitingMap = void 0;
|
|
61103
|
+
} else {
|
|
61104
|
+
const got = checkTypeRelatedToCurrentlyVisitingMap.get(visitingKey);
|
|
61105
|
+
if (got) {
|
|
61106
|
+
if (got === 1)
|
|
61107
|
+
checkTypeRelatedToCurrentlyVisitingMap.delete(visitingKey);
|
|
61108
|
+
else
|
|
61109
|
+
checkTypeRelatedToCurrentlyVisitingMap.set(visitingKey, got - 1);
|
|
61110
|
+
}
|
|
61111
|
+
}
|
|
61068
61112
|
return result !== 0 /* False */;
|
|
61069
61113
|
function resetErrorInfo(saved) {
|
|
61070
61114
|
errorInfo = saved.errorInfo;
|
|
@@ -61551,6 +61595,112 @@ function createTypeChecker(host) {
|
|
|
61551
61595
|
function shouldCheckAsExcessProperty(prop, container) {
|
|
61552
61596
|
return prop.valueDeclaration && container.valueDeclaration && prop.valueDeclaration.parent === container.valueDeclaration;
|
|
61553
61597
|
}
|
|
61598
|
+
function checkOverloadsRelatedToIntersection(source2, target2, _reportErrors) {
|
|
61599
|
+
const sourceSignatures = getSignaturesOfType(source2, 0 /* Call */);
|
|
61600
|
+
const constructSignatureToString = (signature, forceReturnType) => {
|
|
61601
|
+
const origReturnType = signature.resolvedReturnType;
|
|
61602
|
+
signature.resolvedReturnType = forceReturnType;
|
|
61603
|
+
const str = signatureToString(
|
|
61604
|
+
signature,
|
|
61605
|
+
/*enclosingDeclaration*/
|
|
61606
|
+
void 0,
|
|
61607
|
+
262144 /* WriteArrowStyleSignature */,
|
|
61608
|
+
0 /* Call */
|
|
61609
|
+
);
|
|
61610
|
+
signature.resolvedReturnType = origReturnType;
|
|
61611
|
+
return str;
|
|
61612
|
+
};
|
|
61613
|
+
const mapAssignedToBy = /* @__PURE__ */ new Map();
|
|
61614
|
+
const failed = sourceSignatures.some((ssig, _si) => {
|
|
61615
|
+
if (getReturnTypeOfSignature(ssig) === neverType)
|
|
61616
|
+
return false;
|
|
61617
|
+
const accum = {
|
|
61618
|
+
hadMatch: false,
|
|
61619
|
+
gReturn: neverType,
|
|
61620
|
+
gReturnAllVoid: true
|
|
61621
|
+
};
|
|
61622
|
+
const matchedTargetSigs = [];
|
|
61623
|
+
target2.types.forEach((targetMember, _tti) => {
|
|
61624
|
+
const targetSignatures = getSignaturesOfType(targetMember, 0 /* Call */);
|
|
61625
|
+
targetSignatures.forEach((tsig, _ti) => {
|
|
61626
|
+
const targetReturnType = getReturnTypeOfSignature(tsig);
|
|
61627
|
+
if (compareSignaturesRelated(
|
|
61628
|
+
ssig,
|
|
61629
|
+
tsig,
|
|
61630
|
+
0 /* None */ | 4 /* IgnoreReturnTypes */,
|
|
61631
|
+
/*reportErrors*/
|
|
61632
|
+
false,
|
|
61633
|
+
/*errorReporter*/
|
|
61634
|
+
void 0,
|
|
61635
|
+
/*incompatibleErrorReporter*/
|
|
61636
|
+
void 0,
|
|
61637
|
+
compareTypesIdentical,
|
|
61638
|
+
// compareTypesAssignable,
|
|
61639
|
+
/*reportUnreliableMarkers*/
|
|
61640
|
+
void 0,
|
|
61641
|
+
/*compareTypesUnilaterally*/
|
|
61642
|
+
true
|
|
61643
|
+
) === -1 /* True */) {
|
|
61644
|
+
accum.hadMatch = true;
|
|
61645
|
+
if (targetReturnType !== voidType) {
|
|
61646
|
+
accum.gReturn = getUnionType([accum.gReturn, targetReturnType]);
|
|
61647
|
+
accum.gReturnAllVoid = false;
|
|
61648
|
+
}
|
|
61649
|
+
matchedTargetSigs.push(tsig);
|
|
61650
|
+
let mtti = mapAssignedToBy.get(_tti);
|
|
61651
|
+
if (!mtti) {
|
|
61652
|
+
mtti = /* @__PURE__ */ new Map();
|
|
61653
|
+
mapAssignedToBy.set(_tti, mtti);
|
|
61654
|
+
}
|
|
61655
|
+
const setsi = mtti.get(_ti);
|
|
61656
|
+
if (!setsi) {
|
|
61657
|
+
mtti.set(_ti, true);
|
|
61658
|
+
}
|
|
61659
|
+
}
|
|
61660
|
+
});
|
|
61661
|
+
});
|
|
61662
|
+
if (!accum.hadMatch) {
|
|
61663
|
+
if (_reportErrors) {
|
|
61664
|
+
resetErrorInfo({ skipParentCounter: 0 });
|
|
61665
|
+
reportError(Diagnostics.Parameters_of_signature_0_are_not_assignable_to_the_parameters_of_any_signature_in_type_1, constructSignatureToString(ssig), typeToString(target2));
|
|
61666
|
+
}
|
|
61667
|
+
return true;
|
|
61668
|
+
} else {
|
|
61669
|
+
const returnType = getReturnTypeOfSignature(ssig);
|
|
61670
|
+
if (!accum.gReturnAllVoid && !isTypeAssignableTo(returnType, accum.gReturn)) {
|
|
61671
|
+
if (_reportErrors) {
|
|
61672
|
+
resetErrorInfo({ skipParentCounter: 0 });
|
|
61673
|
+
reportError(Diagnostics.Type_0_is_not_assignable_to_type_1, typeToString(returnType), typeToString(accum.gReturn));
|
|
61674
|
+
const strset = /* @__PURE__ */ new Set();
|
|
61675
|
+
matchedTargetSigs.forEach((tsig) => strset.add(constructSignatureToString(tsig)));
|
|
61676
|
+
const strarr = [];
|
|
61677
|
+
strset.forEach((tstr) => strarr.push(tstr));
|
|
61678
|
+
reportError(Diagnostics.Type_0_is_not_assignable_to_type_1, constructSignatureToString(ssig), strarr.join(" | "));
|
|
61679
|
+
}
|
|
61680
|
+
return true;
|
|
61681
|
+
}
|
|
61682
|
+
}
|
|
61683
|
+
});
|
|
61684
|
+
if (failed)
|
|
61685
|
+
return { computed: true, ternary: 0 /* False */ };
|
|
61686
|
+
const failed2 = target2.types.some((targetMember, _tti) => {
|
|
61687
|
+
const mtti = mapAssignedToBy.get(_tti);
|
|
61688
|
+
const targetSignatures = getSignaturesOfType(targetMember, 0 /* Call */);
|
|
61689
|
+
return targetSignatures.some((tsig, _ti) => {
|
|
61690
|
+
if (!mtti || !mtti.get(_ti)) {
|
|
61691
|
+
if (_reportErrors) {
|
|
61692
|
+
resetErrorInfo({ skipParentCounter: 0 });
|
|
61693
|
+
reportError(Diagnostics.There_is_no_signature_in_type_0_such_that_its_parameters_are_assignable_to_the_parameters_of_signature_1, typeToString(source2), constructSignatureToString(tsig, anyType));
|
|
61694
|
+
reportError(Diagnostics.Type_0_is_not_assignable_to_type_1, typeToString(source2), typeToString(targetMember));
|
|
61695
|
+
}
|
|
61696
|
+
return true;
|
|
61697
|
+
}
|
|
61698
|
+
});
|
|
61699
|
+
});
|
|
61700
|
+
if (failed2)
|
|
61701
|
+
return { computed: true, ternary: 0 /* False */ };
|
|
61702
|
+
return { computed: true, ternary: -1 /* True */ };
|
|
61703
|
+
}
|
|
61554
61704
|
function unionOrIntersectionRelatedTo(source2, target2, reportErrors2, intersectionState) {
|
|
61555
61705
|
if (source2.flags & 1048576 /* Union */) {
|
|
61556
61706
|
if (target2.flags & 1048576 /* Union */) {
|
|
@@ -61569,7 +61719,22 @@ function createTypeChecker(host) {
|
|
|
61569
61719
|
return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */) && !(target2.flags & 402784252 /* Primitive */), intersectionState);
|
|
61570
61720
|
}
|
|
61571
61721
|
if (target2.flags & 2097152 /* Intersection */) {
|
|
61572
|
-
|
|
61722
|
+
const result1 = typeRelatedToEachType(source2, target2, reportErrors2, 2 /* Target */);
|
|
61723
|
+
if (result1 === 0 /* False */) {
|
|
61724
|
+
const sourceSignatures = getSignaturesOfType(source2, 0 /* Call */);
|
|
61725
|
+
if (sourceSignatures.every((sourceSig) => {
|
|
61726
|
+
return !sourceSig.typeParameters;
|
|
61727
|
+
})) {
|
|
61728
|
+
if (source2.flags & 524288 /* Object */ && getSignaturesOfType(source2, 0 /* Call */).length > 1) {
|
|
61729
|
+
const { computed, ternary } = checkOverloadsRelatedToIntersection(source2, target2, reportErrors2);
|
|
61730
|
+
if (computed) {
|
|
61731
|
+
Debug.assert(ternary === -1 /* True */ || ternary === 0 /* False */);
|
|
61732
|
+
return ternary;
|
|
61733
|
+
}
|
|
61734
|
+
}
|
|
61735
|
+
}
|
|
61736
|
+
}
|
|
61737
|
+
return result1;
|
|
61573
61738
|
}
|
|
61574
61739
|
if (relation === comparableRelation && target2.flags & 402784252 /* Primitive */) {
|
|
61575
61740
|
const constraints = sameMap(source2.types, (t) => t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(t) || unknownType : t);
|
|
@@ -74433,89 +74598,6 @@ function createTypeChecker(host) {
|
|
|
74433
74598
|
return false;
|
|
74434
74599
|
}
|
|
74435
74600
|
}
|
|
74436
|
-
function getTypePredicateFromBody(func, _sig) {
|
|
74437
|
-
const functionFlags = getFunctionFlags(func);
|
|
74438
|
-
if (functionFlags !== 0 /* Normal */)
|
|
74439
|
-
return void 0;
|
|
74440
|
-
let singleReturn;
|
|
74441
|
-
if (func.body && func.body.kind !== 241 /* Block */) {
|
|
74442
|
-
singleReturn = func.body;
|
|
74443
|
-
} else {
|
|
74444
|
-
if (functionHasImplicitReturn(func))
|
|
74445
|
-
return void 0;
|
|
74446
|
-
const bailedEarly = forEachReturnStatement(func.body, (returnStatement) => {
|
|
74447
|
-
if (singleReturn || !returnStatement.expression)
|
|
74448
|
-
return true;
|
|
74449
|
-
singleReturn = returnStatement.expression;
|
|
74450
|
-
});
|
|
74451
|
-
if (bailedEarly || !singleReturn)
|
|
74452
|
-
return void 0;
|
|
74453
|
-
}
|
|
74454
|
-
const predicate = checkIfExpressionRefinesAnyParameter(singleReturn);
|
|
74455
|
-
if (predicate) {
|
|
74456
|
-
const [i, type] = predicate;
|
|
74457
|
-
const param = func.parameters[i];
|
|
74458
|
-
if (isIdentifier(param.name)) {
|
|
74459
|
-
return createTypePredicate(1 /* Identifier */, param.name.escapedText, i, type);
|
|
74460
|
-
}
|
|
74461
|
-
}
|
|
74462
|
-
return void 0;
|
|
74463
|
-
function checkIfExpressionRefinesAnyParameter(expr) {
|
|
74464
|
-
expr = skipParentheses(
|
|
74465
|
-
expr,
|
|
74466
|
-
/*excludeJSDocTypeAssertions*/
|
|
74467
|
-
true
|
|
74468
|
-
);
|
|
74469
|
-
const type = checkExpressionCached(expr, 64 /* TypeOnly */);
|
|
74470
|
-
if (type !== booleanType || !func.body)
|
|
74471
|
-
return void 0;
|
|
74472
|
-
return forEach(func.parameters, (param, i) => {
|
|
74473
|
-
const initType = getSymbolLinks(param.symbol).type;
|
|
74474
|
-
if (!initType || initType === booleanType || isSymbolAssigned(param.symbol)) {
|
|
74475
|
-
return;
|
|
74476
|
-
}
|
|
74477
|
-
const trueType2 = checkIfExpressionRefinesParameter(
|
|
74478
|
-
expr,
|
|
74479
|
-
param,
|
|
74480
|
-
initType,
|
|
74481
|
-
/*forceFullCheck*/
|
|
74482
|
-
false
|
|
74483
|
-
);
|
|
74484
|
-
if (trueType2) {
|
|
74485
|
-
const trueSubtype = checkIfExpressionRefinesParameter(
|
|
74486
|
-
expr,
|
|
74487
|
-
param,
|
|
74488
|
-
trueType2,
|
|
74489
|
-
/*forceFullCheck*/
|
|
74490
|
-
true
|
|
74491
|
-
);
|
|
74492
|
-
if (trueSubtype) {
|
|
74493
|
-
return [i, trueType2];
|
|
74494
|
-
}
|
|
74495
|
-
}
|
|
74496
|
-
});
|
|
74497
|
-
}
|
|
74498
|
-
function checkIfExpressionRefinesParameter(expr, param, initType, forceFullCheck) {
|
|
74499
|
-
const antecedent = expr.flowNode ?? { flags: 2 /* Start */ };
|
|
74500
|
-
const trueCondition = {
|
|
74501
|
-
flags: 32 /* TrueCondition */,
|
|
74502
|
-
node: expr,
|
|
74503
|
-
antecedent
|
|
74504
|
-
};
|
|
74505
|
-
const trueType2 = getFlowTypeOfReference(param.name, initType, initType, func, trueCondition);
|
|
74506
|
-
if (trueType2 === initType && !forceFullCheck)
|
|
74507
|
-
return void 0;
|
|
74508
|
-
const falseCondition = {
|
|
74509
|
-
...trueCondition,
|
|
74510
|
-
flags: 64 /* FalseCondition */
|
|
74511
|
-
};
|
|
74512
|
-
const falseType2 = getFlowTypeOfReference(param.name, initType, initType, func, falseCondition);
|
|
74513
|
-
const candidateFalse = filterType(initType, (t) => !isTypeSubtypeOf(t, trueType2));
|
|
74514
|
-
if (isTypeIdenticalTo(candidateFalse, falseType2)) {
|
|
74515
|
-
return trueType2;
|
|
74516
|
-
}
|
|
74517
|
-
}
|
|
74518
|
-
}
|
|
74519
74601
|
function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func, returnType) {
|
|
74520
74602
|
addLazyDiagnostic(checkAllCodePathsInNonVoidFunctionReturnOrThrowDiagnostics);
|
|
74521
74603
|
return;
|
package/lib/tsserver.js
CHANGED
|
@@ -2341,7 +2341,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2341
2341
|
|
|
2342
2342
|
// src/compiler/corePublic.ts
|
|
2343
2343
|
var versionMajorMinor = "5.5";
|
|
2344
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2344
|
+
var version = `${versionMajorMinor}.0-insiders.20240222`;
|
|
2345
2345
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2346
2346
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2347
2347
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -11378,7 +11378,9 @@ var Diagnostics = {
|
|
|
11378
11378
|
Compiler_option_0_cannot_be_given_an_empty_string: diag(18051, 1 /* Error */, "Compiler_option_0_cannot_be_given_an_empty_string_18051", "Compiler option '{0}' cannot be given an empty string."),
|
|
11379
11379
|
Non_abstract_class_0_does_not_implement_all_abstract_members_of_1: diag(18052, 1 /* Error */, "Non_abstract_class_0_does_not_implement_all_abstract_members_of_1_18052", "Non-abstract class '{0}' does not implement all abstract members of '{1}'"),
|
|
11380
11380
|
Its_type_0_is_not_a_valid_JSX_element_type: diag(18053, 1 /* Error */, "Its_type_0_is_not_a_valid_JSX_element_type_18053", "Its type '{0}' is not a valid JSX element type."),
|
|
11381
|
-
await_using_statements_cannot_be_used_inside_a_class_static_block: diag(18054, 1 /* Error */, "await_using_statements_cannot_be_used_inside_a_class_static_block_18054", "'await using' statements cannot be used inside a class static block.")
|
|
11381
|
+
await_using_statements_cannot_be_used_inside_a_class_static_block: diag(18054, 1 /* Error */, "await_using_statements_cannot_be_used_inside_a_class_static_block_18054", "'await using' statements cannot be used inside a class static block."),
|
|
11382
|
+
There_is_no_signature_in_type_0_such_that_its_parameters_are_assignable_to_the_parameters_of_signature_1: diag(18055, 1 /* Error */, "There_is_no_signature_in_type_0_such_that_its_parameters_are_assignable_to_the_parameters_of_signatu_18055", "There is no signature in type {0} such that its parameters are assignable to the parameters of signature {1}"),
|
|
11383
|
+
Parameters_of_signature_0_are_not_assignable_to_the_parameters_of_any_signature_in_type_1: diag(18056, 1 /* Error */, "Parameters_of_signature_0_are_not_assignable_to_the_parameters_of_any_signature_in_type_1_18056", "Parameters of signature {0} are not assignable to the parameters of any signature in type {1}")
|
|
11382
11384
|
};
|
|
11383
11385
|
|
|
11384
11386
|
// src/compiler/scanner.ts
|
|
@@ -48414,6 +48416,8 @@ function createTypeChecker(host) {
|
|
|
48414
48416
|
var lastGetCombinedNodeFlagsResult = 0 /* None */;
|
|
48415
48417
|
var lastGetCombinedModifierFlagsNode;
|
|
48416
48418
|
var lastGetCombinedModifierFlagsResult = 0 /* None */;
|
|
48419
|
+
var checkTypeRelatedToDepth = 0;
|
|
48420
|
+
var checkTypeRelatedToCurrentlyVisitingMap;
|
|
48417
48421
|
const checker = {
|
|
48418
48422
|
getNodeCount: () => reduceLeft(host.getSourceFiles(), (n, s) => n + s.nodeCount, 0),
|
|
48419
48423
|
getIdentifierCount: () => reduceLeft(host.getSourceFiles(), (n, s) => n + s.identifierCount, 0),
|
|
@@ -50297,7 +50301,7 @@ function createTypeChecker(host) {
|
|
|
50297
50301
|
if (nameNotFoundMessage) {
|
|
50298
50302
|
addLazyDiagnostic(() => {
|
|
50299
50303
|
var _a2;
|
|
50300
|
-
if (errorLocation && (meaning & 2 /* BlockScopedVariable */ || (meaning & 32 /* Class */ || meaning & 384 /* Enum */) && (meaning & 111551 /* Value */) === 111551 /* Value */)) {
|
|
50304
|
+
if (result && errorLocation && (meaning & 2 /* BlockScopedVariable */ || (meaning & 32 /* Class */ || meaning & 384 /* Enum */) && (meaning & 111551 /* Value */) === 111551 /* Value */)) {
|
|
50301
50305
|
const exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result);
|
|
50302
50306
|
if (exportOrLocalSymbol.flags & 2 /* BlockScopedVariable */ || exportOrLocalSymbol.flags & 32 /* Class */ || exportOrLocalSymbol.flags & 384 /* Enum */) {
|
|
50303
50307
|
checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation);
|
|
@@ -60761,15 +60765,7 @@ function createTypeChecker(host) {
|
|
|
60761
60765
|
jsdocPredicate = getTypePredicateOfSignature(jsdocSignature);
|
|
60762
60766
|
}
|
|
60763
60767
|
}
|
|
60764
|
-
|
|
60765
|
-
signature.resolvedTypePredicate = type && isTypePredicateNode(type) ? createTypePredicateFromTypePredicateNode(type, signature) : jsdocPredicate || noTypePredicate;
|
|
60766
|
-
} else if (signature.declaration && isFunctionLikeDeclaration(signature.declaration) && (!signature.resolvedReturnType || signature.resolvedReturnType === booleanType)) {
|
|
60767
|
-
const { declaration } = signature;
|
|
60768
|
-
signature.resolvedTypePredicate = noTypePredicate;
|
|
60769
|
-
signature.resolvedTypePredicate = getTypePredicateFromBody(declaration, signature) || noTypePredicate;
|
|
60770
|
-
} else {
|
|
60771
|
-
signature.resolvedTypePredicate = noTypePredicate;
|
|
60772
|
-
}
|
|
60768
|
+
signature.resolvedTypePredicate = type && isTypePredicateNode(type) ? createTypePredicateFromTypePredicateNode(type, signature) : jsdocPredicate || noTypePredicate;
|
|
60773
60769
|
}
|
|
60774
60770
|
Debug.assert(!!signature.resolvedTypePredicate);
|
|
60775
60771
|
}
|
|
@@ -65354,7 +65350,7 @@ function createTypeChecker(host) {
|
|
|
65354
65350
|
}
|
|
65355
65351
|
return false;
|
|
65356
65352
|
}
|
|
65357
|
-
function compareSignaturesRelated(source, target, checkMode, reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) {
|
|
65353
|
+
function compareSignaturesRelated(source, target, checkMode, reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers, compareTypesUnilaterally = false) {
|
|
65358
65354
|
if (source === target) {
|
|
65359
65355
|
return -1 /* True */;
|
|
65360
65356
|
}
|
|
@@ -65419,12 +65415,21 @@ function createTypeChecker(host) {
|
|
|
65419
65415
|
const sourceSig = checkMode & 3 /* Callback */ || isInstantiatedGenericParameter(source, i) ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
|
|
65420
65416
|
const targetSig = checkMode & 3 /* Callback */ || isInstantiatedGenericParameter(target, i) ? void 0 : getSingleCallSignature(getNonNullableType(targetType));
|
|
65421
65417
|
const callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) && getTypeFacts(sourceType, 50331648 /* IsUndefinedOrNull */) === getTypeFacts(targetType, 50331648 /* IsUndefinedOrNull */);
|
|
65422
|
-
let related
|
|
65423
|
-
|
|
65424
|
-
|
|
65425
|
-
|
|
65426
|
-
|
|
65427
|
-
|
|
65418
|
+
let related;
|
|
65419
|
+
if (callbacks) {
|
|
65420
|
+
related = compareSignaturesRelated(targetSig, sourceSig, checkMode & 8 /* StrictArity */ | (strictVariance ? 2 /* StrictCallback */ : 1 /* BivariantCallback */), reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers);
|
|
65421
|
+
} else {
|
|
65422
|
+
if (!compareTypesUnilaterally) {
|
|
65423
|
+
related = !(checkMode & 3 /* Callback */) && !strictVariance && compareTypes(
|
|
65424
|
+
sourceType,
|
|
65425
|
+
targetType,
|
|
65426
|
+
/*reportErrors*/
|
|
65427
|
+
false
|
|
65428
|
+
) || compareTypes(targetType, sourceType, reportErrors2);
|
|
65429
|
+
} else {
|
|
65430
|
+
related = compareTypes(sourceType, targetType, reportErrors2);
|
|
65431
|
+
}
|
|
65432
|
+
}
|
|
65428
65433
|
if (related && checkMode & 8 /* StrictArity */ && i >= getMinArgumentCount(source) && i < getMinArgumentCount(target) && compareTypes(
|
|
65429
65434
|
sourceType,
|
|
65430
65435
|
targetType,
|
|
@@ -65743,6 +65748,33 @@ function createTypeChecker(host) {
|
|
|
65743
65748
|
let incompatibleStack;
|
|
65744
65749
|
let relationCount = 16e6 - relation.size >> 3;
|
|
65745
65750
|
Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking");
|
|
65751
|
+
const visitingKey = getRelationKey(
|
|
65752
|
+
source,
|
|
65753
|
+
target,
|
|
65754
|
+
/*intersectionState*/
|
|
65755
|
+
0 /* None */,
|
|
65756
|
+
relation,
|
|
65757
|
+
/*ignoreConstraints*/
|
|
65758
|
+
false
|
|
65759
|
+
);
|
|
65760
|
+
if (checkTypeRelatedToDepth === 0) {
|
|
65761
|
+
checkTypeRelatedToCurrentlyVisitingMap = /* @__PURE__ */ new Map();
|
|
65762
|
+
}
|
|
65763
|
+
if (!errorNode && !headMessage) {
|
|
65764
|
+
let got = checkTypeRelatedToCurrentlyVisitingMap.get(visitingKey);
|
|
65765
|
+
const maxSameKey = 1;
|
|
65766
|
+
if (got && got >= maxSameKey) {
|
|
65767
|
+
relation.set(visitingKey, 1 /* Succeeded */);
|
|
65768
|
+
return true;
|
|
65769
|
+
} else {
|
|
65770
|
+
if (!got)
|
|
65771
|
+
got = 1;
|
|
65772
|
+
else
|
|
65773
|
+
got = got + 1;
|
|
65774
|
+
checkTypeRelatedToCurrentlyVisitingMap.set(visitingKey, got);
|
|
65775
|
+
}
|
|
65776
|
+
}
|
|
65777
|
+
checkTypeRelatedToDepth++;
|
|
65746
65778
|
const result = isRelatedTo(
|
|
65747
65779
|
source,
|
|
65748
65780
|
target,
|
|
@@ -65810,6 +65842,18 @@ function createTypeChecker(host) {
|
|
|
65810
65842
|
if (errorNode && errorOutputContainer && errorOutputContainer.skipLogging && result === 0 /* False */) {
|
|
65811
65843
|
Debug.assert(!!errorOutputContainer.errors, "missed opportunity to interact with error.");
|
|
65812
65844
|
}
|
|
65845
|
+
checkTypeRelatedToDepth--;
|
|
65846
|
+
if (checkTypeRelatedToDepth === 0) {
|
|
65847
|
+
checkTypeRelatedToCurrentlyVisitingMap = void 0;
|
|
65848
|
+
} else {
|
|
65849
|
+
const got = checkTypeRelatedToCurrentlyVisitingMap.get(visitingKey);
|
|
65850
|
+
if (got) {
|
|
65851
|
+
if (got === 1)
|
|
65852
|
+
checkTypeRelatedToCurrentlyVisitingMap.delete(visitingKey);
|
|
65853
|
+
else
|
|
65854
|
+
checkTypeRelatedToCurrentlyVisitingMap.set(visitingKey, got - 1);
|
|
65855
|
+
}
|
|
65856
|
+
}
|
|
65813
65857
|
return result !== 0 /* False */;
|
|
65814
65858
|
function resetErrorInfo(saved) {
|
|
65815
65859
|
errorInfo = saved.errorInfo;
|
|
@@ -66296,6 +66340,112 @@ function createTypeChecker(host) {
|
|
|
66296
66340
|
function shouldCheckAsExcessProperty(prop, container) {
|
|
66297
66341
|
return prop.valueDeclaration && container.valueDeclaration && prop.valueDeclaration.parent === container.valueDeclaration;
|
|
66298
66342
|
}
|
|
66343
|
+
function checkOverloadsRelatedToIntersection(source2, target2, _reportErrors) {
|
|
66344
|
+
const sourceSignatures = getSignaturesOfType(source2, 0 /* Call */);
|
|
66345
|
+
const constructSignatureToString = (signature, forceReturnType) => {
|
|
66346
|
+
const origReturnType = signature.resolvedReturnType;
|
|
66347
|
+
signature.resolvedReturnType = forceReturnType;
|
|
66348
|
+
const str = signatureToString(
|
|
66349
|
+
signature,
|
|
66350
|
+
/*enclosingDeclaration*/
|
|
66351
|
+
void 0,
|
|
66352
|
+
262144 /* WriteArrowStyleSignature */,
|
|
66353
|
+
0 /* Call */
|
|
66354
|
+
);
|
|
66355
|
+
signature.resolvedReturnType = origReturnType;
|
|
66356
|
+
return str;
|
|
66357
|
+
};
|
|
66358
|
+
const mapAssignedToBy = /* @__PURE__ */ new Map();
|
|
66359
|
+
const failed = sourceSignatures.some((ssig, _si) => {
|
|
66360
|
+
if (getReturnTypeOfSignature(ssig) === neverType)
|
|
66361
|
+
return false;
|
|
66362
|
+
const accum = {
|
|
66363
|
+
hadMatch: false,
|
|
66364
|
+
gReturn: neverType,
|
|
66365
|
+
gReturnAllVoid: true
|
|
66366
|
+
};
|
|
66367
|
+
const matchedTargetSigs = [];
|
|
66368
|
+
target2.types.forEach((targetMember, _tti) => {
|
|
66369
|
+
const targetSignatures = getSignaturesOfType(targetMember, 0 /* Call */);
|
|
66370
|
+
targetSignatures.forEach((tsig, _ti) => {
|
|
66371
|
+
const targetReturnType = getReturnTypeOfSignature(tsig);
|
|
66372
|
+
if (compareSignaturesRelated(
|
|
66373
|
+
ssig,
|
|
66374
|
+
tsig,
|
|
66375
|
+
0 /* None */ | 4 /* IgnoreReturnTypes */,
|
|
66376
|
+
/*reportErrors*/
|
|
66377
|
+
false,
|
|
66378
|
+
/*errorReporter*/
|
|
66379
|
+
void 0,
|
|
66380
|
+
/*incompatibleErrorReporter*/
|
|
66381
|
+
void 0,
|
|
66382
|
+
compareTypesIdentical,
|
|
66383
|
+
// compareTypesAssignable,
|
|
66384
|
+
/*reportUnreliableMarkers*/
|
|
66385
|
+
void 0,
|
|
66386
|
+
/*compareTypesUnilaterally*/
|
|
66387
|
+
true
|
|
66388
|
+
) === -1 /* True */) {
|
|
66389
|
+
accum.hadMatch = true;
|
|
66390
|
+
if (targetReturnType !== voidType) {
|
|
66391
|
+
accum.gReturn = getUnionType([accum.gReturn, targetReturnType]);
|
|
66392
|
+
accum.gReturnAllVoid = false;
|
|
66393
|
+
}
|
|
66394
|
+
matchedTargetSigs.push(tsig);
|
|
66395
|
+
let mtti = mapAssignedToBy.get(_tti);
|
|
66396
|
+
if (!mtti) {
|
|
66397
|
+
mtti = /* @__PURE__ */ new Map();
|
|
66398
|
+
mapAssignedToBy.set(_tti, mtti);
|
|
66399
|
+
}
|
|
66400
|
+
const setsi = mtti.get(_ti);
|
|
66401
|
+
if (!setsi) {
|
|
66402
|
+
mtti.set(_ti, true);
|
|
66403
|
+
}
|
|
66404
|
+
}
|
|
66405
|
+
});
|
|
66406
|
+
});
|
|
66407
|
+
if (!accum.hadMatch) {
|
|
66408
|
+
if (_reportErrors) {
|
|
66409
|
+
resetErrorInfo({ skipParentCounter: 0 });
|
|
66410
|
+
reportError(Diagnostics.Parameters_of_signature_0_are_not_assignable_to_the_parameters_of_any_signature_in_type_1, constructSignatureToString(ssig), typeToString(target2));
|
|
66411
|
+
}
|
|
66412
|
+
return true;
|
|
66413
|
+
} else {
|
|
66414
|
+
const returnType = getReturnTypeOfSignature(ssig);
|
|
66415
|
+
if (!accum.gReturnAllVoid && !isTypeAssignableTo(returnType, accum.gReturn)) {
|
|
66416
|
+
if (_reportErrors) {
|
|
66417
|
+
resetErrorInfo({ skipParentCounter: 0 });
|
|
66418
|
+
reportError(Diagnostics.Type_0_is_not_assignable_to_type_1, typeToString(returnType), typeToString(accum.gReturn));
|
|
66419
|
+
const strset = /* @__PURE__ */ new Set();
|
|
66420
|
+
matchedTargetSigs.forEach((tsig) => strset.add(constructSignatureToString(tsig)));
|
|
66421
|
+
const strarr = [];
|
|
66422
|
+
strset.forEach((tstr) => strarr.push(tstr));
|
|
66423
|
+
reportError(Diagnostics.Type_0_is_not_assignable_to_type_1, constructSignatureToString(ssig), strarr.join(" | "));
|
|
66424
|
+
}
|
|
66425
|
+
return true;
|
|
66426
|
+
}
|
|
66427
|
+
}
|
|
66428
|
+
});
|
|
66429
|
+
if (failed)
|
|
66430
|
+
return { computed: true, ternary: 0 /* False */ };
|
|
66431
|
+
const failed2 = target2.types.some((targetMember, _tti) => {
|
|
66432
|
+
const mtti = mapAssignedToBy.get(_tti);
|
|
66433
|
+
const targetSignatures = getSignaturesOfType(targetMember, 0 /* Call */);
|
|
66434
|
+
return targetSignatures.some((tsig, _ti) => {
|
|
66435
|
+
if (!mtti || !mtti.get(_ti)) {
|
|
66436
|
+
if (_reportErrors) {
|
|
66437
|
+
resetErrorInfo({ skipParentCounter: 0 });
|
|
66438
|
+
reportError(Diagnostics.There_is_no_signature_in_type_0_such_that_its_parameters_are_assignable_to_the_parameters_of_signature_1, typeToString(source2), constructSignatureToString(tsig, anyType));
|
|
66439
|
+
reportError(Diagnostics.Type_0_is_not_assignable_to_type_1, typeToString(source2), typeToString(targetMember));
|
|
66440
|
+
}
|
|
66441
|
+
return true;
|
|
66442
|
+
}
|
|
66443
|
+
});
|
|
66444
|
+
});
|
|
66445
|
+
if (failed2)
|
|
66446
|
+
return { computed: true, ternary: 0 /* False */ };
|
|
66447
|
+
return { computed: true, ternary: -1 /* True */ };
|
|
66448
|
+
}
|
|
66299
66449
|
function unionOrIntersectionRelatedTo(source2, target2, reportErrors2, intersectionState) {
|
|
66300
66450
|
if (source2.flags & 1048576 /* Union */) {
|
|
66301
66451
|
if (target2.flags & 1048576 /* Union */) {
|
|
@@ -66314,7 +66464,22 @@ function createTypeChecker(host) {
|
|
|
66314
66464
|
return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */) && !(target2.flags & 402784252 /* Primitive */), intersectionState);
|
|
66315
66465
|
}
|
|
66316
66466
|
if (target2.flags & 2097152 /* Intersection */) {
|
|
66317
|
-
|
|
66467
|
+
const result1 = typeRelatedToEachType(source2, target2, reportErrors2, 2 /* Target */);
|
|
66468
|
+
if (result1 === 0 /* False */) {
|
|
66469
|
+
const sourceSignatures = getSignaturesOfType(source2, 0 /* Call */);
|
|
66470
|
+
if (sourceSignatures.every((sourceSig) => {
|
|
66471
|
+
return !sourceSig.typeParameters;
|
|
66472
|
+
})) {
|
|
66473
|
+
if (source2.flags & 524288 /* Object */ && getSignaturesOfType(source2, 0 /* Call */).length > 1) {
|
|
66474
|
+
const { computed, ternary } = checkOverloadsRelatedToIntersection(source2, target2, reportErrors2);
|
|
66475
|
+
if (computed) {
|
|
66476
|
+
Debug.assert(ternary === -1 /* True */ || ternary === 0 /* False */);
|
|
66477
|
+
return ternary;
|
|
66478
|
+
}
|
|
66479
|
+
}
|
|
66480
|
+
}
|
|
66481
|
+
}
|
|
66482
|
+
return result1;
|
|
66318
66483
|
}
|
|
66319
66484
|
if (relation === comparableRelation && target2.flags & 402784252 /* Primitive */) {
|
|
66320
66485
|
const constraints = sameMap(source2.types, (t) => t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(t) || unknownType : t);
|
|
@@ -79178,89 +79343,6 @@ function createTypeChecker(host) {
|
|
|
79178
79343
|
return false;
|
|
79179
79344
|
}
|
|
79180
79345
|
}
|
|
79181
|
-
function getTypePredicateFromBody(func, _sig) {
|
|
79182
|
-
const functionFlags = getFunctionFlags(func);
|
|
79183
|
-
if (functionFlags !== 0 /* Normal */)
|
|
79184
|
-
return void 0;
|
|
79185
|
-
let singleReturn;
|
|
79186
|
-
if (func.body && func.body.kind !== 241 /* Block */) {
|
|
79187
|
-
singleReturn = func.body;
|
|
79188
|
-
} else {
|
|
79189
|
-
if (functionHasImplicitReturn(func))
|
|
79190
|
-
return void 0;
|
|
79191
|
-
const bailedEarly = forEachReturnStatement(func.body, (returnStatement) => {
|
|
79192
|
-
if (singleReturn || !returnStatement.expression)
|
|
79193
|
-
return true;
|
|
79194
|
-
singleReturn = returnStatement.expression;
|
|
79195
|
-
});
|
|
79196
|
-
if (bailedEarly || !singleReturn)
|
|
79197
|
-
return void 0;
|
|
79198
|
-
}
|
|
79199
|
-
const predicate = checkIfExpressionRefinesAnyParameter(singleReturn);
|
|
79200
|
-
if (predicate) {
|
|
79201
|
-
const [i, type] = predicate;
|
|
79202
|
-
const param = func.parameters[i];
|
|
79203
|
-
if (isIdentifier(param.name)) {
|
|
79204
|
-
return createTypePredicate(1 /* Identifier */, param.name.escapedText, i, type);
|
|
79205
|
-
}
|
|
79206
|
-
}
|
|
79207
|
-
return void 0;
|
|
79208
|
-
function checkIfExpressionRefinesAnyParameter(expr) {
|
|
79209
|
-
expr = skipParentheses(
|
|
79210
|
-
expr,
|
|
79211
|
-
/*excludeJSDocTypeAssertions*/
|
|
79212
|
-
true
|
|
79213
|
-
);
|
|
79214
|
-
const type = checkExpressionCached(expr, 64 /* TypeOnly */);
|
|
79215
|
-
if (type !== booleanType || !func.body)
|
|
79216
|
-
return void 0;
|
|
79217
|
-
return forEach(func.parameters, (param, i) => {
|
|
79218
|
-
const initType = getSymbolLinks(param.symbol).type;
|
|
79219
|
-
if (!initType || initType === booleanType || isSymbolAssigned(param.symbol)) {
|
|
79220
|
-
return;
|
|
79221
|
-
}
|
|
79222
|
-
const trueType2 = checkIfExpressionRefinesParameter(
|
|
79223
|
-
expr,
|
|
79224
|
-
param,
|
|
79225
|
-
initType,
|
|
79226
|
-
/*forceFullCheck*/
|
|
79227
|
-
false
|
|
79228
|
-
);
|
|
79229
|
-
if (trueType2) {
|
|
79230
|
-
const trueSubtype = checkIfExpressionRefinesParameter(
|
|
79231
|
-
expr,
|
|
79232
|
-
param,
|
|
79233
|
-
trueType2,
|
|
79234
|
-
/*forceFullCheck*/
|
|
79235
|
-
true
|
|
79236
|
-
);
|
|
79237
|
-
if (trueSubtype) {
|
|
79238
|
-
return [i, trueType2];
|
|
79239
|
-
}
|
|
79240
|
-
}
|
|
79241
|
-
});
|
|
79242
|
-
}
|
|
79243
|
-
function checkIfExpressionRefinesParameter(expr, param, initType, forceFullCheck) {
|
|
79244
|
-
const antecedent = expr.flowNode ?? { flags: 2 /* Start */ };
|
|
79245
|
-
const trueCondition = {
|
|
79246
|
-
flags: 32 /* TrueCondition */,
|
|
79247
|
-
node: expr,
|
|
79248
|
-
antecedent
|
|
79249
|
-
};
|
|
79250
|
-
const trueType2 = getFlowTypeOfReference(param.name, initType, initType, func, trueCondition);
|
|
79251
|
-
if (trueType2 === initType && !forceFullCheck)
|
|
79252
|
-
return void 0;
|
|
79253
|
-
const falseCondition = {
|
|
79254
|
-
...trueCondition,
|
|
79255
|
-
flags: 64 /* FalseCondition */
|
|
79256
|
-
};
|
|
79257
|
-
const falseType2 = getFlowTypeOfReference(param.name, initType, initType, func, falseCondition);
|
|
79258
|
-
const candidateFalse = filterType(initType, (t) => !isTypeSubtypeOf(t, trueType2));
|
|
79259
|
-
if (isTypeIdenticalTo(candidateFalse, falseType2)) {
|
|
79260
|
-
return trueType2;
|
|
79261
|
-
}
|
|
79262
|
-
}
|
|
79263
|
-
}
|
|
79264
79346
|
function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func, returnType) {
|
|
79265
79347
|
addLazyDiagnostic(checkAllCodePathsInNonVoidFunctionReturnOrThrowDiagnostics);
|
|
79266
79348
|
return;
|
|
@@ -138410,7 +138492,13 @@ function getSourceMapper(host) {
|
|
|
138410
138492
|
const currentDirectory = host.getCurrentDirectory();
|
|
138411
138493
|
const sourceFileLike = /* @__PURE__ */ new Map();
|
|
138412
138494
|
const documentPositionMappers = /* @__PURE__ */ new Map();
|
|
138413
|
-
return {
|
|
138495
|
+
return {
|
|
138496
|
+
tryGetSourcePosition,
|
|
138497
|
+
tryGetGeneratedPosition,
|
|
138498
|
+
toLineColumnOffset,
|
|
138499
|
+
clearCache,
|
|
138500
|
+
documentPositionMappers
|
|
138501
|
+
};
|
|
138414
138502
|
function toPath3(fileName) {
|
|
138415
138503
|
return toPath(fileName, currentDirectory, getCanonicalFileName);
|
|
138416
138504
|
}
|
package/lib/typescript.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.5";
|
|
38
|
-
version = `${versionMajorMinor}.0-insiders.
|
|
38
|
+
version = `${versionMajorMinor}.0-insiders.20240222`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -9147,7 +9147,9 @@ ${lanes.join("\n")}
|
|
|
9147
9147
|
Compiler_option_0_cannot_be_given_an_empty_string: diag(18051, 1 /* Error */, "Compiler_option_0_cannot_be_given_an_empty_string_18051", "Compiler option '{0}' cannot be given an empty string."),
|
|
9148
9148
|
Non_abstract_class_0_does_not_implement_all_abstract_members_of_1: diag(18052, 1 /* Error */, "Non_abstract_class_0_does_not_implement_all_abstract_members_of_1_18052", "Non-abstract class '{0}' does not implement all abstract members of '{1}'"),
|
|
9149
9149
|
Its_type_0_is_not_a_valid_JSX_element_type: diag(18053, 1 /* Error */, "Its_type_0_is_not_a_valid_JSX_element_type_18053", "Its type '{0}' is not a valid JSX element type."),
|
|
9150
|
-
await_using_statements_cannot_be_used_inside_a_class_static_block: diag(18054, 1 /* Error */, "await_using_statements_cannot_be_used_inside_a_class_static_block_18054", "'await using' statements cannot be used inside a class static block.")
|
|
9150
|
+
await_using_statements_cannot_be_used_inside_a_class_static_block: diag(18054, 1 /* Error */, "await_using_statements_cannot_be_used_inside_a_class_static_block_18054", "'await using' statements cannot be used inside a class static block."),
|
|
9151
|
+
There_is_no_signature_in_type_0_such_that_its_parameters_are_assignable_to_the_parameters_of_signature_1: diag(18055, 1 /* Error */, "There_is_no_signature_in_type_0_such_that_its_parameters_are_assignable_to_the_parameters_of_signatu_18055", "There is no signature in type {0} such that its parameters are assignable to the parameters of signature {1}"),
|
|
9152
|
+
Parameters_of_signature_0_are_not_assignable_to_the_parameters_of_any_signature_in_type_1: diag(18056, 1 /* Error */, "Parameters_of_signature_0_are_not_assignable_to_the_parameters_of_any_signature_in_type_1_18056", "Parameters of signature {0} are not assignable to the parameters of any signature in type {1}")
|
|
9151
9153
|
};
|
|
9152
9154
|
}
|
|
9153
9155
|
});
|
|
@@ -46168,6 +46170,8 @@ ${lanes.join("\n")}
|
|
|
46168
46170
|
var lastGetCombinedNodeFlagsResult = 0 /* None */;
|
|
46169
46171
|
var lastGetCombinedModifierFlagsNode;
|
|
46170
46172
|
var lastGetCombinedModifierFlagsResult = 0 /* None */;
|
|
46173
|
+
var checkTypeRelatedToDepth = 0;
|
|
46174
|
+
var checkTypeRelatedToCurrentlyVisitingMap;
|
|
46171
46175
|
const checker = {
|
|
46172
46176
|
getNodeCount: () => reduceLeft(host.getSourceFiles(), (n, s) => n + s.nodeCount, 0),
|
|
46173
46177
|
getIdentifierCount: () => reduceLeft(host.getSourceFiles(), (n, s) => n + s.identifierCount, 0),
|
|
@@ -48051,7 +48055,7 @@ ${lanes.join("\n")}
|
|
|
48051
48055
|
if (nameNotFoundMessage) {
|
|
48052
48056
|
addLazyDiagnostic(() => {
|
|
48053
48057
|
var _a2;
|
|
48054
|
-
if (errorLocation && (meaning & 2 /* BlockScopedVariable */ || (meaning & 32 /* Class */ || meaning & 384 /* Enum */) && (meaning & 111551 /* Value */) === 111551 /* Value */)) {
|
|
48058
|
+
if (result && errorLocation && (meaning & 2 /* BlockScopedVariable */ || (meaning & 32 /* Class */ || meaning & 384 /* Enum */) && (meaning & 111551 /* Value */) === 111551 /* Value */)) {
|
|
48055
48059
|
const exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result);
|
|
48056
48060
|
if (exportOrLocalSymbol.flags & 2 /* BlockScopedVariable */ || exportOrLocalSymbol.flags & 32 /* Class */ || exportOrLocalSymbol.flags & 384 /* Enum */) {
|
|
48057
48061
|
checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation);
|
|
@@ -58515,15 +58519,7 @@ ${lanes.join("\n")}
|
|
|
58515
58519
|
jsdocPredicate = getTypePredicateOfSignature(jsdocSignature);
|
|
58516
58520
|
}
|
|
58517
58521
|
}
|
|
58518
|
-
|
|
58519
|
-
signature.resolvedTypePredicate = type && isTypePredicateNode(type) ? createTypePredicateFromTypePredicateNode(type, signature) : jsdocPredicate || noTypePredicate;
|
|
58520
|
-
} else if (signature.declaration && isFunctionLikeDeclaration(signature.declaration) && (!signature.resolvedReturnType || signature.resolvedReturnType === booleanType)) {
|
|
58521
|
-
const { declaration } = signature;
|
|
58522
|
-
signature.resolvedTypePredicate = noTypePredicate;
|
|
58523
|
-
signature.resolvedTypePredicate = getTypePredicateFromBody(declaration, signature) || noTypePredicate;
|
|
58524
|
-
} else {
|
|
58525
|
-
signature.resolvedTypePredicate = noTypePredicate;
|
|
58526
|
-
}
|
|
58522
|
+
signature.resolvedTypePredicate = type && isTypePredicateNode(type) ? createTypePredicateFromTypePredicateNode(type, signature) : jsdocPredicate || noTypePredicate;
|
|
58527
58523
|
}
|
|
58528
58524
|
Debug.assert(!!signature.resolvedTypePredicate);
|
|
58529
58525
|
}
|
|
@@ -63108,7 +63104,7 @@ ${lanes.join("\n")}
|
|
|
63108
63104
|
}
|
|
63109
63105
|
return false;
|
|
63110
63106
|
}
|
|
63111
|
-
function compareSignaturesRelated(source, target, checkMode, reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) {
|
|
63107
|
+
function compareSignaturesRelated(source, target, checkMode, reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers, compareTypesUnilaterally = false) {
|
|
63112
63108
|
if (source === target) {
|
|
63113
63109
|
return -1 /* True */;
|
|
63114
63110
|
}
|
|
@@ -63173,12 +63169,21 @@ ${lanes.join("\n")}
|
|
|
63173
63169
|
const sourceSig = checkMode & 3 /* Callback */ || isInstantiatedGenericParameter(source, i) ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
|
|
63174
63170
|
const targetSig = checkMode & 3 /* Callback */ || isInstantiatedGenericParameter(target, i) ? void 0 : getSingleCallSignature(getNonNullableType(targetType));
|
|
63175
63171
|
const callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) && getTypeFacts(sourceType, 50331648 /* IsUndefinedOrNull */) === getTypeFacts(targetType, 50331648 /* IsUndefinedOrNull */);
|
|
63176
|
-
let related
|
|
63177
|
-
|
|
63178
|
-
|
|
63179
|
-
|
|
63180
|
-
|
|
63181
|
-
|
|
63172
|
+
let related;
|
|
63173
|
+
if (callbacks) {
|
|
63174
|
+
related = compareSignaturesRelated(targetSig, sourceSig, checkMode & 8 /* StrictArity */ | (strictVariance ? 2 /* StrictCallback */ : 1 /* BivariantCallback */), reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers);
|
|
63175
|
+
} else {
|
|
63176
|
+
if (!compareTypesUnilaterally) {
|
|
63177
|
+
related = !(checkMode & 3 /* Callback */) && !strictVariance && compareTypes(
|
|
63178
|
+
sourceType,
|
|
63179
|
+
targetType,
|
|
63180
|
+
/*reportErrors*/
|
|
63181
|
+
false
|
|
63182
|
+
) || compareTypes(targetType, sourceType, reportErrors2);
|
|
63183
|
+
} else {
|
|
63184
|
+
related = compareTypes(sourceType, targetType, reportErrors2);
|
|
63185
|
+
}
|
|
63186
|
+
}
|
|
63182
63187
|
if (related && checkMode & 8 /* StrictArity */ && i >= getMinArgumentCount(source) && i < getMinArgumentCount(target) && compareTypes(
|
|
63183
63188
|
sourceType,
|
|
63184
63189
|
targetType,
|
|
@@ -63497,6 +63502,33 @@ ${lanes.join("\n")}
|
|
|
63497
63502
|
let incompatibleStack;
|
|
63498
63503
|
let relationCount = 16e6 - relation.size >> 3;
|
|
63499
63504
|
Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking");
|
|
63505
|
+
const visitingKey = getRelationKey(
|
|
63506
|
+
source,
|
|
63507
|
+
target,
|
|
63508
|
+
/*intersectionState*/
|
|
63509
|
+
0 /* None */,
|
|
63510
|
+
relation,
|
|
63511
|
+
/*ignoreConstraints*/
|
|
63512
|
+
false
|
|
63513
|
+
);
|
|
63514
|
+
if (checkTypeRelatedToDepth === 0) {
|
|
63515
|
+
checkTypeRelatedToCurrentlyVisitingMap = /* @__PURE__ */ new Map();
|
|
63516
|
+
}
|
|
63517
|
+
if (!errorNode && !headMessage) {
|
|
63518
|
+
let got = checkTypeRelatedToCurrentlyVisitingMap.get(visitingKey);
|
|
63519
|
+
const maxSameKey = 1;
|
|
63520
|
+
if (got && got >= maxSameKey) {
|
|
63521
|
+
relation.set(visitingKey, 1 /* Succeeded */);
|
|
63522
|
+
return true;
|
|
63523
|
+
} else {
|
|
63524
|
+
if (!got)
|
|
63525
|
+
got = 1;
|
|
63526
|
+
else
|
|
63527
|
+
got = got + 1;
|
|
63528
|
+
checkTypeRelatedToCurrentlyVisitingMap.set(visitingKey, got);
|
|
63529
|
+
}
|
|
63530
|
+
}
|
|
63531
|
+
checkTypeRelatedToDepth++;
|
|
63500
63532
|
const result = isRelatedTo(
|
|
63501
63533
|
source,
|
|
63502
63534
|
target,
|
|
@@ -63564,6 +63596,18 @@ ${lanes.join("\n")}
|
|
|
63564
63596
|
if (errorNode && errorOutputContainer && errorOutputContainer.skipLogging && result === 0 /* False */) {
|
|
63565
63597
|
Debug.assert(!!errorOutputContainer.errors, "missed opportunity to interact with error.");
|
|
63566
63598
|
}
|
|
63599
|
+
checkTypeRelatedToDepth--;
|
|
63600
|
+
if (checkTypeRelatedToDepth === 0) {
|
|
63601
|
+
checkTypeRelatedToCurrentlyVisitingMap = void 0;
|
|
63602
|
+
} else {
|
|
63603
|
+
const got = checkTypeRelatedToCurrentlyVisitingMap.get(visitingKey);
|
|
63604
|
+
if (got) {
|
|
63605
|
+
if (got === 1)
|
|
63606
|
+
checkTypeRelatedToCurrentlyVisitingMap.delete(visitingKey);
|
|
63607
|
+
else
|
|
63608
|
+
checkTypeRelatedToCurrentlyVisitingMap.set(visitingKey, got - 1);
|
|
63609
|
+
}
|
|
63610
|
+
}
|
|
63567
63611
|
return result !== 0 /* False */;
|
|
63568
63612
|
function resetErrorInfo(saved) {
|
|
63569
63613
|
errorInfo = saved.errorInfo;
|
|
@@ -64050,6 +64094,112 @@ ${lanes.join("\n")}
|
|
|
64050
64094
|
function shouldCheckAsExcessProperty(prop, container) {
|
|
64051
64095
|
return prop.valueDeclaration && container.valueDeclaration && prop.valueDeclaration.parent === container.valueDeclaration;
|
|
64052
64096
|
}
|
|
64097
|
+
function checkOverloadsRelatedToIntersection(source2, target2, _reportErrors) {
|
|
64098
|
+
const sourceSignatures = getSignaturesOfType(source2, 0 /* Call */);
|
|
64099
|
+
const constructSignatureToString = (signature, forceReturnType) => {
|
|
64100
|
+
const origReturnType = signature.resolvedReturnType;
|
|
64101
|
+
signature.resolvedReturnType = forceReturnType;
|
|
64102
|
+
const str = signatureToString(
|
|
64103
|
+
signature,
|
|
64104
|
+
/*enclosingDeclaration*/
|
|
64105
|
+
void 0,
|
|
64106
|
+
262144 /* WriteArrowStyleSignature */,
|
|
64107
|
+
0 /* Call */
|
|
64108
|
+
);
|
|
64109
|
+
signature.resolvedReturnType = origReturnType;
|
|
64110
|
+
return str;
|
|
64111
|
+
};
|
|
64112
|
+
const mapAssignedToBy = /* @__PURE__ */ new Map();
|
|
64113
|
+
const failed = sourceSignatures.some((ssig, _si) => {
|
|
64114
|
+
if (getReturnTypeOfSignature(ssig) === neverType)
|
|
64115
|
+
return false;
|
|
64116
|
+
const accum = {
|
|
64117
|
+
hadMatch: false,
|
|
64118
|
+
gReturn: neverType,
|
|
64119
|
+
gReturnAllVoid: true
|
|
64120
|
+
};
|
|
64121
|
+
const matchedTargetSigs = [];
|
|
64122
|
+
target2.types.forEach((targetMember, _tti) => {
|
|
64123
|
+
const targetSignatures = getSignaturesOfType(targetMember, 0 /* Call */);
|
|
64124
|
+
targetSignatures.forEach((tsig, _ti) => {
|
|
64125
|
+
const targetReturnType = getReturnTypeOfSignature(tsig);
|
|
64126
|
+
if (compareSignaturesRelated(
|
|
64127
|
+
ssig,
|
|
64128
|
+
tsig,
|
|
64129
|
+
0 /* None */ | 4 /* IgnoreReturnTypes */,
|
|
64130
|
+
/*reportErrors*/
|
|
64131
|
+
false,
|
|
64132
|
+
/*errorReporter*/
|
|
64133
|
+
void 0,
|
|
64134
|
+
/*incompatibleErrorReporter*/
|
|
64135
|
+
void 0,
|
|
64136
|
+
compareTypesIdentical,
|
|
64137
|
+
// compareTypesAssignable,
|
|
64138
|
+
/*reportUnreliableMarkers*/
|
|
64139
|
+
void 0,
|
|
64140
|
+
/*compareTypesUnilaterally*/
|
|
64141
|
+
true
|
|
64142
|
+
) === -1 /* True */) {
|
|
64143
|
+
accum.hadMatch = true;
|
|
64144
|
+
if (targetReturnType !== voidType) {
|
|
64145
|
+
accum.gReturn = getUnionType([accum.gReturn, targetReturnType]);
|
|
64146
|
+
accum.gReturnAllVoid = false;
|
|
64147
|
+
}
|
|
64148
|
+
matchedTargetSigs.push(tsig);
|
|
64149
|
+
let mtti = mapAssignedToBy.get(_tti);
|
|
64150
|
+
if (!mtti) {
|
|
64151
|
+
mtti = /* @__PURE__ */ new Map();
|
|
64152
|
+
mapAssignedToBy.set(_tti, mtti);
|
|
64153
|
+
}
|
|
64154
|
+
const setsi = mtti.get(_ti);
|
|
64155
|
+
if (!setsi) {
|
|
64156
|
+
mtti.set(_ti, true);
|
|
64157
|
+
}
|
|
64158
|
+
}
|
|
64159
|
+
});
|
|
64160
|
+
});
|
|
64161
|
+
if (!accum.hadMatch) {
|
|
64162
|
+
if (_reportErrors) {
|
|
64163
|
+
resetErrorInfo({ skipParentCounter: 0 });
|
|
64164
|
+
reportError(Diagnostics.Parameters_of_signature_0_are_not_assignable_to_the_parameters_of_any_signature_in_type_1, constructSignatureToString(ssig), typeToString(target2));
|
|
64165
|
+
}
|
|
64166
|
+
return true;
|
|
64167
|
+
} else {
|
|
64168
|
+
const returnType = getReturnTypeOfSignature(ssig);
|
|
64169
|
+
if (!accum.gReturnAllVoid && !isTypeAssignableTo(returnType, accum.gReturn)) {
|
|
64170
|
+
if (_reportErrors) {
|
|
64171
|
+
resetErrorInfo({ skipParentCounter: 0 });
|
|
64172
|
+
reportError(Diagnostics.Type_0_is_not_assignable_to_type_1, typeToString(returnType), typeToString(accum.gReturn));
|
|
64173
|
+
const strset = /* @__PURE__ */ new Set();
|
|
64174
|
+
matchedTargetSigs.forEach((tsig) => strset.add(constructSignatureToString(tsig)));
|
|
64175
|
+
const strarr = [];
|
|
64176
|
+
strset.forEach((tstr) => strarr.push(tstr));
|
|
64177
|
+
reportError(Diagnostics.Type_0_is_not_assignable_to_type_1, constructSignatureToString(ssig), strarr.join(" | "));
|
|
64178
|
+
}
|
|
64179
|
+
return true;
|
|
64180
|
+
}
|
|
64181
|
+
}
|
|
64182
|
+
});
|
|
64183
|
+
if (failed)
|
|
64184
|
+
return { computed: true, ternary: 0 /* False */ };
|
|
64185
|
+
const failed2 = target2.types.some((targetMember, _tti) => {
|
|
64186
|
+
const mtti = mapAssignedToBy.get(_tti);
|
|
64187
|
+
const targetSignatures = getSignaturesOfType(targetMember, 0 /* Call */);
|
|
64188
|
+
return targetSignatures.some((tsig, _ti) => {
|
|
64189
|
+
if (!mtti || !mtti.get(_ti)) {
|
|
64190
|
+
if (_reportErrors) {
|
|
64191
|
+
resetErrorInfo({ skipParentCounter: 0 });
|
|
64192
|
+
reportError(Diagnostics.There_is_no_signature_in_type_0_such_that_its_parameters_are_assignable_to_the_parameters_of_signature_1, typeToString(source2), constructSignatureToString(tsig, anyType));
|
|
64193
|
+
reportError(Diagnostics.Type_0_is_not_assignable_to_type_1, typeToString(source2), typeToString(targetMember));
|
|
64194
|
+
}
|
|
64195
|
+
return true;
|
|
64196
|
+
}
|
|
64197
|
+
});
|
|
64198
|
+
});
|
|
64199
|
+
if (failed2)
|
|
64200
|
+
return { computed: true, ternary: 0 /* False */ };
|
|
64201
|
+
return { computed: true, ternary: -1 /* True */ };
|
|
64202
|
+
}
|
|
64053
64203
|
function unionOrIntersectionRelatedTo(source2, target2, reportErrors2, intersectionState) {
|
|
64054
64204
|
if (source2.flags & 1048576 /* Union */) {
|
|
64055
64205
|
if (target2.flags & 1048576 /* Union */) {
|
|
@@ -64068,7 +64218,22 @@ ${lanes.join("\n")}
|
|
|
64068
64218
|
return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */) && !(target2.flags & 402784252 /* Primitive */), intersectionState);
|
|
64069
64219
|
}
|
|
64070
64220
|
if (target2.flags & 2097152 /* Intersection */) {
|
|
64071
|
-
|
|
64221
|
+
const result1 = typeRelatedToEachType(source2, target2, reportErrors2, 2 /* Target */);
|
|
64222
|
+
if (result1 === 0 /* False */) {
|
|
64223
|
+
const sourceSignatures = getSignaturesOfType(source2, 0 /* Call */);
|
|
64224
|
+
if (sourceSignatures.every((sourceSig) => {
|
|
64225
|
+
return !sourceSig.typeParameters;
|
|
64226
|
+
})) {
|
|
64227
|
+
if (source2.flags & 524288 /* Object */ && getSignaturesOfType(source2, 0 /* Call */).length > 1) {
|
|
64228
|
+
const { computed, ternary } = checkOverloadsRelatedToIntersection(source2, target2, reportErrors2);
|
|
64229
|
+
if (computed) {
|
|
64230
|
+
Debug.assert(ternary === -1 /* True */ || ternary === 0 /* False */);
|
|
64231
|
+
return ternary;
|
|
64232
|
+
}
|
|
64233
|
+
}
|
|
64234
|
+
}
|
|
64235
|
+
}
|
|
64236
|
+
return result1;
|
|
64072
64237
|
}
|
|
64073
64238
|
if (relation === comparableRelation && target2.flags & 402784252 /* Primitive */) {
|
|
64074
64239
|
const constraints = sameMap(source2.types, (t) => t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(t) || unknownType : t);
|
|
@@ -76932,89 +77097,6 @@ ${lanes.join("\n")}
|
|
|
76932
77097
|
return false;
|
|
76933
77098
|
}
|
|
76934
77099
|
}
|
|
76935
|
-
function getTypePredicateFromBody(func, _sig) {
|
|
76936
|
-
const functionFlags = getFunctionFlags(func);
|
|
76937
|
-
if (functionFlags !== 0 /* Normal */)
|
|
76938
|
-
return void 0;
|
|
76939
|
-
let singleReturn;
|
|
76940
|
-
if (func.body && func.body.kind !== 241 /* Block */) {
|
|
76941
|
-
singleReturn = func.body;
|
|
76942
|
-
} else {
|
|
76943
|
-
if (functionHasImplicitReturn(func))
|
|
76944
|
-
return void 0;
|
|
76945
|
-
const bailedEarly = forEachReturnStatement(func.body, (returnStatement) => {
|
|
76946
|
-
if (singleReturn || !returnStatement.expression)
|
|
76947
|
-
return true;
|
|
76948
|
-
singleReturn = returnStatement.expression;
|
|
76949
|
-
});
|
|
76950
|
-
if (bailedEarly || !singleReturn)
|
|
76951
|
-
return void 0;
|
|
76952
|
-
}
|
|
76953
|
-
const predicate = checkIfExpressionRefinesAnyParameter(singleReturn);
|
|
76954
|
-
if (predicate) {
|
|
76955
|
-
const [i, type] = predicate;
|
|
76956
|
-
const param = func.parameters[i];
|
|
76957
|
-
if (isIdentifier(param.name)) {
|
|
76958
|
-
return createTypePredicate(1 /* Identifier */, param.name.escapedText, i, type);
|
|
76959
|
-
}
|
|
76960
|
-
}
|
|
76961
|
-
return void 0;
|
|
76962
|
-
function checkIfExpressionRefinesAnyParameter(expr) {
|
|
76963
|
-
expr = skipParentheses(
|
|
76964
|
-
expr,
|
|
76965
|
-
/*excludeJSDocTypeAssertions*/
|
|
76966
|
-
true
|
|
76967
|
-
);
|
|
76968
|
-
const type = checkExpressionCached(expr, 64 /* TypeOnly */);
|
|
76969
|
-
if (type !== booleanType || !func.body)
|
|
76970
|
-
return void 0;
|
|
76971
|
-
return forEach(func.parameters, (param, i) => {
|
|
76972
|
-
const initType = getSymbolLinks(param.symbol).type;
|
|
76973
|
-
if (!initType || initType === booleanType || isSymbolAssigned(param.symbol)) {
|
|
76974
|
-
return;
|
|
76975
|
-
}
|
|
76976
|
-
const trueType2 = checkIfExpressionRefinesParameter(
|
|
76977
|
-
expr,
|
|
76978
|
-
param,
|
|
76979
|
-
initType,
|
|
76980
|
-
/*forceFullCheck*/
|
|
76981
|
-
false
|
|
76982
|
-
);
|
|
76983
|
-
if (trueType2) {
|
|
76984
|
-
const trueSubtype = checkIfExpressionRefinesParameter(
|
|
76985
|
-
expr,
|
|
76986
|
-
param,
|
|
76987
|
-
trueType2,
|
|
76988
|
-
/*forceFullCheck*/
|
|
76989
|
-
true
|
|
76990
|
-
);
|
|
76991
|
-
if (trueSubtype) {
|
|
76992
|
-
return [i, trueType2];
|
|
76993
|
-
}
|
|
76994
|
-
}
|
|
76995
|
-
});
|
|
76996
|
-
}
|
|
76997
|
-
function checkIfExpressionRefinesParameter(expr, param, initType, forceFullCheck) {
|
|
76998
|
-
const antecedent = expr.flowNode ?? { flags: 2 /* Start */ };
|
|
76999
|
-
const trueCondition = {
|
|
77000
|
-
flags: 32 /* TrueCondition */,
|
|
77001
|
-
node: expr,
|
|
77002
|
-
antecedent
|
|
77003
|
-
};
|
|
77004
|
-
const trueType2 = getFlowTypeOfReference(param.name, initType, initType, func, trueCondition);
|
|
77005
|
-
if (trueType2 === initType && !forceFullCheck)
|
|
77006
|
-
return void 0;
|
|
77007
|
-
const falseCondition = {
|
|
77008
|
-
...trueCondition,
|
|
77009
|
-
flags: 64 /* FalseCondition */
|
|
77010
|
-
};
|
|
77011
|
-
const falseType2 = getFlowTypeOfReference(param.name, initType, initType, func, falseCondition);
|
|
77012
|
-
const candidateFalse = filterType(initType, (t) => !isTypeSubtypeOf(t, trueType2));
|
|
77013
|
-
if (isTypeIdenticalTo(candidateFalse, falseType2)) {
|
|
77014
|
-
return trueType2;
|
|
77015
|
-
}
|
|
77016
|
-
}
|
|
77017
|
-
}
|
|
77018
77100
|
function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func, returnType) {
|
|
77019
77101
|
addLazyDiagnostic(checkAllCodePathsInNonVoidFunctionReturnOrThrowDiagnostics);
|
|
77020
77102
|
return;
|
|
@@ -136757,7 +136839,13 @@ ${lanes.join("\n")}
|
|
|
136757
136839
|
const currentDirectory = host.getCurrentDirectory();
|
|
136758
136840
|
const sourceFileLike = /* @__PURE__ */ new Map();
|
|
136759
136841
|
const documentPositionMappers = /* @__PURE__ */ new Map();
|
|
136760
|
-
return {
|
|
136842
|
+
return {
|
|
136843
|
+
tryGetSourcePosition,
|
|
136844
|
+
tryGetGeneratedPosition,
|
|
136845
|
+
toLineColumnOffset,
|
|
136846
|
+
clearCache,
|
|
136847
|
+
documentPositionMappers
|
|
136848
|
+
};
|
|
136761
136849
|
function toPath3(fileName) {
|
|
136762
136850
|
return toPath(fileName, currentDirectory, getCanonicalFileName);
|
|
136763
136851
|
}
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
|
|
|
54
54
|
|
|
55
55
|
// src/compiler/corePublic.ts
|
|
56
56
|
var versionMajorMinor = "5.5";
|
|
57
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
57
|
+
var version = `${versionMajorMinor}.0-insiders.20240222`;
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
|
@@ -7186,7 +7186,9 @@ var Diagnostics = {
|
|
|
7186
7186
|
Compiler_option_0_cannot_be_given_an_empty_string: diag(18051, 1 /* Error */, "Compiler_option_0_cannot_be_given_an_empty_string_18051", "Compiler option '{0}' cannot be given an empty string."),
|
|
7187
7187
|
Non_abstract_class_0_does_not_implement_all_abstract_members_of_1: diag(18052, 1 /* Error */, "Non_abstract_class_0_does_not_implement_all_abstract_members_of_1_18052", "Non-abstract class '{0}' does not implement all abstract members of '{1}'"),
|
|
7188
7188
|
Its_type_0_is_not_a_valid_JSX_element_type: diag(18053, 1 /* Error */, "Its_type_0_is_not_a_valid_JSX_element_type_18053", "Its type '{0}' is not a valid JSX element type."),
|
|
7189
|
-
await_using_statements_cannot_be_used_inside_a_class_static_block: diag(18054, 1 /* Error */, "await_using_statements_cannot_be_used_inside_a_class_static_block_18054", "'await using' statements cannot be used inside a class static block.")
|
|
7189
|
+
await_using_statements_cannot_be_used_inside_a_class_static_block: diag(18054, 1 /* Error */, "await_using_statements_cannot_be_used_inside_a_class_static_block_18054", "'await using' statements cannot be used inside a class static block."),
|
|
7190
|
+
There_is_no_signature_in_type_0_such_that_its_parameters_are_assignable_to_the_parameters_of_signature_1: diag(18055, 1 /* Error */, "There_is_no_signature_in_type_0_such_that_its_parameters_are_assignable_to_the_parameters_of_signatu_18055", "There is no signature in type {0} such that its parameters are assignable to the parameters of signature {1}"),
|
|
7191
|
+
Parameters_of_signature_0_are_not_assignable_to_the_parameters_of_any_signature_in_type_1: diag(18056, 1 /* Error */, "Parameters_of_signature_0_are_not_assignable_to_the_parameters_of_any_signature_in_type_1_18056", "Parameters of signature {0} are not assignable to the parameters of any signature in type {1}")
|
|
7190
7192
|
};
|
|
7191
7193
|
|
|
7192
7194
|
// src/compiler/scanner.ts
|
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.5.0-pr-
|
|
5
|
+
"version": "5.5.0-pr-57395-9",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -114,5 +114,5 @@
|
|
|
114
114
|
"node": "20.1.0",
|
|
115
115
|
"npm": "8.19.4"
|
|
116
116
|
},
|
|
117
|
-
"gitHead": "
|
|
117
|
+
"gitHead": "3f19e7287bee138140fc654a72cc76aea37f2635"
|
|
118
118
|
}
|