From 000ea5d3df7918af503e51055a58f59938efc93d Mon Sep 17 00:00:00 2001 From: Sam Adams Date: Wed, 21 Sep 2022 21:09:28 +0100 Subject: [PATCH 1/3] fix: add missing type for 'expirationChecker' on PgConnectionConfig --- types/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/index.d.ts b/types/index.d.ts index b246bbe587..ccfad9d139 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -3024,6 +3024,7 @@ export declare namespace Knex { connectionTimeoutMillis?: number; types?: PgCustomTypesConfig; options?: string; + expirationChecker?(): boolean; } type PgGetTypeParser = (oid: number, format: string) => any; From 2e7fca0093ee1662ede628c7c5dbb72e31f9a7f6 Mon Sep 17 00:00:00 2001 From: Sam Adams Date: Tue, 27 Sep 2022 17:19:31 +0100 Subject: [PATCH 2/3] test: add tsd test for pg-config --- test-tsd/pg-config.test-d.ts | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 test-tsd/pg-config.test-d.ts diff --git a/test-tsd/pg-config.test-d.ts b/test-tsd/pg-config.test-d.ts new file mode 100644 index 0000000000..b448941284 --- /dev/null +++ b/test-tsd/pg-config.test-d.ts @@ -0,0 +1,30 @@ +import { expectAssignable } from 'tsd'; + +import {Knex} from '../types'; +import * as stream from "stream"; + +const connectionConfig: Knex.PgConnectionConfig = { + user: '', + database: '', + password: '', + port: 1, + host: '', + connectionString: '', + keepAlive: true, + stream: new stream.Duplex(), + statement_timeout: false, + parseInputDatesAsUTC: false, + ssl: true, + query_timeout: 2, + keepAliveInitialDelayMillis: 3, + idle_in_transaction_session_timeout: 4, + application_name: '', + connectionTimeoutMillis: 5, + types: { + getTypeParser: () => {}, + }, + options: '', + expirationChecker: () => {return true;}, +}; + +expectAssignable(connectionConfig); From 36839f11ba85e98d3d088ccfd0d7a5ea8cc9bde8 Mon Sep 17 00:00:00 2001 From: Sam Adams <107990625+sam-super@users.noreply.github.com> Date: Tue, 27 Sep 2022 21:26:28 +0100 Subject: [PATCH 3/3] Update test-tsd/pg-config.test-d.ts Co-authored-by: Igor Savin --- test-tsd/pg-config.test-d.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/test-tsd/pg-config.test-d.ts b/test-tsd/pg-config.test-d.ts index b448941284..7f6a26f442 100644 --- a/test-tsd/pg-config.test-d.ts +++ b/test-tsd/pg-config.test-d.ts @@ -3,7 +3,7 @@ import { expectAssignable } from 'tsd'; import {Knex} from '../types'; import * as stream from "stream"; -const connectionConfig: Knex.PgConnectionConfig = { +expectAssignable({ user: '', database: '', password: '', @@ -25,6 +25,4 @@ const connectionConfig: Knex.PgConnectionConfig = { }, options: '', expirationChecker: () => {return true;}, -}; - -expectAssignable(connectionConfig); +});