reactjs - Argument of type 'typeof test' is not assignable to parameter of type 'Component<{ children?: ReactNode; } & DispatchProp<any>>' -
import * react 'react'; import {connect} 'react-redux'; interface types{ type:string; status?:boolean; } export class test extends react.component<undefined,any> { constructor(props:undefined){ super(props); } private test(){} render(){ return( <h1 onclick={this.test.bind(this)}> test </h1> ) } } export default connect()(test); error
argument of type 'typeof test' not assignable parameter of type 'component<{ children?: reactnode; } & dispatchprop>'.
it looks you're overengineering component; doesn't need connect redux @ doesn't make use of either state or dispatch. also, error refers fact type of props undefined , doesn't implement of required properties connected components.
here's simplified component:
import * react 'react'; export default class test extends react.component<{}, {}> { private test() {} render() { return( <h1 onclick={this.test.bind(this)}> test </h1> ); } }
Comments
Post a Comment