File: genericInstantiationEquivalentToObjectLiteral.types

package info (click to toggle)
node-typescript 4.9.5%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 533,908 kB
  • sloc: javascript: 2,018,330; makefile: 7; sh: 1
file content (53 lines) | stat: -rw-r--r-- 1,254 bytes parent folder | download | duplicates (4)
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
=== tests/cases/conformance/types/namedTypes/genericInstantiationEquivalentToObjectLiteral.ts ===
interface Pair<T1, T2> { first: T1; second: T2; }
>first : T1
>second : T2

var x: Pair<string, number>
>x : Pair<string, number>

var y: { first: string; second: number; }
>y : { first: string; second: number; }
>first : string
>second : number

x = y;
>x = y : { first: string; second: number; }
>x : Pair<string, number>
>y : { first: string; second: number; }

y = x;
>y = x : Pair<string, number>
>y : { first: string; second: number; }
>x : Pair<string, number>

declare function f<T, U>(x: Pair<T, U>);
>f : <T, U>(x: Pair<T, U>) => any
>x : Pair<T, U>

declare function f2<T, U>(x: { first: T; second: U; });
>f2 : <T, U>(x: {    first: T;    second: U;}) => any
>x : { first: T; second: U; }
>first : T
>second : U

f(x);
>f(x) : any
>f : <T, U>(x: Pair<T, U>) => any
>x : Pair<string, number>

f(y);
>f(y) : any
>f : <T, U>(x: Pair<T, U>) => any
>y : { first: string; second: number; }

f2(x);
>f2(x) : any
>f2 : <T, U>(x: { first: T; second: U; }) => any
>x : Pair<string, number>

f2(y);
>f2(y) : any
>f2 : <T, U>(x: { first: T; second: U; }) => any
>y : { first: string; second: number; }