-
-
Notifications
You must be signed in to change notification settings - Fork 181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: add branded types #56
Comments
Can you explain in which specific use cases |
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 |
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. |
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 |
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. |
The |
@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:
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?) |
Thank you. I will have a look at it. |
Introduce
brand
methodThe text was updated successfully, but these errors were encountered: