File: genericCallWithObjectTypeArgs.types

package info (click to toggle)
node-typescript 3.3.3333-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 324,548 kB
  • sloc: makefile: 6; sh: 3
file content (58 lines) | stat: -rw-r--r-- 816 bytes parent folder | download
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
=== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgs.ts ===
class C {
>C : C

    private x: string;
>x : string
}

class D {
>D : D

    private x: string;
>x : string
}

class X<T> {
>X : X<T>

    x: T;
>x : T
}

function foo<T>(t: X<T>, t2: X<T>) {
>foo : <T>(t: X<T>, t2: X<T>) => T
>t : X<T>
>t2 : X<T>

    var x: T;
>x : T

    return x;
>x : T
}

var c1 = new X<C>();
>c1 : X<C>
>new X<C>() : X<C>
>X : typeof X

var d1 = new X<D>();
>d1 : X<D>
>new X<D>() : X<D>
>X : typeof X

var r = foo(c1, d1); // error
>r : any
>foo(c1, d1) : any
>foo : <T>(t: X<T>, t2: X<T>) => T
>c1 : X<C>
>d1 : X<D>

var r2 = foo(c1, c1); // ok
>r2 : C
>foo(c1, c1) : C
>foo : <T>(t: X<T>, t2: X<T>) => T
>c1 : X<C>
>c1 : X<C>