/** * @public * Get the stored value if present, then delete the key. * * @remarks * See {@link (mapDeleteGet: 1)}. */ export function mapDeleteGet(map: Map, key: TKey): TValue | undefined; /** * @public * {@inheritDoc (mapDeleteGet: 1)} */ export function mapDeleteGet(map: WeakMap, key: TKey): TValue | undefined; export function mapDeleteGet ( map: Map | WeakMap, key: TKey, ) : TValue | undefined { const value = map.get(key); map.delete(key); return value; }