error message
Argument of type "typeof BottomBar" is not assignable to parameter of type
"ComponentClass<{ posts: any; key: any; message: any; isLogin: any; user: any; }
& {
praiseAction(type: any): (dispatch: any) => Promise<any>;
favaAction(type: any): (dispatch: any) => Promise<any>;
addToPraisePanel(key: any, data: any): void;
removeFromPraisePanel(key: any, uid: any): void; }, any>".
Types of parameters "props" and "props" are incompatible.
Type "{ posts: any; key: any; message: any; isLogin: any; user: any; }
& { praiseAction(type: any): (dispatch: any) => Promise<any>;
favaAction(type: any): (dispatch: any) => Promise<any>;
addToPraisePanel(key: any, data: any): void;
removeFromPraisePanel(key: any, uid: any): void; }" is not assignable to type "BottomBarProps | undefined".
Type "{ posts: any; key: any; message: any; isLogin: any; user: any; }
& { praiseAction(type: any): (dispatch: any) => Promise<any>;
favaAction(type: any): (dispatch: any) => Promise<any>;
addToPraisePanel(key: any, data: any): void;
removeFromPraisePanel(key: any, uid: any): void; }" is not assignable to type "BottomBarProps".
Type "{ posts: any; key: any; message: any; isLogin: any; user: any; }
& { praiseAction(type: any): (dispatch: any) => Promise<any>;
favaAction(type: any): (dispatch: any) => Promise<any>;
addToPraisePanel(key: any, data: any): void;
removeFromPraisePanel(key: any, uid: any): void; }" is missing the following properties from type "pageOwnProps": favaNum, isFavorite, isLike, likeNum
this is the type written by yourself
type pageOwnProps = {
favaNum: number
isFavorite: boolean
isLike: boolean
likeNum: number
}
type reduxProps = {
posts: any[]
key: string
message: string
isLogin: number
user: any
}
type reduxAction = {
praiseAction(type: any): Promise<any>
favaAction(type: any): Promise<any>
addToPraisePanel(key: any, data: any): void
removeFromPraisePanel(key: any, uid: any): void
}
type BottomBarProps = pageOwnProps & reduxProps & reduxAction
redux connect function
@connect(
({ posts, user }) => ({
posts: posts.postlists,
key: posts.currentKey,
message: posts.message,
isLogin: user.status,
user: user.userinfo
}),
dispatch => ({
praiseAction(type: any) {
let data = this.key.split("/")
return type
? dispatch(praiseAdd(data[0], data[1]))
: dispatch(praiseCancel(data[0], data[1]))
},
favaAction(type: any) {
let data = this.key.split("/")
return type
? dispatch(favaAdd(data[0], data[1]))
: dispatch(favaCancel(data[0], data[1]))
},
addToPraisePanel(key: any, data: any) {
dispatch(addToPraisePanel(key, data))
},
removeFromPraisePanel(key: any, uid: any) {
dispatch(removeFromPraisePanel(key, uid))
}
})
)
Class function
class BottomBar extends Component<BottomBarProps, {}> {
render() {
let { favaNum, isFavorite, isLike, likeNum } = this.props
return (...)
}
I have broken the line by reporting an error message. May I ask where the problem is
?