From 789d28808ac1378f8691437b62025d1cc06d0f9c Mon Sep 17 00:00:00 2001 From: Chet Husk Date: Tue, 19 Dec 2017 12:17:10 -0600 Subject: [PATCH 1/2] allow for right hand side fo a join to be a Raw value, per the docs --- types/knex/index.d.ts | 6 +++--- types/knex/knex-tests.ts | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/types/knex/index.d.ts b/types/knex/index.d.ts index 479e38c286..792541d6dd 100644 --- a/types/knex/index.d.ts +++ b/types/knex/index.d.ts @@ -196,19 +196,19 @@ declare namespace Knex { on(columns: { [key: string]: string | Raw }): JoinClause; on(column1: string, column2: string): JoinClause; on(column1: string, raw: Raw): JoinClause; - on(column1: string, operator: string, column2: string): JoinClause; + on(column1: string, operator: string, column2: string | Raw): JoinClause; andOn(raw: Raw): JoinClause; andOn(callback: Function): JoinClause; andOn(columns: { [key: string]: string | Raw }): JoinClause; andOn(column1: string, column2: string): JoinClause; andOn(column1: string, raw: Raw): JoinClause; - andOn(column1: string, operator: string, column2: string): JoinClause; + andOn(column1: string, operator: string, column2: string | Raw): JoinClause; orOn(raw: Raw): JoinClause; orOn(callback: Function): JoinClause; orOn(columns: { [key: string]: string | Raw }): JoinClause; orOn(column1: string, column2: string): JoinClause; orOn(column1: string, raw: Raw): JoinClause; - orOn(column1: string, operator: string, column2: string): JoinClause; + orOn(column1: string, operator: string, column2: string | Raw): JoinClause; onIn(column1: string, values: any[]): JoinClause; andOnIn(column1: string, values: any[]): JoinClause; orOnIn(column1: string, values: any[]): JoinClause; diff --git a/types/knex/knex-tests.ts b/types/knex/knex-tests.ts index 910f0ee427..687b641b93 100644 --- a/types/knex/knex-tests.ts +++ b/types/knex/knex-tests.ts @@ -257,6 +257,10 @@ knex.select('*').from('users').join('accounts', function(join: Knex.JoinClause) join.on('accounts.id', '=', 'users.account_id').orOn('accounts.owner_id', '=', 'users.id'); }); +knex.select('*').from('user').join('contacts', () => { + this.on('users.id', '=', knex.raw(7)); +}); + knex.select('*').from('users').join('contacts', function() { this.on('users.id', '=', 'contacts.id').onIn('contacts.id', [7, 15, 23, 41]) }); From 53db8d03dfa43c9e9b9f0987b3d9a62abd0ad0e5 Mon Sep 17 00:00:00 2001 From: Chet Husk Date: Tue, 19 Dec 2017 13:31:13 -0600 Subject: [PATCH 2/2] remove key from downstream test that was causing build failure --- types/knex-postgis/knex-postgis-tests.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/types/knex-postgis/knex-postgis-tests.ts b/types/knex-postgis/knex-postgis-tests.ts index 4639a55ea6..43a6c2f58b 100644 --- a/types/knex-postgis/knex-postgis-tests.ts +++ b/types/knex-postgis/knex-postgis-tests.ts @@ -7,13 +7,7 @@ const st: KPG.KnexPostgis = KPG(knex); const point: GeoJSON.Point = { type: 'Point', - coordinates: [23.773206, 61.506005], - crs: { - type: 'name', - properties: { - name: 'EPSG:4326' - } - } + coordinates: [23.773206, 61.506005] }; const wktPoint = 'POINT(23.773206 61.506005)';