From 88fae72f6cfd06d24e04c7c5782b84db7d40b85f Mon Sep 17 00:00:00 2001 From: Leo Liang Date: Fri, 26 Feb 2016 19:09:46 +0800 Subject: [PATCH] pg.d.ts: add support to pg-types --- pg/pg-tests.ts | 6 +++++- pg/pg.d.ts | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/pg/pg-tests.ts b/pg/pg-tests.ts index dd9c75378..087c60834 100644 --- a/pg/pg-tests.ts +++ b/pg/pg-tests.ts @@ -1,7 +1,11 @@ /// -import pg = require("pg"); +import * as pg from "pg"; + var conString = "postgres://username:password@localhost/database"; +// https://github.com/brianc/node-pg-types +pg.types.setTypeParser(20, (val) => Number(val)); + // Client pooling pg.connect(conString, (err, client, done) => { if (err) { diff --git a/pg/pg.d.ts b/pg/pg.d.ts index 5e65987cb..55ceea60f 100644 --- a/pg/pg.d.ts +++ b/pg/pg.d.ts @@ -85,4 +85,8 @@ declare module "pg" { public on(event: "error", listener: (err: Error, client: Client) => void): this; public on(event: string, listener: Function): this; } + + namespace types { + function setTypeParser(oid: number, fn: (val: string) => any): void; + } }