feat(core): add isPromise
generic (#34168)
This commit adds generic to `isPromise` function to help with type inference. PR Close #34168
This commit is contained in:
@ -214,7 +214,7 @@ export function resolveForwardRef(type: any): any {
|
||||
/**
|
||||
* Determine if the argument is shaped like a Promise
|
||||
*/
|
||||
export function isPromise(obj: any): obj is Promise<any> {
|
||||
export function isPromise<T = any>(obj: any): obj is Promise<T> {
|
||||
// allow any Promise/A+ compliant thenable.
|
||||
// It's up to the caller to ensure that obj.then conforms to the spec
|
||||
return !!obj && typeof obj.then === 'function';
|
||||
|
Reference in New Issue
Block a user