8000 fix(schema): HookContext is now typed in schema by AshotN · Pull Request #3306 · feathersjs/feathers · GitHub
[go: up one dir, main page]

Skip to content

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

Merged
daffl merged 3 commits intofeathersjs:dovefrom
AshotN:an/generateHookContextType
Oct 11, 2023
Merged

fix(schema): HookContext is now typed in schema#3306
daffl merged 3 commits intofeathersjs:dovefrom
AshotN:an/generateHookContextType

Conversation

@AshotN
Copy link
Contributor
@AshotN AshotN commented Oct 9, 2023

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>

@daffl daffl changed the title fix: HookContext is now typed in schema fix(schema): HookContext is now typed in schema Oct 11, 2023
@daffl daffl merged commit 65fab86 into feathersjs:dove Oct 11, 2023
@AshotN AshotN deleted the an/generateHookContextType branch October 11, 2023 04:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0