lodash: sugnatures of _.delay have been changed

This commit is contained in:
Ilya Mochalov
2015-11-19 01:52:00 +05:00
parent fc341765eb
commit e88a75776f
2 changed files with 55 additions and 16 deletions
+30 -3
View File
@@ -4371,9 +4371,36 @@ returnedThrottled(4);
result = <number>_.defer(function () { console.log('deferred'); });
result = <_.LoDashImplicitWrapper<number>>_(function () { console.log('deferred'); }).defer();
var log = _.bind(console.log, console);
result = <number>_.delay(log, 1000, 'logged later');
result = <_.LoDashImplicitWrapper<number>>_(log).delay(1000, 'logged later');
// _.delay
module TestDelay {
type SampleFunc = (a: number, b: string) => boolean;
let func: SampleFunc;
{
let result: number;
result = _.delay<SampleFunc>(func, 1);
result = _.delay<SampleFunc>(func, 1, 2);
result = _.delay<SampleFunc>(func, 1, 2, '');
}
{
let result: _.LoDashImplicitWrapper<number>;
result = _(func).delay(1);
result = _(func).delay(1, 2);
result = _(func).delay(1, 2, '');
}
{
let result: _.LoDashExplicitWrapper<number>;
result = _(func).chain().delay(1);
result = _(func).chain().delay(1, 2);
result = _(func).chain().delay(1, 2, '');
}
}
// _.flow
var testFlowSquareFn = (n: number) => n * n;
+25 -13
View File
@@ -7861,26 +7861,38 @@ declare module _ {
//_.delay
interface LoDashStatic {
/**
* Executes the func function after wait milliseconds. Additional arguments will be provided
* to func when it is invoked.
* @param func The function to delay.
* @param wait The number of milliseconds to delay execution.
* @param args Arguments to invoke the function with.
* @return The timer id.
**/
delay(
func: Function,
* Invokes func after wait milliseconds. Any additional arguments are provided to func when its invoked.
*
* @param func The function to delay.
* @param wait The number of milliseconds to delay invocation.
* @param args The arguments to invoke the function with.
* @return Returns the timer id.
*/
delay<T extends Function>(
func: T,
wait: number,
...args: any[]): number;
...args: any[]
): number;
}
interface LoDashImplicitObjectWrapper<T> {
/**
* @see _.delay
**/
* @see _.delay
*/
delay(
wait: number,
...args: any[]): LoDashImplicitWrapper<number>;
...args: any[]
): LoDashImplicitWrapper<number>;
}
interface LoDashExplicitObjectWrapper<T> {
/**
* @see _.delay
*/
delay(
wait: number,
...args: any[]
): LoDashExplicitWrapper<number>;
}
//_.flow