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.
19570
19567
if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~TypeFlags.NonPrimitive), RecursionFlags.Both)) {
19571
19568
resetErrorInfo(saveErrorInfo);
19572
19569
return result;
19573
19570
}
19574
19571
}
19575
19572
// 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
Copy file name to clipboardExpand all lines: tests/baselines/reference/genericUnboundedTypeParamAssignability.errors.txt
+1-9
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,8 @@
1
1
tests/cases/compiler/genericUnboundedTypeParamAssignability.ts(2,5): error TS2339: Property 'toString' does not exist on type 'T'.
2
-
tests/cases/compiler/genericUnboundedTypeParamAssignability.ts(15,6): error TS2345: Argument of type 'T' is not assignable to parameter of type '{}'.
3
-
tests/cases/compiler/genericUnboundedTypeParamAssignability.ts(16,6): error TS2345: Argument of type 'T' is not assignable to parameter of type 'Record<string, any>'.
4
2
tests/cases/compiler/genericUnboundedTypeParamAssignability.ts(17,5): error TS2339: Property 'toString' does not exist on type 'T'.
f2(t); // error in strict, unbounded T doesn't satisfy the constraint
25
-
~
26
-
!!! error TS2345: Argument of type 'T' is not assignable to parameter of type '{}'.
27
-
!!! related TS2208 tests/cases/compiler/genericUnboundedTypeParamAssignability.ts:13:15: This type parameter probably needs an `extends object` constraint.
28
23
f3(t); // error in strict, unbounded T doesn't satisfy the constraint
29
-
~
30
-
!!! error TS2345: Argument of type 'T' is not assignable to parameter of type 'Record<string, any>'.
31
-
!!! related TS2208 tests/cases/compiler/genericUnboundedTypeParamAssignability.ts:13:15: This type parameter probably needs an `extends object` constraint.
32
24
t.toString(); // error, for the same reason as f1()
33
25
~~~~~~~~
34
26
!!! error TS2339: Property 'toString' does not exist on type 'T'.
0 commit comments