TheSpyder / rescript-webapi

ReScript bindings to the DOM and other Web APIs
http://tinymce.github.io/rescript-webapi/api/Webapi/
Other
149 stars 36 forks source link

missing HtmlInputElement.t converter #96

Closed mununki closed 2 years ago

mununki commented 2 years ago

Hi,

I have to getElementById of the input element and need to set the value of it. But I can't find the converter function from Dom.Element -> Dom.HtmlInputElement.

let _ = (document |> Document.getElementById("site_cd"))
            ->Option.flatMap(HtmlInputElement.ofElement)
            // Dom.HtmlInputElement.ofElement: Webapi__Dom__Element.t => option<Dom.htmlElement>
            // why not Webapi__Dom__Element.t => option<Dom.htmlInputElement> ??
            ->Option.map(e => e->HtmlInputElement.setValue)
TheSpyder commented 2 years ago

Which version are you using? The type of HtmlInputElement.ofElement has been wrong for a while, but a recent release should have fixed that up.

mununki commented 2 years ago

Oh! my bad. This came from one of my projects which is still using bs-webapi. I've checked the current rescript-webapi resolves this. 👍