import type { ServiceType, IResolverServiceType } from "../types/index.js"; import { SingleServiceTypeResolver } from "./SingleServiceTypeResolver.js"; const cache = new WeakMap< ServiceType, IResolverServiceType >(); export function single(service: ServiceType): IResolverServiceType { let cached = cache.get(service) as IResolverServiceType; if (!cached) { cached = new SingleServiceTypeResolver(service); cache.set(service, cached); } return cached; }