Skip to content

@deprecated does not work on index signatures #47256

Closed
@ab-pm

Description

@ab-pm

🔎 Search Terms

index signature deprecation annotation @deprecated jsdoc

💻 Code

interface Example {
    /** @deprecated please no longer use this, it's unsafe and kept only for b/c */
    [p: string]: any;
    /** @deprecated please use `.y` instead  */
    x: number;
    /** Superseeds `.x` */
    y: number;
}

function example(e: Example) {
    console.log(e.x); // marked as deprecated, as expected
    console.log(e.y); // not marked as deprecated, as expected
    console.log(e.z); // not marked as deprecated, but should be
}

Playground with relevant code

🙁 Actual behavior

e.z shows up like a normal property, but it's deprecated.

🙂 Expected behavior

Any usage of e.z should be highlighted as deprecated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions