feat: add overload types for find service methods#1972
Merged
daffl merged 2 commits intofeathersjs:masterfrom Jun 25, 2020
robbyphillips:master
Merged
feat: add overload types for find service methods#1972daffl merged 2 commits intofeathersjs:masterfrom robbyphillips:master
find service methods#1972daffl merged 2 commits intofeathersjs:masterfrom
robbyphillips:master
Conversation
Contributor
Author
|
Hey @daffl, just wondering if I should've done something different here. Totally get that something like this might be very low priority -- it just seems like a pretty straightforward "quality of life" improvement to me. |
Member
|
Sorry about that and thank you for the PR @robbyphillips. Been meaning to address this but I am also in the process of moving the adapters specific typings into https://github.com/feathersjs/databases and https://github.com/feathersjs/databases/tree/master/packages/adapter-commons |
Contributor
Author
|
No worries at all, just happy to contribute if it's helpful. And thanks for pointing out where new work is happening. Is this part of a reorg with v5? |
daffl
pushed a commit
that referenced
this pull request
Jul 11, 2020
daffl
added a commit
that referenced
this pull request
Jul 24, 2020
daffl
added a commit
that referenced
this pull request
Jul 24, 2020
daffl
added a commit
that referenced
this pull request
Jul 24, 2020
EliSadaka
pushed a commit
to yusernetwork/authentication-oauth
that referenced
this pull request
Oct 20, 2020
EliSadaka
pushed a commit
to yusernetwork/authentication-oauth
that referenced
this pull request
Oct 20, 2020
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.
Summary
I thought this might be a better way to have a conversation about #1970.
The goal is to let typescript automatically infer the return type for
findmethods based onparams.paginate.I do not think it is dependent on any other PRs.
Other Information
Adding these type definitions did have one unexpected side effect where TS no longer approved of line 106 in
packages/authentication-oauth/src/strategy.ts, but it was such a little change that I included it in this PR.I can think of two things that I would really like some feeback on:
The main
ServiceMethods<T>definition forfindhas the signaturefind (params?: Params): Promise<T | T[] | Paginated<T>>;, and thePromise<T>result is not included in the overloadsI am not sure if changes similar to the one in the
strategy.tsfile would be needed in some ecosystem libs