Reactjs 类型React:类型为'的参数;简介';不可分配给类型为';组件类型<;从不>';

Reactjs 类型React:类型为'的参数;简介';不可分配给类型为';组件类型<;从不>';,reactjs,typescript,react-redux,typescript-typings,Reactjs,Typescript,React Redux,Typescript Typings,我是打字新手,这个问题一直困扰着我。 这是我的密码 import { IProps, IState } from './types'; class Profile extends Component<RouteComponentProps & IProps, IState>{ state: IState = { form: { first_name: this.props.user.first_name,

我是打字新手,这个问题一直困扰着我。 这是我的密码

import { IProps, IState }   from './types';

class Profile extends Component<RouteComponentProps & IProps, IState>{
    state: IState = {
        form: {
            first_name: this.props.user.first_name,
            last_name : this.props.user.last_name,
            email     : this.props.user.email,
            phone     : this.props.user.phone || ''
        },

        isLoading: false
    };

    validator = new SimpleReactValidator({autoForceUpdate: true});


    render () {
        const { user } = this.props;
        const { form, isLoading } = this.state;

        return (<div></div>)
    }
}

export default Profile;
这是我的索引。ts:

import Profile       from './pages/profile/Profile';

const mapStateToProps = (state: IAppState) => {
    return {
        user: state.Auth.user
    };
};

export default connect(mapStateToProps)(Profile);
我的代码编辑器将该(配置文件)突出显示为错误

我的终端抛出以下错误:

类型为“typeof Profile”的参数不能分配给类型为>“ComponentType”的参数。 类型“typeof Profile”不可分配给类型“ComponentClassany>”

我想知道我是否可以在这里更改代码以修复此Typescript“错误”。
从“/types”导入{IProps,IState};
从“react redux”导入{connect}
类概要文件扩展了组件{
状态:IState={
表格:{
first_name:this.props.user.first_name,
姓氏:this.props.user.last_name,
电子邮件:this.props.user.email,
电话:this.props.user.phone | |“
},
孤岛加载:false
};
validator=新的SimpleReactValidator({autoForceUpdate:true});
渲染(){
const{user}=this.props;
const{form,isLoading}=this.state;
返回()
}
}
常量mapStateToProps=(状态:IAppState)=>{
返回{
用户:state.Auth.user
};
};
导出默认连接(MapStateTops)(配置文件);
从“/types”导入{IProps,IState};
从“react redux”导入{connect}
类概要文件扩展了组件{
状态:IState={
表格:{
first_name:this.props.user.first_name,
姓氏:this.props.user.last_name,
电子邮件:this.props.user.email,
电话:this.props.user.phone | |“
},
孤岛加载:false
};
validator=新的SimpleReactValidator({autoForceUpdate:true});
渲染(){
const{user}=this.props;
const{form,isLoading}=this.state;
返回()
}
}
常量mapStateToProps=(状态:IAppState)=>{
返回{
用户:state.Auth.user
};
};
导出默认连接(MapStateTops)(配置文件);

如果您尝试将index.ts代码移动到配置文件ts文件中,然后将其移动到默认配置文件ts文件中,会发生什么情况?是否会显示相同的错误?我尝试了此操作,但出现了相同的错误。如果您尝试将index.ts代码移动到配置文件ts文件中,然后从该文件移动到默认配置文件,会发生什么情况?是否会显示相同的错误?我尝试了此操作,但是同样的错误发生了。这并不能解决问题,同样的错误发生了。这并不能解决问题,同样的错误发生了。
import Profile       from './pages/profile/Profile';

const mapStateToProps = (state: IAppState) => {
    return {
        user: state.Auth.user
    };
};

export default connect(mapStateToProps)(Profile);
import { IProps, IState }   from './types';
import {connect} from "react-redux"

class Profile extends Component<RouteComponentProps & IProps, IState>{
    state: IState = {
        form: {
            first_name: this.props.user.first_name,
            last_name : this.props.user.last_name,
            email     : this.props.user.email,
            phone     : this.props.user.phone || ''
        },

        isLoading: false
    };

    validator = new SimpleReactValidator({autoForceUpdate: true});


    render () {
        const { user } = this.props;
        const { form, isLoading } = this.state;

        return (<div></div>)
    }
}


const mapStateToProps = (state: IAppState) => {
    return {
        user: state.Auth.user
    };
};

export default connect(mapStateToProps)(Profile);