Skip to content

Commit

Permalink
Merge pull request #139 from sliit-foss/feature/tracing-prefix
Browse files Browse the repository at this point in the history
Feat(functions): updated type definitions
  • Loading branch information
Akalanka47000 authored Jan 15, 2024
2 parents 8ad15a0 + b487aaf commit 9ace7d0
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions packages/functions/types/traced.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
type BaseTracedFunction = <T extends (...args: any[]) => any>(fn: T, loggable?: Record<any, any>) => T;

interface TracedFunction extends BaseTracedFunction {
[key: string]: BaseTracedFunction;
}

/**
* @description Invokes the given function with tracing
* @param fn The function to be invoked asynchronously
Expand All @@ -12,7 +18,7 @@ export function trace(fn: Function, loggable?: Record<any, any>): Promise<void>;
* @param loggable Object with extra information to be logged
* @returns Returns the new function
*/
export function traced<T extends (...args: any[]) => any>(fn: T, loggable?: Record<any, any>): T;
export const traced: TracedFunction;

/**
* @description Invokes the given function with tracing. Tracing is however ignored if the function is an anonymous function
Expand All @@ -28,11 +34,4 @@ export function cleanTrace(fn: Function, loggable?: Record<any, any>): Promise<v
* @param loggable Object with extra information to be logged
* @returns Returns the new function
*/
export function cleanTraced<T extends (...args: any[]) => any>(fn: T, loggable?: Record<any, any>): T;

export default {
traced,
trace,
cleanTraced,
cleanTrace
};
export const cleanTraced: TracedFunction;

0 comments on commit 9ace7d0

Please sign in to comment.