1
鉴于这种如何声明添加到原型链的方法?
class GameActions {
bootstrap() {
return fetchGames().then((data: any) => {
// error
this.dispatch(data)
})
}
}
module.exports = alt.createActions(GameActions)
如何通知打字稿是dispatch
在原型链中发现了什么? alt.createActions
通过原型继承增加了dispatch
。此外,alt
是来自npm的外部通量库。
清除它。 Typescript需要一个'become'关键字,这意味着它将在未来实现一些接口。在我的例子中,'GameActions类变成ActionCreator' – mgutz 2015-04-01 05:21:15
Mixin在2.0的路线图上:https://github.com/Microsoft/TypeScript/wiki/Roadmap#20你也可以在这里开始讨论:https:// github。 com/Microsoft/TypeScript/issues如果你能提出一个建议,那将是非常好的。 – basarat 2015-04-01 06:05:03