ramda: add support of applying chain to function type argument (#36078)

* ramda: add support of applying `chain` to function type argument

* lint

* add test for `chain`
This commit is contained in:
林集团 2019-06-27 01:30:37 +08:00 committed by Benjamin Lichtman
parent eff7ed18e6
commit d3cf467af3
2 changed files with 7 additions and 0 deletions

View File

@ -28,6 +28,7 @@
// Krantisinh Deshmukh <https://github.com/krantisinh>
// Pierre-Antoine Mills <https://github.com/pirix-gh>
// Brekk Bockrath <https://github.com/brekk>
// Jituan Lin <https://github.com/jituanlin>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.3
@ -964,6 +965,7 @@ declare namespace R {
*/
chain<T, U>(fn: (n: T) => ReadonlyArray<U>, list: ReadonlyArray<T>): U[];
chain<T, U>(fn: (n: T) => ReadonlyArray<U>): (list: ReadonlyArray<T>) => U[];
chain<X0, X1, R>(fn: (x0: X0, x1: X1) => R, fn1: (x1: X1) => X0): (x1: X1) => R;
/**
* Restricts a number to be within a range.

View File

@ -723,6 +723,11 @@ R.times(i, 5);
R.chain(duplicate, [1, 2, 3]); // => [1, 1, 2, 2, 3, 3]
R.chain(duplicate)([1, 2, 3]); // => [1, 1, 2, 2, 3, 3]
const result1: number[] = R.chain<number, number[], number[]>(R.append, R.head)([
1,
2,
3
]); // => [1, 2, 3, 1]
};
() => {