/* eslint-disable @typescript-eslint/no-redundant-type-constituents */ /* eslint-disable @typescript-eslint/no-explicit-any */ export interface Func { /** * Returns the name of the function. Function names are read-only and can not be changed. */ readonly name: string (...args: any[]): any | Promise (this: any, ...args: any[]): any | Promise } /** * ReturnType is any */ export type MethodType< ArgsType extends unknown[] = any[], ReturnType = any | Promise, TThis = any, > = (this: TThis, ...input: ArgsType) => ReturnType /** * ReturnType is unknown */ export type MethodTypeUnknown< ArgsType extends any[] = any[], ReturnType = unknown, TThis = any, > = (this: TThis, ...input: ArgsType) => ReturnType /** * ReturnType is Promise */ export type AsyncMethodType< ArgsType extends any[] = any[], ResultType = unknown, TThis = any, > = (this: TThis, ...input: ArgsType) => Promise /** * Convert a function type to an async function type */ export type ToAsyncFunction any> = T extends (...args: infer A) => infer R ? (...args: A) => Promise : never