@cruncher/utils
Version:
Utility functions for Cruncher.
23 lines • 959 B
TypeScript
export declare const measureTime: <T>(id: string, fn: () => T) => T;
export declare function product<T>(elements: T[][]): T[][];
export declare const createSignal: <T = void>() => {
reset: () => void;
wait: (opts?: {
timeout?: number;
signal?: AbortSignal;
}) => Promise<T>;
signal: (value: T | PromiseLike<T>) => void;
then: (onFulfilled: (value: T) => void, onRejected?: (reason: any) => void) => Promise<void>;
};
export type Signal<T = void> = ReturnType<typeof createSignal<T>>;
export declare const atLeastOneConnectionSignal: () => {
isReady: () => Promise<void>;
increment: () => void;
decrement: () => void;
};
export declare const debounceInitialize: <T, R>(fn: (...args: T[]) => Promise<R>, delay: number) => ((...args: T[]) => Promise<R>);
export type Brand<K, T> = K & {
__brand: T;
};
export declare const asBrand: <T, K = unknown>(value: K) => Brand<K, T>;
//# sourceMappingURL=index.d.ts.map