title: Conditionally chaining promises not working
body: <p>I'm using React with Typescript and have this function:</p>
  
  <pre><code>const saveData = (): Promise&lt;any&gt; =&gt; {
          const promise = new Promise((s:any,f:any) =&gt; s(true))
  
          if (true) {
              promise.then(() =&gt; 5)
          }
  
          return promise
  }
  </code></pre>
  
  <p>I then pass it as a handler prop to some component:</p>
  
  <pre><code>&lt;Component save={() =&gt; {saveData().then(a =&gt; console.log)}}
  </code></pre>
  
  <p>This always logs <code>true</code> when it should log <code>5</code> instead, why? how do I effectively chain these promises. what I'm I doing wrong here?</p>
  
  <p>This is a codesandbox.io example:</p>
  
  <p><a href="https://codesandbox.io/embed/practical-montalcini-5njyg" rel="nofollow noreferrer">https://codesandbox.io/embed/practical-montalcini-5njyg</a></p>