call-chainer
Version:
Combine a regular function and a class so that methods of the class become chainable properties of the function that get called automatically.
4 lines (3 loc) • 314 B
TypeScript
import type { Chained, ConstructorOf, FN } from './types.js';
declare const chainer: <Arguments extends any[], Return extends unknown, Methods extends Record<string, any>>(Methods: ConstructorOf<Methods>, fn: FN<[Methods, ...Arguments], Return>) => Chained<FN<Arguments, Return>, Methods>;
export default chainer;