docs(NODE-4798): move deprecated overloads to the bottom #3461
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.
Description
What is changing?
This PR simply moves all deprecated function overloads to the bottom of their signatures so that the overloads that should be used come up first and are preferred by TS
Is there new documentation needed for these changes?
No, they were already documented in the PR that introduced the deprecations
What is the motivation for this change?
When using TS's built-in types such as ReturnType or others, TS will usually grab the first overload of the function. Along with that, if you ever had an error in some of your function's arguments, the overload would often fallback to the callback one since, in the presence of an error, TS fins the first overload that matches the amount of parameters passed, causing your function's return type to be
void
. Also by doing this it will make it easier to remove all of these overloads when the time comes for that, and it will also make the diff look nicerhttps://jira.mongodb.org/browse/NODE-4798
Double check the following
npm run check:lint
scriptGot this error when running it but I believe that's not my fault
<type>(NODE-xxxx)<!>: <description>