Open
Description
Hey - thanks for this library
I've got a question:
If I have a function like this, a 'left join' type function, how do I get types out of it that I need so I can object properties without the compiler complaining?
export function LeftOuterJoin<L, R>(
leftArray: L,
rightArray: R,
leftKey: string,
rightKey: string
) {
return Enumerable.from(leftArray)
.groupJoin(
Enumerable.from(rightArray),
(pk) => pk[leftKey],
(fk) => fk[rightKey],
(left, right) => ({ ...left, right })
)
.selectMany(
(m) => m.right.defaultIfEmpty(),
(left, right) => ({ ...left, ...right })
)
.select(({ right, ...rest }) => ({ ...rest }))
.toArray();
}
Metadata
Metadata
Assignees
Labels
No labels