mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-16 23:10:29 +00:00
Fix tryCatch definition.
This commit is contained in:
Vendored
+2
-2
@@ -1,6 +1,6 @@
|
||||
// Type definitions for ramda
|
||||
// Project: https://github.com/donnut/typescript-ramda
|
||||
// Definitions by: Erwin Poeze <https://github.com/donnut>, Matt DeKrey <https://github.com/mdekrey>, Liam Goodacre <https://github.com/LiamGoodacre>
|
||||
// Definitions by: Erwin Poeze <https://github.com/donnut>, Matt DeKrey <https://github.com/mdekrey>, Liam Goodacre <https://github.com/LiamGoodacre>, Matt Dziuban <https://github.com/mrdziuban>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
@@ -1598,7 +1598,7 @@ declare namespace R {
|
||||
* function and returns its result. Note that for effective composition with this function, both the tryer and
|
||||
* catcher functions must return the same type of results.
|
||||
*/
|
||||
tryCatch<T>(tryer: (...args: any[]) => T, catcher: (...args: any[]) => T, x: any): T;
|
||||
tryCatch<T>(tryer: (...args: any[]) => T, catcher: (...args: any[]) => T): (...args: any[]) => T;
|
||||
|
||||
/**
|
||||
* Gives a single-word string description of the (native) type of a value, returning such answers as 'Object',
|
||||
|
||||
@@ -972,8 +972,9 @@ type Pair = KeyValuePair<string, number>
|
||||
|
||||
() => {
|
||||
const x = R.prop('x');
|
||||
const a: boolean = R.tryCatch<boolean>(R.prop('x'), R.F, {x: true}); //=> true
|
||||
const b: boolean = R.tryCatch<boolean>(R.prop('x'), R.F, null); //=> false
|
||||
const a: boolean = R.tryCatch<boolean>(R.prop('x'), R.F)({x: true}); //=> true
|
||||
const b: boolean = R.tryCatch<boolean>(R.prop('x'), R.F)(null); //=> false
|
||||
const c: boolean = R.tryCatch<boolean>(R.and, R.F)(true, true); //=> true
|
||||
}
|
||||
|
||||
() => {
|
||||
|
||||
Reference in New Issue
Block a user