title: How to iterate on results inside then() and call other chained then() inside the loop
body: <p>I cannot find any documentation or example in typescript  that illustrates how to nest then() inside a loop which is inside a then().</p>
  
  <p>I have the following chained then() functions that work perfectly.</p>
  
  <p>but i need to make the functions 1 to 3 run n number of times based on an array property of the process object after it has been returned from the _promptUploadDialog </p>
  
  <pre><code>    .then(process =&gt; this._promptUploadDialog(process))            
          .then(process =&gt; this._function1(process))
          .then(process =&gt; this._function2(process))
          .then(process =&gt; this._function3(process))
  </code></pre>
  
  <p>needs to become something like this:</p>
  
  <pre><code> .then(process =&gt; this._promptUploadDialog(process)
       process.array1.forEach(function (value) {
          process.currentobject = value;
          this._function1(process))
              .then(process =&gt; this._function2(process))
              .then(process =&gt; this._function3(process))
       }); 
  )            
  </code></pre>
  
  <p>Tried</p>
  
  <pre><code>return Promise.resolve&lt;UploadDataProcess&gt;({
              uploadResponse: undefined,           
              arrayProp: [1,2,3]
          })
              .then(process =&gt; this._promptUploadDialog(process))
              .then(process =&gt; 
                  process.arrayProp.forEach((value) =&gt; {
                      this._function1(process)
                          .then(process =&gt; this._function2(process))
                          .then(process =&gt; this._function3(process));
                      })
              );
  </code></pre>
  
  <p>But I am getting a compile error: </p>
  
  <blockquote>
    <p>TS2322    Type 'Promise' is not assignable to type 'Promise'.</p>
  </blockquote>