import '../../assert/js/assert.js';
import '../../globals.js';
import Constructor from './types/Constructor.js';
type SelfPoolableOptions<T extends Constructor> = {
    defaultArguments?: ConstructorParameters<T>;
    initialize?: PoolableInitializer<T>;
    maxSize?: number;
    initialSize?: number;
    useDefaultConstruction?: boolean;
};
export type PoolableOptions<T extends Constructor> = SelfPoolableOptions<T> & (InstanceType<T> extends {
    initialize: PoolableInitializer<T>;
} ? unknown : {
    initialize: PoolableInitializer<T>;
});
type PoolableInitializer<T extends Constructor> = (...args: ConstructorParameters<T>) => InstanceType<T>;
export type TPoolable = {
    freeToPool: () => void;
};
export type PossiblyRequiredParameterSpread<T> = ({} extends T ? [T?] : [T]);
export default class Pool<T extends Constructor> {
    private readonly objects;
    private _maxPoolSize;
    private readonly partialConstructor;
    private readonly DefaultConstructor;
    private readonly initialize;
    private readonly useDefaultConstruction;
    constructor(type: T, ...providedOptionsSpread: PossiblyRequiredParameterSpread<PoolableOptions<T>>);
    private createDefaultObject;
    /**
     * Returns an object with arbitrary state (possibly constructed with the default arguments).
     */
    fetch(): InstanceType<T>;
    /**
     * Returns an object that behaves as if it was constructed with the given arguments. May result in a new object
     * being created (if the pool is empty), or it may use the constructor to mutate an object from the pool.
     */
    create(...args: ConstructorParameters<T>): InstanceType<T>;
    /**
     * Returns the current size of the pool.
     */
    get poolSize(): number;
    /**
     * Sets the maximum pool size.
     */
    set maxPoolSize(value: number);
    /**
     * Returns the maximum pool size.
     */
    get maxPoolSize(): number;
    freeToPool(object: InstanceType<T>): void;
    forEach(callback: (object: InstanceType<T>) => void): void;
}
export {};
//# sourceMappingURL=Pool.d.ts.map