TS2585: 'Promise' only refers to a type, but is being used as a value here

Just install @types/node from npm. This should solve the problem.

npm install @types/node

In my case I simply added a tsconfig.json file with the following contents where the significant part relating to the above error is "target": "es2015":

{
    "compilerOptions": {
        "noImplicitAny": false,
        "noEmitOnError": true,
        "removeComments": false,
        "sourceMap": true,
        "target": "es2015"
    },
    "include": [
        "file.ts"
    ],
    "exclude": [
        "node_modules",
        "wwwroot"
    ]
}

Problem

TypeScript has two modes.

  1. A project-builder mode (when tsc is invoked with no arguments)
  2. A compile-mode (when tsc is invoked with any arguments) which does not read from the configuration file tsconfig.json

If that sounds confusing, it's even more confusing when you account for

  1. the flag for the compiler-mode to accept a configuration file is called --project
  2. inside the project-builder's configuration file there the pragma is called "compilerOptions"
  3. the compiler-mode and the project-builder mode accept the same configuration file

Anyway, the problem here was that TypeScript was simply ignoring the configuration file in the current working directory that I was running it in.

If you want to see this changed vote here,

  • https://twitter.com/TheEvanCarroll/status/1080899909522477061

This is further reported here,

  • https://github.com/Microsoft/TypeScript/issues/29241