import type { Config, Fn, MethodReturnType } from "./index.js"; import recall from "./recall.js"; import useAsync from "./useAsync.js"; import useAsyncSafe from "./useAsyncSafe.js"; export function constructor>(methods: Fn[]) { return function create(func: Func, config?: Config) { return methods.map( (method) => (...args: Parameters) => method(func, config, args), ) as [ (...args: Parameters) => MethodReturnType, (...args: Parameters) => MethodReturnType, (...args: Parameters) => MethodReturnType, ]; }; } export default constructor<["useAsync", "recall", "useAsyncSafe"]>([ useAsync, recall, useAsyncSafe, ]);