rescript-lang.org
rescript-lang.org copied to clipboard
Document ignore function
Hello!
The VSCode plugin/OCaml library doc for ignore:
'a => unit
Discard the value of its argument and return [()]. For instance, [ignore(f x)] discards the result of
the side-effecting function [f]. It is equivalent to [f x; ()], except that the latter may generate a
compiler warning; writing [ignore(f x)] instead avoids the warning.
This use does not seem to be documented for ReScript or in the search results/syntax lookup. I added a setTimeout to my project and got a compiler error (This has type: Js.Global.timeoutId (defined as Js_global.timeoutId) Somewhere wanted: unit) that I cleared by piping to ignore.
Js.Global.setTimeout(() => myFunc, 1000)->ignore
Thank you!