Typescript promise generic type : <p>I've a sample Promise function like below. On success I return a <code>number</code> and on false I return <code>string</code>. The compiler is complaining to specify some kind of generic type to the promise. In this case what type I've to specify? Do I've to specify like <code>Promise&lt;number&gt;</code> or <code>Promise&lt;number | string&gt;</code>?</p>

<pre><code>function test(arg: string): Promise {
    return new Promise((resolve, reject) =&gt; {
        if (arg === "a") {
            resolve(1);
        } else {
            reject("1");
        }
    });
}
</code></pre>
