UNPKG

@thisisagile/easy

Version:

Straightforward library for building domain-driven microservice architectures

25 lines (24 loc) 1.1 kB
import { Id } from './Id'; import { List } from './List'; import { Validatable } from './Validatable'; import { JsonValue } from './Json'; import { Get } from './Get'; import { TypeGuard } from './TypeGuard'; export declare abstract class Enum implements Validatable { readonly name: string; readonly id: Id; readonly code: string; protected constructor(name: string, id?: Id, code?: string); get isValid(): boolean; static all<E extends Enum>(): List<E>; protected static allTuple<E extends Enum>(): Record<Id, E>; static filter<E extends Enum>(p: (value: E, index: number, array: E[]) => unknown, params?: unknown): List<E>; static first<E extends Enum>(p?: (value: E, index: number, array: E[]) => unknown, params?: unknown): E; static byIds<E extends Enum>(ids?: Id[]): List<E>; static byId<E extends Enum>(id: Id, alt?: Get<E, unknown>): E; equals<E extends Enum>(other: E | Id): other is E; isIn<E extends Enum>(...items: E[] | Id[]): boolean; toJSON(): JsonValue; toString(): string; } export declare const isEnum: TypeGuard<Enum>;