UNPKG

@stryke/helpers

Version:

A package containing miscellaneous helper functions that are used across many different Storm Software projects.

10 lines (9 loc) 539 B
/** silence "error TS2322" but practically this is safer and more convenient than resorting to `any` in a random place */ export declare function safeFunctionCast<TFunc extends (...args: any[]) => any>(fn: (...args: Parameters<TFunc>) => ReturnType<TFunc>): TFunc; /** * Executes a function only once. * * @param fn - The function to be executed only once. * @returns A function that, when called, will execute the original function only once. */ export declare function once<TFunc extends (...args: any[]) => any>(fn: TFunc): TFunc;