blob: fabdf0cf2b7406041d512204ae95194748e24efd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
/**
* Make a function mimic another one. It will copy over the properties `name`, `length`, `displayName`, and any custom properties you may have set.
*
* @param to - Mimicking function.
* @param from - Function to mimic.
* @returns The modified `to` function.
*/
export default function mimicFn<
ArgumentsType extends unknown[],
ReturnType,
FunctionType extends (...arguments: ArgumentsType) => ReturnType
>(
to: (...arguments: ArgumentsType) => ReturnType,
from: FunctionType
): FunctionType;
|