Git Product home page Git Product logo

Comments (7)

nhinhdao avatar nhinhdao commented on September 26, 2024 1

Hey @brandongregoryscott, sorry for holding you back. I actually haven't looked into this issue. Let me get back to you this afternoon on this.

from andculturecode.javascript.core.

nhinhdao avatar nhinhdao commented on September 26, 2024 1

Yup. value?: string with type predicate value is "" is equivalent to value: null | undefined | string with type predicate value is null | undefined | '' so the optional parameter actually helps taking care of that. PR is coming in a bit

from andculturecode.javascript.core.

nhinhdao avatar nhinhdao commented on September 26, 2024

I will look into this

from andculturecode.javascript.core.

brandongregoryscott avatar brandongregoryscott commented on September 26, 2024

Thanks @nhinhdao! No rush, I was just excited to use the new guards! 😂

from andculturecode.javascript.core.

brandongregoryscott avatar brandongregoryscott commented on September 26, 2024

@nhinhdao How's this coming? I am holding back on pushing out a new version w/ the JSDoc + RecordUtils type guard since it won't be of much use with the way the type guard for isEmpty currently stands

from andculturecode.javascript.core.

nhinhdao avatar nhinhdao commented on September 26, 2024

@brandongregoryscott I have found the workaround for this case by using literal type for string;

image

this type predicate will narrow value to be null | undefined | '' which works well for this case

from andculturecode.javascript.core.

brandongregoryscott avatar brandongregoryscott commented on September 26, 2024

Woah, that's awesome 👍 Is it actually bound to null | undefined | '' with the type guard of value is ''? As long as we don't have to start non-null asserting after isEmpty returns false, then we should be good to go. Do you want to send out a PR for this, or would you like me to pick it up?

from andculturecode.javascript.core.

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.