TypeScript/tests/baselines/reference/genericCallbacksAndClassHierarchy.types
2014-08-18 19:56:03 -07:00

84 lines
1.7 KiB
Plaintext

=== 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>
>I : I<T>
>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
>C1 : C1<T>
>A : A<T>
>T : T
export class D<T> {
>D : D<T>
>T : T
_subscribe(viewModel: B<T>): void {
>_subscribe : (viewModel: B<T>) => void
>viewModel : B<T>
>B : B<T>
>T : T
var f = (newValue: A<T>) => { };
>f : (newValue: A<T>) => void
>(newValue: A<T>) => { } : (newValue: A<T>) => void
>newValue : A<T>
>A : A<T>
>T : T
var v: I<A<T>> = viewModel.value;
>v : I<A<T>>
>I : I<T>
>A : A<T>
>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>
>A : A<T>
>T : T
}
}
}