feathers-objection
feathers-objection copied to clipboard
Typescript error for GET request when using composite key
Hi, I'm using typescript with feathers-objection. And trying to make a GET request with composite-key like in the readme example:
app.service('/user-todos').get([1, 2])
But I get type error:
Argument of type 'number[]' is not assignable to parameter of type 'string | number'
Because feathers define the id to be type Id = number | string;
As a workaround I'm currently using find method instead of get. Any suggestions?
10x
A better workaround is probably to .join(',')
your ids to get a comma-separated string as shown here: https://github.com/feathersjs-ecosystem/feathers-objection#composite-primary-keys
But yeah, the actual solution is probably to have this lib override the default feathers id type.