I am struggling to use jQuery with jsdom in typescript.
This is the snippet of code I currently have:
import { JSDOM } from 'jsdom';
import jQueryFactory from 'jquery';
const jsdom = new JSDOM(html);
const { window } = jsdom;
(global as any).window = window;
(global as any).document = window.document;
const $ = jQueryFactory(jsdom.window, true); // unable to make it work
console.log($('.button').text());
Encountering the error
Argument of type 'DOMWindow' is not assignable to parameter of type 'Window'.
in jQueryFactory(jsdom.window, true);
Although the jQueryFactory signature states
jQueryFactory(window: Window, discriminator: boolean)
I also attempted
const $ = jQueryFactory(jsdom.DOMWindow.window, true);
but ended up with another error Property 'DOMWindow' does not exist on type 'JSDOM'. Did you mean 'window'?
Any suggestions on how to resolve this issue?