import { Computed, Signal } from '@tma.js/signals'; export interface StatefulOptions { /** * The initial state. */ initialState: S; /** * A function to call whenever the state changes. * @param state - updated state. */ onChange: (state: S) => void; } export declare class Stateful { constructor({ initialState, onChange }: StatefulOptions); protected readonly _state: Signal; /** * The current state. */ readonly state: Computed; /** * Creates a computed signal based on the state. * @param key - a state key to use as a source. */ getter(key: K): Computed; /** * Updates the state. * @param state - updates to apply. */ readonly setState: (state: Partial) => void; /** * @returns True if specified payload will update the state. * @param state */ hasDiff(state: Partial): boolean; }