File: genericCallWithObjectLiteralArguments1.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 (43 lines) | stat: -rw-r--r-- 3,450 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
tests/cases/compiler/genericCallWithObjectLiteralArguments1.ts(3,9): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
  Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'string'.
tests/cases/compiler/genericCallWithObjectLiteralArguments1.ts(4,22): error TS2345: Argument of type '{ x: number; y: string; }' is not assignable to parameter of type '{ x: number; y: number; }'.
  Types of property 'y' are incompatible.
    Type 'string' is not assignable to type 'number'.
tests/cases/compiler/genericCallWithObjectLiteralArguments1.ts(5,22): error TS2345: Argument of type '{ x: number; y: string; }' is not assignable to parameter of type '{ x: string; y: string; }'.
  Types of property 'x' are incompatible.
    Type 'number' is not assignable to type 'string'.
tests/cases/compiler/genericCallWithObjectLiteralArguments1.ts(6,22): error TS2345: Argument of type '{ x: string; y: number; }' is not assignable to parameter of type '{ x: number; y: number; }'.
  Types of property 'x' are incompatible.
    Type 'string' is not assignable to type 'number'.
tests/cases/compiler/genericCallWithObjectLiteralArguments1.ts(7,22): error TS2345: Argument of type '{ x: string; y: number; }' is not assignable to parameter of type '{ x: string; y: string; }'.
  Types of property 'y' are incompatible.
    Type 'number' is not assignable to type 'string'.


==== tests/cases/compiler/genericCallWithObjectLiteralArguments1.ts (5 errors) ====
    function foo<T>(n: { x: T; y: T }, m: T) { return m; }
    // these are all errors
    var x = foo({ x: 3, y: "" }, 4);
            ~~~
!!! 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 'number' is not a valid type argument because it is not a supertype of candidate 'string'.
    var x2 = foo<number>({ x: 3, y: "" }, 4); 
                         ~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '{ x: number; y: string; }' is not assignable to parameter of type '{ x: number; y: number; }'.
!!! error TS2345:   Types of property 'y' are incompatible.
!!! error TS2345:     Type 'string' is not assignable to type 'number'.
    var x3 = foo<string>({ x: 3, y: "" }, 4); 
                         ~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '{ x: number; y: string; }' is not assignable to parameter of type '{ x: string; y: string; }'.
!!! error TS2345:   Types of property 'x' are incompatible.
!!! error TS2345:     Type 'number' is not assignable to type 'string'.
    var x4 = foo<number>({ x: "", y: 4 }, "");
                         ~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '{ x: string; y: number; }' is not assignable to parameter of type '{ x: number; y: number; }'.
!!! error TS2345:   Types of property 'x' are incompatible.
!!! error TS2345:     Type 'string' is not assignable to type 'number'.
    var x5 = foo<string>({ x: "", y: 4 }, "");
                         ~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '{ x: string; y: number; }' is not assignable to parameter of type '{ x: string; y: string; }'.
!!! error TS2345:   Types of property 'y' are incompatible.
!!! error TS2345:     Type 'number' is not assignable to type 'string'.