Skip to content

Commit

Permalink
fix iterateFormatted type signature not handling maybe-async-iterab…
Browse files Browse the repository at this point in the history
…le types correctly
  • Loading branch information
shtaif committed Jan 16, 2025
1 parent 9f6e47a commit bb57253
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/common/AsyncIterableChannel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class AsyncIterableChannel<T, TInit = T> {
const whenIteratorClosed = promiseWithResolvers<IteratorReturnResult<undefined>>();
return {
next: () => {
// TODO: Should every iterator of this kind here yield `this.#currentValue` first?...
return Promise.race([this.#nextIteration.promise, whenIteratorClosed.promise]);
},
return: async () => {
Expand Down
4 changes: 1 addition & 3 deletions src/iterateFormatted/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export { iterateFormatted };
*
* @returns a transformed async iterable emitting every value of `source` after formatting.
*/
function iterateFormatted<TIn extends AsyncIterable<unknown>, TRes>(
function iterateFormatted<TIn, TRes>(
source: TIn,
formatFn: (
value: ExtractAsyncIterValue<TIn> | (TIn extends AsyncIterableSubject<infer J> ? J : never),
Expand All @@ -89,8 +89,6 @@ function iterateFormatted<TIn extends AsyncIterable<unknown>, TRes>(
? { value: Required<AsyncIterableSubject<TRes>['value']> }
: { value: undefined });

function iterateFormatted<TIn, TRes>(source: TIn, formatFn: (value: TIn, i: number) => TRes): TRes;

function iterateFormatted(
source:
| undefined
Expand Down

0 comments on commit bb57253

Please sign in to comment.