Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(toMap): fix return type of keySelector #365

Merged
merged 1 commit into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/add/asynciterable-operators/tomap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { toMap, ToMapOptions } from '../../asynciterable/tomap';

export async function toMapProto<TSource, TKey, TElement = TSource>(
this: AsyncIterable<TSource>,
options: ToMapOptions<TSource, TElement>
options: ToMapOptions<TSource, TKey, TElement>
): Promise<Map<TKey, TElement | TSource>> {
return toMap(this, options);
}
Expand Down
2 changes: 1 addition & 1 deletion src/add/iterable-operators/tomap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { toMap, ToMapOptions } from '../../iterable/tomap';

export function toMapProto<TSource, TKey, TElement = TSource>(
this: IterableX<TSource>,
options: ToMapOptions<TSource, TElement>
options: ToMapOptions<TSource, TKey, TElement>
): Map<TKey, TElement | TSource> {
return toMap(this, options);
}
Expand Down
6 changes: 3 additions & 3 deletions src/asynciterable/tomap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import { throwIfAborted } from '../aborterror';
* @template TElement
* @ignore
*/
export interface ToMapOptions<TSource, TElement> {
export interface ToMapOptions<TSource, TKey, TElement> {
/**
* The selector to get the key for the map.
*
* @memberof ToMapOptions
*/
keySelector: (item: TSource, signal?: AbortSignal) => TElement | Promise<TElement>;
keySelector: (item: TSource, signal?: AbortSignal) => TKey | Promise<TKey>;
/**
* The selector used to get the element for the Map.
*
Expand Down Expand Up @@ -44,7 +44,7 @@ export interface ToMapOptions<TSource, TElement> {
*/
export async function toMap<TSource, TKey, TElement = TSource>(
source: AsyncIterable<TSource>,
options: ToMapOptions<TSource, TElement>
options: ToMapOptions<TSource, TKey, TElement>
): Promise<Map<TKey, TElement | TSource>> {
const {
['signal']: signal,
Expand Down
6 changes: 3 additions & 3 deletions src/iterable/tomap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import { identity } from '../util/identity';
* @template TElement
* @ignore
*/
export interface ToMapOptions<TSource, TElement> {
export interface ToMapOptions<TSource, TKey, TElement> {
/**
* The selector to get the key for the map.
*
* @memberof ToMapOptions
*/
keySelector: (item: TSource) => TElement;
keySelector: (item: TSource) => TKey;
/**
* The selector used to get the element for the Map.
*
Expand All @@ -35,7 +35,7 @@ export interface ToMapOptions<TSource, TElement> {
*/
export function toMap<TSource, TKey, TElement = TSource>(
source: Iterable<TSource>,
options: ToMapOptions<TSource, TElement>
options: ToMapOptions<TSource, TKey, TElement>
): Map<TKey, TElement | TSource> {
const {
['elementSelector']: elementSelector = identity as any,
Expand Down
Loading