Type isPromise
This commit is contained in:
parent
8ca52bcc2c
commit
841cb20243
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue