在TypeScript中使用feathersjs,我一直在寻找从钩子之前到之后传递数据或将数据添加到上下文的正确方法。
我尝试扩展HookContext
,但随后type 'Partial<HooksObject<any>>'
的app.ts中让app.hooks(appHooks);
感到不满意
type HookContextWithAssociations = HookContext & { associations: { include: any[] } };
export default () => {
return function (this: any, context: HookContextWithAssociations) {
switch (context.type) {
case 'before':