Skip to content

Commit

Permalink
fix: use correct return type for predicates
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanbtucker committed Jun 23, 2019
1 parent 06829a5 commit 5ec8bf9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lazy-iterable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class LazyIterable<T> implements Iterable<T> {
* @param callback A predicate function to test each item against.
* @param thisArg The value to use as `this` when executing `callback`.
*/
public every (callback: (value: T, index?: number, source?: LazyIterable<T>) => void, thisArg: any = this): boolean {
public every (callback: (value: T, index?: number, source?: LazyIterable<T>) => boolean, thisArg: any = this): boolean {
let index = 0
for (const value of this) {
if (!callback.call(thisArg, value, index++, this)) {
Expand All @@ -127,7 +127,7 @@ class LazyIterable<T> implements Iterable<T> {
* @param callback A predicate function to test each item against.
* @param thisArg The value to use as `this` when executing `callback`.
*/
public filter (callback: (value: T, index?: number, source?: LazyIterable<T>) => void, thisArg: any = this): LazyIterable<T> {
public filter (callback: (value: T, index?: number, source?: LazyIterable<T>) => boolean, thisArg: any = this): LazyIterable<T> {
const source = this
return new LazyIterable(function* () {
let index = 0
Expand All @@ -145,7 +145,7 @@ class LazyIterable<T> implements Iterable<T> {
* @param callback A predicate function to test each item against.
* @param thisArg The value to use as `this` when executing `callback`.
*/
public find (callback: (value: T, index?: number, source?: LazyIterable<T>) => void, thisArg: any = this): T | undefined {
public find (callback: (value: T, index?: number, source?: LazyIterable<T>) => boolean, thisArg: any = this): T | undefined {
let index = 0
for (const value of this) {
if (callback.call(thisArg, value, index++, this)) {
Expand All @@ -160,7 +160,7 @@ class LazyIterable<T> implements Iterable<T> {
* @param callback A predicate function to test each item against.
* @param thisArg The value to use as `this` when executing `callback`.
*/
public findIndex (callback: (value: T, index?: number, source?: LazyIterable<T>) => void, thisArg: any = this): number {
public findIndex (callback: (value: T, index?: number, source?: LazyIterable<T>) => boolean, thisArg: any = this): number {
let index = 0
for (const value of this) {
if (callback.call(thisArg, value, index, this)) {
Expand Down

0 comments on commit 5ec8bf9

Please sign in to comment.