Skip to content

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

Closed
@reecetwhite

Description

@reecetwhite

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.

Activity

transferred this issue frommicrosoft/vscodeon Jun 2, 2022
removed their assignment
on Jun 2, 2022
DanielRosenwasser

DanielRosenwasser commented on Jun 3, 2022

@DanielRosenwasser
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.

fatcerberus

fatcerberus commented on Jun 3, 2022

@fatcerberus

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

added
BugA bug in TypeScript
Domain: Quick Infoe.g. hover text, tool-tips, and tooltips.
Effort: CasualGood issue if you're already used to contributing to the codebase. Harder than "good first issue".
and removed
Working as IntendedThe behavior described is the intended behavior; this is not a bug
on Jun 3, 2022
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[/+] on Jun 3, 2022
DanielRosenwasser

DanielRosenwasser commented on Jun 3, 2022

@DanielRosenwasser
Member

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

a-tarasyuk

a-tarasyuk commented on Jul 2, 2022

@a-tarasyuk
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

4 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: Quick Infoe.g. hover text, tool-tips, and tooltips.Effort: CasualGood issue if you're already used to contributing to the codebase. Harder than "good first issue".Help WantedYou can do this

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @sandersn@a-tarasyuk@DanielRosenwasser@fatcerberus@mjbvz

      Issue actions

        Overloads shouldn't gain `@deprecated` tags of other overloads in quick info · Issue #49368 · microsoft/TypeScript