So I want to wrap a function with a promise. I don’t need the reject function, just need the resolve.
However, the JS.Promise.make requires a function that takes two named arguments. If I don’t take the second named argument, it fails to compile, and if I add it and I don’t use it, I get a warning about an unused parameter:
How can I safely ignore that argument? And please don’t suggest me to install a third party dependency just for this only line on the entire project
Please post code samples as text. Images are not accessible.
You can ignore named arguments like this:
make((~resolve, ~reject as _) => ...
That worked perfectly, thanks.
I just wanted to showcase the error hence the screenshot. Sorry about that
That still produces a weird param argument:
rescript:
let confirm = () => {
open Js.Promise
make((~resolve, ~reject as _) =>
output:
function confirm(param) {
return new Promise((function (resolve, param) {
Is it possible to get rid of that param?
As far as I know, no. I think don’t there’s a safe way to get rid of it, anyway.