From b487aafeb9d041091ea46154b9aac58d78b2cfc8 Mon Sep 17 00:00:00 2001 From: Akalanka Perera Date: Mon, 15 Jan 2024 13:05:38 +0530 Subject: [PATCH] Feat(functions): updated type definitions --- packages/functions/types/traced.d.ts | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/packages/functions/types/traced.d.ts b/packages/functions/types/traced.d.ts index 8c8429c..d2920ec 100644 --- a/packages/functions/types/traced.d.ts +++ b/packages/functions/types/traced.d.ts @@ -1,3 +1,9 @@ +type BaseTracedFunction = any>(fn: T, loggable?: Record) => T; + +interface TracedFunction extends BaseTracedFunction { + [key: string]: BaseTracedFunction; +} + /** * @description Invokes the given function with tracing * @param fn The function to be invoked asynchronously @@ -12,7 +18,7 @@ export function trace(fn: Function, loggable?: Record): Promise; * @param loggable Object with extra information to be logged * @returns Returns the new function */ -export function traced any>(fn: T, loggable?: Record): T; +export const traced: TracedFunction; /** * @description Invokes the given function with tracing. Tracing is however ignored if the function is an anonymous function @@ -28,11 +34,4 @@ export function cleanTrace(fn: Function, loggable?: Record): Promise any>(fn: T, loggable?: Record): T; - -export default { - traced, - trace, - cleanTraced, - cleanTrace -}; +export const cleanTraced: TracedFunction;