title: How should I declare the return type of a function that returns a $q promise with no data?
body: <p>I have this function:</p>
  
  <pre><code>getMethod = (): ng.IPromise&lt;any&gt; =&gt; {
      if (1 == 2) {
          return this.$q.when();
      }
      var defer = this.$q.defer();
      this.$http({
          url: '/abc',
          method: "GET"
      })
          .success((): void =&gt; {
              //
              defer.resolve();
          })
          .error((): void =&gt; {
              //
              defer.reject();
          })
      return defer.promise;
  }
  </code></pre>
  
  <p>This works okay and the promises returned do not contain any data.</p>
  
  <p>So I changed the first line to:</p>
  
  <pre><code>getMethod = (): ng.IPromise&lt;void&gt; =&gt; {
  </code></pre>
  
  <p>Now I get an error:</p>
  
  <blockquote>
    <p>Error 3   Cannot convert 'ng.IPromise&lt;{}>' to 'ng.IPromise':
        Types of property 'then' of types 'ng.IPromise&lt;{}>' and 'ng.IPromise' are incompatible:</p>
  </blockquote>
  
  <p>Can someone give me advice on how I should correctly declare the return type. I know using  works but it does not seem a clean solution if the function really always returns void.</p>