Microsoft/TypeScript

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

Open

#47 652 ouverte le 28 janv. 2022

Voir sur GitHub
 (5 commentaires) (0 réactions) (0 assignés)TypeScript (6 726 forks)batch import
BugDomain: JSDocHelp Wanted

Métriques du dépôt

Stars
 (48 455 stars)
Métriques de merge PR
 (Merge moyen 6j 17h) (9 PRs mergées en 30 j)

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.

Guide contributeur