Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Document ignore function #448

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jamessouth opened this issue Sep 25, 2021 · 0 comments
Closed

Document ignore function #448

jamessouth opened this issue Sep 25, 2021 · 0 comments

Comments

@jamessouth
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant