-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Make brand available as a runtime value #2480
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I think this would be a great feature |
This could/would probably be used by various "Zod to X" converters that currently need the schema's name as a separate parameter. |
A PR for this issue has been created here: #2860 I also think this feature would be useful. |
I will repeat it here too: the most reliable solution is to use "unique symbol" as runtime unique markers. I mean, it would be nice if the |
I'm inspecting Zod values at runtime. I've run into a situation where I would like to use branded types but I've found that the brand isn't available at runtime. The
brand
function takes the brand as an optional runtime parameter. I'd like this value to be stored in the type definition. This is the code that I would like to be able to write:I'd also like this
brand
property’s type to be the brand type ('foo'
in the above example) if a runtime value was provided orundefined
if a value wasn’t provided.As a workaround, I might be able to get away with using the description for my use case but I need the
description
as a description. The brand and the description serve different purposes.Related: #1833
The text was updated successfully, but these errors were encountered: