diff --git a/types/pg/index.d.ts b/types/pg/index.d.ts index 82654afd04..255165a1df 100644 --- a/types/pg/index.d.ts +++ b/types/pg/index.d.ts @@ -144,10 +144,15 @@ export class Connection extends events.EventEmitter { end(): void; } +/** + * {@link https://node-postgres.com/api/pool} + */ export class Pool extends events.EventEmitter { - // `new Pool('pg://user@localhost/mydb')` is not allowed. - // But it passes type check because of issue: - // https://github.com/Microsoft/TypeScript/issues/7485 + /** + * Every field of the config object is entirely optional. + * The config passed to the pool is also passed to every client + * instance within the pool when the pool creates that client. + */ constructor(config?: PoolConfig); readonly totalCount: number; diff --git a/types/pg/pg-tests.ts b/types/pg/pg-tests.ts index c464f2f487..673f4105e4 100644 --- a/types/pg/pg-tests.ts +++ b/types/pg/pg-tests.ts @@ -124,6 +124,12 @@ client.end() .then(() => console.log('client has disconnected')) .catch(err => console.error('error during disconnection', err.stack)); +// pg.Pool +// https://node-postgres.com/api/pool + +// no params ctor +const poolParameterlessCtor = new Pool(); + const poolOne = new Pool({ connectionString: 'postgresql://dbuser:secretpassword@database.server.com:3211/mydb' });