]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - shared/core-utils/common/promises.ts
Type isPromise
[github/Chocobozzz/PeerTube.git] / shared / core-utils / common / promises.ts
index dc0db9074825594d3298e0c48b376b6dd16acc4d..f17221b97fb61841f7aeeb86c1d2cd4f6b9b4341 100644 (file)
@@ -1,5 +1,5 @@
-function isPromise (value: any) {
-  return value && typeof value.then === 'function'
+function isPromise <T = unknown> (value: T | Promise<T>): value is Promise<T> {
+  return value && typeof (value as Promise<T>).then === 'function'
 }
 
 function isCatchable (value: any) {