Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

Redux & TypeScript: Property 'X' is missing in type 'DefaultRootState' - but the property is declared in Interface

$
0
0

Here's my Interface which I'm using with mapStateToProps:

export interface IStore {  cache?: any;  dataManager?: IUR;  userPrefs: IUP;  fingerprintModal?: IfingerprintModal;}export interface IfingerprintModal {  cbCancel: IFModalFn | null;  cbTryAgain?: IFModalFn | null;  error: null | string;  success: boolean;  visible: boolean;}

Here's the mapStateToProps fn expression:

const mapStateToProps = (state: IStore) => ({  store: {    fingerprintModal: state.userPrefs.fingerprintModal,  },});

And here's the connect HOC:

export default connect<IStore,{}>(mapStateToProps, mapDispatchToProps)(FingerprintModal);

That's the error I'm seeing:enter image description here

I can get rid of the problem by:

export default connect<IStore>(mapStateToProps as any, mapDispatchToProps)(FingerprintModal);

But I am trying to find a generic solution to that


Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>