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

217
Views
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 answers
Answer question

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 Report
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!