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

169
Visualizações
How are you supposed to flowtype redux thunk?

What I'm currently doing is:

export type Action =
   { type: 'FOO' }
 | { type: 'BAR' }

export type Thunk = (dispatch: Dispatch, getState: GetState) => Action | Thunk 

export type Dispatch = ReduxDispatch<Action> & (action: Thunk) => void

but if you dispatch directly on the store, that won't work without recreating store:

export type Store = ReduxStore<State, Action>

In general, my thunk solution seems to have other minor problems. Does anyone have a working library definition for redux-thunk? I can't find one anywhere.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

The best example I've found so far are the ones used in Facebook's own F8 app here.

It's pretty similar to yours:

export type Dispatch = (action: Action | ThunkAction | PromiseAction | Array<Action>) => any;
export type GetState = () => Object;
export type ThunkAction = (dispatch: Dispatch, getState: GetState) => any;
export type PromiseAction = Promise<Action>;

It's worked pretty well for me so far in my project, though I don't dispatch directly on the store anywhere.

over 4 years ago · Santiago Trujillo 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