/**
 * @copyright Sister Software
 * @license AGPL-3.0
 * @author Teffen Ellis, et al.
 */
/**
 * A resource that can be disposed of either synchronously or asynchronously.
 */
export type DisposableLike = Disposable | AsyncDisposable;
export type ResourceConstructor<K extends PropertyKey, R extends DisposableLike> = new (key: K) => R;
export type ResourceFactory<K extends PropertyKey, R extends DisposableLike> = (key: K) => R | Promise<R>;
export type ResourceFactoryLike<K extends PropertyKey = PropertyKey, R extends DisposableLike = DisposableLike> = ResourceConstructor<K, R> | ResourceFactory<K, R>;
export type InferResource<F> = F extends ResourceConstructor<infer _K, infer R> ? R : F extends ResourceFactory<infer _K, infer R> ? R : never;
export type OpenResourceResult<F> = F extends ResourceConstructor<infer _K, infer R> ? R : F extends ResourceFactory<infer _K, infer _R> ? ReturnType<F> : never;
/**
 * Type-guard to determine if a value is a promise-like object.
 */
export declare function isPromiseLike<T>(value: unknown): value is PromiseLike<T>;
/**
 * A map-like object that caches disposable resources, creating them on demand.
 */
export declare class ResourceMapCache<K extends PropertyKey = PropertyKey, R extends DisposableLike = DisposableLike, F extends ResourceFactoryLike<K, R> = ResourceConstructor<K, R>> extends Map<K, R> implements AsyncDisposable {
    protected readonly factoryLike: F;
    /**
     * The human-readable name of the resource.
     */
    displayName: string;
    constructor(ResourceConstructor: ResourceConstructor<K, R>);
    constructor(factory: ResourceFactory<K, R>);
    /**
     * Gets a resource from the cache, creating if it doesn't exist.
     */
    open(key: K): OpenResourceResult<F>;
    /**
     * Closes a resource and removes it from the cache.
     */
    close(key: K): void;
    [Symbol.asyncDispose](): Promise<void>;
}
//# sourceMappingURL=ResourceMapCache.d.ts.map