You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// A type variable with no constraint is not related to the non-primitive object type.
12317
+
if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~TypeFlags.NonPrimitive))) {
12318
+
errorInfo = saveErrorInfo;
12319
+
return result;
12320
+
}
12313
12321
}
12314
-
}
12315
-
// hi-speed no-this-instantiation check (less accurate, but avoids costly `this`-instantiation when the constraint will suffice), see #28231 for report on why this is needed
// hi-speed no-this-instantiation check (less accurate, but avoids costly `this`-instantiation when the constraint will suffice), see #28231 for report on why this is needed
// slower, fuller, this-instantiated check (necessary when comparing raw `this` types from base classes), see `subclassWithPolymorphicThisIsAssignable.ts` test for example
// slower, fuller, this-instantiated check (necessary when comparing raw `this` types from base classes), see `subclassWithPolymorphicThisIsAssignable.ts` test for example
return propType === narrowedPropType ? type : filterType(type, t => isTypeComparableTo(getTypeOfPropertyOfType(t, propName)!, narrowedPropType!));
15664
+
return propType === narrowedPropType ? type : filterType(type, t => isTypeComparableTo(getTypeOfPropertyOrIndexSignature(t, propName), narrowedPropType!));
15647
15665
}
15648
15666
15649
15667
function narrowTypeByTruthiness(type: Type, expr: Expression, assumeTrue: boolean): Type {
@@ -19872,14 +19890,31 @@ namespace ts {
19872
19890
}
19873
19891
19874
19892
function getTypeArgumentArityError(node: Node, signatures: ReadonlyArray<Signature>, typeArguments: NodeArray<TypeNode>) {
19875
-
let min = Infinity;
19876
-
let max = -Infinity;
19893
+
const argCount = typeArguments.length;
19894
+
// No overloads exist
19895
+
if (signatures.length === 1) {
19896
+
const sig = signatures[0];
19897
+
const min = getMinTypeArgumentCount(sig.typeParameters);
19898
+
const max = length(sig.typeParameters);
19899
+
return createDiagnosticForNodeArray(getSourceFileOfNode(node), typeArguments, Diagnostics.Expected_0_type_arguments_but_got_1, min < max ? min + "-" + max : min , argCount);
19900
+
}
19901
+
// Overloads exist
19902
+
let belowArgCount = -Infinity;
19903
+
let aboveArgCount = Infinity;
19877
19904
for (const sig of signatures) {
19878
-
min = Math.min(min, getMinTypeArgumentCount(sig.typeParameters));
19879
-
max = Math.max(max, length(sig.typeParameters));
19905
+
const min = getMinTypeArgumentCount(sig.typeParameters);
19906
+
const max = length(sig.typeParameters);
19907
+
if (min > argCount) {
19908
+
aboveArgCount = Math.min(aboveArgCount, min);
19909
+
}
19910
+
else if (max < argCount) {
19911
+
belowArgCount = Math.max(belowArgCount, max);
19912
+
}
19913
+
}
19914
+
if (belowArgCount !== -Infinity && aboveArgCount !== Infinity) {
0 commit comments