Files
DefinitelyTyped/types
Miika Hänninen b8b95c0cf8 ramda: Workaround for type inference problem in Filter (#28592)
* ramda: add return type assertions for filter/reject test

* ramda: Add failing test for filter-in-pipe scenario

* ramda: Workaround for type inference problem in Filter

In the `Filter` type, when used inside a pipe, the second format always took
precedence in type inference, causing problems when a list was filtered.

With this change, you can manually specify whether you are using filter
for an array or an object, so usage in a pipe will work. You can also
leave out the second type parameter, in which case filter works as
previously.

```ts
import { pipe, filter } from 'ramda';

pipe(
    filter<string, 'array'>((val: string) => val.length > 2),
)(['list', 'or', 'object']);

pipe(
    filter<string, 'object'>((val) => val.length > 2),
)({ a: 'list', b: 'or', c: 'object' });
```
2018-10-02 11:34:46 -07:00
..
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2018-10-01 21:03:52 -07:00
2018-10-01 20:51:05 -07:00
…
…
…
…
…
…
…
…
…
…
…
…
…
2018-09-27 14:58:58 -07:00
…
…
2018-09-25 10:33:47 +02:00
…
…
2018-09-21 12:07:19 -07:00
…
2018-09-28 18:24:51 +03:00
…
…
…
…
…
…
…
…
…
…
2018-09-21 12:04:45 -07:00
…
…
…
…
…
…
…
2018-09-23 08:52:35 -07:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2018-09-23 11:03:30 +02:00
2018-09-24 22:09:52 +02:00
2018-09-27 07:42:04 +02:00
…
…
…
…
…
…
…
…
2018-09-21 14:44:00 -07:00
…
…
…
…
2018-10-01 08:12:20 -07:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2018-09-21 12:07:41 -07:00
2018-09-24 16:49:39 +02:00
2018-09-26 08:49:57 +02:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2018-10-01 21:07:12 -07:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2018-09-28 09:48:34 +10:00
…
…
…
…
…
…
…
…
…
…
…
2018-09-24 17:05:52 +02:00
…
…
…
…
…
2018-09-21 12:08:05 -07:00
…
…
…
…
…
…
…
…
…
…
…
2018-09-24 12:31:25 -04:00
2018-09-26 10:06:43 +01:00
…
…
…
…
…
…
…
2018-09-21 14:57:27 -07:00
…
…
…
…
2018-09-26 09:26:42 +02:00
…
…
…
…
2018-10-01 14:38:08 -07:00
…
…
…
…
…
2018-09-24 16:16:08 +02:00
…
…
2018-10-01 10:57:00 -07:00
…
2018-09-26 11:22:28 +09:00
…
…
…
…
…
…
…
…
…
…
…
…
2018-09-27 16:26:59 -07:00
2018-09-28 11:01:09 +01:00
…
…
…
…
…
2018-09-24 09:13:57 -07:00
2018-09-24 14:19:28 +02:00
…
…
…
…
…
…
…
…
…
…
…
2018-09-23 15:53:21 +10:00
2018-10-01 21:31:48 -07:00
…
…
…
…
…
…
2018-09-24 17:48:52 +02:00
2018-09-24 17:48:52 +02:00
…
…
…
…
…
…
…
…
…
…
…
2018-09-21 12:24:57 -07:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2018-09-22 16:12:50 +08:00
…
…
…
…
…
…
…
2018-09-25 22:00:15 +09:00
…
…
…
2018-09-28 12:34:07 +09:00
…
…
…
…
…