The generic Promise type must match the return function type without error. The error is implicitly of type any and is not specified in the generic type of Promise.
So for example:
function test(arg: string): Promise<number> { return new Promise<number>((resolve, reject) => { if (arg === "a") { resolve(1); } else { reject("1"); } }); }
Dave templin
source share