8000 fix(core): context.path is now typed correctly by AshotN · Pull Request #3303 · feathersjs/feathers · GitHub
[go: up one dir, main page]

Skip to content

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

Merged
daffl merged 1 commit intofeathersjs:dovefrom
AshotN:an/contextPathType
Oct 11, 2023
Merged

fix(core): context.path is now typed correctly#3303
daffl merged 1 commit intofeathersjs:dovefrom
AshotN:an/contextPathType

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
@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

0