Scenario
We are using Node and Typescript and we want to load readFileSync
with import
instead of require
.
Approach
npm install --save @types/node
The readFileSync
function can now be imported like this:
import {readFileSync} from 'fs';
We are using Node and Typescript and we want to load readFileSync
with import
instead of require
.
npm install --save @types/node
The readFileSync
function can now be imported like this:
import {readFileSync} from 'fs';