Microsoft/TypeScript

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

オープン

#47,652 opened on 2022/01/28

 (5 件のコメント) (0 件のリアクション) (0 人の担当者)TypeScript (13,395 件のフォーク)batch import
BugDomain: JSDocHelp Wanted

Repository metrics

Stars
 (108,860 個のスター)
PR merge metrics
 (PR metrics pending)

説明

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.

コントリビューターガイド