Skip to content

Commit

Permalink
fix type errors occurring in tsc >= 3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
dmonad committed Sep 4, 2019
1 parent 03c85a3 commit 88b3add
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions iterator.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @template T,R
* @param {Iterator<T>} iterator
* @param {function(T):R} f
* @return {Iterator<R>}
* @return {IterableIterator<R>}
*/
export const mapIterator = (iterator, f) => ({
/**
Expand All @@ -14,13 +14,13 @@ export const mapIterator = (iterator, f) => ({
// @ts-ignore
next () {
const r = iterator.next()
return r.done ? { value: r.done ? undefined : f(r.value), done: r.done } : { value: f(r.value), done: false }
return { value: r.done ? undefined : f(r.value), done: r.done }
}
})

/**
* @template T
* @param {function():{done:boolean,value:T|undefined}} next
* @param {function():IteratorResult<T>} next
* @return {IterableIterator<T>}
*/
export const createIterator = next => ({
Expand Down

0 comments on commit 88b3add

Please sign in to comment.