extend-error.d.ts 482 B

123456789
  1. import { ErrorLike, OnoError } from "./types";
  2. /**
  3. * Extends the new error with the properties of the original error and the `props` object.
  4. *
  5. * @param newError - The error object to extend
  6. * @param originalError - The original error object, if any
  7. * @param props - Additional properties to add, if any
  8. */
  9. export declare function extendError<T extends ErrorLike, E extends ErrorLike, P extends object>(error: T, originalError?: E, props?: P): T & E & P & OnoError<T & E & P>;