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

Use a record to bind CombinedError. Prepare for ReScript migration. #230

Merged

Conversation

parkerziegler
Copy link
Contributor

@parkerziegler parkerziegler commented Dec 7, 2020

With ReScript / bs-platform > @8, the syntax for binding JS classes to OCaml classes is no longer supported. In many ways this is a good thing — the old syntax was a bit cumbersome and circuitous. However, we still had our CombinedError binding using that syntax, which was always more trouble than it was worth. By the time we receive CombinedError, it is an instance not the class itself. Therefore, we can treat it (for our purposes) more or less like a JS object. We can bind this with a record in Reason ✅

We also don't need to do any Js.Nullable conversion here from what I can tell. Based on the types of instance properties on CombinedError we would get undefined rather than null in all cases for optional properties. These can be safely compiled using option in Reason. @kitten let me know if that's not the case and I'll add the appropriate Js.Nullable wrapper.

Copy link

@kitten kitten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Niceeee 🙌

@parkerziegler parkerziegler merged commit 0ab2d7a into main Dec 8, 2020
@parkerziegler parkerziegler deleted the fix/prepare-combined-error-binding-for-rescript branch December 9, 2020 05:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants