How to fix "@types/node/index.d.ts is not a module"?

It's because inside the node typing file any module has declared with name node.

If you use

import { Process } from 'node';

TypeScript will try too find a node module or node namespace

Here you can load the complete file using

import 'node';

In your case you want to get only Process from NodeJS namespace :

import 'NodeJS';

Aftert that you just need to call it like this :

class toto implements NodeJS.Process{

}

EDIT :

If you use TypeScript >= 2.0 you should not need to add import in your file, only if you want to "optimize import"


Instead of using:

import { Process } from '@types/node';

You need to change your tsconfig.json:

{
  "compilerOptions": {
    ...
    "typeRoots": ["node_modules/@types"]
  }
}

After doing that the process variable becomes available as a global.

Sometimes you will need to import from a Node.js module like for example the fs module. You can do:

import * as fs from "fs";

You don't need to import fs from "node" or from "@types/node".

You can learn more here.