import type { DependencyList, EffectCallback } from 'react'; import type { RefObject } from 'react'; export type ExtendedReactEffect = (effect: EffectCallback, deps?: DependencyList, ...args: T[]) => void; export type Noop = () => void; export type AnyFunc = (...args: any[]) => any; export type WithThis = (this: ThisParameterType, ...args: Parameters) => ReturnType; export type PureObject = Record; export type Arrayable = T | T[]; export type Gettable = T | (() => T); export type Reffable = T | RefObject; export type Promisable = T | Promise; export type GettableOrReffable = Gettable | Reffable; export type WindowEventName = keyof WindowEventMap; export type PointerType = 'mouse' | 'touch' | 'pen'; export type Position = { /** * X coordinate */ x: number; /** * Y coordinate */ y: number; }; export type Size = { /** * Width of the element */ width: number; /** * Height of the element */ height: number; }; export type SetTimeoutReturn = ReturnType<(typeof globalThis)['setTimeout']>; export type SetIntervalReturn = ReturnType<(typeof globalThis)['setInterval']>; export declare const isDev: boolean; export declare const isClient: boolean; export declare function noop(): undefined; export declare function wait(time?: number): Promise; export declare function now(): number; export declare function timestamp(): number; export declare function clamp(n: number, min: number, max: number): number; export declare function noNullish(val: T | null): val is T; export declare function isDefined(val?: T): val is T; export declare function isFunction(val: unknown): val is T; export declare function isNumber(val: unknown): val is number; export declare function isBoolean(val: unknown): val is boolean; export declare function isString(val: unknown): val is string; export declare function isObject(val: unknown): val is object; export declare function isReact18OrLater(): boolean; export declare function hasOwn(val: T, key: K): boolean; export declare function ensureSSRSecurity(fn: () => T, fallback: S): T; export interface PromiseWithResolversReturns { resolve: (value: T | PromiseLike) => void; reject: (reason: unknown) => void; promise: Promise; } /** * TODO: re-write with `Promise.withResolvers` * * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers#browser_compatibility */ export declare function createPromiseWithResolvers(): PromiseWithResolversReturns; /** * Increase string a value with unit * * @example '2px' + 1 = '3px' * @example '15em' + (-2) = '13em' */ export declare function increaseWithUnit(target: T, delta: number): T; export declare function increaseWithUnit(target: T, delta: number): T; export declare function increaseWithUnit(target: T, delta: number): T; export declare function createSingletonPromise(fn: () => Promise): (() => Promise) & { reset: () => Promise; };