A mutable data structure for hooks to maintain state across their lifecycle. Each hook instance gets its own isolated data store that persists for the duration of a single flag evaluation.

interface HookData<TData> {
    clear(): void;
    delete<K>(key: K): boolean;
    delete(key: string): boolean;
    get<K>(key: K): undefined | TData[K];
    get(key: string): unknown;
    has<K>(key: K): boolean;
    has(key: string): boolean;
    set<K>(key: K, value: TData[K]): void;
    set(key: string, value: unknown): void;
}

Type Parameters

  • TData = Record<string, unknown>

    A record type that defines the shape of the stored data

Implemented by

Methods