Change type of callback for List/Set/Map forEach (#2562)

No need to restrict what type of promise the callback returns
This commit is contained in:
Erik Arvidsson
2016-09-14 11:56:40 -07:00
committed by GitHub
parent 8fbcb58ca7
commit 601db6bd89
3 changed files with 3 additions and 3 deletions

View File

@@ -105,7 +105,7 @@ export default class List<T: Value> extends Collection<IndexedSequence<any>> {
* function returns a promise `forEach` will continue but it will not return until all of those
* promises have been fulfilled.
*/
async forEach(cb: (v: T, i: number) => ?Promise<void>): Promise<void> {
async forEach(cb: (v: T, i: number) => ?Promise<any>): Promise<void> {
const cursor = await this.sequence.newCursorAt(0);
const promises = [];
return cursor.iter((v, i) => {

View File

@@ -122,7 +122,7 @@ export default class Map<K: Value, V: Value> extends
return equals(entry[KEY], key) ? entry[VALUE] : undefined;
}
async forEach(cb: (v: V, k: K) => ?Promise<void>): Promise<void> {
async forEach(cb: (v: V, k: K) => ?Promise<any>): Promise<void> {
const cursor = await this.sequence.newCursorAt(null);
const promises = [];
return cursor.iter(entry => {

View File

@@ -77,7 +77,7 @@ export default class Set<T: Value> extends Collection<OrderedSequence<any, any>>
return this._firstOrLast(true);
}
async forEach(cb: (v: T) => ?Promise<void>): Promise<void> {
async forEach(cb: (v: T) => ?Promise<any>): Promise<void> {
const cursor = await this.sequence.newCursorAt(null);
const promises = [];
return cursor.iter(v => {