Skip to content

unacy / EnumType

Type Alias: EnumType

ts
type EnumType = Record<string, string | number>;

Defined in: packages/core/src/types.ts:167

A TypeScript enum object at runtime — an object whose values are all strings (string enum) or all numbers (numeric enum). Mixed enums (both string and number values) are rejected at validation.

Remarks

TypeScript numeric enums produce reverse-mapped keys at runtime (e.g., { DEBUG: 0, 0: 'DEBUG' }). validateEnum filters those out automatically — you do not need to handle them yourself.

Pitfalls

NEVER use an empty object ({}) as an enum type — validateEnum rejects it, and the registry will throw at registration time.

NEVER mix numeric and string values in a single enum — unacy rejects mixed enums at validation time because the value type would be ambiguous.

Released under the MIT License.