The destructured props (from redux state) for the mapStateToProps()
function are nested, how would I apply the HeaderStateMap
types to it? I receive the following error message upon compilation:
Property 'cart' does not exist on type 'HeaderStateMap'. TS2339
Also, I've set user:any
for the meantime, but if I change the type to object, TypeScript complains that Property 'user' does not exist on type '{}'
.
Would appreciate any help :).
Code
type HeaderStateMap = {
user:any,
hidden:boolean
};
const mapStateToProps = ({ user: { user }, cart: { hidden } }:HeaderStateMap) => {
return {
user,
hidden
};
};