index.d.ts 506 B

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