import type { L } from 'ts-toolbelt'; export type AddAbortSignal = L.Append; export type InvokablesDict = Record; export type CreateInvokablesDict = T; export type InvokerFn = (...args: AddAbortSignal) => Result | Promise>; /** * Create a `.register` argument union from a list of arguments and a return type. * * @example * type Args = InvokerRegistrationArgs<[string, number], string> * // | [string, number, InvokerFn<[], string>] * // | [string, InvokerFn<[number], string>] * // | [InvokerFn<[string, number], string>] */ export type InvokerRegistrationArgs = _InvokerRegistrationArgs]>; type _InvokerRegistrationArgs = L.Length extends 0 ? Acc : _InvokerRegistrationArgs, Return, L.Prepend>, L.Append> | Acc>; export interface Invoker { args: unknown[]; fn: InvokerFn; } export type Invokers = Partial<{ [InvokableName in keyof Invokables]: Invoker[]; }>; export type Unsubscriber = () => void; export {};