Javascript 方法不能对交叉点类型交叉点-流|反应|不可变的任何成员调用

Javascript 方法不能对交叉点类型交叉点-流|反应|不可变的任何成员调用,javascript,reactjs,debugging,flowtype,immutable.js,Javascript,Reactjs,Debugging,Flowtype,Immutable.js,声明道具: type IProps = { user: ?Map<string, any> & Record<IUser>, }; 我试图自己处理,但惨败了 非常感谢您的帮助 它是用以下方法固定的: const{name,姓氏}=映射的用户实例?user.toJS():{}出于兴趣。。。运行代码时,代码是否按预期工作? const { user } = this.props; const { name, surname } = user.toJS();

声明道具:

type IProps = {
  user: ?Map<string, any> & Record<IUser>,
};
我试图自己处理,但惨败了

非常感谢您的帮助

它是用以下方法固定的:


const{name,姓氏}=映射的用户实例?user.toJS():{}

出于兴趣。。。运行代码时,代码是否按预期工作?
const { user } = this.props;
const { name, surname } = user.toJS();   // <---- flow doesn't like this line
Flow: Call of method .toJS().
Method cannot be called on any member of intersection type intersection.