So it seems like this is the right way to document everything without warning.
var TYPES = { TYPE_A: 1, TYPE_B: 2 } function useTypesEnum( type ) { }
It means:
- MyType is a number
- TYPES is an enumeration that contains MyType values
- This function accepts enumerations that print MyType values.
Works for me on the website 2017.1
However, this will still allow passing each line to the function without warning.
If you also want to specify the values โโof the enumeration - therefore, it should raise errors if another line is used, use the method described at: https://stackoverflow.com/a/16729/
/** * @typedef FieldType * @property {string} Text "text" * @property {string} Date "date" * @property {string} DateTime "datetime" * @property {string} Number "number" * @property {string} Currency "currency" * @property {string} CheckBox "checkbox" * @property {string} ComboBox "combobox" * @property {string} Dropdownlist "dropdownlist" * @property {string} Label "label" * @property {string} TextArea "textarea" * @property {string} JsonEditor "jsoneditor" * @property {string} NoteEditor "noteeditor" * @property {string} ScriptEditor "scripteditor" * @property {string} SqlEditor "sqleditor" */
guy mograbi
source share