Declared props:
type IProps = {
user: ?Map<string, any> & Record<IUser>,
};
Assigning variables from props using destructuring:
const { user } = this.props;
const { name, surname } = user.toJS(); // <---- flow doesn't like this line
user variable is typeof Map (immutable.js map). Have to use .toJS() to change it into an object. But then the flow error/warning appears:
Flow: Call of method .toJS().
Method cannot be called on any member of intersection type intersection.
Was trying to handle it myself, failed miserably.
Any help highly appreciated!