2014-08-15 23:33:16 +02:00
|
|
|
=== tests/cases/compiler/genericCallbacksAndClassHierarchy.ts ===
|
|
|
|
module M {
|
|
|
|
>M : typeof M
|
|
|
|
|
|
|
|
export interface I<T> {
|
|
|
|
>I : I<T>
|
|
|
|
>T : T
|
|
|
|
|
|
|
|
subscribe(callback: (newValue: T) => void ): any;
|
|
|
|
>subscribe : (callback: (newValue: T) => void) => any
|
|
|
|
>callback : (newValue: T) => void
|
|
|
|
>newValue : T
|
|
|
|
>T : T
|
|
|
|
}
|
|
|
|
export class C1<T> {
|
|
|
|
>C1 : C1<T>
|
|
|
|
>T : T
|
|
|
|
|
|
|
|
public value: I<T>;
|
|
|
|
>value : I<T>
|
2014-08-19 04:56:03 +02:00
|
|
|
>I : I<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>T : T
|
|
|
|
}
|
|
|
|
export class A<T> {
|
|
|
|
>A : A<T>
|
|
|
|
>T : T
|
|
|
|
|
|
|
|
public dummy: any;
|
|
|
|
>dummy : any
|
|
|
|
}
|
|
|
|
export class B<T> extends C1<A<T>> { }
|
|
|
|
>B : B<T>
|
|
|
|
>T : T
|
2014-08-19 04:56:03 +02:00
|
|
|
>C1 : C1<T>
|
|
|
|
>A : A<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>T : T
|
|
|
|
|
|
|
|
export class D<T> {
|
|
|
|
>D : D<T>
|
|
|
|
>T : T
|
|
|
|
|
|
|
|
_subscribe(viewModel: B<T>): void {
|
|
|
|
>_subscribe : (viewModel: B<T>) => void
|
|
|
|
>viewModel : B<T>
|
2014-08-19 04:56:03 +02:00
|
|
|
>B : B<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>T : T
|
|
|
|
|
|
|
|
var f = (newValue: A<T>) => { };
|
|
|
|
>f : (newValue: A<T>) => void
|
|
|
|
>(newValue: A<T>) => { } : (newValue: A<T>) => void
|
|
|
|
>newValue : A<T>
|
2014-08-19 04:56:03 +02:00
|
|
|
>A : A<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>T : T
|
|
|
|
|
|
|
|
var v: I<A<T>> = viewModel.value;
|
|
|
|
>v : I<A<T>>
|
2014-08-19 04:56:03 +02:00
|
|
|
>I : I<T>
|
|
|
|
>A : A<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>T : 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>
|
2014-08-19 04:56:03 +02:00
|
|
|
>A : A<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>T : T
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|