File: typeArgumentInferenceWithConstraintAsCommonRoot.errors.txt

package info (click to toggle)
node-typescript 2.1.5-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 203,952 kB
  • ctags: 52,987
  • sloc: sh: 11; makefile: 5
file content (17 lines) | stat: -rw-r--r-- 1,169 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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'.