API
enumType
enumType
Defining as an array of enum values:
1const Episode = enumType({2 name: 'Episode',3 members: ['NEWHOPE', 'EMPIRE', 'JEDI'],4 description: 'The first Star Wars episodes released',5})
As an object, with a simple mapping of enum values to internal values:
1const Episode = enumType({2 name: 'Episode',3 members: {4 NEWHOPE: 4,5 EMPIRE: 5,6 JEDI: 6,7 },8})
Check the type-definitions or the examples for a full illustration of the various options of enumType
, or feel free to open a PR on the docs to help document!