我需要声明该函数返回一个类定义(而且是泛型的)。我怎么能这样做?
以下适用于非泛型类,但不适用于泛型:
export function composeAll(composeFunction: Function, depsFunction: Function):
(component: any) => typeof React.Component; // works
export function composeAll<V>(composeFunction: Function, depsFunction: Function):
(component: any) => typeof React.Component<V, {}>; // fails
由于
答案 0 :(得分:0)
您不需要typeof
。只是简单地
export function composeAll(composeFunction: Function, depsFunction: Function):
(component: any) => React.Component;
和
export function composeAll<V>(composeFunction: Function, depsFunction: Function):
(component: any) => React.Component<V, {}>;
您要做的事情被称为type query,我认为这不适用于此。