Fix tryCatch definition.

This commit is contained in:
Matt Dziuban
2017-05-17 09:32:16 -04:00
parent 2a89f40ab7
commit d6d84ab954
2 changed files with 5 additions and 4 deletions
+2 -2
View File
@@ -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',
+3 -2
View File
@@ -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
}
() => {