Skip to content

Commit

Permalink
chore(cli): More robust isAwaitable (#9806)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobbe authored Jan 6, 2024
1 parent 8466e75 commit 6fbc5b8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tasks/test-project/typing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,10 @@ export interface TuiTaskDef {
}

export function isAwaitable(promise: unknown): promise is Promise<unknown> {
return typeof promise !== 'undefined' && 'then' in promise
return (
!!promise &&
typeof promise === 'object' &&
'then' in promise &&
typeof promise.then === 'function'
)
}

0 comments on commit 6fbc5b8

Please sign in to comment.