I was wondering if it would be possible to have a transformer that converts
suspend fun foo(): Result<String>
to
fun foo(): Promise<String>
instead of
fun foo(): Promise<Result<String>>
I was thinking something like
fun <T> toAsync(block: suspend () -> Result<T>): Promise<T> {
return coroutineScope.promise { block().getOrThrow() }
}
which technically works as a custom transformer but the return type isn't correct