From 95b41f1a299306cc6ead4a44948d811a872df0f9 Mon Sep 17 00:00:00 2001 From: Duncan Date: Thu, 24 May 2018 13:43:24 +0100 Subject: [PATCH] Added n=1->10 cases for aperture types, and tests. --- types/ramda/index.d.ts | 10 ++++++++++ types/ramda/ramda-tests.ts | 3 +++ 2 files changed, 13 insertions(+) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 3ee2bd3dfa..4ff685488b 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -252,6 +252,16 @@ declare namespace R { * Returns a new list, composed of n-tuples of consecutive elements If n is greater than the length of the list, * an empty list is returned. */ + aperture(n: 1, list: T[]): Array<[T]>; + aperture(n: 2, list: T[]): Array<[T, T]>; + aperture(n: 3, list: T[]): Array<[T, T, T]>; + aperture(n: 4, list: T[]): Array<[T, T, T, T]>; + aperture(n: 5, list: T[]): Array<[T, T, T, T, T]>; + aperture(n: 6, list: T[]): Array<[T, T, T, T, T, T]>; + aperture(n: 7, list: T[]): Array<[T, T, T, T, T, T, T]>; + aperture(n: 8, list: T[]): Array<[T, T, T, T, T, T, T, T]>; + aperture(n: 9, list: T[]): Array<[T, T, T, T, T, T, T, T, T]>; + aperture(n: 10, list: T[]): Array<[T, T, T, T, T, T, T, T, T, T]>; aperture(n: number, list: ReadonlyArray): T[][]; aperture(n: number): (list: ReadonlyArray) => T[][]; diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index 2d8cfb1e21..a9b35692c2 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -475,6 +475,9 @@ R.times(i, 5); R.aperture(3, [1, 2, 3, 4, 5]); // => [[1, 2, 3], [2, 3, 4], [3, 4, 5]] R.aperture(7, [1, 2, 3, 4, 5]); // => [] R.aperture(7)([1, 2, 3, 4, 5]); // => [] + + const res1: Array<[number, number]> = R.aperture(2, [1, 2, 3, 4, 5]); + const res2: number[][] = R.aperture(11, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]); }; () => {