import { Awaitable } from 'justypes' type Asyncify = Awaitable> type Promisify = { [Index in keyof Args]: Asyncify } export function asyncify( fn: (this: This, ...args: Args) => Awaitable ): (this: This, ...args: Promisify) => Promise { return async function ( this: This , ...args: Promisify ): Promise { await Promise.resolve() return Reflect.apply(fn, this, await Promise.all(args)) } }