@daiso-tech/core
Version:
The library offers flexible, framework-agnostic solutions for modern web applications, built on adaptable components that integrate seamlessly with popular frameworks like Next Js.
85 lines (84 loc) • 2.88 kB
TypeScript
/**
* @module Utilities
*/
import type { NoneFunc } from "../../utilities/types/none-func.type.js";
import type { Promisable } from "../../utilities/types/promiseable.type.js";
/**
*
* IMPORT_PATH: `"@daiso-tech/core/utilities"`
*/
export type InvokableFn<TArgs extends unknown[] = unknown[], TReturn = unknown> = (...args: TArgs) => TReturn;
/**
*
* IMPORT_PATH: `"@daiso-tech/core/utilities"`
*/
export type IInvokableObject<TArgs extends unknown[] = unknown[], TReturn = unknown> = {
invoke(...args: TArgs): TReturn;
};
/**
*
* IMPORT_PATH: `"@daiso-tech/core/utilities"`
*/
export type Invokable<TArgs extends unknown[] = unknown[], TReturn = unknown> = InvokableFn<TArgs, TReturn> | IInvokableObject<TArgs, TReturn>;
/**
*
* IMPORT_PATH: `"@daiso-tech/core/utilities"`
*/
export type FactoryFn<TInput, TOutput> = InvokableFn<[
value: TInput
], NoneFunc<TOutput>>;
/**
*
* IMPORT_PATH: `"@daiso-tech/core/utilities"`
*/
export type IFactoryObject<TInput, TOutput> = IInvokableObject<[
value: TInput
], NoneFunc<TOutput>>;
/**
*
* IMPORT_PATH: `"@daiso-tech/core/utilities"`
*/
export type Factory<TInput, TOutput> = FactoryFn<TInput, TOutput> | IFactoryObject<TInput, TOutput>;
/**
*
* IMPORT_PATH: `"@daiso-tech/core/utilities"`
*/
export type AsyncFactoryFn<TInput, TOutput> = InvokableFn<[
value: TInput
], Promisable<NoneFunc<TOutput>>>;
/**
*
* IMPORT_PATH: `"@daiso-tech/core/utilities"`
*/
export type IAsyncFactoryObject<TInput, TOutput> = IInvokableObject<[
value: TInput
], Promisable<NoneFunc<TOutput>>>;
/**
*
* IMPORT_PATH: `"@daiso-tech/core/utilities"`
*/
export type AsyncFactory<TInput, TOutput> = AsyncFactoryFn<TInput, TOutput> | IAsyncFactoryObject<TInput, TOutput>;
/**
* @internal
*/
export declare function isInvokableObject<TValue, TParameters extends unknown[], TReturn>(invokable: TValue | Invokable<TParameters, TReturn>): invokable is IInvokableObject<TParameters, TReturn>;
/**
* @internal
*/
export declare function isInvokableFn<TValue, TParameters extends unknown[], TReturn>(invokable: TValue | Invokable<TParameters, TReturn>): invokable is InvokableFn<TParameters, TReturn>;
/**
* @internal
*/
export declare function isInvokable<TValue, TParameters extends unknown[], TReturn>(invokable: TValue | Invokable<TParameters, TReturn>): invokable is Invokable<TParameters, TReturn>;
/**
* @internal
*/
export declare function resolveInvokable<TParameters extends unknown[], TReturn>(invokable: Invokable<TParameters, TReturn>): InvokableFn<TParameters, TReturn>;
/**
* @internal
*/
export declare function callInvokable<TParameters extends unknown[], TReturn>(invokable: Invokable<TParameters, TReturn>, ...args: TParameters): TReturn;
/**
* @internal
*/
export declare function getInvokableName<TParameters extends unknown[], TReturn>(invokable: Invokable<TParameters, TReturn>): string;