Function.prototype.delay = function (ms) {
return (...args) => {
setTimeout(() => {
this(...args);
}, ms)
}
}
interface newFunction extends Function {
delay: () => {}
}
declare global {
interface Function<T> {
delay(ms: number): Function<T>;
}
}