import { BonbonsConfigCollection, BonbonsToken, BonbonsEntry } from "@bonbons/contracts/dist/src/private-api"; type Configs = BonbonsConfigCollection; type Token = BonbonsToken; export class ConfigCollection implements Configs { protected _pool = new Map(); public set(token: Token, entry: T): void { this._pool.set(token.key, { value: entry }); } public get(token: Token): T { const entry = this._pool.get(token.key); return entry && entry.value; } public toArray(): BonbonsEntry[] { return Array.from(this._pool.entries()).map(([sb, { value }]) => ({ token: { key: sb }, value })); } }