8000 Updated typings for ServiceMethods by deskoh · Pull Request #1409 · feathersjs/feathers · GitHub
[go: up one dir, main page]

Skip to content
Merged
2 changes: 1 addition & 1 deletion packages/authentication/src/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Params, ServiceMethods } from '@feathersjs/feathers';

const debug = Debug('@feathersjs/authentication/service');

export class AuthenticationService extends AuthenticationBase implements ServiceMethods<AuthenticationResult> {
export class AuthenticationService extends AuthenticationBase implements Partial<ServiceMethods<AuthenticationResult>> {
/**
* Return the payload for a JWT based on the authentication result.
* Called internally by the `create` method.
Expand Down
15 changes: 6 additions & 9 deletions packages/feathers/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,23 +137,20 @@ declare namespace createApplication {
finally?: Partial<HookMap> | 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<T> {
[key: string]: any;

find? (params?: Params): Promise<T | T[] | Paginated<T>>;
find (params?: Params): Promise<T | T[] | Paginated<T>>;

get? (id: Id, params?: Params): Promise<T>;
get (id: Id, params?: Params): Promise<T>;

create? (data: Partial<T> | Array<Partial<T>>, params?: Params): Promise<T | T[]>;
create (data: Partial<T> | Array<Partial<T>>, params?: Params): Promise<T | T[]>;

update? (id: NullableId, data: T, params?: Params): Promise<T>;
update (id: NullableId, data: T, params?: Params): Promise<T>;

patch? (id: NullableId, data: Partial<T>, params?: Params): Promise<T>;
patch (id: NullableId, data: Partial<T>, params?: Params): Promise<T>;

remove? (id: NullableId, params?: Params): Promise<T>;
remove (id: NullableId, params?: Params): Promise<T>;
}

interface SetupMethod {
Expand Down
0