Add new @enum tag
See original GitHub issueHi!
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:
- Created 8 years ago
- Reactions:14
- Comments:15 (3 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We use them a lot
@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.