Vincit / objection.js

An SQL-friendly ORM for Node.js
https://vincit.github.io/objection.js
MIT License
7.27k stars 639 forks source link

orderBy typing error when using array of columns #1354

Closed naishe closed 5 years ago

naishe commented 5 years ago

I am having an issue in TypeScript when using order by this way: .orderBy([{ column: 'isConfigured', order: 'asc' }, { column: orderBy, order: ascDesc }]); citing:

Argument of type '{ column: string; order: string; }[]' is not assignable to parameter of type 'ColumnRef'.
  Type '{ column: string; order: string; }[]' is not assignable to type 'string'.ts(2345)

The Knex.js documentation says this should be possible. Am I missing something?

Thanks!

koskimas commented 5 years ago

Am I missing something?

Nope, just a case of missing typings. A PR would get merged immediately.

real-artswan commented 5 years ago

Hi, what is the version where it is fixed? It seems 1.6.9 has no this fix.