File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -142,6 +142,7 @@ export function toGenerator<T>(promise: Promise<T> | QuansyncGenerator<T> | T):
142142/**
143143 * @returns `true` if the current context is async, `false` otherwise.
144144 */
145- export function * getIsAsync ( ) : Generator < typeof GET_IS_ASYNC , boolean , unknown > {
146- return ! ! ( yield GET_IS_ASYNC )
147- }
145+ export const getIsAsync = quansync ( {
146+ async : ( ) => Promise . resolve ( true ) ,
147+ sync : ( ) => false ,
148+ } )
Original file line number Diff line number Diff line change @@ -285,7 +285,7 @@ it('call onYield hook', async () => {
285285
286286it ( 'getIsAsync' , async ( ) => {
287287 const fn = quansync ( function * ( ) {
288- const isAsync : boolean = yield * getIsAsync ( )
288+ const isAsync = ( yield getIsAsync ( ) ) as boolean
289289 return isAsync
290290 } )
291291 await expect ( fn . async ( ) ) . resolves . toBe ( true )
You can’t perform that action at this time.
0 commit comments