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

107
Visualizações
TS error when filtering on results in Promise.allSettled from axios request

I am using axios and Promise.allSettled to make a number of API calls. I am also using TS in this project.

const settledResults = await Promise.allSettled([
    axios.get("./one.json"),
    axios.get("./two.json"),
]);

const fulfilledResults = settledResults.filter(result => result.status === 'fulfilled');

This line gives the following error, which I can fix by adding any:

settledResults.filter((result: any) => result.status === 'fulfilled');

Parameter 'result' implicitly has an 'any' type.

Has anyone got an idea what the type here should be?

Have tried AxiosResponse with Promises and anything else I could think of with no luck.

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

0

Maybe use the type {[key:string]:string} or {status: string} so the filter can compare?

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