Typings fix and improvements.#1364
Merged
daffl merged 10 commits intofeathersjs:masterfrom May 31, 2019
deskoh:master
Merged
Conversation
Contributor
Author
|
Expected type resolution: let app: Application<{ users: User }>;
app.service('users'); // Service<User>
app.service('user'); // never
let app2: Application<any>;
app2.service('users'); // Service<any>
app2.service('user'); // Service<any>
let app3 = Application; // equivalent to Application<never>
app3.service('users'); // Service<any>
app3.service('user'); // Service<any> |
Contributor
Author
|
Test seems to fail due to the fix below: - service<L extends keyof ServiceTypes> (location: L): ServiceTypes[L];
+ service<L extends keyof ServiceTypes> (location: L): Service<ServiceTypes[L]>; |
Member
|
Thank you for the pull request. If someone just uses |
Contributor
Author
|
Yeap. |
Member
|
Great. Thanks again! |
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Current typings consists of a catch-all for any service name:
This allows service type to resolve if no
ServiceTypeis specified.However, if
ServiceTypeis specified, invalid service name should not be resolved:Defaulting the
ServiceTypeto{}and modifying the 'catch-all' typings can fulfill the above: