question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add new @enum tag

See original GitHub issue

Hi!

Current JSDoc spec allows documenting plain objects as enumerables. This is very helpful when restricting argument types.

An abstract example:

//Season.js
/**
 * @enum {String}
 */
const Season = {
    SPRING: 'SPRING',
    SUMMER: 'SUMMER',
    AUTUMN: 'AUTUMN',
    WINTER: 'WINTER'
};

export default Season;
//Forecast.js
export default class Forecast {
    /**
     * @param {Season} season
     */
    generate(season) {
        //implementation
    }
}
//test.js
import Season from './Season.js';
import Forecast from './Forecast.js';

let forecast = new Forecast();
forecast.generate(Season.SUMMER);

Current implementation of ESDoc treats season argument of Forecast#generate as a variable import Season from './Season.js' instead of const Season inside Season.js.

Is it planned to support @enum annotations similar to @typedef?

Issue Analytics

  • State:open
  • Created 8 years ago
  • Reactions:14
  • Comments:15 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
pronebirdcommented, Mar 10, 2017

We use them a lot

0reactions
elashpearcommented, May 7, 2019

@raveclassic That sounds like a great idea - would love some tips on how to do this. I was able to get ESDoc up and running super easily but I have been unable to figure out how to do the same with typedoc, it just spits out an empty template page.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Adding a new value to an existing ENUM Type - Stack Overflow
PostgreSQL 9.1 introduces ability to ALTER Enum types: ALTER TYPE enum_type ADD VALUE 'new_value'; -- appends to list ALTER TYPE enum_type ...
Read more >
Attaching Values to Java Enum - Baeldung
Let's start by adding the element names. ... First of all, we notice the special syntax in the declaration list. This is how...
Read more >
Enumeration (or enum) in C - GeeksforGeeks
Enumeration (or enum) is a user defined data type in C. It is ... The keyword 'enum' is used to declare new enumeration...
Read more >
Enumeration types - C# reference - Microsoft Learn
You cannot define a method inside the definition of an enumeration type. To add functionality to an enumeration type, create an extension ...
Read more >
Documentation: 15: 8.7. Enumerated Types - PostgreSQL
White space in the labels is significant too. Although enum types are primarily intended for static sets of values, there is support for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found