title: RxJs Array of Observable to Observable of Array
body: <p>For a Web-Application written with Angular2 in TypeScript, I need to work with RxJs <code>Observable</code>s.<br />
  As I never used rxjs before and I am new to reactiveprogramming in general, I sometimes have some difficulties finding the right way to do some specific things.<br />
  I am now facing a problem. where I have to convert an <code>Array&lt;Observable&lt;T&gt;&gt;</code> into an <code>Observable&lt;Array&lt;T&gt;&gt;</code>.<br />
  I'll try to explain it with an example:</p>
  <ul>
  <li>I have an <code>Observable</code>, which gives me a list of <code>Users</code> (<code>Observable&lt;Array&lt;User&gt;&gt;</code>)</li>
  <li>The <code>User</code>-class has a function <code>getPosts</code> returning an <code>Observable&lt;Array&lt;Post&gt;&gt;</code>.</li>
  <li>I need to map the <code>Observable&lt;Array&lt;User&gt;&gt;</code> to an <code>Observable&lt;Array&lt;Post&gt;&gt;</code> to evaluate all the <code>Post</code>s inside the <code>onNext</code> function.</li>
  </ul>
  <p>I can easily map from <code>Observable&lt;Array&lt;User&gt;&gt;</code> to <code>Observable&lt;Array&lt;Observable&lt;Array&lt;Post&gt;&gt;&gt;&gt;</code> using<br />
  <code>map((result : Array&lt;User&gt;) =&gt; result.map((user : User) =&gt; user.getPosts()))</code><br />
  and I can flatten an <code>Array&lt;Array&lt;Post&gt;&gt;</code> into an <code>Array&lt;Post&gt;</code>.<br />
  However I just can't find the correct way to map the <code>Observable&lt;Array&lt;Observable&lt;Array&lt;Post&gt;&gt;&gt;&gt;</code> into an <code>Observable&lt;Array&lt;Array&lt;Post&gt;&gt;&gt;</code><br />
  Until now i used the <code>combineLatest</code> function together with <code>flatMap</code>.<br />
  To me it seemed to work and the editor i used (Atom editor) did not show any error. However now I use Netbeans, which shows me an error in this code. Also compiling the code using &quot;tsc&quot; results in the following errors:</p>
  <pre><code>Argument of type '(result: Post[]) =&gt; void' is not assignable to parameter of type 'NextObserver&lt;[Observable&lt;Post&gt;]&gt; | ErrorObserver&lt;[Observable&lt;Post&gt;]&gt; | CompletionObserver&lt;[...'.
  Type '(result: Post[]) =&gt; void' is not assignable to type '(value: [Observable&lt;Post&gt;]) =&gt; void'.  
  </code></pre>
  <p>So my question is:<br />
  How can I &quot;flatten&quot; an <code>Array</code> of <code>Observables</code> into an <code>Array</code>?</p>