Skip to content

Commit

Permalink
feat: improve mapToObject types (#97)
Browse files Browse the repository at this point in the history
Co-authored-by: Egor Miasniankin <e.myasnyankin@cryptology.com>
  • Loading branch information
Vetin and Egor Miasniankin committed Mar 11, 2024
1 parent 65340aa commit 2fe94a5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions immutable.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1302,14 +1302,14 @@ export function mapParallelAsyncWithLimit<T, K>(fn: AsyncIterableIndexed<T, K>,
*
* All of returned objects will be merged to generate the final result.
*/
export function mapToObject<T, U>(fn: (input: T) => object|false, list: readonly T[]): U;
export function mapToObject<T, U>(fn: (input: T) => object|false): (list: readonly T[]) => U;
export function mapToObject<T, U extends object>(fn: (input: T) => U|false, list: readonly T[]): U;
export function mapToObject<T, U extends object>(fn: (input: T) => U|false): (list: readonly T[]) => U;

/**
* Asynchronous version of `R.mapToObject`
*/
export function mapToObjectAsync<T, U>(fn: (input: T) => Promise<object|false>, list: readonly T[]): Promise<U>;
export function mapToObjectAsync<T, U>(fn: (input: T) => Promise<object|false>): (list: readonly T[]) => Promise<U>;
export function mapToObjectAsync<T, U extends object>(fn: (input: T) => Promise<U|false>, list: readonly T[]): Promise<U>;
export function mapToObjectAsync<T, U extends object>(fn: (input: T) => Promise<U|false>): (list: readonly T[]) => Promise<U>;

export function mapcat<T>(x: T): T;

Expand Down
8 changes: 4 additions & 4 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1302,14 +1302,14 @@ export function mapParallelAsyncWithLimit<T, K>(fn: AsyncIterableIndexed<T, K>,
*
* All of returned objects will be merged to generate the final result.
*/
export function mapToObject<T, U>(fn: (input: T) => object|false, list: T[]): U;
export function mapToObject<T, U>(fn: (input: T) => object|false): (list: T[]) => U;
export function mapToObject<T, U extends object>(fn: (input: T) => U|false, list: T[]): U;
export function mapToObject<T, U extends object>(fn: (input: T) => U|false): (list: T[]) => U;

/**
* Asynchronous version of `R.mapToObject`
*/
export function mapToObjectAsync<T, U>(fn: (input: T) => Promise<object|false>, list: T[]): Promise<U>;
export function mapToObjectAsync<T, U>(fn: (input: T) => Promise<object|false>): (list: T[]) => Promise<U>;
export function mapToObjectAsync<T, U extends object>(fn: (input: T) => Promise<U|false>, list: T[]): Promise<U>;
export function mapToObjectAsync<T, U extends object>(fn: (input: T) => Promise<U|false>): (list: T[]) => Promise<U>;

export function mapcat<T>(x: T): T;

Expand Down

0 comments on commit 2fe94a5

Please sign in to comment.