-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
typescript中使用.then() 提示Property 'then' does not exits on type '{type:string}' #2237
Comments
#2219 能解决你的问题吗? |
@sorrycc ,您好,我看commit中 "version": "2.6.0-beta.17", 是需要把dva升级到dva@2.6.0-beta.17么 |
而且我每次升级到2.6.0@-beta.14 都会在@connect出现Unable to resolve signature of class decorator when called as an expression |
我自己按照这个PR里面的方式定义了一下,还是无法实现 export interface IDispatch<A extends Action = AnyAction> {
<T extends A>(action: T): Promise<any> | T;
}
export interface IProps {
dispatch: IDispatch<AnyAction>;
[key: string]: any;
children?: React.ReactNode;
} 使用: class Index extends React.Component<IProps>{
click = () => {
const { success, ...rest } = await this.props.dispatch({type: 'global/someAction'});
// some handle ...
}
render(){
return <div onClick={this.click}>test</div>
}
} |
不要使用 decorator 的语法,使用 export default connect(mapState, mapDispatch)(YourComponent); TS 对于 decocrator 的限制比较多。 |
@xc1427 是的,但是dva,2.4.1版本还是可以用的 |
@Moicen 我也重新定义了一下,也是不可以,我试一下你的方法,谢谢 |
@sorrycc 2.6.0-beta.19 还是存在这个问题,请问如何处理? |
强行 as any吧 |
What happens?
typescript中使用.then() 提示Property 'then' does not exits on type '{type:string}'
Context
The text was updated successfully, but these errors were encountered: