-
I'd like to write something liek This has type:
Dom.eventTarget (defined as Dom.eventTarget_like<Dom._baseClass>)
But this function argument is expecting:
Dom.node_like<'a> (defined as Dom.eventTarget_like<Dom._node<'a>>)
The incompatible parts:
Dom._baseClass vs Dom._node<'a> Is there a way to make this work? I just sprinkled some Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Even in JS, assuming the shape of rescript-webapi/src/Webapi/Dom/Webapi__Dom__EventTarget.res Lines 1595 to 1597 in 18d9d55 Which, in your case, I think translates to |
Beta Was this translation helpful? Give feedback.
Even in JS, assuming the shape of
event.target
can be unsafe. So in that spirit there are built-in unsafe identity functions:rescript-webapi/src/Webapi/Dom/Webapi__Dom__EventTarget.res
Lines 1595 to 1597 in 18d9d55
Which, in your case, I think translates to
event->Event.target->EventTarget.unsafeAsElement
.