title: 'void' return type not checked in TypeScript – prevent floating promises?
body: <p>Running in TypeScript 3.9.7, this does not concern the compiler:</p>
  <pre><code>const someFn: () =&gt; void = () =&gt; 123;
  </code></pre>
  <p>I discovered <a href="https://stackoverflow.com/a/12763878/2072165">this answer</a>, which explains that this is by design. I somewhat get the reasoning behind it (basically, you should be able to ignore the return type when passing the function as an argument).</p>
  <p>But the story becomes a different one looking at promises:</p>
  <pre><code>const someFn: () =&gt; void = () =&gt;
    new Promise((resolve, reject) =&gt; reject(Error('onoez')));
  someFn();
  </code></pre>
  <p>I am checking my code with <code>eslint</code>s <code>@typescript-eslint/no-floating-promises</code> rule to avoid unhandled promise rejections. In the script above, since the linter thinks <code>someFn</code> does not return anything, it will not warn me.</p>
  <p>Is this something I have to live with? If a function accepts a <code>() =&gt; void</code> type callback, and I pass it an async function, the compiler will not warn me and bad things will start to happen. Can I somehow avoid this?</p>