mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* 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' });
```
|
||
|---|---|---|
| .. | ||
| index.d.ts | ||
| ramda-tests.ts | ||
| tsconfig.json | ||
| tslint.json | ||