Skip to content

Funcware

Defined in: function-types.ts:70

Funcware is a higher-order function type for enhancing or wrapping methods.

Given a function type F, Funcware is:

(...args) => (fn) => F

This lets you intercept, modify, or extend the behavior of a method by wrapping its logic.

Used with createMethodEnhancer and createMethodEnhancer to create method middleware.

const logWare: Funcware<Foo['foo']> = (x, y, z) => fn => {
console.log('before', x, y, z);
const r = fn(x, y, z);
console.log('after', r);
return r;
};
Type Parameter
F extends Func

Funcware(inner: F): F

Defined in: function-types.ts:70

Funcware is a higher-order function type for enhancing or wrapping methods.

Given a function type F, Funcware is:

(...args) => (fn) => F

This lets you intercept, modify, or extend the behavior of a method by wrapping its logic.

Used with createMethodEnhancer and createMethodEnhancer to create method middleware.

ParameterType
innerF

F

const logWare: Funcware<Foo['foo']> = (x, y, z) => fn => {
console.log('before', x, y, z);
const r = fn(x, y, z);
console.log('after', r);
return r;
};