1// @allowJs: true 2// @checkJs: true 3// @outDir: ./out 4// @filename: tile1.ts 5interface Lifecycle<Attrs, State> { 6 oninit?(vnode: Vnode<Attrs, State>): number; 7 [_: number]: any; 8} 9 10interface Vnode<Attrs, State extends Lifecycle<Attrs, State> = Lifecycle<Attrs, State>> { 11 tag: Component<Attrs, State>; 12} 13 14interface Component<Attrs, State> { 15 view(this: State, vnode: Vnode<Attrs, State>): number; 16} 17 18interface ClassComponent<A> extends Lifecycle<A, ClassComponent<A>> { 19 oninit?(vnode: Vnode<A, this>): number; 20 view(vnode: Vnode<A, this>): number; 21} 22 23interface MyAttrs { id: number } 24class C implements ClassComponent<MyAttrs> { 25 view(v: Vnode<MyAttrs>) { return 0; } 26} 27 28const test8: ClassComponent<any> = new C(); 29// @filename: file1.js 30/** @type {ClassComponent<any>} */ 31const test9 = new C(); 32