Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript error for GET request when using composite key #138

Open
idandagan1 opened this issue Dec 29, 2020 · 1 comment
Open

Typescript error for GET request when using composite key #138

idandagan1 opened this issue Dec 29, 2020 · 1 comment

Comments

@idandagan1
Copy link
Contributor

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

@robbyphillips
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants