[pg]: Add a "Notification" type and pass it to the notification event listener

See: https://node-postgres.com/api/client#client-on-39-notification-39-notification-notification-gt-void-gt-void
This commit is contained in:
André Wachter 2017-09-01 14:31:45 +02:00
parent 5bb93e3433
commit e84cf3ef7b

8
types/pg/index.d.ts vendored
View File

@ -60,6 +60,12 @@ export interface QueryResult {
rows: any[];
}
export interface Notification {
processId: number,
channel: string,
payload?: string
}
export interface ResultBuilder extends QueryResult {
addRow(row: any): void;
}
@ -109,7 +115,7 @@ export declare class Client extends events.EventEmitter {
on(event: "drain", listener: () => void): this;
on(event: "error", listener: (err: Error) => void): this;
on(event: "notification" | "notice", listener: (message: any) => void): this;
on(event: "notification" | "notice", listener: (message: Notification) => void): this;
on(event: "end", listener: () => void): this;
}