Skip to content
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

Overloads shouldn't gain @deprecated tags of other overloads in quick info #49368

Closed
brplatinum opened this issue Jun 2, 2022 · 6 comments · Fixed by #50904
Closed

Overloads shouldn't gain @deprecated tags of other overloads in quick info #49368

brplatinum opened this issue Jun 2, 2022 · 6 comments · Fixed by #50904
Labels
Bug A bug in TypeScript Domain: Quick Info e.g. hover text, tool-tips, and tooltips. Effort: Casual Good issue if you're already used to contributing to the codebase. Harder than "good first issue". Help Wanted You can do this

Comments

@brplatinum
Copy link

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.67.2
  • OS Version: Windows 11 Pro 21H2, also reproducible on macOS Monterey 12.4

Steps to Reproduce:

  1. Create a file that contains a list of exported, consecutive, overloaded functions, with a single @deprecated tag at the top of the first one.

api.d.ts

/**
 * @deprecated Use the new method instead.
 */
export function getArrayLength(arr: string[]): number;
export function getArrayLength(arr: number[]): number;
export function getArrayLength(arr: boolean[]): number;
  1. Create a file that imports the overloaded function

test.ts

import { getArrayLength } from "./api";

getArrayLength(["1"])
getArrayLength([1])
getArrayLength([true])
  1. Only the first function is striked-through, the other two overloaded functions aren't, even though they are all marked as @deprecated when hovering over them.
    image
    image
    image
    image

Either the bottom two overloaded functions shouldn't be marked as @deprecated when hovering over, or all three functions should be striked-through.

@mjbvz mjbvz transferred this issue from microsoft/vscode Jun 2, 2022
@mjbvz mjbvz removed their assignment Jun 2, 2022
@DanielRosenwasser
Copy link
Member

This is working as intended. If we made all of them deprecated, there would be no way to convey that you want someone to use a different overload instead of a different function entirely, so we had to opt for a more granular approach.

@DanielRosenwasser DanielRosenwasser added the Working as Intended The behavior described is the intended behavior; this is not a bug label Jun 3, 2022
@fatcerberus
Copy link

@DanielRosenwasser In that case, the hover text shouldn't show @deprecated for all of them.

@DanielRosenwasser DanielRosenwasser added Bug A bug in TypeScript Help Wanted You can do this Domain: Quick Info e.g. hover text, tool-tips, and tooltips. Effort: Casual Good issue if you're already used to contributing to the codebase. Harder than "good first issue". and removed Working as Intended The behavior described is the intended behavior; this is not a bug labels Jun 3, 2022
@DanielRosenwasser DanielRosenwasser changed the title Consecutive deprecated overloaded functions don't show a strikethrough, only the first one does Overloads shouldn't gain @deprecated tags of other overloads in quick info Jun 3, 2022
@DanielRosenwasser
Copy link
Member

Agreed, I think I missed that. Sorry about the incorrect triage.

@a-tarasyuk
Copy link
Contributor

I think we can exclude only @depracated tag, however, does it make sense to show other tags/docs for overloaded signatures from the root declaration? Maybe we should inherit docs, however, tags seem to add confusion in the following cases.

/**
 * comment
 *
 * @param {string[]} a
 */
export function a(a: string[]): number;
export function a(a: number[]): number;
export function a(a: number[], b: number[]): number;
a/*1*/([1], [1]) 
a/*2*/([1])

/cc @DanielRosenwasser @RyanCavanaugh @sandersn

@sandersn
Copy link
Member

@a-tarasyuk one of our oldest issues tracks that: #407

I don't think anybody's made a complete proposal, but I have to admit I haven't paid attention in several years.

@ValerianClerc
Copy link
Member

@sandersn @DanielRosenwasser I've made a PR (#50904) which filters out the @deprecated tag from being passed on to other signatures of an overloaded function. Please let me know your feedback on it 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: Quick Info e.g. hover text, tool-tips, and tooltips. Effort: Casual Good issue if you're already used to contributing to the codebase. Harder than "good first issue". Help Wanted You can do this
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants