@serenity-is/corelib / registerEnum
Function: registerEnum()
registerEnum(
enumType,name,optOrEnumKey?):void
Defined in: src/base/system.ts:278
Register an enum with the type system.
Parameters
enumType
any
Enum type to register
name
string
Name to register the enum under
optOrEnumKey?
Alternative enum key or options for the enum registration, including alternative key and icon classes.
string |
{ enumFlags?: boolean; enumIcons?: Record<string | number, string>; enumKey?: string; enumTextKeys?: Record<string | number, string>; enumTexts?: Record<string | number, string>; }
Alternative enum key or options for the enum registration, including alternative key and icon classes.
enumFlags?
boolean
Whether the enum is a set of flags, like a [Flags] enum on the server side, whose values are OR-ed together
enumIcons?
Record<string | number, string>
Icon classes for enum values, numeric or string
enumKey?
string
Enum key
enumTextKeys?
Record<string | number, string>
Local text keys of the members that do not use the one their enum implies, i.e. Enums.<enumKey>.<Member>, e.g.
{ '2': 'My.Read.Key' }. An empty string means the member has no key, and its text is shown as it is.
enumTexts?
Record<string | number, string>
Texts of the members that are shown as they are, i.e. the ones that have no local text key, e.g.
{ '2': 'Read' }. A member with a key does not need one, as its text comes from the local texts.
Returns
void