Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 类型为'的参数;类型-';不可分配给ComponentClass错误类型的参数_Reactjs_Typescript_Redux - Fatal编程技术网

Reactjs 类型为'的参数;类型-';不可分配给ComponentClass错误类型的参数

Reactjs 类型为'的参数;类型-';不可分配给ComponentClass错误类型的参数,reactjs,typescript,redux,Reactjs,Typescript,Redux,我正在为React/Redux项目设置TypeScript 按照标准的Redux模式,我有一个组件Foo和一个组件容器FooContainer // Foo Component file interface FooProps { fooProp: string <-- I think props have something to do with the issue } class Foo extends React.Component<FooProps, {}>

我正在为React/Redux项目设置TypeScript

按照标准的Redux模式,我有一个组件Foo和一个组件容器FooContainer

// Foo Component file
interface FooProps {
  fooProp: string <-- I think props have something to do with the issue
}     

class Foo extends React.Component<FooProps, {}> {
  ...
}

// in FooContainer file
...
const FooContainer = 
   connect(mapStateToProps,mapDispatchToProps)(Foo <--)
   // Foo throws TypeScript error 
   // Argument of type 'typeof Foo' is not assignable
   // to parameter of type 'ComponentClass
//Foo组件文件
界面道具{

fooProp:string你的mapStateToProps和mapDispatchToProps看起来像什么?它们的类型是什么?它们都没有可能是问题的类型…将连接类型设置为使错误消失,但实际上似乎不是正确的方法。希望这是一条线索,让我找到解决问题的途径。让你的操作成为典型e any,以及您在这两个函数中的状态,看看会发生什么。不要更改连接函数类型