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