-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Description
It's usual to have places where you only can set a group of strings, for example names of events or types of media, and don't want to allow others. At this moment the only way to document them is creating a Javascript object and set it as an enum, but this forces to create an object for this enum that in other case is unnecesary. I propose three non-mutually incompatible solutions:
- allow to use ad-hoc objects and reference them in a similar way as with callbacks
- allow to set quoted strings as a type
/**
* @param {('MP4'|'WEBM')} mediaType - Type of the media
*/
function foo(mediaType){};
/**
* @param {MediaType} mediaType - Type of the media
*/
function foo(mediaType){};
/**
* @type {('MP4'|'WEBM')} MediaType - Allowed media types
*/
- allow to set quoted strings on the enum statement
omarkj, i11v, rhys-vdw, Thaina, ryanoasis and 83 moreryanoasis, lifenautjoe, robertstettner, paroxyzm, morajabi and 15 more