I have installed VS Code and want to create a simple Express app.
My code right now just looks like this:
import express from "express"
const HTTP_PORT = 1*process.env.PORT || 66600;
const app = express()
app.listen()
When I hover process.env I just get any, instead of {[name:string]:string} or some such. Even process itself is an any type. When I hover app, I just get Function, no hints for stuff like listen, get etc.
I installed these extensions:
- JavaScript and TypeScript Nightly
- Node.js Modules Intellisense
How do I configure my dev environment to get full type hints for packages and nodejs core libraries?
>Solution :
I think you migght need to add express types explicity, do npm i @types/express or yarn add @types/express. With regards to process.env, you cant get type inference because typescript doesnt know anything about your a files that are not in its scan area, its only looking for node modules, ts,and js files when your env variables are in your zshrc file or bashrc file or whatever it is on windows, maybe there is a vs-code plugin for it but im not aware of that