2754. Bind Function to Context ¶ TypeScript 1 2 3 4 5 6 7 8 9 10 11type Fn = (...args) => any; declare global { interface Function { bindPolyfill(obj: Record<any, any>): Fn; } } Function.prototype.bindPolyfill = function (obj): Fn { return (...newArgs) => this.call(obj, ...newArgs); };