Skip to content
This repository was archived by the owner on Feb 21, 2021. It is now read-only.

Commit ef621d4

Browse files
committed
fix run for rethinkdbdash
1 parent d0d649f commit ef621d4

File tree

1 file changed

+34
-30
lines changed

1 file changed

+34
-30
lines changed

rethinkdbdash/rethinkdbdash.d.ts

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
55
// Reference: http://www.rethinkdb.com/api/#js
66

7-
/// <reference path="../node/node.d.ts" />
87
/// <reference path="../rethinkdb/rethinkdb.d.ts" />
98

109
declare module rethinkdbdash {
@@ -26,7 +25,7 @@ declare module rethinkdbdash {
2625
getConnection(): any;
2726
getPools(): any[];
2827
}
29-
28+
3029
export interface Pool extends NodeJS.EventEmitter {
3130
id: any;
3231
options: any;
@@ -42,7 +41,7 @@ declare module rethinkdbdash {
4241
putConnection(connection: Connection): void;
4342
getConnection(): Promise<Connection>;
4443
}
45-
44+
4645
export interface Connection extends NodeJS.EventEmitter {
4746
rejectMap: any;
4847
timeout: any;
@@ -113,47 +112,52 @@ declare module rethinkdbdash {
113112
prototype: Error;
114113
new (message?: string): ReqlClientError;
115114
}
116-
115+
117116
export interface RDashConnect {
118-
(options?:{
119-
port?:number,
120-
host?:string,
121-
db?:string,
122-
discovery?:boolean,
123-
max?:number,
124-
buffer?:number,
125-
timeout?:number,
126-
timeoutError?:number,
127-
timeoutGb?:number,
128-
maxExponent?:number,
129-
silent?:boolean,
130-
servers?:Array<{host:string, port:number}>,
131-
optionalRun?:boolean,
132-
ssl?:boolean,
133-
pool?:boolean,
134-
cursor?:boolean
117+
(options?:{
118+
port?:number,
119+
host?:string,
120+
db?:string,
121+
discovery?:boolean,
122+
max?:number,
123+
buffer?:number,
124+
timeout?:number,
125+
timeoutError?:number,
126+
timeoutGb?:number,
127+
maxExponent?:number,
128+
silent?:boolean,
129+
servers?:Array<{host:string, port:number}>,
130+
optionalRun?:boolean,
131+
ssl?:boolean,
132+
pool?:boolean,
133+
cursor?:boolean
135134
}):RDash;
136135
}
136+
export interface RDashConnectionOptions extends rethinkdb.RConnectionOptions {
137+
cursor: boolean;
138+
}
137139
}
138140

139141
declare module rethinkdb {
140-
// override RRunable to extend it with PromiseLike<T>
142+
// override RRunable to extend it with PromiseLike<T>
141143
export interface RRunable<T> extends PromiseLike<T> {
142144
run(connection:rethinkdbdash.Connection, cb:CallbackFunction<T>):void;
143-
run(connection:rethinkdbdash.Connection, options:RConnectionOptions, cb:CallbackFunction<T>):void;
144-
run(connection:rethinkdbdash.Connection, options?:RConnectionOptions):Promise<T>;
145145
run(cb:CallbackFunction<T>):void;
146-
run(options:RConnectionOptions, cb:CallbackFunction<T>):void;
147-
run(options?:RConnectionOptions):Promise<T>;
146+
run(options:rethinkdbdash.RDashConnectionOptions, cb:CallbackFunction<T>):void;
147+
run(connection:rethinkdbdash.Connection, options:rethinkdbdash.RDashConnectionOptions, cb:CallbackFunction<T>):void;
148+
149+
run(connection:rethinkdbdash.Connection, options?:rethinkdbdash.RDashConnectionOptions):Promise<T>;
150+
run(options?:rethinkdbdash.RDashConnectionOptions):Promise<T>;
148151
}
149-
150-
export interface RCursor<RemoteT> extends NodeJS.EventEmitter {
152+
153+
// note: extends RemoteT to accomodate for automatic coercing with { cursor: false } option
154+
export interface RCursor<RemoteT> extends NodeJS.EventEmitter, RemoteT {
151155
eachAsync(process_function:(element:RemoteT) => any): Promise<void> & { error:(errorHandler:(error:Error)=>void)=>Promise<void> };
152156
}
153157
}
154158

155159
declare module "rethinkdbdash" {
156160
var r:rethinkdbdash.RDashConnect;
157-
161+
158162
export = r;
159-
}
163+
}

0 commit comments

Comments
 (0)