File: typeParameterAsTypeParameterConstraint.symbols

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 (88 lines) | stat: -rw-r--r-- 4,545 bytes parent folder | download | duplicates (7)
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
=== tests/cases/conformance/types/typeParameters/typeArgumentLists/typeParameterAsTypeParameterConstraint.ts ===
// using a type parameter as a constraint for a type parameter is valid
// no errors expected except illegal constraints

function foo<T, U extends T>(x: T, y: U): U { return y; }
>foo : Symbol(foo, Decl(typeParameterAsTypeParameterConstraint.ts, 0, 0))
>T : Symbol(T, Decl(typeParameterAsTypeParameterConstraint.ts, 3, 13))
>U : Symbol(U, Decl(typeParameterAsTypeParameterConstraint.ts, 3, 15))
>T : Symbol(T, Decl(typeParameterAsTypeParameterConstraint.ts, 3, 13))
>x : Symbol(x, Decl(typeParameterAsTypeParameterConstraint.ts, 3, 29))
>T : Symbol(T, Decl(typeParameterAsTypeParameterConstraint.ts, 3, 13))
>y : Symbol(y, Decl(typeParameterAsTypeParameterConstraint.ts, 3, 34))
>U : Symbol(U, Decl(typeParameterAsTypeParameterConstraint.ts, 3, 15))
>U : Symbol(U, Decl(typeParameterAsTypeParameterConstraint.ts, 3, 15))
>y : Symbol(y, Decl(typeParameterAsTypeParameterConstraint.ts, 3, 34))

var r = foo(1, 2);
>r : Symbol(r, Decl(typeParameterAsTypeParameterConstraint.ts, 5, 3), Decl(typeParameterAsTypeParameterConstraint.ts, 6, 3))
>foo : Symbol(foo, Decl(typeParameterAsTypeParameterConstraint.ts, 0, 0))

var r = foo({}, 1);
>r : Symbol(r, Decl(typeParameterAsTypeParameterConstraint.ts, 5, 3), Decl(typeParameterAsTypeParameterConstraint.ts, 6, 3))
>foo : Symbol(foo, Decl(typeParameterAsTypeParameterConstraint.ts, 0, 0))

interface A {
>A : Symbol(A, Decl(typeParameterAsTypeParameterConstraint.ts, 6, 19))

    foo: string;
>foo : Symbol(A.foo, Decl(typeParameterAsTypeParameterConstraint.ts, 8, 13))
}
interface B extends A {
>B : Symbol(B, Decl(typeParameterAsTypeParameterConstraint.ts, 10, 1))
>A : Symbol(A, Decl(typeParameterAsTypeParameterConstraint.ts, 6, 19))

    bar: number;
>bar : Symbol(B.bar, Decl(typeParameterAsTypeParameterConstraint.ts, 11, 23))
}
var a: A;
>a : Symbol(a, Decl(typeParameterAsTypeParameterConstraint.ts, 14, 3))
>A : Symbol(A, Decl(typeParameterAsTypeParameterConstraint.ts, 6, 19))

var b: B;
>b : Symbol(b, Decl(typeParameterAsTypeParameterConstraint.ts, 15, 3))
>B : Symbol(B, Decl(typeParameterAsTypeParameterConstraint.ts, 10, 1))

var r2 = foo(a, b);
>r2 : Symbol(r2, Decl(typeParameterAsTypeParameterConstraint.ts, 17, 3))
>foo : Symbol(foo, Decl(typeParameterAsTypeParameterConstraint.ts, 0, 0))
>a : Symbol(a, Decl(typeParameterAsTypeParameterConstraint.ts, 14, 3))
>b : Symbol(b, Decl(typeParameterAsTypeParameterConstraint.ts, 15, 3))

var r3 = foo({ x: 1 }, { x: 2, y: 3 });
>r3 : Symbol(r3, Decl(typeParameterAsTypeParameterConstraint.ts, 18, 3))
>foo : Symbol(foo, Decl(typeParameterAsTypeParameterConstraint.ts, 0, 0))
>x : Symbol(x, Decl(typeParameterAsTypeParameterConstraint.ts, 18, 14))
>x : Symbol(x, Decl(typeParameterAsTypeParameterConstraint.ts, 18, 24))
>y : Symbol(y, Decl(typeParameterAsTypeParameterConstraint.ts, 18, 30))

function foo2<T, U extends { length: T }>(x: T, y: U) { return y; }
>foo2 : Symbol(foo2, Decl(typeParameterAsTypeParameterConstraint.ts, 18, 39))
>T : Symbol(T, Decl(typeParameterAsTypeParameterConstraint.ts, 20, 14))
>U : Symbol(U, Decl(typeParameterAsTypeParameterConstraint.ts, 20, 16))
>length : Symbol(length, Decl(typeParameterAsTypeParameterConstraint.ts, 20, 28))
>T : Symbol(T, Decl(typeParameterAsTypeParameterConstraint.ts, 20, 14))
>x : Symbol(x, Decl(typeParameterAsTypeParameterConstraint.ts, 20, 42))
>T : Symbol(T, Decl(typeParameterAsTypeParameterConstraint.ts, 20, 14))
>y : Symbol(y, Decl(typeParameterAsTypeParameterConstraint.ts, 20, 47))
>U : Symbol(U, Decl(typeParameterAsTypeParameterConstraint.ts, 20, 16))
>y : Symbol(y, Decl(typeParameterAsTypeParameterConstraint.ts, 20, 47))

foo2(1, '');
>foo2 : Symbol(foo2, Decl(typeParameterAsTypeParameterConstraint.ts, 18, 39))

foo2({}, { length: 2 }); 
>foo2 : Symbol(foo2, Decl(typeParameterAsTypeParameterConstraint.ts, 18, 39))
>length : Symbol(length, Decl(typeParameterAsTypeParameterConstraint.ts, 22, 10))

foo2(1, { width: 3, length: 2 }); 
>foo2 : Symbol(foo2, Decl(typeParameterAsTypeParameterConstraint.ts, 18, 39))
>width : Symbol(width, Decl(typeParameterAsTypeParameterConstraint.ts, 23, 9))
>length : Symbol(length, Decl(typeParameterAsTypeParameterConstraint.ts, 23, 19))

foo2(1, []);
>foo2 : Symbol(foo2, Decl(typeParameterAsTypeParameterConstraint.ts, 18, 39))

foo2(1, ['']);
>foo2 : Symbol(foo2, Decl(typeParameterAsTypeParameterConstraint.ts, 18, 39))