Skip to content

Commit

Permalink
fix(list): Improve Join and GroupJoin typings (#173)
Browse files Browse the repository at this point in the history
Co-authored-by: Marlon Tucker <marlon.tucker@aareon.com>
  • Loading branch information
marlon-tucker and Marlon Tucker committed Aug 19, 2020
1 parent 87c7c26 commit c37100c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,12 @@ class List<T> {
* Correlates the elements of two sequences based on equality of keys and groups the results.
* The default equality comparer is used to compare keys.
*/
public GroupJoin<U>(
public GroupJoin<U, R>(
list: List<U>,
key1: (k: T) => any,
key2: (k: U) => any,
result: (first: T, second: List<U>) => any
): List<any> {
result: (first: T, second: List<U>) => R
): List<R> {
return this.Select(x =>
result(
x,
Expand Down Expand Up @@ -275,12 +275,12 @@ class List<T> {
/**
* Correlates the elements of two sequences based on matching keys. The default equality comparer is used to compare keys.
*/
public Join<U>(
public Join<U, R>(
list: List<U>,
key1: (key: T) => any,
key2: (key: U) => any,
result: (first: T, second: U) => any
): List<any> {
result: (first: T, second: U) => R
): List<R> {
return this.SelectMany(x =>
list.Where(y => key2(y) === key1(x)).Select(z => result(x, z))
)
Expand Down

0 comments on commit c37100c

Please sign in to comment.