diff --git a/doric-js/index.d.ts b/doric-js/index.d.ts index fc905135..e811e19d 100644 --- a/doric-js/index.d.ts +++ b/doric-js/index.d.ts @@ -1266,12 +1266,11 @@ declare module 'doric/lib/src/pattern/mvvm' { abstract onAttached(state: M, vh: V): void; abstract onBind(state: M, vh: V): void; } - export type ViewModelClass = new (m: M, v: V) => ViewModel; - export type ViewHolderClass = new () => V; + export type ClassType = new (...args: any) => T; export abstract class VMPanel extends Panel { - abstract getViewModelClass(): ViewModelClass; + abstract getViewModelClass(): ClassType>; abstract getState(): M; - abstract getViewHolderClass(): ViewHolderClass; + abstract getViewHolderClass(): ClassType; getViewModel(): ViewModel | undefined; build(root: Group): void; } diff --git a/doric-js/lib/src/pattern/mvvm.d.ts b/doric-js/lib/src/pattern/mvvm.d.ts index b7f06e20..78bfe5bd 100644 --- a/doric-js/lib/src/pattern/mvvm.d.ts +++ b/doric-js/lib/src/pattern/mvvm.d.ts @@ -15,14 +15,13 @@ export declare abstract class ViewModel abstract onAttached(state: M, vh: V): void; abstract onBind(state: M, vh: V): void; } -export declare type ViewModelClass = new (m: M, v: V) => ViewModel; -export declare type ViewHolderClass = new () => V; +export declare type ClassType = new (...args: any) => T; export declare abstract class VMPanel extends Panel { private vm?; private vh?; - abstract getViewModelClass(): ViewModelClass; + abstract getViewModelClass(): ClassType>; abstract getState(): M; - abstract getViewHolderClass(): ViewHolderClass; + abstract getViewHolderClass(): ClassType; getViewModel(): ViewModel | undefined; build(root: Group): void; } diff --git a/doric-js/src/pattern/mvvm.ts b/doric-js/src/pattern/mvvm.ts index be913266..8e49ac9a 100644 --- a/doric-js/src/pattern/mvvm.ts +++ b/doric-js/src/pattern/mvvm.ts @@ -54,20 +54,19 @@ export abstract class ViewModel { abstract onBind(state: M, vh: V): void } -export type ViewModelClass = new (m: M, v: V) => ViewModel -export type ViewHolderClass = new () => V +export type ClassType = new (...args: any) => T export abstract class VMPanel extends Panel { private vm?: ViewModel private vh?: V - abstract getViewModelClass(): ViewModelClass + abstract getViewModelClass(): ClassType> abstract getState(): M - abstract getViewHolderClass(): ViewHolderClass + abstract getViewHolderClass(): ClassType getViewModel() { return this.vm