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
(...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.
Example
Section titled “Example”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 Parameters
Section titled “Type Parameters”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
(...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.
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
inner | F |
Returns
Section titled “Returns”F
Example
Section titled “Example”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;};