UNPKG

@trpc/server

Version:

The tRPC server library

17 lines 1.01 kB
/** * Takes a value and a dispose function and returns a new object that implements the Disposable interface. * The returned object is the original value augmented with a Symbol.dispose method. * @param thing The value to make disposable * @param dispose Function to call when disposing the resource * @returns The original value with Symbol.dispose method added */ export declare function makeResource<T>(thing: T, dispose: () => void): T & Disposable; /** * Takes a value and an async dispose function and returns a new object that implements the AsyncDisposable interface. * The returned object is the original value augmented with a Symbol.asyncDispose method. * @param thing The value to make async disposable * @param dispose Async function to call when disposing the resource * @returns The original value with Symbol.asyncDispose method added */ export declare function makeAsyncResource<T>(thing: T, dispose: () => Promise<void>): T & AsyncDisposable; //# sourceMappingURL=disposable.d.ts.map