Microsoft/TypeScript

`@deprecated` incorrectly marks the wrong type as deprecated when used in JavaScript.

Open

#47.652 aberto em 28 de jan. de 2022

Ver no GitHub
 (5 comments) (0 reactions) (0 assignees)TypeScript (6.726 forks)batch import
BugDomain: JSDocHelp Wanted

Métricas do repositório

Stars
 (48.455 stars)
Métricas de merge de PR
 (Mesclagem média 6d 17h) (9 fundiu PRs em 30d)

Description

Bug Report

🔎 Search Terms

deprecated jsdoc js

🕗 Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about deprecated

⏯ Playground Link

Playground (JavaScript) Playground (TypeScript)

💻 Code

/**
 * @deprecated
 * @typedef {number | string} MyType
 */

class Foo {
    /**
     * @param {MyType} x
     *         ^^^^^^-- Not marked as deprecated
     */
    foo(x) {

    }
}

const x = new Foo();
//            ^^^--- Marked as deprecated
x.foo(5);

🙁 Actual behavior

The class Foo is marked as deprecated.

🙂 Expected behavior

The type MyType of parameter x of Foo.foo() should be marked as deprecated and the class Foo should not. Just like how it works in the TypeScript equivalent of this code.

Guia do colaborador