File: genericCallbacksAndClassHierarchy.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 (62 lines) | stat: -rw-r--r-- 1,550 bytes parent folder | download | duplicates (5)
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
=== tests/cases/compiler/genericCallbacksAndClassHierarchy.ts ===
module M {
>M : typeof M

    export interface I<T> {
        subscribe(callback: (newValue: T) => void ): any;
>subscribe : (callback: (newValue: T) => void) => any
>callback : (newValue: T) => void
>newValue : T
    }
    export class C1<T> {
>C1 : C1<T>

        public value: I<T>;
>value : I<T>
    }
    export class A<T> {
>A : A<T>

        public dummy: any;
>dummy : any
    }
    export class B<T> extends C1<A<T>> { }
>B : B<T>
>C1 : C1<A<T>>

    export class D<T> {
>D : D<T>

        _subscribe(viewModel: B<T>): void {
>_subscribe : (viewModel: B<T>) => void
>viewModel : B<T>

            var f = (newValue: A<T>) => { };
>f : (newValue: A<T>) => void
>(newValue: A<T>) => { } : (newValue: A<T>) => void
>newValue : A<T>

            var v: I<A<T>> = viewModel.value;
>v : I<A<T>>
>viewModel.value : I<A<T>>
>viewModel : B<T>
>value : I<A<T>>

            // both of these should work
            v.subscribe(f);
>v.subscribe(f) : any
>v.subscribe : (callback: (newValue: A<T>) => void) => any
>v : I<A<T>>
>subscribe : (callback: (newValue: A<T>) => void) => any
>f : (newValue: A<T>) => void

            v.subscribe((newValue: A<T>) => { });
>v.subscribe((newValue: A<T>) => { }) : any
>v.subscribe : (callback: (newValue: A<T>) => void) => any
>v : I<A<T>>
>subscribe : (callback: (newValue: A<T>) => void) => any
>(newValue: A<T>) => { } : (newValue: A<T>) => void
>newValue : A<T>
        }
    }
}