isaacs / node-lru-cache

A fast cache that automatically deletes the least recently used items

Home Page:http://isaacs.github.io/node-lru-cache/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Private field '#head' must be declared in an enclosing class

justinr1234 opened this issue · comments

return c.#head

In the web browser (nextjs), this is throwing an error Private field '#head' must be declared in an enclosing class

commented

But... it is declared in an enclosing class.

This works just fine, logs 2 0 1 in any modern browser:

<!DOCTYPE html>
<html>
  <head>
    <script type="module">
      import { LRUCache } from 'https://unpkg.com/lru-cache@10.0.1/dist/mjs/index.js'
      const cache = new LRUCache({ max: 3 })
      cache.set('one', 1)
      cache.set('two', 2)
      cache.set('tre', 3)
      cache.get('two')
      const internals = LRUCache.unsafeExposeInternals(cache)
      console.log(cache.get('two'), internals.head, internals.tail)
    </script>
  </head>
</html>

Idk what next is doing to LRUCache, but it's not correct.

I was using an old version of the library via octokit