I have already required a global value to my global javascript context:
const fs = require('fs')
Because of some special reason, I have to require it in the global scope.
And I want to write a .d.ts file to declare the global variable with a strong type.
But how to?
'fs' is a module, not a type.
If I give the type like: (in my types.d.ts file)
import * as fsi from 'fs';
declare const fs: fsi;
There will be an error TS2709: Cannot use namespace 'fsi' as a type.
How to declare a global variable of a module in Typescript?