mirror of
https://github.com/dolthub/dolt.git
synced 2026-01-24 18:59:02 -06:00
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:
@@ -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) => {
|
||||
|
||||
@@ -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 => {
|
||||
|
||||
@@ -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 => {
|
||||
|
||||
Reference in New Issue
Block a user