mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
[rethinkdb] Add missing promise types for cursor.next() (#45204)
This commit is contained in:
parent
dcd7613ded
commit
dd707289fc
2
types/rethinkdb/index.d.ts
vendored
2
types/rethinkdb/index.d.ts
vendored
@ -82,6 +82,8 @@ declare module "rethinkdb" {
|
||||
each<T>(cb: (err: Error, row: T) => boolean, done?: () => void): void; // returning false stops iteration
|
||||
next(cb: (err: Error, row: any) => void): void;
|
||||
next<T>(cb: (err: Error, row: T) => void): void;
|
||||
next(): Promise<any>;
|
||||
next<T>(): Promise<T>;
|
||||
toArray(cb: (err: Error, rows: any[]) => void): void;
|
||||
toArray<T>(cb: (err: Error, rows: T[]) => void): void;
|
||||
toArray(): Promise<any[]>;
|
||||
|
||||
@ -98,9 +98,14 @@ r.connect({ host: "localhost", port: 28015 }).then(function(conn: r.Connection)
|
||||
.limit(4)
|
||||
.run(conn)
|
||||
.then((cursor: r.Cursor) => {
|
||||
cursor.toArray().then((rows: any[]) => {
|
||||
console.log(rows);
|
||||
});
|
||||
return cursor.next().then((row) => {
|
||||
console.log('first row', row);
|
||||
return cursor.toArray();
|
||||
}).then((rows) => {
|
||||
console.log('all rows', rows);
|
||||
}).then(() => {
|
||||
return cursor.close();
|
||||
})
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user