Original Answer To Avoid Error
Put this at the top of your typescript file
const globalAny:any = global;
Then use globalAny instead.
globalAny.document = jsdom('');
globalAny.window = global.document.defaultView;
Updated Answer To Maintain Type Safety
If you want to keep your type safety, you can augment the existing NodeJS.Global type definition.
You need to put your definition inside the global scope declare global {...}
Keep in mind that the typescript global scope is not the same as the NodeJS interface Global, or the node global property called global of type Global…
declare global {
namespace NodeJS {
interface Global {
document: Document;
window: Window;
navigator: Navigator;
}
}
}