1 declare const mimicFn: {
3 Make a function mimic another one. It will copy over the properties `name`, `length`, `displayName`, and any custom properties you may have set.
5 @param to - Mimicking function.
6 @param from - Function to mimic.
7 @returns The modified `to` function.
11 import mimicFn = require('mimic-fn');
20 console.log(wrapper.name);
23 mimicFn(wrapper, foo);
25 console.log(wrapper.name);
28 console.log(wrapper.unicorn);
33 ArgumentsType extends unknown[],
35 FunctionType extends (...arguments: ArgumentsType) => ReturnType
37 to: (...arguments: ArgumentsType) => ReturnType,
41 // TODO: Remove this for the next major release, refactor the whole definition to:
42 // declare function mimicFn<
43 // ArgumentsType extends unknown[],
45 // FunctionType extends (...arguments: ArgumentsType) => ReturnType
47 // to: (...arguments: ArgumentsType) => ReturnType,
51 default: typeof mimicFn;