Seph Reed
Seph Reed

Reputation: 11038

Typescript, "process" does not exist

I installed npm i @types/node but process still doesn't register as existing. What else do I need to do to have type definitions for node?

Upvotes: 4

Views: 3354

Answers (2)

minimaliz
minimaliz

Reputation: 1

Currently, it's extremely important to note that if you update "types" or "typesRoots", you are creating an exclusive list to include (which you'll have to maintain), whereas leaving it at default makes all relevant available type locations available.

https://www.typescriptlang.org/tsconfig#types https://www.typescriptlang.org/tsconfig#typeRoots

Upvotes: 0

Seph Reed
Seph Reed

Reputation: 11038

You not only have to install the types for node (ie npm i @types/node), but you also have to list "node" under "types" in tsconfig.json

// example tsconfig.json
{
  "compilerOptions": {
    "module": "CommonJS",
    "target": "ES2018",
    "baseUrl": ".",
    "importHelpers": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "types": ["node"]
  }
}

Upvotes: 7

Related Questions