Skip to content

Commit

Permalink
$mol_wire_sync, $mol_wire_async new types restore
Browse files Browse the repository at this point in the history
  • Loading branch information
zerkalica committed Oct 3, 2023
1 parent 91f1088 commit 1495e24
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 27 deletions.
15 changes: 1 addition & 14 deletions wire/async/async.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,7 @@ namespace $ {
return fiber.async()
},

} ) as any as (
Host extends ( ... args: infer Args )=> infer Res
? Res extends Promise<any>
? Host
: ( ... args: Args )=> Promise< Res >
: {}
) & {
[ key in keyof Host ]: Host[ key ] extends ( ... args: infer Args )=> infer Res
? Res extends Promise<any>
? Host[ key ]
: ( ... args: Args )=> Promise< Res >
: Host[ key ]
}
// as ObjectOrFunctionResultPromisify<Host>
} ) as unknown as ObjectOrFunctionResultPromisify<Host>

}

Expand Down
14 changes: 1 addition & 13 deletions wire/sync/sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,7 @@ namespace $ {
return fiber.sync()
},

} ) as any as (
Host extends ( ... args: infer Args )=> infer Res
? Res extends Promise< infer Res2 >
? ( ... args: Args )=> Res2
: Host
: {}
) & {
[ key in keyof Host ]: Host[ key ] extends ( ... args: infer Args )=> Promise< infer Res >
? ( ... args: Args )=> Res
: Host[ key ]
}

//as ObjectOrFunctionResultAwaited<Host>
} ) as unknown as ObjectOrFunctionResultAwaited<Host>
}

type FunctionResultAwaited<Some> = Some extends (...args: infer Args) => infer Res
Expand Down

0 comments on commit 1495e24

Please sign in to comment.