import type { SetStateAction } from 'react'; export type UseCounterOptions = { /** * The maximum value of the counter */ max?: number; /** * The minimum value of the counter */ min?: number; }; export interface UseCounterReturnsAction { /** * Increment the counter */ inc: (delta?: number) => void; /** * Decrement the counter */ dec: (delta?: number) => void; /** * Set the counter */ set: (value: number) => void; /** * Get the counter */ get(): number; /** * Reset the counter */ reset: (n?: number) => void; /** * Set the counter, use React's `setState` style, supports function updater to avoid expired value * * @since 1.9.0 */ setState: (state: SetStateAction) => void; } export interface UseCounterState { /** * The value of the counter */ count: number; /** * The maximum value of the counter */ max: number; /** * The minimum value of the counter */ min: number; /** * The initial value of the counter */ initialCount: number; } export type UseCounterReturns = readonly [ /** * The count state of the counter */ number, /** * Functions to control the counter */ UseCounterReturnsAction, /** * The full internal state of the counter */ UseCounterState ]; /** * A React hook that provides a counter with increment, decrement, and reset functionalities. * * @param {number} [initialCount=0] - `number`, The initial value of the counter * @param {UseCounterOptions} [options] - `UseCounterOptions`, The options of the counter, see {@link UseCounterOptions} */ export declare function useCounter(initialCount?: number, options?: UseCounterOptions): UseCounterReturns;