Skip to content
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

S.optional accepts undefined but does not make the property optional on the Inferred type #87

Open
justin0mcateer opened this issue Aug 20, 2024 · 2 comments
Labels
enhancement New feature or request v10 Features planned for the v10 version

Comments

@justin0mcateer
Copy link

Based on my experience with complex types and other libraries, I would prefer to maintain my type definitions separate from the Rescript Schema schema definitions. However, I obviously need to make sure that the types and schemas are in sync, so I setup type assertions using a utility type that will throw type errors if the types are not equivalent.

However, because S.optional indicates the property can accept 'undefined' values, but does not actually indicate the property itself is optional, these assertions fail in those cases.

I am not entirely sure if this can be solved, but I thought it was worth bringing up.

@DZakh
Copy link
Owner

DZakh commented Aug 21, 2024

Hmm, I need to double check how it works for zod

@DZakh
Copy link
Owner

DZakh commented Oct 11, 2024

Related to #92

@DZakh DZakh added enhancement New feature or request v10 Features planned for the v10 version v9 Features planned for the v9 version labels Oct 11, 2024
@DZakh DZakh removed the v9 Features planned for the v9 version label Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request v10 Features planned for the v10 version
Projects
None yet
Development

No branches or pull requests

2 participants