In a project I have several type declarations of global variables, like so:
declare const process: { [key: string]: any };
declare function setTimeout(...);
...
I am looking to declare a variable named "global" that refers to the global object (global
in CommonJS) whose type is implied by all of the other global declarations in the project.
declare const global: ???
Specifically, I'd like for TypeScript to infer that global.process
is an object and global.setTimeout
is a function because those global variables are declared to be of those types.
Is there a way to get the type of the global object in TypeScript?