Home > @microsoft/node-core-library > LegacyAdapters > convertCallbackToPromise

LegacyAdapters.convertCallbackToPromise() method

This function wraps a function with a callback in a promise.

Signature:

static convertCallbackToPromise<TResult, TError>(fn: (cb: LegacyCallback<TResult, TError>) => void): Promise<TResult>;

Parameters

Parameter Type Description
fn (cb: LegacyCallback<TResult, TError>) => void  

Returns:

Promise<TResult>