Microsoft/TypeScript

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

Open

#47,652 建立於 2022年1月28日

在 GitHub 查看
 (5 留言) (0 反應) (0 負責人)TypeScript (6,726 fork)batch import
BugDomain: JSDocHelp Wanted

倉庫指標

Star
 (48,455 star)
PR 合併指標
 (平均合併 6天 17小時) (30 天內合併 9 個 PR)

描述

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.

貢獻者指南