mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
29 lines
1017 B
Plaintext
29 lines
1017 B
Plaintext
genericCallbacksAndClassHierarchy.ts(6,16): error TS2564: Property 'value' has no initializer and is not definitely assigned in the constructor.
|
|
|
|
|
|
==== genericCallbacksAndClassHierarchy.ts (1 errors) ====
|
|
namespace M {
|
|
export interface I<T> {
|
|
subscribe(callback: (newValue: T) => void ): any;
|
|
}
|
|
export class C1<T> {
|
|
public value: I<T>;
|
|
~~~~~
|
|
!!! error TS2564: Property 'value' has no initializer and is not definitely assigned in the constructor.
|
|
}
|
|
export class A<T> {
|
|
public dummy: any;
|
|
}
|
|
export class B<T> extends C1<A<T>> { }
|
|
export class D<T> {
|
|
_subscribe(viewModel: B<T>): void {
|
|
var f = (newValue: A<T>) => { };
|
|
|
|
var v: I<A<T>> = viewModel.value;
|
|
|
|
// both of these should work
|
|
v.subscribe(f);
|
|
v.subscribe((newValue: A<T>) => { });
|
|
}
|
|
}
|
|
} |