title: TypeScript error with Promise.reject
body: <p>Why do I receive the following compilation error with this TypeScript method which I wrote:</p>
  
  <pre><code>getFile(path: string): Promise&lt;FileEntry&gt; {
    return this.file.resolveLocalFilesystemUrl(path)
      .then(entry =&gt; {
        if (entry.isFile) {
          return &lt;FileEntry&gt;entry;
        } else {
          let err = new FileError(13);         
          err.message = 'input is not a file';
          return Promise.reject(err);
        }
      });
  }
  </code></pre>
  
  <p>I get the error:</p>
  
  <pre><code>Argument of type '(entry: Entry) =&gt; Promise&lt;never&gt; | FileEntry' is not assignable to parameter of type '(value: Entry) =&gt; PromiseLike&lt;never&gt;'. Type 'Promise&lt;never&gt; | FileEntry' is not assignable to type 'PromiseLike&lt;never&gt;'. Type 'FileEntry' is not assignable to type 'PromiseLike&lt;never&gt;'. Property 'then' is  missing in type 'FileEntry'.
  </code></pre>
  
  <p>The definition for <code>resolveLocalFilesystemUrl</code> is as follows:</p>
  
  <pre><code>resolveLocalFilesystemUrl(fileUrl: string): Promise&lt;Entry&gt;;
  </code></pre>
  
  <p><code>FileEntry</code> is a subclass of <code>Entry</code>, hence the casted return. However, the error is around <code>Promise.reject</code>.</p>
  
  <p>If I change my reject line to the following, it works:</p>
  
  <pre><code>return Promise.reject&lt;FileEntry&gt;(err);
  </code></pre>
  
  <p>Do I need to return <code>Promise.reject(...)</code> and what is the correct implementation?</p>