export = flux.createActions(Actions); // in actions.ts
那回报是什么?因为你没有为 <T> 指定泛型,并且因为 createActions 的参数没有正确地包含它可以推断的 T ,所以它假设 T 只是 {} . 这是discussed here并最终下降 . 因此,如上所述,您需要指定泛型:
export = flux.createActions<Actions>(Actions);
但要避免这种情况,您可以将本地(或远程) alt.d.ts 更改为:
class Alt {
createActions<T extends ActionsClass>(con: ActionsClassConstructor<T>, ...): T;
}
type ActionsClassConstructor<T extends ActionsClass> = new (alt:Alt) => T;
1 回答
您正在使用名为
"app/actions/actions"
的模块 . 该模块实际上不是一个模块(属性的映射),但是flux.createACtions(Actions)
的结果是什么:那回报是什么?因为你没有为
<T>
指定泛型,并且因为createActions
的参数没有正确地包含它可以推断的T
,所以它假设T
只是{}
. 这是discussed here并最终下降 . 因此,如上所述,您需要指定泛型:但要避免这种情况,您可以将本地(或远程)
alt.d.ts
更改为:这会根据您提供的构造函数添加正确推断所需的泛型类型信息 .