Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): context.path is now typed correctly #3303

Merged
merged 1 commit into from
Oct 11, 2023

Conversation

AshotN
Copy link
Contributor

@AshotN AshotN commented Oct 6, 2023

Summary

Currently app.service() is typed to all the registered services, and since context.path is just a string doing app.service(context.path) in a hook leads to an error that string is not assignable to <list of schemas>

This issue resolve that by allow context.path to check against the service provided in the HookContext. If HookContext is not typed with a service, it will default back to all services.

If you create a hook in your user service. Where the context.path should always be user. It should not be typed as such

If you create a global hook, context.path will be a intersection of all your registered services.

@daffl daffl changed the title fix: context.path is now typed correctly fix(core): context.path is now typed correctly Oct 11, 2023
@daffl daffl merged commit ff18b3f into feathersjs:dove Oct 11, 2023
2 checks passed
@daffl
Copy link
Member

daffl commented Oct 11, 2023

That's a great change, thank you!

@AshotN AshotN deleted the an/contextPathType branch October 11, 2023 04:04
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