title: How to change the result type of a Promise< > in TypeScript
body: <p>For some Typescript methods I build, often I need the asynchronicity of a promise but I do not require the promise to return a value (conceptually speaking). A simple example might be calling an initLanguageStrings( ) method to load up language strings used by an application. The language strings are placed into a global structure but the promise is still necessary to ensure the application does not continue until after the language strings are loaded.</p>
  
  <p>Multiple this scenario two or three times and I then tie all of the initialisation work into a set of promises that collectively must all be completed before continuing. I therefore use Promise.all, like so (example):</p>
  
  <pre><code>initialiseApp( ): Promise&lt; void &gt;
  {
      let promises: Promise&lt; any &gt;[ ] = [ ];
  
      promises.push( this.initLanguageStrings( ) );
      promises.push( this.initModelData( ) );
      promises.push( this.initUserInfo( ) );
  
      return Promise.all( promises );
  }
  </code></pre>
  
  <p>The above code won't actually compile (TS1.5/1.6) because Promise.all( ) returns Promise&lt; any[ ] > not Promise&lt; void >.</p>
  
  <p>So what I end up writing is this:</p>
  
  <pre><code>return new Promise( ( resolve, reject ) =&gt; {
     Promise.all( promises )
        .then( ( dummy: any[ ] ) =&gt; {
           resolve( );
        } );         
  } );
  </code></pre>
  
  <p>I believe this is semantically the correct approach, because the "implementation" actually remains hidden, and the "inner promise" (from Promise.all) never "escapes" to the caller of initialiseApp( ).</p>
  
  <p>But on the other hand I find this approach ugly, and would like to find a nicer way to do this, since returning Promise&lt; void > is becoming quite a common pattern for me.</p>
  
  <p>Is there a better way to achieve what I am trying to do?</p>
  
  <p>The compiler will permit:</p>
  
  <pre><code>return Promise.all( promises ).then( ( ) =&gt; { } );
  </code></pre>
  
  <p>But it too strikes me as "tricky" and ugly.</p>