import type { DeepPartial, PrimitiveObject } from '../libs/bemedev/globals/types'; import type { EventObject } from '../events/index.js'; import type { FnMap, FnR } from '../types/index.js'; import type { Describer, FromDescriber } from '../types/index.js'; /** * JSON configuration for an action. * * @see {@linkcode Describer} for more details. */ export type ActionConfig = string | Describer; /** * Retrieves the name of the action if it is a describer, otherwise returns the action itself. * @template : type {@linkcode ActionConfig} [T], ActionConfig to reduce * @returns The name of the action if it is a describer, otherwise the action itself. * * @see {@linkcode FromDescriber} for more details. */ export type FromActionConfig = T extends Describer ? FromDescriber : T; /** * Represents the result of executing an action, which includes the private context and the context. * * @template : [Pc] : The type of the private context. * @template : type {@linkcode PrimitiveObject} [Tc] : The type of the context. * @returns a {@linkcode DeepPartial} object containing the private context and the {@linkcode PrimitiveObject} context. */ export type ActionResult = DeepPartial<{ pContext: Pc; context: Tc; }>; /** * An action may return synchronously or asynchronously. * * Any action (user-provided or produced by an `addOptions` helper except * `debounce`) may return `ActionResult` or a promise that resolves to one. */ export type MaybeAsyncActionResult = ActionResult | Promise>; export type Action = FnMap>; /** * Represents a collection of actions, where each action is identified by a string key. * * @template : type {@linkcode EventObject} [E], all events. * @template : [Pc], the type of the private context. * @template : type {@linkcode PrimitiveObject} [Tc], the type of the context. * @returns a partial record where each key is a string and each value is an {@linkcode Action}. */ export type ActionMap = Partial>>; export type Action2 = FnR>; export type Action22 = FnR>; //# sourceMappingURL=types.d.ts.map