title: How to type the callback of a promise in typescript?
body: <p>I can type the callback for .then in my promise, currently I am temporary using <code>any</code> bit I would like to use <code>string</code> or similar.</p>
  
  <p>Any idea how to type my function md5?</p>
  
  <pre><code>export const md5 = (path: string) =&gt;
    new Promise((resolve, reject) =&gt; {
      const hash = createHash("sha1");
      const rs = createReadStream(path);
      rs.on("error", reject);
      rs.on("data", chunk =&gt; hash.update(chunk));
      rs.on("end", () =&gt; resolve(hash.digest("hex")));
    });
  
  
    it("should hash md5 a file", () =&gt; {
      // error here on hash:string, if I use instead any it works
      const m = md5(fileName).then((hash: string) =&gt; {
        assert.strictEqual(m, "4738e449ab0ae7c25505aab6e88750da");
      });
  </code></pre>
  
  <p>Error I receive:</p>
  
  <pre><code>Argument of type '(hash: string) =&gt; void' is not assignable to parameter of type '(value: {}) =&gt; void | PromiseLike&lt;void&gt;'.
    Types of parameters 'hash' and 'value' are incompatible.
      Type '{}' is not assignable to type 'string'.
    });
  </code></pre>