feathers icon indicating copy to clipboard operation
feathers copied to clipboard

`params.paginate.default` override produces Typescript errors

Open speigg opened this issue 1 year ago • 1 comments

Steps to reproduce

app.service(path).find({
  paginate: {
    default: 1000, // ts error here
    max: 1000
  }
})

Expected behavior

I'd expect to be able to pass the necessary paginate options without facing typescript errors. It's not clear to me why only the max option would be allowed, since pagination requires default to be set in order to return paginated results.

This behavior is expected because of the documentation at https://feathersjs.com/api/databases/common.html#pagination, which indicates that params.paginate can be overriden as shown above.

Actual behavior

I get the following typescript error:

Type '{ default: number; max: number; }' is not assignable to type 'false | Pick<PaginationOptions, "max"> | undefined'.
  Object literal may only specify known properties, and 'default' does not exist in type 'Pick<PaginationOptions, "max">'.ts(2322)

System configuration

Tell us about the applicable parts of your setup.

Module versions (especially the part that's not working): Feathers Dove (5.0.1) [email protected]

speigg avatar Mar 26 '23 13:03 speigg

i have't the error image

Hareis avatar Apr 22 '23 00:04 Hareis