@typescript-deploys/pr-build 5.5.0-pr-57403-12 → 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 +197 -51
- package/lib/tsserver.js +205 -53
- package/lib/typescript.d.ts +0 -1
- package/lib/typescript.js +205 -53
- package/lib/typingsInstaller.js +4 -3
- 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 = [];
|
|
@@ -3708,7 +3708,6 @@ var ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
|
|
|
3708
3708
|
ObjectFlags3[ObjectFlags3["ContainsSpread"] = 2097152] = "ContainsSpread";
|
|
3709
3709
|
ObjectFlags3[ObjectFlags3["ObjectRestType"] = 4194304] = "ObjectRestType";
|
|
3710
3710
|
ObjectFlags3[ObjectFlags3["InstantiationExpressionType"] = 8388608] = "InstantiationExpressionType";
|
|
3711
|
-
ObjectFlags3[ObjectFlags3["SingleSignatureType"] = 134217728] = "SingleSignatureType";
|
|
3712
3711
|
ObjectFlags3[ObjectFlags3["IsClassInstanceClone"] = 16777216] = "IsClassInstanceClone";
|
|
3713
3712
|
ObjectFlags3[ObjectFlags3["IdenticalBaseTypeCalculated"] = 33554432] = "IdenticalBaseTypeCalculated";
|
|
3714
3713
|
ObjectFlags3[ObjectFlags3["IdenticalBaseTypeExists"] = 67108864] = "IdenticalBaseTypeExists";
|
|
@@ -7811,7 +7810,9 @@ var Diagnostics = {
|
|
|
7811
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."),
|
|
7812
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}'"),
|
|
7813
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."),
|
|
7814
|
-
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}")
|
|
7815
7816
|
};
|
|
7816
7817
|
|
|
7817
7818
|
// src/compiler/scanner.ts
|
|
@@ -43670,6 +43671,8 @@ function createTypeChecker(host) {
|
|
|
43670
43671
|
var lastGetCombinedNodeFlagsResult = 0 /* None */;
|
|
43671
43672
|
var lastGetCombinedModifierFlagsNode;
|
|
43672
43673
|
var lastGetCombinedModifierFlagsResult = 0 /* None */;
|
|
43674
|
+
var checkTypeRelatedToDepth = 0;
|
|
43675
|
+
var checkTypeRelatedToCurrentlyVisitingMap;
|
|
43673
43676
|
const checker = {
|
|
43674
43677
|
getNodeCount: () => reduceLeft(host.getSourceFiles(), (n, s) => n + s.nodeCount, 0),
|
|
43675
43678
|
getIdentifierCount: () => reduceLeft(host.getSourceFiles(), (n, s) => n + s.identifierCount, 0),
|
|
@@ -45553,7 +45556,7 @@ function createTypeChecker(host) {
|
|
|
45553
45556
|
if (nameNotFoundMessage) {
|
|
45554
45557
|
addLazyDiagnostic(() => {
|
|
45555
45558
|
var _a2;
|
|
45556
|
-
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 */)) {
|
|
45557
45560
|
const exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result);
|
|
45558
45561
|
if (exportOrLocalSymbol.flags & 2 /* BlockScopedVariable */ || exportOrLocalSymbol.flags & 32 /* Class */ || exportOrLocalSymbol.flags & 384 /* Enum */) {
|
|
45559
45562
|
checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation);
|
|
@@ -48775,7 +48778,7 @@ function createTypeChecker(host) {
|
|
|
48775
48778
|
}
|
|
48776
48779
|
const abstractSignatures = filter(resolved.constructSignatures, (signature) => !!(signature.flags & 4 /* Abstract */));
|
|
48777
48780
|
if (some(abstractSignatures)) {
|
|
48778
|
-
const types = map(abstractSignatures,
|
|
48781
|
+
const types = map(abstractSignatures, getOrCreateTypeFromSignature);
|
|
48779
48782
|
const typeElementCount = resolved.callSignatures.length + (resolved.constructSignatures.length - abstractSignatures.length) + resolved.indexInfos.length + // exclude `prototype` when writing a class expression as a type literal, as per
|
|
48780
48783
|
// the logic in `createTypeNodesFromResolvedType`.
|
|
48781
48784
|
(context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */ ? countWhere(resolved.properties, (p) => !(p.flags & 4194304 /* Prototype */)) : length(resolved.properties));
|
|
@@ -56169,12 +56172,6 @@ function createTypeChecker(host) {
|
|
|
56169
56172
|
isInJSFile(signature.declaration)
|
|
56170
56173
|
);
|
|
56171
56174
|
}
|
|
56172
|
-
function getImplementationSignature(signature) {
|
|
56173
|
-
return signature.typeParameters ? signature.implementationSignatureCache || (signature.implementationSignatureCache = createImplementationSignature(signature)) : signature;
|
|
56174
|
-
}
|
|
56175
|
-
function createImplementationSignature(signature) {
|
|
56176
|
-
return signature.typeParameters ? instantiateSignature(signature, createTypeMapper([], [])) : signature;
|
|
56177
|
-
}
|
|
56178
56175
|
function getBaseSignature(signature) {
|
|
56179
56176
|
const typeParameters = signature.typeParameters;
|
|
56180
56177
|
if (typeParameters) {
|
|
@@ -56197,22 +56194,12 @@ function createTypeChecker(host) {
|
|
|
56197
56194
|
}
|
|
56198
56195
|
return signature;
|
|
56199
56196
|
}
|
|
56200
|
-
function getOrCreateTypeFromSignature(signature
|
|
56197
|
+
function getOrCreateTypeFromSignature(signature) {
|
|
56201
56198
|
var _a;
|
|
56202
56199
|
if (!signature.isolatedSignatureType) {
|
|
56203
56200
|
const kind = (_a = signature.declaration) == null ? void 0 : _a.kind;
|
|
56204
56201
|
const isConstructor = kind === void 0 || kind === 176 /* Constructor */ || kind === 180 /* ConstructSignature */ || kind === 185 /* ConstructorType */;
|
|
56205
|
-
const type = createObjectType(16 /* Anonymous */
|
|
56206
|
-
if (signature.declaration && !nodeIsSynthesized(signature.declaration)) {
|
|
56207
|
-
type.symbol.declarations = [signature.declaration];
|
|
56208
|
-
type.symbol.valueDeclaration = signature.declaration;
|
|
56209
|
-
}
|
|
56210
|
-
outerTypeParameters || (outerTypeParameters = signature.declaration && getOuterTypeParameters(
|
|
56211
|
-
signature.declaration,
|
|
56212
|
-
/*includeThisTypes*/
|
|
56213
|
-
true
|
|
56214
|
-
));
|
|
56215
|
-
type.outerTypeParameters = outerTypeParameters;
|
|
56202
|
+
const type = createObjectType(16 /* Anonymous */);
|
|
56216
56203
|
type.members = emptySymbols;
|
|
56217
56204
|
type.properties = emptyArray;
|
|
56218
56205
|
type.callSignatures = !isConstructor ? [signature] : emptyArray;
|
|
@@ -59605,7 +59592,7 @@ function createTypeChecker(host) {
|
|
|
59605
59592
|
const declaration = type.objectFlags & 4 /* Reference */ ? type.node : type.objectFlags & 8388608 /* InstantiationExpressionType */ ? type.node : type.symbol.declarations[0];
|
|
59606
59593
|
const links = getNodeLinks(declaration);
|
|
59607
59594
|
const target = type.objectFlags & 4 /* Reference */ ? links.resolvedType : type.objectFlags & 64 /* Instantiated */ ? type.target : type;
|
|
59608
|
-
let typeParameters =
|
|
59595
|
+
let typeParameters = links.outerTypeParameters;
|
|
59609
59596
|
if (!typeParameters) {
|
|
59610
59597
|
let outerTypeParameters = getOuterTypeParameters(
|
|
59611
59598
|
declaration,
|
|
@@ -59786,9 +59773,6 @@ function createTypeChecker(host) {
|
|
|
59786
59773
|
if (type.objectFlags & 8388608 /* InstantiationExpressionType */) {
|
|
59787
59774
|
result.node = type.node;
|
|
59788
59775
|
}
|
|
59789
|
-
if (type.objectFlags & 134217728 /* SingleSignatureType */) {
|
|
59790
|
-
result.outerTypeParameters = type.outerTypeParameters;
|
|
59791
|
-
}
|
|
59792
59776
|
result.target = type;
|
|
59793
59777
|
result.mapper = mapper;
|
|
59794
59778
|
result.aliasSymbol = aliasSymbol || type.aliasSymbol;
|
|
@@ -60621,7 +60605,7 @@ function createTypeChecker(host) {
|
|
|
60621
60605
|
}
|
|
60622
60606
|
return false;
|
|
60623
60607
|
}
|
|
60624
|
-
function compareSignaturesRelated(source, target, checkMode, reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) {
|
|
60608
|
+
function compareSignaturesRelated(source, target, checkMode, reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers, compareTypesUnilaterally = false) {
|
|
60625
60609
|
if (source === target) {
|
|
60626
60610
|
return -1 /* True */;
|
|
60627
60611
|
}
|
|
@@ -60686,12 +60670,21 @@ function createTypeChecker(host) {
|
|
|
60686
60670
|
const sourceSig = checkMode & 3 /* Callback */ || isInstantiatedGenericParameter(source, i) ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
|
|
60687
60671
|
const targetSig = checkMode & 3 /* Callback */ || isInstantiatedGenericParameter(target, i) ? void 0 : getSingleCallSignature(getNonNullableType(targetType));
|
|
60688
60672
|
const callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) && getTypeFacts(sourceType, 50331648 /* IsUndefinedOrNull */) === getTypeFacts(targetType, 50331648 /* IsUndefinedOrNull */);
|
|
60689
|
-
let related
|
|
60690
|
-
|
|
60691
|
-
|
|
60692
|
-
|
|
60693
|
-
|
|
60694
|
-
|
|
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
|
+
}
|
|
60695
60688
|
if (related && checkMode & 8 /* StrictArity */ && i >= getMinArgumentCount(source) && i < getMinArgumentCount(target) && compareTypes(
|
|
60696
60689
|
sourceType,
|
|
60697
60690
|
targetType,
|
|
@@ -61010,6 +61003,33 @@ function createTypeChecker(host) {
|
|
|
61010
61003
|
let incompatibleStack;
|
|
61011
61004
|
let relationCount = 16e6 - relation.size >> 3;
|
|
61012
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++;
|
|
61013
61033
|
const result = isRelatedTo(
|
|
61014
61034
|
source,
|
|
61015
61035
|
target,
|
|
@@ -61077,6 +61097,18 @@ function createTypeChecker(host) {
|
|
|
61077
61097
|
if (errorNode && errorOutputContainer && errorOutputContainer.skipLogging && result === 0 /* False */) {
|
|
61078
61098
|
Debug.assert(!!errorOutputContainer.errors, "missed opportunity to interact with error.");
|
|
61079
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
|
+
}
|
|
61080
61112
|
return result !== 0 /* False */;
|
|
61081
61113
|
function resetErrorInfo(saved) {
|
|
61082
61114
|
errorInfo = saved.errorInfo;
|
|
@@ -61563,6 +61595,112 @@ function createTypeChecker(host) {
|
|
|
61563
61595
|
function shouldCheckAsExcessProperty(prop, container) {
|
|
61564
61596
|
return prop.valueDeclaration && container.valueDeclaration && prop.valueDeclaration.parent === container.valueDeclaration;
|
|
61565
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
|
+
}
|
|
61566
61704
|
function unionOrIntersectionRelatedTo(source2, target2, reportErrors2, intersectionState) {
|
|
61567
61705
|
if (source2.flags & 1048576 /* Union */) {
|
|
61568
61706
|
if (target2.flags & 1048576 /* Union */) {
|
|
@@ -61581,7 +61719,22 @@ function createTypeChecker(host) {
|
|
|
61581
61719
|
return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */) && !(target2.flags & 402784252 /* Primitive */), intersectionState);
|
|
61582
61720
|
}
|
|
61583
61721
|
if (target2.flags & 2097152 /* Intersection */) {
|
|
61584
|
-
|
|
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;
|
|
61585
61738
|
}
|
|
61586
61739
|
if (relation === comparableRelation && target2.flags & 402784252 /* Primitive */) {
|
|
61587
61740
|
const constraints = sameMap(source2.types, (t) => t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(t) || unknownType : t);
|
|
@@ -64409,7 +64562,7 @@ function createTypeChecker(host) {
|
|
|
64409
64562
|
if (objectFlags & 524288 /* CouldContainTypeVariablesComputed */) {
|
|
64410
64563
|
return !!(objectFlags & 1048576 /* CouldContainTypeVariables */);
|
|
64411
64564
|
}
|
|
64412
|
-
const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags &
|
|
64565
|
+
const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
|
|
64413
64566
|
if (type.flags & 3899393 /* ObjectFlagsType */) {
|
|
64414
64567
|
type.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (result ? 1048576 /* CouldContainTypeVariables */ : 0);
|
|
64415
64568
|
}
|
|
@@ -64691,9 +64844,6 @@ function createTypeChecker(host) {
|
|
|
64691
64844
|
pos = p;
|
|
64692
64845
|
}
|
|
64693
64846
|
}
|
|
64694
|
-
function isTupleOfSelf(typeParameter, type) {
|
|
64695
|
-
return isTupleType(type) && getTupleElementType(type, 0) === getIndexedAccessType(typeParameter, getNumberLiteralType(0)) && !getTypeOfPropertyOfType(type, "1");
|
|
64696
|
-
}
|
|
64697
64847
|
function inferTypes(inferences, originalSource, originalTarget, priority = 0 /* None */, contravariant = false) {
|
|
64698
64848
|
let bivariant = false;
|
|
64699
64849
|
let propagationType;
|
|
@@ -64779,9 +64929,6 @@ function createTypeChecker(host) {
|
|
|
64779
64929
|
inference.priority = priority;
|
|
64780
64930
|
}
|
|
64781
64931
|
if (priority === inference.priority) {
|
|
64782
|
-
if (isTupleOfSelf(inference.typeParameter, candidate)) {
|
|
64783
|
-
return;
|
|
64784
|
-
}
|
|
64785
64932
|
if (contravariant && !bivariant) {
|
|
64786
64933
|
if (!contains(inference.contraCandidates, candidate)) {
|
|
64787
64934
|
inference.contraCandidates = append(inference.contraCandidates, candidate);
|
|
@@ -65348,7 +65495,9 @@ function createTypeChecker(host) {
|
|
|
65348
65495
|
inferredType = silentNeverType;
|
|
65349
65496
|
} else {
|
|
65350
65497
|
const defaultType = getDefaultFromTypeParameter(inference.typeParameter);
|
|
65351
|
-
|
|
65498
|
+
if (defaultType) {
|
|
65499
|
+
inferredType = instantiateType(defaultType, mergeTypeMappers(createBackreferenceMapper(context, index), context.nonFixingMapper));
|
|
65500
|
+
}
|
|
65352
65501
|
}
|
|
65353
65502
|
} else {
|
|
65354
65503
|
inferredType = getTypeFromInference(inference);
|
|
@@ -71736,7 +71885,7 @@ function createTypeChecker(host) {
|
|
|
71736
71885
|
void 0,
|
|
71737
71886
|
checkMode
|
|
71738
71887
|
);
|
|
71739
|
-
const checkArgType =
|
|
71888
|
+
const checkArgType = checkMode & 4 /* SkipContextSensitive */ ? getRegularTypeOfObjectLiteral(argType) : argType;
|
|
71740
71889
|
const effectiveCheckArgumentNode = getEffectiveCheckNode(arg);
|
|
71741
71890
|
if (!checkTypeRelatedToAndOptionallyElaborate(checkArgType, paramType, relation, reportErrors2 ? effectiveCheckArgumentNode : void 0, effectiveCheckArgumentNode, headMessage, containingMessageChain, errorOutputContainer)) {
|
|
71742
71891
|
Debug.assert(!reportErrors2 || !!errorOutputContainer.errors, "parameter should have errors when reporting errors");
|
|
@@ -72280,16 +72429,13 @@ function createTypeChecker(host) {
|
|
|
72280
72429
|
return candidate;
|
|
72281
72430
|
}
|
|
72282
72431
|
for (let candidateIndex = 0; candidateIndex < candidates2.length; candidateIndex++) {
|
|
72283
|
-
|
|
72432
|
+
const candidate = candidates2[candidateIndex];
|
|
72284
72433
|
if (!hasCorrectTypeArgumentArity(candidate, typeArguments) || !hasCorrectArity(node, args, candidate, signatureHelpTrailingComma2)) {
|
|
72285
72434
|
continue;
|
|
72286
72435
|
}
|
|
72287
72436
|
let checkCandidate;
|
|
72288
72437
|
let inferenceContext;
|
|
72289
72438
|
if (candidate.typeParameters) {
|
|
72290
|
-
if (candidate.declaration && findAncestor(node, (a) => a === candidate.declaration)) {
|
|
72291
|
-
candidate = getImplementationSignature(candidate);
|
|
72292
|
-
}
|
|
72293
72439
|
let typeArgumentTypes;
|
|
72294
72440
|
if (some(typeArguments)) {
|
|
72295
72441
|
typeArgumentTypes = checkTypeArguments(
|
|
@@ -72309,7 +72455,7 @@ function createTypeChecker(host) {
|
|
|
72309
72455
|
/*flags*/
|
|
72310
72456
|
isInJSFile(node) ? 2 /* AnyDefault */ : 0 /* None */
|
|
72311
72457
|
);
|
|
72312
|
-
typeArgumentTypes =
|
|
72458
|
+
typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode | 8 /* SkipGenericFunctions */, inferenceContext);
|
|
72313
72459
|
argCheckMode |= inferenceContext.flags & 4 /* SkippedGenericFunction */ ? 8 /* SkipGenericFunctions */ : 0 /* Normal */;
|
|
72314
72460
|
}
|
|
72315
72461
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext && inferenceContext.inferredTypeParameters);
|
|
@@ -72337,7 +72483,7 @@ function createTypeChecker(host) {
|
|
|
72337
72483
|
if (argCheckMode) {
|
|
72338
72484
|
argCheckMode = 0 /* Normal */;
|
|
72339
72485
|
if (inferenceContext) {
|
|
72340
|
-
const typeArgumentTypes =
|
|
72486
|
+
const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
|
|
72341
72487
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
|
|
72342
72488
|
if (getNonArrayRestType(candidate) && !hasCorrectArity(node, args, checkCandidate, signatureHelpTrailingComma2)) {
|
|
72343
72489
|
candidateForArgumentArityError = checkCandidate;
|
|
@@ -76054,7 +76200,7 @@ function createTypeChecker(host) {
|
|
|
76054
76200
|
}
|
|
76055
76201
|
}
|
|
76056
76202
|
}
|
|
76057
|
-
return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, context)
|
|
76203
|
+
return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, context));
|
|
76058
76204
|
}
|
|
76059
76205
|
}
|
|
76060
76206
|
}
|