17 lines
1.1 KiB
Plaintext
17 lines
1.1 KiB
Plaintext
tests/cases/compiler/typeArgumentInferenceWithConstraintAsCommonRoot.ts(7,1): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
|
Type argument candidate 'Giraffe' is not a valid type argument because it is not a supertype of candidate 'Elephant'.
|
|
Property 'y' is missing in type 'Elephant'.
|
|
|
|
|
|
==== tests/cases/compiler/typeArgumentInferenceWithConstraintAsCommonRoot.ts (1 errors) ====
|
|
interface Animal { x }
|
|
interface Giraffe extends Animal { y }
|
|
interface Elephant extends Animal { z }
|
|
function f<T extends Animal>(x: T, y: T): T { return undefined; }
|
|
var g: Giraffe;
|
|
var e: Elephant;
|
|
f(g, e); // valid because both Giraffe and Elephant satisfy the constraint. T is Animal
|
|
~
|
|
!!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
|
!!! error TS2453: Type argument candidate 'Giraffe' is not a valid type argument because it is not a supertype of candidate 'Elephant'.
|
|
!!! error TS2453: Property 'y' is missing in type 'Elephant'. |