When making a promise in Rescript:
let myPromise = Js.Promise.make((~resolve, ~reject) => resolve(. 2))
The ReScript compiler will give a warning on unused variable reject.
Is there a way to suppress this error?
You can bind a parameter to a new name using as
, i.e. ~reject as newName
, and as with any binding/pattern you can use the wildcard pattern, _
, to tell the compiler that you're intentionally ignoring it.
So put together it'd be:
let myPromise = Js.Promise.make((~resolve, ~reject as _) => resolve(. 2))