Importing Node’s readFileSync With Typescript

Ole Ersoy
1 min readMay 15, 2020
Image by Alexander Fradellafra from Pixabay

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';

Brought to You By Firefly Semantics

--

--