I want to pass lru-cache into my custom class, which accepts any Map.
lru-cache and ttl-cache work perfectly in runtime, but I have to cast them using cache as Map<string, T>.
I added implements Map<K, V> to this class, and tweaked it to match. All it needed was a few type assertions, and the addition of [Symbol.toStringTag]. No functionality is changed.
I want to pass
lru-cache
into my custom class, which accepts anyMap
.lru-cache
andttl-cache
work perfectly in runtime, but I have to cast them usingcache as Map<string, T>
.I added
implements Map<K, V>
to this class, and tweaked it to match. All it needed was a few type assertions, and the addition of[Symbol.toStringTag]
. No functionality is changed.