feathersjs / feathers

The API and real-time application framework
https://feathersjs.com
MIT License
14.97k stars 744 forks source link

fix(schema): HookContext is now typed in schema #3306

Closed AshotN closed 9 months ago

AshotN commented 9 months ago

Summary

This PR updates the generators for *.schema files to include a type for HookContext.

Without typing HookContext<Service> the revolvers experience type issues.

Other Information

With this PR, the only place that the generator doesn't type HookContext is in the logError hook, which can easily be typed to any

After-which, we can remove the default for the HookContext generic. https://github.com/feathersjs/feathers/blob/dove/packages/generators/src/app/templates/declarations.tpl.ts#L30

I propose to replace the default HookContext<S = any> to HookContext<S extends ServiceMethods>