title: How to fix the issue not all the code paths return value?
body: <p>I have an error in the code that I am trying to resolve. I think it needs a <code>return</code> statement but I have that already outside of the <code>forEach</code> loop but it still throws the error:</p>
  
  <pre><code>not all the code path return the value
  </code></pre>
  
  <p>How to fix below code?</p>
  
  <p><code>main.ts</code>:</p>
  
  <pre><code>private ValidateRequestArgs(str) {
    let ret: boolean = true;
    // here on val its throwing tslint error not all code paths return value 
    str.split(',').forEach((val) =&gt; {
      if (!ret) {
        return false;
      }
      if (List.indexOf(val) &gt; -1) {
        ret = true;
      } else {
        ret = false;
      }
    });
    return ret;
  }
  </code></pre>