Git Product home page Git Product logo

Comments (8)

fabian-hiller avatar fabian-hiller commented on May 22, 2024 1

I think I understand it now. Cool idea. Once I'm done with my bachelor thesis and hopefully have some more time, I can take a closer look at it.

from valibot.

fabian-hiller avatar fabian-hiller commented on May 22, 2024 1

If you have time and interest, you can try to implement this feature and submit a PR. I will check your code and give you feedback.

from valibot.

fabian-hiller avatar fabian-hiller commented on May 22, 2024 1

The brand feature is now available 🎉

from valibot.

fabian-hiller avatar fabian-hiller commented on May 22, 2024

Can you explain in which specific use cases brand is useful and offers an advantage? I have not quite understood it yet.

from valibot.

zkulbeda avatar zkulbeda commented on May 22, 2024

Nominal type matching is highly requested typescript feature, and until typescript doesn't have it, branded types is alternative.

See some resources of using them
https://egghead.io/blog/using-branded-types-in-typescript
https://twitter.com/mattpocockuk/status/1625173884885401600

from valibot.

zkulbeda avatar zkulbeda commented on May 22, 2024

Thanks! I should mention that zod also have brand utility, docs. I think it would simplify migration to valibot. See later great example of implementing nominal types in other lib @effect/data

from valibot.

danielo515 avatar danielo515 commented on May 22, 2024

@fabian-hiller if you have finished your degree and you are not yet familiar with this, then you are missing one of the best type safety features and it's a good time for you to investigate it 😁. This exists in several languages with different names, but the same concept:

  • ocaml: phantom types
  • rust: newtype pattern
  • F# constrained types (I think)

Since you seem to be interested in the type safety topic I really recommend taking a look at "domain modeling made functional", for some eye-opening usage examples. For me they are super valuable for IDs (what is that string? A user ID or a car ID?)

from valibot.

fabian-hiller avatar fabian-hiller commented on May 22, 2024

Thank you. I will have a look at it.

from valibot.

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.