fix: change overload order to not show the deprecation per default [HOMER-1999] #1841
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
In some IDEs, it will only pick up the JSDoc of the first overload for a function. By moving the deprecated overload to the end, we hope to mitigate the wrongly shown deprecation warning.
Description
We need to change the order of function overloads for
createClient
. In some cases, the IDE will pick up only the JSDoc for the first overload and even mark the usage asdeprecated
as shown in this issue. Weirdly, we can't reproduce this consistently with the same version of VSC & TS. In some cases, it works as expected. In a few other cases, the TS engine appears to pick up only the first overload and render any usage of the function as being deprecated.This is a reported issue for VSC (issue) and WebStorm (issue). It appears we can mitigate this scenario by changing the order of overloads.
We also tested this on the TS playground (see here) but couldn't reproduce it there as well.
Example from the linked issue:
Interestingly, there is yet no way to check for deprecated usages via the console just with TS. See this issue.