export const functions = {
add: (a: number, b: number) => a + b,
pow: (a: number) => a * a,
twice: (a: string) => a + a,
}

const createMessagePassing =
<T extends Record<string, F>, F extends (...args: any[]) => any = any>(t: T) =>
<K extends keyof T>(k: K, ...p: Parameters<T[K]>): ReturnType<T[K]> =>
t[k](...p)

const runFunctions = createMessagePassing(functions)


보기 좋으라고 개행 넣긴했는데 


코드 한줄이면 끝남