// Duplicate some of the utils in `/src/utils` to ensure // we don't end up dragging in larger chunks of the RTK core // into the RTKQ bundle export function getOrInsert( map: WeakMap, key: K, value: V, ): V export function getOrInsert(map: Map, key: K, value: V): V export function getOrInsert( map: Map | WeakMap, key: K, value: V, ): V { if (map.has(key)) return map.get(key) as V return map.set(key, value).get(key) as V } export function getOrInsertComputed( map: WeakMap, key: K, compute: (key: K) => V, ): V export function getOrInsertComputed( map: Map, key: K, compute: (key: K) => V, ): V export function getOrInsertComputed( map: Map | WeakMap, key: K, compute: (key: K) => V, ): V { if (map.has(key)) return map.get(key) as V return map.set(key, compute(key)).get(key) as V } export const createNewMap = () => new Map()