I used to define global variables using the following code:
interface CustomNodeJSGlobal extends NodeJS.Global {
myGlobalVariable: unknown
}
export { CustomNodeJSGlobal }
In Node 14, but when I installed @types/node
(which is currently in the version 16) it throws me an error Namespace 'NodeJS' has no exported member 'Global'
. How can I declare global variables in Node 16 and above?