Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion packages/feathers/src/declarations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export interface ServiceMethods<
ServiceParams = Params,
PatchData = Partial<Data>
> {
find(params?: ServiceParams & { paginate?: PaginationParams }): Promise<Result | Result[]>
find(params?: ServiceParams & { paginate?: PaginationParams }): Promise<Paginated<Result> | Result[]>

get(id: Id, params?: ServiceParams): Promise<Result>

Expand All @@ -95,6 +95,18 @@ export interface ServiceOverloads<
ServiceParams = Params,
PatchData = Partial<Data>
> {
find?(
params?: ServiceParams & {
paginate: false
}
): Promise<Result[]>

find?(
params?: ServiceParams & {
paginate?: PaginationOptions
}
): Promise<Paginated<Result>>

create?(data: Data[], params?: ServiceParams): Promise<Result[]>

update?(id: Id, data: Data, params?: ServiceParams): Promise<Result>
Expand Down
4 changes: 2 additions & 2 deletions packages/transport-commons/src/client.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import { convert } from '@feathersjs/errors'
import { createDebug } from '@feathersjs/commons'
import { Id, NullableId, Params, ServiceInterface } from '@feathersjs/feathers'
import { Id, NullableId, Paginated, Params, ServiceInterface } from '@feathersjs/feathers'

const debug = createDebug('@feathersjs/transport-commons/client')

Expand Down Expand Up @@ -103,7 +103,7 @@ export class Service<T = any, D = Partial<T>, P extends Params = Params>
}

_find(params: Params = {}) {
return this.send<T | T[]>('find', params.query || {})
return this.send<Paginated<T> | T[]>('find', params.query || {})
}

find(params: Params = {}) {
Expand Down