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

190
Visualizações
VSCode thinks axios is not callable based on it's type file

Here is how I'm using axios in my nodejs project, (n.b. @ts-ignore is a temporary measure while I figure this out):

/**
 * Gets the current latest version of MTG JSON
 * @returns {Promise<string>} latest json version
 */
async function getMtgJsonVersion() {
  try {
    // @ts-ignore
    const { data } = await axios(metaUrl);
    return data.date;
  } catch (error) {
    console.error('Could not fetch MTG JSON metadata');
    throw error;
  }
}
// ... elsewhere in my code ....
// @ts-ignore
  const { data, headers } = await axios({
    url,
    method: 'GET',
    responseType: 'stream',
  });

And it's based on this tutorial by Future Studios

The axios documentations says about using the Axios API this was:

axios(url[, config])

// Send a GET request (default method)
axios('/user/12345');

axios(config)

// GET request for remote image in node.js
axios({
  method: 'get',
  url: // shortened link removed,
  responseType: 'stream'
})
  .then(function (response) {
    response.data.pipe(fs.createWriteStream('ada_lovelace.jpg'))
  });

I don't 'speak' typescript, but these are the type definitions I see in my node_modules:

export interface AxiosInstance {
  (config: AxiosRequestConfig): AxiosPromise;
  (url: string, config?: AxiosRequestConfig): AxiosPromise;
   ...
}

export interface AxiosStatic extends AxiosInstance { ... }

some code cut for brevity

Which looks like it should be happy with how I'm calling it?

But I am getting this error:

This expression is not callable.
Type 'typeof import("/home/castone/ponder/node_modules/axios/index")' has no call signatures.ts(2349)

I have axios version as '^0.19.2' in my package.json file. I'm happy to upgrade (the latest version at time of writing seems to be '0.24.0', but I'd prefer to address this issue separately first if possible. I'm also on WSL1 if that matters?

about 4 years ago · Juan Pablo Isaza
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