mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-22 11:40:10 +08:00
Merge pull request #6673 from chrootsu/lodash-once
lodash: signatures of the method _.once have been changed
This commit is contained in:
+25
-2
@@ -3696,8 +3696,31 @@ result = <TestNegateResult>_(testNegatePredicate).negate().value();
|
||||
result = <TestNegateResult>_(testNegatePredicate).negate<TestNegateResult>().value();
|
||||
|
||||
// _.once
|
||||
result = <() => void>_.once<() => void>(function () {});
|
||||
result = <() => void>(_(function () {}).once().value());
|
||||
module TestOnce {
|
||||
interface Func {
|
||||
(a: number, b: string): boolean;
|
||||
}
|
||||
|
||||
let func: Func;
|
||||
|
||||
{
|
||||
let result: Func;
|
||||
|
||||
result = _.once(func);
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashImplicitObjectWrapper<Func>;
|
||||
|
||||
result = _(func).once();
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashExplicitObjectWrapper<Func>;
|
||||
|
||||
result = _(func).chain().once();
|
||||
}
|
||||
}
|
||||
|
||||
var returnedOnce = _.throttle(function (a: any) { return a * 5; }, 5);
|
||||
returnedOnce(4);
|
||||
|
||||
Vendored
+8
-1
@@ -7510,10 +7510,10 @@ declare module _ {
|
||||
/**
|
||||
* Creates a function that is restricted to invoking func once. Repeat calls to the function return the value
|
||||
* of the first call. The func is invoked with the this binding and arguments of the created function.
|
||||
*
|
||||
* @param func The function to restrict.
|
||||
* @return Returns the new restricted function.
|
||||
*/
|
||||
|
||||
once<T extends Function>(func: T): T;
|
||||
}
|
||||
|
||||
@@ -7524,6 +7524,13 @@ declare module _ {
|
||||
once(): LoDashImplicitObjectWrapper<T>;
|
||||
}
|
||||
|
||||
interface LoDashExplicitObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.once
|
||||
*/
|
||||
once(): LoDashExplicitObjectWrapper<T>;
|
||||
}
|
||||
|
||||
//_.partial
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user