Browse Source

Type isPromise

Chocobozzz 1 year ago
parent
commit
841cb20243
1 changed files with 2 additions and 2 deletions
  1. 2 2
      shared/core-utils/common/promises.ts

+ 2 - 2
shared/core-utils/common/promises.ts

@@ -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) {