-
-
Notifications
You must be signed in to change notification settings - Fork 186
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
Feedback on oneof
#546
Comments
Having better typings for The fact to avoid users to explicitly type If you want to I can let you open a PR for that purpose. Otherwise I can handle it in the future. Concerning the idea of forcing at least one parameter at call site, it was originally the case but the constraint has been removed by 1833a4b I'll need to dig a little bit more to understand why. But I believe that it caused issues when combined with other arbitraries or chain: fc.set(fc.uuid(), 1, 10)
.chain(allUuids => fc.record({
oneRecord: fc.oneof(...allUuids),
records: fc.constant(allUuids),
})) Enforcing at least one parameter with typings might break existing code (that is working today) 🙄 |
Agree, technically is a breaking change |
As I'm planning a next major of fast-check (mostly to add a full support for esm), I'll maybe take advantage of it to include your request into it 👍 |
I believe this issue has been resolved, right? I've had no problems w/ needing to specify |
It should not be that far indeed 🙂 But I think we still support the empty case from a typing point of view. If so it should not be that hard to forbid and finally close this old issue. |
woot |
💡 Idea
Currently
oneof
;Repros:
Not sure whether you may be interested (type level tricks are nice when they work, however they could add some maintenance burden) but here's a possible solution:
The text was updated successfully, but these errors were encountered: