Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

282
Views
How to mark a property deprecated in a @typedef?

I would like to mark a property (for example, qux below) as deprecated:

/**
 @typedef {object} Foo
 @property {string} bar
 @property {symbol} qux - How to deprecate it?
 @deprecated @property {symbol} qux2 - Doesn't work
 @property {symbol} qux3 @deprecated - This marks the whole of Foo as deprecated 
 */

I should mention, I'd like to do this in a JSDoc comment, not using TypeScript.

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

As far as i know the @deprecated tag can be only used for deprecating anything else than an entire symbol

Following the jsdoc docs this is the only way you can use @deprecated

/**
 * @deprecated since version 2.0.0
 */
function old() {

}

https://jsdoc.app/tags-deprecated.html

about 4 years ago · Juan Pablo Isaza Report

0

According to Issue#131 over at tsdoc, you can actually use @deprecated on properties, you just have to set it inside the object (works with JS as well).

For e.g.:

/**
 * Explain the interface ...
 */
export interface test {
    /**
     * Foo property
     */
    Foo: string;
    /**
     * @deprecated Use {@link test.qux2} instead.
     */
    qux: string;
    /**
     * qux2 property
     */
    qux2: string;
}

Results in:

enter image description here


In classes for e.g.:

/**
 * Class description ...
 */
class User {
    /**
     * Holds user's name
     */
    name = "";
    /**
     * Holds user's surname
     */
    surname = "";
    /**
     * @deprecated Holds user height
     */
    height = 0;

    /**
     * constructor
     */

    constructor(name, surname) {
        this.name = name;
        this.surname = surname;
    }
}

const me = new User("Arslan", "Sohail Bano");

Results:

enter image description here

When using the deprecated property. enter image description here

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!