Skip to main content
Deno 2 is finally here 🎉️
Learn more
Latest
function promisify
import { promisify } from "https://deno.land/x/kafkasaur@v0.0.7/src/utils/promisify.ts";

Promisifies a given function that has a final callback argument.

Type Parameters

T extends (...args: any[]) => any
optional
$FirstParams extends unknown[] = Parameters<T> extends [...infer $FirstParams, infer _] ? $FirstParams : any[]

Returns

(...args: $FirstParams) => Promise<Parameters<T> extends [...infer _, infer $Last] ? $Last : any>