Skip to content

Commit 0447629

Browse files
JorgenVatledaffl
authored andcommitted
fix(typescript): Make HookMap and HookObject generics. (#1815)
1 parent 04c79fe commit 0447629

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

packages/feathers/index.d.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -119,21 +119,21 @@ declare namespace createApplication {
119119
readonly type: 'before' | 'after' | 'error';
120120
}
121121

122-
interface HookMap {
123-
all: Hook | Hook[];
124-
find: Hook | Hook[];
125-
get: Hook | Hook[];
126-
create: Hook | Hook[];
127-
update: Hook | Hook[];
128-
patch: Hook | Hook[];
129-
remove: Hook | Hook[];
122+
interface HookMap<T = any> {
123+
all: Hook<T> | Hook<T>[];
124+
find: Hook<T> | Hook<T>[];
125+
get: Hook<T> | Hook<T>[];
126+
create: Hook<T> | Hook<T>[];
127+
update: Hook<T> | Hook<T>[];
128+
patch: Hook<T> | Hook<T>[];
129+
remove: Hook<T> | Hook<T>[];
130130
}
131131

132-
interface HooksObject {
133-
before: Partial<HookMap> | Hook | Hook[];
134-
after: Partial<HookMap> | Hook | Hook[];
135-
error: Partial<HookMap> | Hook | Hook[];
136-
finally?: Partial<HookMap> | Hook | Hook[];
132+
interface HooksObject<T = any> {
133+
before: Partial<HookMap<T>> | Hook<T> | Hook<T>[];
134+
after: Partial<HookMap<T>> | Hook<T> | Hook<T>[];
135+
error: Partial<HookMap<T>> | Hook<T> | Hook<T>[];
136+
finally?: Partial<HookMap<T>> | Hook<T> | Hook<T>[];
137137
}
138138

139139
interface ServiceMethods<T> {
@@ -220,4 +220,4 @@ declare namespace createApplication {
220220

221221
listen (port: number): http.Server;
222222
}
223-
}
223+
}

0 commit comments

Comments
 (0)