-
Notifications
You must be signed in to change notification settings - Fork 12.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Quick info shouldn't default to showing jsdoc from first overload #45337
Comments
tap
function from rxjs
. VSCode 1.58.2. TS version in project: 4.3.5tap
function from rxjs
tap
function from rxjs
tap
from rxjs
To be more clear, i'm talking about just the comment showing up at wrong times. Actually VSCode only strikes over the correct, deprecated one. But still the comment shows up when using any of these signatures. I noticed that the position of the deprecated signature matters. If it's the first signature in the file, the comment will show up when hovering any of these function calls.
/** @deprecated This signature is deprecated */
export declare function fn();
export declare function fn(a: any);
export declare function fn(a: any, b: any);
fn();
fn(1);
fn(1, 2); If I simply swap places of the first and second signature, the comment is correctly not visible when hovering over export declare function fn(a: any);
/** @deprecated This signature is deprecated */
export declare function fn();
export declare function fn(a: any, b: any);
fn();
fn(1);
fn(1, 2);
|
It is confusing to developers. I've seen people (including me) scratch their head for hours trying to figure out why they see this comment when they're using a non-deprecated thing correctly. |
And actually this is not about /** This comment will show up for the first two signatures */
export declare function fn();
export declare function fn(a: any);
/** This will override the first comment for the last signature */
export declare function fn(a: any, b: any);
fn(); // Hover: "This comment will show up for the first two signatures"
fn(1); // Hover: "This comment will show up for the first two signatures"
fn(1, 2); // Hover: "This will override the first comment for the last signature" And now that I think about it more, is this actually intended behavior? Is the first signature always the "default", from which comments are supposed to be copied to all the other signatures, unless overridden? |
This issue has been marked as 'External' and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
tap
from rxjs
This behaviour is intended because I believe people more often want to document all signatures at once when they write a jsdoc before the initial signature. But it's worth revisiting this. What I think we'd need to move this suggestion forward:
OR
|
Now that I thinked this through, my opinion is that all comments should carry over, so they work consistently, deprecation or not. Library authors just should be aware and keep this in mind. RXJS has already fixed this for Thank you @sandersn and my love and appreciation to everyone working on TypeScript <3 Edit: Seems this is fixed in RXJS 7. It's just that the latest Angular still ships with 6. :) |
#43053
This is still happening at least with the
tap
function fromrxjs
. VSCode 1.58.2. TS version in project: 4.3.5Deprecation warning shows up regardless of which overloaded signature you use. Should not show up for the last two signatures.
rxjs/tap.d.ts
:The text was updated successfully, but these errors were encountered: