Skip to content

Commit 0fc7f41

Browse files
Concurrency: Use JSPromise.Result instead of Swift.Result for JSPromise.result
To reduce burden type casting, it's better to remove the wrapper from the API.
1 parent 39c207b commit 0fc7f41

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ public extension JSPromise {
227227
}
228228

229229
/// Wait for the promise to complete, returning its result or exception as a Result.
230-
var result: Swift.Result<JSValue, JSException> {
230+
var result: JSPromise.Result {
231231
get async {
232232
await withUnsafeContinuation { [self] continuation in
233233
self.then(
@@ -236,7 +236,7 @@ public extension JSPromise {
236236
return JSValue.undefined
237237
},
238238
failure: {
239-
continuation.resume(returning: .failure(JSException($0)))
239+
continuation.resume(returning: .failure($0))
240240
return JSValue.undefined
241241
}
242242
)

0 commit comments

Comments
 (0)