thorish
Version:
This is a library of useful JS concepts and data structures for Node and the browser. It it, unashamedly, a dumping ground for code needed by [@samthor](https://twitter.com/samthor)'s projects.
10 lines (9 loc) • 443 B
TypeScript
/**
* Builds a fake version of a passed module-like that allows bound callables (functions, classes).
*
* This can be used like `const { foo } = mocked;`, where `foo` is a function on `mocked`. Updates
* to `mocked.foo` later are _still reflected_ in `foo`, because it's secretly a `Proxy`.
*
* The original passed module remains unchanged.
*/
export declare function buildBoundProxy<T extends Record<string | symbol, any>>(mod: T): T;