Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

68
Visualizações
Property 'X' is missing in type 'DefaultRootState' - but the property is declared in Interface

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

export interface IStore {
  cache?: any;
  dataManager?: IUR;
  userPrefs: IUP;
  IModal?: IfingerprintModal;
}

export interface IModal {
  cbCancel: IFModalFn | null;
  cbTryAgain?: IFModalFn | null;
  error: null | string;
  success: boolean;
  visible: boolean;
}

Here's the mapStateToProps fn expression:

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

And here's the connect HOC:

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

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)(IModal);

But I am trying to find a generic solution to that

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Just remove the type from the connect call and let typescript to handle it for you:

connect(mapStateToProps, mapDispatchToProps)(FingerprintModal);

Otherwise you would need to specify the full type:

connect<{store: IStore;}, {}, {}, IStore>(mapStateToProps, mapDispatchToProps)

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda