mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
lodash: signatures of _.before have been changed
This commit is contained in:
+25
-16
@@ -4658,22 +4658,31 @@ module TestBackflow {
|
||||
}
|
||||
|
||||
// _.before
|
||||
var testBeforeFn = ((n: number) => () => ++n)(0);
|
||||
var testBeforeResultFn = <() => number>_.before<() => number>(3, testBeforeFn);
|
||||
result = <number>testBeforeResultFn();
|
||||
// → 1
|
||||
result = <number>testBeforeResultFn();
|
||||
// → 2
|
||||
result = <number>testBeforeResultFn();
|
||||
// → 2
|
||||
var testBeforeFn = ((n: number) => () => ++n)(0);
|
||||
var testBeforeResultFn = <() => number>_(3).before<() => number>(testBeforeFn);
|
||||
result = <number>testBeforeResultFn();
|
||||
// → 1
|
||||
result = <number>testBeforeResultFn();
|
||||
// → 2
|
||||
result = <number>testBeforeResultFn();
|
||||
// → 2
|
||||
module TestBefore {
|
||||
interface Func {
|
||||
(a: string, b: number): boolean;
|
||||
}
|
||||
|
||||
let func: Func;
|
||||
|
||||
{
|
||||
let result: Func;
|
||||
|
||||
_.before(42, func);
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashImplicitObjectWrapper<Func>;
|
||||
|
||||
_(42).before(func);
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashExplicitObjectWrapper<Func>;
|
||||
|
||||
_(42).chain().before(func);
|
||||
}
|
||||
}
|
||||
|
||||
var funcBind = function(greeting: string, punctuation: string) { return greeting + ' ' + this.user + punctuation; };
|
||||
var funcBound1: (punctuation: string) => any = _.bind(funcBind, { 'name': 'moe' }, 'hi');
|
||||
|
||||
Vendored
+16
-5
@@ -8048,20 +8048,31 @@ declare module _ {
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Creates a function that invokes func, with the this binding and arguments of the created function, while
|
||||
* it is called less than n times. Subsequent calls to the created function return the result of the last func
|
||||
* it’s called less than n times. Subsequent calls to the created function return the result of the last func
|
||||
* invocation.
|
||||
*
|
||||
* @param n The number of calls at which func is no longer invoked.
|
||||
* @param func The function to restrict.
|
||||
* @return Returns the new restricted function.
|
||||
*/
|
||||
before<TFunc extends Function>(n: number, func: TFunc): TFunc;
|
||||
before<TFunc extends Function>(
|
||||
n: number,
|
||||
func: TFunc
|
||||
): TFunc;
|
||||
}
|
||||
|
||||
interface LoDashImplicitWrapper<T> {
|
||||
/**
|
||||
* @sed _.before
|
||||
*/
|
||||
before<TFunc extends Function>(func: TFunc): TFunc;
|
||||
* @see _.before
|
||||
**/
|
||||
before<TFunc extends Function>(func: TFunc): LoDashImplicitObjectWrapper<TFunc>;
|
||||
}
|
||||
|
||||
interface LoDashExplicitWrapper<T> {
|
||||
/**
|
||||
* @see _.before
|
||||
**/
|
||||
before<TFunc extends Function>(func: TFunc): LoDashExplicitObjectWrapper<TFunc>;
|
||||
}
|
||||
|
||||
//_.bind
|
||||
|
||||
Reference in New Issue
Block a user