mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-27 11:40:08 +08:00
lodash: signatures of the method _.attempt changed
This commit is contained in:
+18
-8
@@ -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;
|
||||
|
||||
Vendored
+8
@@ -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 it’s 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 {
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user