Hi, I am new to rescript. I am trying to bind for an external js library, but i have a problem with the dynamic.
This external function accepts an option
argument, which might look like this:
const res = lib.create({ // ...,
onClick: () => {console.log(...)}
})
const res = lib.create({ // ...,
onClick: false
})
const res = lib.create({ // ...,
onClick: {
exit: () => {}
}
})
type options = {
// ...
onClick: | false
| () => unit
| {
pre: option<() => unit>,
on: option<() => unit>,
exit: option<() => unit>
}
}
How to model such an object? I want to get type safety while having better ide code hints.
Thanks!