lodash: signatures of the method _.attempt changed

This commit is contained in:
Ilya Mochalov
2015-10-23 22:11:12 +05:00
parent 3191f6e008
commit 9be7f3bbcc
2 changed files with 26 additions and 8 deletions
+18 -8
View File
@@ -3468,14 +3468,6 @@ result = <number[]>_(new TestValueIn()).valuesIn<number>().value();
* Utility *
***********/
// _.attempt
interface TestAttemptFn {
(): TResult;
}
var testAttempFn: TestAttemptFn;
result = <TResult|Error>_.attempt<TResult>(testAttempFn);
result = <TResult|Error>_(testAttempFn).attempt<TResult>();
// _.noop
result = <void>_.noop();
result = <void>_.noop(1);
@@ -3678,6 +3670,24 @@ result = <string[]>_('fred, barney, & pebbles').words(/[^, ]+/g);
* Utility *
***********/
// _.attempt
module TestAttempt {
let func: (...args: any[]) => {a: string};
{
let result: {a: string}|Error;
result = _.attempt<{a: string}>(func);
result = _(func).attempt<{a: string}>();
}
{
let result: _.LoDashExplicitObjectWrapper<{a: string}|Error>;
result = _(func).chain().attempt<{a: string}>();
}
}
// _.callback
{
let result: (...args: any[]) => TResult;
+8
View File
@@ -9401,6 +9401,7 @@ declare module _ {
/**
* Attempts to invoke func, returning either the result or the caught error object. Any additional arguments
* are provided to func when its invoked.
*
* @param func The function to attempt.
* @return Returns the func result or error object.
*/
@@ -9414,6 +9415,13 @@ declare module _ {
attempt<TResult>(): TResult|Error;
}
interface LoDashExplicitObjectWrapper<T> {
/**
* @see _.attempt
*/
attempt<TResult>(): LoDashExplicitObjectWrapper<TResult|Error>;
}
//_.callback
interface LoDashStatic {
/**