Skip to content

Commit

Permalink
fix(typescript): Allow specific service typings for Hook and `HookC…
Browse files Browse the repository at this point in the history
…ontext` (#1688)
  • Loading branch information
deskoh authored and daffl committed Nov 21, 2019
1 parent 42d81b2 commit f5d0ddd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/feathers/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ declare namespace createApplication {
}

// tslint:disable-next-line void-return
type Hook = (hook: HookContext) => (Promise<HookContext | void> | HookContext | void);
type Hook<T = any, S = Service<T>> = (hook: HookContext<T, S>) => (Promise<HookContext<T, S> | void> | HookContext<T, S> | void);

interface HookContext<T = any> {
interface HookContext<T = any, S = Service<T>> {
/**
* A read only property that contains the Feathers application object. This can be used to
* retrieve other services (via context.app.service('name')) or configuration values.
Expand Down Expand Up @@ -101,7 +101,7 @@ declare namespace createApplication {
/**
* A read only property and contains the service this hook currently runs on.
*/
readonly service: Service<T>;
readonly service: S;
/**
* A writeable, optional property and contains a 'safe' version of the data that
* should be sent to any client. If context.dispatch has not been set context.result
Expand Down

0 comments on commit f5d0ddd

Please # to comment.