-
-
Notifications
You must be signed in to change notification settings - Fork 57
Closed
Description
Currently, it's possible to define JS object literals in Reason syntax, e.g.
let headers = {"Content-Type": "application/json"};
But translating this snippet to OCaml syntax triggers an error:
let headers = [%mel.obj { Content-Type = "application/json" }]
^
Error Syntax error
One can use mel.raw
to workaround, e.g.
let headers = [%mel.raw {| {"Content-Type": "application/json"} |}]
with the downside that inferred types are lost, and it's not possible to annotate the value with the corresponding < Content-Type : string > Js.t
type.
Having a way to redefine generated JS fields when using %mel.obj
using mel.as
would be very useful.
Metadata
Metadata
Assignees
Labels
No labels