TS2339: Property does not exist on type {}

折月煮酒 提交于 2020-01-03 01:28:21
问题 Please help me fix this compilation error. Below you can see the compiler complaining that the Actions object on line 20 (I removed a few lines for clarity before posting this) is {}: But below you can see in actions.ts that Actions is an object of type Actions , and it has the requested property (which is a function): And in the base code you can see in the DefinitelyTyped Alt definition that createActions should return an object of type Actions : So why is Typescript complaining that

Having trouble accessing React actions in isomorphic application

六眼飞鱼酱① 提交于 2019-12-11 06:38:26
问题 Iam using Alt.js with React and getting error in HomeActions.js file HomeActions.js: Uncaught TypeError: Cannot read property 'updateUserSuccess' of undefined . Not to mention the same code was working flawlessly before i completely reinstalled node_modules. here is the code import alt from '../../alt'; import request from 'superagent'; class HomeActions { constructor() { this.generateActions( 'updateUserSuccess', ); } getUser() { request .get('api/getuser') .end((err, res) => { this.actions