How to retrieve value from Js.t object?


#1

I am using mostjs library and I am new to bucklescript, when a map function returns me

Js.t(< time : int; value : Dom.event >)
in a stamp from

let startLoop = Most.(
  timestamp(start)
  |> map((stamp) => {
    // what to do here?
  })
)

Is there anything I can do to use this object values or convert it? There is absolutely nothing in the docs about this scenario.


#2

If the type is not marked as bs.abstract, then you can retrieve the values by writing stamp##time and / or stamp##value. The docs list it under Object2 nowadays as it’s encouraged to use the abstract way of binding to the object.