From b5ee7e293c6682bd8cdcc23051d3df59fe93f63c Mon Sep 17 00:00:00 2001 From: Desmond Koh Date: Wed, 3 Jul 2019 12:06:01 +0800 Subject: [PATCH] fix: Updated typings for ServiceMethods (#1409) --- packages/authentication/src/service.ts | 2 +- packages/feathers/index.d.ts | 15 ++++++--------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/packages/authentication/src/service.ts b/packages/authentication/src/service.ts index 4ea00c0ea4..e5bbefcbe6 100644 --- a/packages/authentication/src/service.ts +++ b/packages/authentication/src/service.ts @@ -7,7 +7,7 @@ import { Params, ServiceMethods } from '@feathersjs/feathers'; const debug = Debug('@feathersjs/authentication/service'); -export class AuthenticationService extends AuthenticationBase implements ServiceMethods { +export class AuthenticationService extends AuthenticationBase implements Partial> { /** * Return the payload for a JWT based on the authentication result. * Called internally by the `create` method. diff --git a/packages/feathers/index.d.ts b/packages/feathers/index.d.ts index 676b94521d..d01d8f81c8 100644 --- a/packages/feathers/index.d.ts +++ b/packages/feathers/index.d.ts @@ -137,23 +137,20 @@ declare namespace createApplication { finally?: Partial | Hook | Hook[]; } - // todo: figure out what to do: These methods don't actually need to be - // implemented, so they can be undefined at runtime. Yet making them - // optional gets cumbersome in strict mode. interface ServiceMethods { [key: string]: any; - find? (params?: Params): Promise>; + find (params?: Params): Promise>; - get? (id: Id, params?: Params): Promise; + get (id: Id, params?: Params): Promise; - create? (data: Partial | Array>, params?: Params): Promise; + create (data: Partial | Array>, params?: Params): Promise; - update? (id: NullableId, data: T, params?: Params): Promise; + update (id: NullableId, data: T, params?: Params): Promise; - patch? (id: NullableId, data: Partial, params?: Params): Promise; + patch (id: NullableId, data: Partial, params?: Params): Promise; - remove? (id: NullableId, params?: Params): Promise; + remove (id: NullableId, params?: Params): Promise; } interface SetupMethod {