From aa71a4e1669ae75cbcdcb5f1301c42c11d44a571 Mon Sep 17 00:00:00 2001 From: Hugo Dozois Date: Thu, 28 Jun 2018 12:15:24 -0700 Subject: [PATCH] Fix issue with modify not accepting arguments --- types/knex/index.d.ts | 4 +++- types/knex/knex-tests.ts | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/types/knex/index.d.ts b/types/knex/index.d.ts index 624fde2d01..20418e1fac 100644 --- a/types/knex/index.d.ts +++ b/types/knex/index.d.ts @@ -155,7 +155,7 @@ declare namespace Knex { pluck(column: string): QueryBuilder; insert(data: any, returning?: string | string[]): QueryBuilder; - modify(callback: QueryCallback, ...args: any[]): QueryBuilder; + modify(callback: QueryCallbackWithArgs, ...args: any[]): QueryBuilder; update(data: any, returning?: string | string[]): QueryBuilder; update(columnName: string, value: Value, returning?: string | string[]): QueryBuilder; returning(column: string | string[]): QueryBuilder; @@ -360,6 +360,8 @@ declare namespace Knex { // type QueryCallback = (this: QueryBuilder, builder: QueryBuilder) => void; + type QueryCallbackWithArgs = (this: QueryBuilder, builder: QueryBuilder, ...args: any[]) => void; + interface QueryBuilder extends QueryInterface, ChainableInterface { or: QueryBuilder; and: QueryBuilder; diff --git a/types/knex/knex-tests.ts b/types/knex/knex-tests.ts index 9167ad3f77..ebd392aea3 100644 --- a/types/knex/knex-tests.ts +++ b/types/knex/knex-tests.ts @@ -1045,10 +1045,10 @@ knex('users') }).unionAll(function(builder) { let self: Knex.QueryBuilder = this; self = builder; - }).modify(function(builder) { + }).modify(function(builder, aBool) { let self: Knex.QueryBuilder = this; self = builder; - }); + }, true); // // Migrations