To import node’s path module using import path from ‘path’ with Node.js, we add the type definitions for node.
And the we import the module.
To install the type definitions, we run
npm install --save-dev @types/node
Then we import path with
import * as path from 'path';
to import all members into the path object.