Skip to content

Type Alias: PrependTimeoutError<T>

ts
type PrependTimeoutError<T> = {
  [K in keyof T]: T[K] extends (args: infer Params) => infer Result
    ? Params[0] extends Error
      ? T[K]
      : (err: Error, args: Params) => Result
    : T[K];
};

Prepends a timeout error to the parameters of functions in a tuple.

Type Parameters

Type ParameterDescription
T extends any[]The tuple of functions to modify.