From a12a1cf8c286b623817078e8b611223c173b04ee Mon Sep 17 00:00:00 2001 From: Rob Phillips Date: Thu, 25 Jun 2020 18:41:48 -0500 Subject: [PATCH] feat: add overload types for `find` service methods (#1972) --- packages/authentication-oauth/src/strategy.ts | 3 ++- packages/feathers/index.d.ts | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/packages/authentication-oauth/src/strategy.ts b/packages/authentication-oauth/src/strategy.ts index 1a2358872f..86bdef0b63 100644 --- a/packages/authentication-oauth/src/strategy.ts +++ b/packages/authentication-oauth/src/strategy.ts @@ -103,7 +103,8 @@ export class OAuthStrategy extends AuthenticationBaseStrategy { ...params, query }); - const [ entity = null ] = result.data ? result.data : result; + + const [ entity = null ] = Array.isArray(result) ? result : result.data debug('findEntity returning', entity); diff --git a/packages/feathers/index.d.ts b/packages/feathers/index.d.ts index 33c1eda184..1e90c6acbb 100644 --- a/packages/feathers/index.d.ts +++ b/packages/feathers/index.d.ts @@ -205,6 +205,22 @@ declare namespace createApplication { } interface ServiceOverloads { + /** + * Retrieve all resources from this service. + * + * @param params - Service call parameters {@link Params} + * @see {@link https://docs.feathersjs.com/api/services.html#find-params|Feathers API Documentation: .find(params)} + */ + find? (params: Params & { paginate: false}): Promise + + /** + * Retrieve all resources from this service. + * + * @param params - Service call parameters {@link Params} + * @see {@link https://docs.feathersjs.com/api/services.html#find-params|Feathers API Documentation: .find(params)} + */ + find? (params?: Params): Promise> + /** * Create a new resource for this service. *