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

222
Visualizações
How to get VS Code to show / validate object schema?
  1. npm init -y
  2. npm i axios
  3. npm i @types/axios --save-dev

How come VS code 1.62 doesn't appear to give the schema of the response object when I am typing out code like:

resp = await axios("https://httpstat.us/404");
resp. 

<C-Space> shows confusing / inappropriate completions.

What am I missing please? I tried renaming the file to typescript and that doesn't help either, so I am really confused how to edit Javascript effectively. I.e. for the editor to diagnose that I am using the wrong properties and prompt for using the right ones with documentation.

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

0

Name the file with a .ts extension and import axios with:

import axios from 'axios'

Then the following should work with full autocompletion:

async function testing() {
  const resp = await axios("https://httpstat.us/404");
  resp.status // works
}

Typescript doesn't always get the types right with the require function. import is the right way you do this in typescript.

See the docs

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