File tree Expand file tree Collapse file tree 3 files changed +11
-8
lines changed
Expand file tree Collapse file tree 3 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -238,8 +238,8 @@ export class Pool extends events.EventEmitter {
238238export class ClientBase extends events . EventEmitter {
239239 constructor ( config ?: string | ClientConfig ) ;
240240
241- connect ( ) : Promise < void > ;
242- connect ( callback : ( err : Error ) => void ) : void ;
241+ connect ( ) : Promise < ClientBase > ;
242+ connect ( callback : ( ( err : Error ) => void ) | ( ( err : null , c : ClientBase ) => void ) ) : void ;
243243
244244 query < T extends Submittable > ( queryStream : T ) : T ;
245245 // tslint:disable:no-unnecessary-generics
@@ -300,6 +300,9 @@ export class Client extends ClientBase {
300300
301301 constructor ( config ?: string | ClientConfig ) ;
302302
303+ connect ( ) : Promise < Client > ;
304+ connect ( callback : ( ( err : Error ) => void ) | ( ( err : null , c : Client ) => void ) ) : void ;
305+
303306 end ( ) : Promise < void > ;
304307 end ( callback : ( err : Error ) => void ) : void ;
305308}
@@ -342,8 +345,8 @@ import * as Pg from ".";
342345export const native : typeof Pg | null ;
343346
344347export { DatabaseError } from "pg-protocol" ;
345- import TypeOverrides = require( "./lib/type-overrides" ) ;
346348export { TypeOverrides } ;
349+ import TypeOverrides = require( "./lib/type-overrides" ) ;
347350
348351export class Result < R extends QueryResultRow = any > implements QueryResult < R > {
349352 command : string ;
Original file line number Diff line number Diff line change 11{
22 "private" : true ,
33 "name" : " @types/pg" ,
4- "version" : " 8.16 .9999" ,
4+ "version" : " 8.18 .9999" ,
55 "projects" : [
66 " https://github.com/brianc/node-postgres"
77 ],
Original file line number Diff line number Diff line change @@ -47,19 +47,19 @@ const escapeIdentifier: (str: string) => string = pg.escapeIdentifier;
4747const escapeLiteral : ( str : string ) => string = pg . escapeLiteral ;
4848
4949client . on ( "notice" , ( notice : NoticeMessage ) => console . warn ( `${ notice . severity } : ${ notice . message } ` ) ) ;
50- client . connect ( err => {
50+ client . connect ( ( err , c ) => {
5151 if ( err ) {
5252 console . error ( "Could not connect to postgres" , err ) ;
5353 return ;
5454 }
55- client . query ( "SELECT NOW() AS 'theTime'" , ( err , result ) => {
55+ c . query ( "SELECT NOW() AS 'theTime'" , ( err , result ) => {
5656 if ( err ) {
5757 console . error ( "Error running query" , err ) ;
5858 return ;
5959 }
6060 console . log ( result . rowCount ) ;
6161 console . log ( result . rows [ 0 ] [ "theTime" ] ) ;
62- client . end ( ) ;
62+ c . end ( ) ;
6363 return null ;
6464 } ) ;
6565 return null ;
@@ -68,7 +68,7 @@ client.on("end", () => console.log("Client was disconnected."));
6868
6969client
7070 . connect ( )
71- . then ( ( ) => console . log ( "connected" ) )
71+ . then ( ( c ) => console . log ( "connected" ) )
7272 . catch ( e => console . error ( "connection error" , e . stack ) ) ;
7373
7474client . query ( "SELECT NOW()" , ( err , res ) => {
You can’t perform that action at this time.
0 commit comments