Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions types/pg/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Type definitions for pg 8.6
// Type definitions for pg 8.10
// Project: https://github.com/brianc/node-postgres
// Definitions by: Phips Peter <https://github.com/pspeter3>, Ravi van Rooijen <https://github.com/HoldYourWaffle>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
Expand All @@ -21,7 +21,7 @@ export interface ClientConfig {
host?: string | undefined;
connectionString?: string | undefined;
keepAlive?: boolean | undefined;
stream?: stream.Duplex | undefined;
stream?: () => stream.Duplex | stream.Duplex | undefined;
statement_timeout?: false | number | undefined;
ssl?: boolean | ConnectionOptions | undefined;
query_timeout?: number | undefined;
Expand Down
9 changes: 9 additions & 0 deletions types/pg/pg-tests.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { connect } from 'net';
import { types, Client, CustomTypesConfig, QueryArrayConfig, Pool, DatabaseError } from 'pg';
import TypeOverrides = require('pg/lib/type-overrides');
import { NoticeMessage } from 'pg-protocol/dist/messages';
Expand Down Expand Up @@ -305,6 +306,14 @@ c = new Client({
connectionTimeoutMillis: 1000, // connection timeout optionally specified
});

// using custom socket factory method
c = new Client({
stream: () => connect({
host: 'my.database-server.com',
port: 5334,
}),
});

const dynamicPasswordSync = new Client({
password: () => 'sync-secret',
});
Expand Down