Add an `unwrap` alias called `nonNullable`?
It's great to see that unwrap now exists! Thanks for adding it,
I had trouble finding unwrap, and the name isn't intuitive to me. I worry I'll have trouble finding it again in the future, since I don't use zod very often.
What do you think of adding an alias for unwrap called nonNullable? It was the first thing that came to mind for me when I was searching for this feature since Typescript has a utility type called NonNullable.
I second this motion
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'm still interested in this.
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.
Bumping this!
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'm still interested.
I'm interested.
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.
For context here, we use unwrap to mean unwrapping in more contexts than just unwrapping a nullable schema, so I think it would be a misnomer for us to alias unwrap to nonNullable in general. Can probably do a better job of documenting this part of the code, but I think there is little chance of this happening at the moment.
I see. What else is it for? I didn't find anything in a quick search.
Since it doesn't make sense as an alias, I think this request could be for a new nonNullable method, instead, that disallows null and undefined, like typescript's NonNullable
Why is there little chance? I'm happy to submit a PR if it's just an issue of getting it done.
Side note, maybe for docs: I noticed that something that's made nullish-able with .nullish() needs to be unwrap()ed twice before you get back the non-optional, non-nullable type, which was kind of confusing.
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.
Don't close
Since it doesn't make sense as an alias, I think this request could be for a new
nonNullablemethod, instead, that disallowsnullandundefined, like typescript'sNonNullable
This looks like a good idea.
I'm happy to submit a PR if it's just an issue of getting it done
Feel free to submit a PR. No guarantees that it will get added, but at least it keeps things moving in the right direction.