From e84cf3ef7bdc333cb439e615a034ca2bc6176c04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andre=CC=81=20Wachter?= Date: Fri, 1 Sep 2017 14:31:45 +0200 Subject: [PATCH] [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 --- types/pg/index.d.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/types/pg/index.d.ts b/types/pg/index.d.ts index da6f4db575..258188c937 100644 --- a/types/pg/index.d.ts +++ b/types/pg/index.d.ts @@ -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; }