我是Reactjs的新手。我正在使用typescript@2.9.2构建一个预构建的应用程序并做出反应。我设法旋转并运行了该应用程序。但是,当我尝试执行npm时,请根据package.json中脚本的建议运行build:prod。我收到类似
的错误Argument of type 'typeof Step1' is not assignable to parameter of type 'ComponentType<Step1Props & DispatchProp<any> & { backTo: string; getForwardTo: (state:...'.
Type 'typeof Step1' is not assignable to type 'StatelessComponent<Step1Props & DispatchProp<any> & { backTo: string; getForwardTo: (s...'.
Type 'typeof Step1' provides no match for the signature '(props: Step1Props & DispatchProp<any> & { backTo: string; getForwardTo: (state: AppState) => string; selectType: (value: boolean) => void; appService: AppService; contents: Contents; } & { children?: ReactNode; }, context?: any): ReactElement<any> | null'.
使用npm start运行应用程序时,我收到一些无法将类型“”的参数分配给“ ComponentType&StepContainerProps>”类型的参数
识别和解决此问题的最佳方法是什么
function mapStateToProps(state: ApplicationState, props: { backTo: string, goTo: (state: ApplicationState) => string, selectType: (value: boolean) => void, applicationService: ApplicationService, contents: Contents }): Step1Props {
return {
applicationService: props.applicationService,
contents: props.contents,
backTo: props.backTo,
goTo: state.steps.isCompleted ? RouteMap.Review : props.goTo(state),
}
}
export const Step1Container = connect(mapStateToProps)(Step1)