Merge pull request #6673 from chrootsu/lodash-once

lodash: signatures of the method _.once have been changed
This commit is contained in:
Masahiro Wakame
2015-11-11 19:01:45 +09:00
2 changed files with 33 additions and 3 deletions
+25 -2
View File
@@ -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);
+8 -1
View File
@@ -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 {
/**