The guard should use PromiseLike<T>, not Promise<T>.
If a thenable can be considered a Promise/A+ promise ("if it looks like a duck, it is a duck"), it certainly does not means it's also a ES Promise (which also has catch and finally).
Therefore the PromiseLike in TypeScript.
The guard should use
PromiseLike<T>
, notPromise<T>
.If a thenable can be considered a Promise/A+ promise ("if it looks like a duck, it is a duck"), it certainly does not means it's also a ES Promise (which also has
catch
andfinally
). Therefore thePromiseLike
in TypeScript.