@@ -84,10 +84,9 @@ public final class JSPromise: JSBridgedClass {
8484 }
8585 #endif
8686
87- #if !hasFeature(Embedded)
8887 /// Schedules the `success` closure to be invoked on successful completion of `self`.
8988 @discardableResult
90- public func then( success: @escaping ( JSValue ) -> ConvertibleToJSValue ) -> JSPromise {
89+ public func then( success: @escaping ( JSValue ) -> some ConvertibleToJSValue ) -> JSPromise {
9190 let closure = JSOneshotClosure {
9291 success ( $0 [ 0 ] ) . jsValue
9392 }
@@ -98,7 +97,7 @@ public final class JSPromise: JSBridgedClass {
9897 /// Schedules the `success` closure to be invoked on successful completion of `self`.
9998 @available ( macOS 10 . 15 , iOS 13 . 0 , watchOS 6 . 0 , tvOS 13 . 0 , * )
10099 @discardableResult
101- public func then( success: sending @escaping ( sending JSValue) async throws -> ConvertibleToJSValue ) -> JSPromise {
100+ public func then( success: sending @escaping ( sending JSValue) async throws -> some ConvertibleToJSValue ) -> JSPromise {
102101 let closure = JSOneshotClosure . async {
103102 try await success ( $0 [ 0 ] ) . jsValue
104103 }
@@ -109,8 +108,8 @@ public final class JSPromise: JSBridgedClass {
109108 /// Schedules the `success` closure to be invoked on successful completion of `self`.
110109 @discardableResult
111110 public func then(
112- success: @escaping ( sending JSValue) -> ConvertibleToJSValue ,
113- failure: @escaping ( sending JSValue) -> ConvertibleToJSValue
111+ success: @escaping ( sending JSValue) -> some ConvertibleToJSValue ,
112+ failure: @escaping ( sending JSValue) -> some ConvertibleToJSValue
114113 ) -> JSPromise {
115114 let successClosure = JSOneshotClosure {
116115 success ( $0 [ 0 ] ) . jsValue
@@ -126,8 +125,8 @@ public final class JSPromise: JSBridgedClass {
126125 @available ( macOS 10 . 15 , iOS 13 . 0 , watchOS 6 . 0 , tvOS 13 . 0 , * )
127126 @discardableResult
128127 public func then(
129- success: sending @escaping ( sending JSValue) async throws -> ConvertibleToJSValue ,
130- failure: sending @escaping ( sending JSValue) async throws -> ConvertibleToJSValue
128+ success: sending @escaping ( sending JSValue) async throws -> some ConvertibleToJSValue ,
129+ failure: sending @escaping ( sending JSValue) async throws -> some ConvertibleToJSValue
131130 ) -> JSPromise {
132131 let successClosure = JSOneshotClosure . async {
133132 try await success ( $0 [ 0 ] ) . jsValue
@@ -141,7 +140,9 @@ public final class JSPromise: JSBridgedClass {
141140
142141 /// Schedules the `failure` closure to be invoked on rejected completion of `self`.
143142 @discardableResult
144- public func `catch`( failure: @escaping ( sending JSValue) -> ConvertibleToJSValue ) -> JSPromise {
143+ public func `catch`( failure: @escaping ( sending JSValue) -> some ConvertibleToJSValue )
144+ -> JSPromise
145+ {
145146 let closure = JSOneshotClosure {
146147 failure ( $0 [ 0 ] ) . jsValue
147148 }
@@ -152,7 +153,7 @@ public final class JSPromise: JSBridgedClass {
152153 /// Schedules the `failure` closure to be invoked on rejected completion of `self`.
153154 @available ( macOS 10 . 15 , iOS 13 . 0 , watchOS 6 . 0 , tvOS 13 . 0 , * )
154155 @discardableResult
155- public func `catch`( failure: sending @escaping ( sending JSValue) async throws -> ConvertibleToJSValue ) -> JSPromise
156+ public func `catch`( failure: sending @escaping ( sending JSValue) async throws -> some ConvertibleToJSValue ) -> JSPromise
156157 {
157158 let closure = JSOneshotClosure . async {
158159 try await failure ( $0 [ 0 ] ) . jsValue
@@ -171,5 +172,4 @@ public final class JSPromise: JSBridgedClass {
171172 }
172173 return . init( unsafelyWrapping: jsObject. finally!( closure) . object!)
173174 }
174- #endif
175175}
0 commit comments