real-enums
    Preparing search index...

    Hierarchy

    • String
      • Enum

    Indexable

    • readonly [index: number]: string
    Index
    value: string
    • get label(): string

      The value with its first letter capitalized, or, once the class has a static i18n key and a translator is set, its translation. Read on every access (never cached), so a tracked locale keeps it reactive in Ember.

      Returns string

    • get values(): any[]

      Every instance declared as a static member, in declaration order.

      A getter so templates can read it ({{#each OrderState.values}}). TypeScript cannot give a static getter a per-subclass type, so it is any[]; annotate where it matters (const all: OrderState[] = OrderState.values).

      Returns any[]

    • Starts a match over the static members, checked by the compiler: .when([Cls.A, Cls.B], fn) handles members, .exhaustive() compiles only once every member is handled, and .otherwise(fn) is the catch-all.

      Type Parameters

      Parameters

      • this: C & { prototype: T }
      • value: T

      Returns MatchOf<T, Members<C, T>>

    • Declares a member: static Pending = OrderState.of('pending'). Same instance as new, but typed as its own member, which is what lets Enum.match track what is handled.

      Type Parameters

      • T extends Enum
      • const V extends string
      • A extends unknown[]

      Parameters

      • this: new (value: string, ...args: A) => T
      • value: V
      • ...args: A

      Returns T & { value: V }