Antoine
Antoine

Reputation: 1812

How to create an optdef_prop with ppx syntax in js_of_ocaml?

How can I create an object property of type Js.optdef_prop with the PPX syntax in js_of_ocaml?

I tried something like follow but with no success:

type t = <foo: Js.js_string Js.t Js.optdef_prop> Js.t
...
(object%js
  val foo = Js.Optdef (Js.string "bar")
end :> t)

The documentation only talks about Js.readonly_prop and Js.prop.

Upvotes: 0

Views: 66

Answers (1)

Drup
Drup

Reputation: 3739

I don't remember implementing, and I doubt it was added later.

IIRC, One of the reason was that there was no easy syntax to use, but I could have just used an attribute. Another was that it didn't seem that useful at the time, but I guess I was wrong. :)

Please make a feature request on the bug tracker.

Upvotes: 0

Related Questions