Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

180
Views
VSCode cree que no se puede llamar a axios en función de su tipo de archivo

Así es como estoy usando axios en mi proyecto nodejs (nb @ts-ignore es una medida temporal mientras resuelvo esto):

 /** * 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', });

Y está basado en este tutorial de Future Studios.

La documentación de axios dice sobre el uso de la API de Axios :

axios(url[, configuración])

 // 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')) });

No 'hablo' mecanografiado, pero estas son las definiciones de tipo que veo en mis node_modules:

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

algún código cortado por brevedad

¿Cuál parece que debería estar contento con cómo lo estoy llamando?

Pero estoy recibiendo este error:

Esta expresión no es invocable.
Type 'typeof import("/home/castone/ponder/node_modules/axios/index")' has no call signatures.ts(2349)

Tengo la versión de axios como '^0.19.2' en mi archivo package.json. Estoy feliz de actualizar (la última versión al momento de escribir parece ser '0.24.0', pero preferiría abordar este problema por separado primero si es posible. También estoy en WSL1 si eso importa?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!