Veve

Fn Function

veve / Fn

Function: Fn()

Fn<T>(implementation): TrackedFunction<T>

Defined in: framework/Fn.ts:389

Creates a tracked version of a given function, preserving its original type signature while adding tracking capabilities. The returned function maintains the same behavior as the original while providing additional methods for tracking calls, arguments, and results.

Type Parameters

T extends (...args) => any

The type of the function being tracked, must extend (...args: any[]) => any

Parameters

implementation

T

The original function implementation to track

Returns

TrackedFunction<T>

A function that combines the original implementation with tracking capabilities

Example

// Track a simple addition function
const add = (a: number, b: number) => a + b;
const trackedAdd = Fn(add);
trackedAdd(1, 2); // Returns 3
console.log(trackedAdd.getCallCount()); // Returns 1

On this page