-
Notifications
You must be signed in to change notification settings - Fork 469
Allow function type in untagged variants #6278
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
Comments
Do you have references to example TS code that uses that? |
Thanks, so it looks like a case where one wants to construct values rather than doing pattern matching on. |
That is true. Looks like in this case a bunch of externals with However, I still wonder if it would be a useful addition in other cases. |
This pattern, providing either an object or a function to produce that object, is quite common in TS I'd say. |
| Bool(bool) instead of | @as(false) False
| @as(true) True would be nice, too. (Wasn't there a discussion about that somewhere else? Can't find the issue.) |
This was done at speed: need to double check that there are no corner cases missing. Fixes #6278
Here: #6231 |
* Add support for functions in untagged variants. This was done at speed: need to double check that there are no corner cases missing. Fixes #6278 * test gentype * Add parens as required for TS case with function type. * Update CHANGELOG.md
Just tried to bind the MUI SxProps with untagged variants.
This is the TS definition:
and this is my attempt in ReScript:
which, aside from the fact that it's simplified because the array should not be nested and the booleans should only be nested, does not work, because one cannot use a function (the
Callback
variant in this example) type here.Would it be possible to add that? Since you can check that easily with
typeof == "function"
.The text was updated successfully, but these errors were encountered: