-
Notifications
You must be signed in to change notification settings - Fork 428
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
Failed assertion when parsing [%bs.obj] #1222
Comments
Hey @ryb73 I think the types here would be simply this in ocaml: type pathObject = <
dir : string ;
root : string ;
base : string ;
name : string ;
ext : string
> which actually today's syntax in Reason is: type pathObject = {. /* The dot means it's a close object type. You can use 2 dots to mean open object type. */
dir : string,
root : string,
base : string,
name : string,
ext : string
}; What you use let a: pathObject = [%bs.obj {dir: "asd"}]
/* actually we have premium syntax for those JS objects, which is the following */
let a: pathObject = {"dir": "asd"} /* notice the quotes around the key */ I'd recommend using reason-tools to look at what all those become into OCaml if that helps. Or compile to JS to see the output. |
@bsansouci actually it should be possible to use %bs.obj for both types and values (at least in ocaml, it doesn't seem to work for reason when I try either): https://bloomberg.github.io/bucklescript/Manual.html#_create_js_objects_using_bs_obj |
Fixed by #1659. There's a better warning for this now |
I got the following error when running
refmt
with no options:My input file:
I'm using Reason 1.13.0.
The text was updated successfully, but these errors were encountered: