Not sure if regression.
Works at runtime, but last partition doesn't type check:
import { filter, partition, test, where } from "ramda";
export interface IFoo {
bar: string;
}
const check = where({ bar: test(/fo/) })
const dataList: IFoo[] = [{ bar: "foo" }, { bar: "baz" }]
const dataObj: { [id: string]: IFoo } = { one: { bar: "foo" }, two: { bar: "baz" } }
describe("whereUnit", () => {
it("works with filter", () => {
expect(filter(check, dataList)).toEqual([{ bar: "foo" }])
expect(filter(check, dataObj)).toEqual({ one: { bar: "foo" } })
});
;
it("doesn't with partition", () => {
expect(partition(check, dataList)).toEqual([[{ bar: "foo" }], [{ bar: "baz" }]])
expect(partition(check, dataObj)).toEqual([{ one: { bar: "foo" } }, { two: { bar: "baz" } }]) // see below
});
})
No overload matches this call.
Overload 1 of 4, '(fn: (a: IFoo) => a is IFoo, list: readonly IFoo[]): [IFoo[], never[]]', gave the following error.
Argument of type '<U>(testObj: U) => boolean' is not assignable to parameter of type '(a: IFoo) => a is IFoo'.
Signature '(testObj: IFoo): boolean' must be a type predicate.
Overload 2 of 4, '(fn: (a: IFoo) => boolean, list: readonly IFoo[]): [IFoo[], IFoo[]]', gave the following error.
Argument of type '{ [id: string]: IFoo; }' is not assignable to parameter of type 'readonly IFoo[]'.
Type '{ [id: string]: IFoo; }' is missing the following properties from type 'readonly IFoo[]': length, concat, join, slice, and 26 more.ts(2769)
Not sure if regression. Works at runtime, but last
partition
doesn't type check:See also: