GithubHelp home page GithubHelp logo

Comments (2)

holgerd77 avatar holgerd77 commented on June 2, 2024 1

πŸ‘

Thanks a lot for going so deep with your answer, yes, we already had this wrapping solution in parts, but since I thought about this whole thing a couple of rounds already I finally wanted to loot out a bit if this all things are structurally intended/necessary/whatever. πŸ™‚

Generally, the whole upgrade to the TypeScript/non-default-export/whateer new versions (we upgraded from v7) worked pretty seamlessly.

from node-lru-cache.

isaacs avatar isaacs commented on June 2, 2024

Yeah, rewriting in typescript exposed a conflict in how fetch() was possibly handling undefined values in the case of aborted fetches, unfortunately. It's a logical consequence of supporting ignoreFetchAbort and allowStaleOnFetchAbort, meaning that aborts aren't necessarily a failure, and I missed the implication when those features for added. I see this as ultimately my error, and typescript doing its job quite well, but still, annoying lol.

The clearest way to approach it imo is to have a special "no value here" value, like Symbol('undefined'), or wrap your values in an object like type Value = { value: MyThing | undefined }. It does add a step in the cache lookup, but it also means that cache.get(key) will either return undefined (not in cache) or {value:undefined} (known to be missing).

from node-lru-cache.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.