type AnyFunc = (...args: any[]) => any; type Methods = { [P in keyof Scope as Scope[P] extends AnyFunc ? P : never]: Scope[P]; }; type MethodNames = string & keyof Methods; /** * Creates a new function, which has `this` bound to `scope`. * Only difference to Function.bind is, that it can bind a string value so the real executed function may change in the * scope. * Hint: It is semantically equal to the behavior of dojo/_base/lang#hitch. * * @param scope the this object * @param name the function or the name of a function. * @param partials a custom argument list. * @returns a callable function * @deprecated use Function.bind instead * @example * ``` * let x = { * count : 1, * inc(i){ * return this.count+=i; * } * }; * // use "name" binding * let inc = bind(x, "inc", 5); * * assert.equal(inc(), 5); * assert.equal(inc(), 10); * ``` */ declare function bind, Partials extends any[]>(scope: Scope, name: MethodName, ...partials: Partials): (...args: any[]) => any; /** @deprecated use Function.bind instead */ declare function bind(scope: Scope, fn: (this: Scope, ...a: A) => R): (...a: A) => R; /** @deprecated use Function.bind instead */ declare function bind(scope: Scope, fn: (this: Scope, a0: A0, ...a: A) => R, a0: A0): (...a: A) => R; /** @deprecated use Function.bind instead */ declare function bind(scope: Scope, fn: (this: Scope, a0: A0, a1: A1, ...a: A) => R, a0: A0, a1: A1): (...a: A) => R; /** @deprecated use Function.bind instead */ declare function bind(scope: Scope, fn: (this: Scope, a0: A0, a1: A1, a2: A2, ...a: A) => R, a0: A0, a1: A1, a2: A2): (...a: A) => R; /** @deprecated use Function.bind instead */ declare function bind(scope: Scope, fn: (this: Scope, a0: A0, a1: A1, a2: A2, a3: A3, ...a: A) => R, a0: A0, a1: A1, a2: A2, a3: A3): (...a: A) => R; export { bind, bind as default };