Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TypeScript] Add Object syntax overload to increment method (#5512)
The [documentation for `QueryBuilder#icrements`](https://knexjs.org/guide/query-builder.html#increment) says, that the method accepts columns and values either as separate arguments, or in Object syntax ([the code also checks if the column is an object](https://github.com/knex/knex/blob/0d27bcb60b9bfd57fabf896715350089e0b1050c/lib/query/querybuilder.js#L1111)). But currently this code: ````typescript knex("table") .where({ id: 1 }) .increment({ foo: 1, bar: 2, }); ```` Throws an error: ```` No overload matches this call. Overload 1 of 2, '(columnName: string | number | symbol, amount?: number): QueryBuilder<any, number>', gave the following error. Argument of type '{ views: number; clicks: number; sales: number; }' is not assignable to parameter of type 'string | number | symbol'. Overload 2 of 2, '(columnName: string, amount?: number): QueryBuilder<any, number>', gave the following error. Argument of type '{ views: number; clicks: number; sales: number; }' is not assignable to parameter of type 'string'. ```` This adds an overload to the increment method type definition for the case where the first argument is an Object consisting of keys from TRecord and numbers as values.
- Loading branch information