export = bind; // #region bind(): /** * For a given function, creates a bound function that has the same body as the original function. * The this object of the bound function is associated with the specified object, and has the specified initial parameters. * @param thisArg The object to be used as the this object. * @param args Arguments to bind to the parameters of the function. */ declare function bind(this: T, thisArg: ThisParameterType): OmitThisParameter; // CallableFunction: declare function bind( this: (this: T, ...args: [...bound: AX, ...args: A]) => R, thisArg: T, ...bound: AX ): (...args: A) => R; // NewableFunction: declare function bind( this: new(...args: [...bound: AX, ...args: A]) => R, thisArg: unknown, ...bound: AX ): new(...args: A) => R; // #endregion declare namespace bind { // #region bind.call(): // CallableFunction: function call( func: (this: T, ...args: [...bound: AX, ...args: A]) => R, thisArg: T, ...bound: AX ): (...args: A) => R; // NewableFunction: function call( func: new(...args: [...bound: AX, ...args: A]) => R, thisArg: unknown, ...bound: AX ): new(...args: A) => R; // #endregion // #region bind.apply(): // CallableFunction: function apply( func: (this: T, ...args: [...bound: AX, ...args: A]) => R, args: readonly [thisArg: T, ...bound: AX], ): (...args: A) => R; // NewableFunction: // TODO: Figure out why this is necessary: function apply( func: new(...args: A) => R, args: readonly [thisArg: unknown], ): new(...args: A) => R; function apply( func: new(bound_0: A0, ...args: A) => R, args: readonly [thisArg: unknown, bound_0: A0], ): new(...args: A) => R; function apply( func: new(bound_0: A0, bound_1: A1, ...args: A) => R, args: readonly [thisArg: unknown, bound_0: A0, bound_1: A1], ): new(...args: A) => R; function apply( func: new(bound_0: A0, bound_1: A1, bound_2: A2, ...args: A) => R, args: readonly [thisArg: unknown, bound_0: A0, bound_1: A1, bound_2: A2], ): new(...args: A) => R; function apply( func: new(bound_0: A0, bound_1: A1, bound_2: A2, bound_3: A3, ...args: A) => R, args: readonly [thisArg: unknown, bound_0: A0, bound_1: A1, bound_2: A2, bound_3: A3], ): new(...args: A) => R; function apply( func: new(...args: [...bound: AX, ...args: A]) => R, args: readonly [thisArg: unknown, ...bound: AX], ): new(...args: A) => R; // #endregion }