rescript-webapi
rescript-webapi copied to clipboard
Improve type safety of MutationObserver.observe
The type of observe is currently an open object:
https://github.com/tinymce/rescript-webapi/blob/18d9d553201d575fa8e194d3370298b556b28747/src/Webapi/Dom/Webapi__Dom__MutationObserver.res#L5
To make this type safe, we can use @obj to create the object using optional arguments:
https://github.com/tinymce/rescript-webapi/blob/5219ef22571c7e79ac221d049c1ad19546270c99/src/Webapi/Webapi__Blob.res#L29-L30
There are 7 observe options to support, and we have a test that includes all of them. https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver/observe https://github.com/tinymce/rescript-webapi/blob/0c84f193a083341febaea9f19be732d22e941d31/tests/Webapi/Dom/Webapi__Dom__MutationObserver__test.res#L9-L16