When running my tests, I encountered an issue with the setTimeout method making them run slower than desired.
I initially attempted to address this by using "any" in my code... but that led to complaints from eslint and others.
Now, I have implemented a new piece of code that eliminates the need for the use of "any".
let defaultTimeout: typeof globalThis.setTimeout;
beforeEach(() => {
defaultTimeout = global.setTimeout;
globalThis.setTimeout = (callback: TimerHandler) => { (1)
defaultTimeout(callback, 500);
};
})
Despite these changes, I am still encountering an error related to globalThis.setTimeout.
TS2741: Property promisify is missing in type (callback: TimerHandler) => void but required in type typeof setTimeout timers.d.ts(161, 19): promisify is declared here.
While I am aware that using any and unknown could resolve this issue, I am curious if there is an alternative solution available?