@@ -84,10 +84,9 @@ public final class JSPromise: JSBridgedClass {
84
84
}
85
85
#endif
86
86
87
- #if !hasFeature(Embedded)
88
87
/// Schedules the `success` closure to be invoked on successful completion of `self`.
89
88
@discardableResult
90
- public func then( success: @escaping ( JSValue ) -> ConvertibleToJSValue ) -> JSPromise {
89
+ public func then( success: @escaping ( JSValue ) -> some ConvertibleToJSValue ) -> JSPromise {
91
90
let closure = JSOneshotClosure {
92
91
success ( $0 [ 0 ] ) . jsValue
93
92
}
@@ -98,7 +97,7 @@ public final class JSPromise: JSBridgedClass {
98
97
/// Schedules the `success` closure to be invoked on successful completion of `self`.
99
98
@available ( macOS 10 . 15 , iOS 13 . 0 , watchOS 6 . 0 , tvOS 13 . 0 , * )
100
99
@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 {
102
101
let closure = JSOneshotClosure . async {
103
102
try await success ( $0 [ 0 ] ) . jsValue
104
103
}
@@ -109,8 +108,8 @@ public final class JSPromise: JSBridgedClass {
109
108
/// Schedules the `success` closure to be invoked on successful completion of `self`.
110
109
@discardableResult
111
110
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
114
113
) -> JSPromise {
115
114
let successClosure = JSOneshotClosure {
116
115
success ( $0 [ 0 ] ) . jsValue
@@ -126,8 +125,8 @@ public final class JSPromise: JSBridgedClass {
126
125
@available ( macOS 10 . 15 , iOS 13 . 0 , watchOS 6 . 0 , tvOS 13 . 0 , * )
127
126
@discardableResult
128
127
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
131
130
) -> JSPromise {
132
131
let successClosure = JSOneshotClosure . async {
133
132
try await success ( $0 [ 0 ] ) . jsValue
@@ -141,7 +140,9 @@ public final class JSPromise: JSBridgedClass {
141
140
142
141
/// Schedules the `failure` closure to be invoked on rejected completion of `self`.
143
142
@discardableResult
144
- public func `catch`( failure: @escaping ( sending JSValue) -> ConvertibleToJSValue ) -> JSPromise {
143
+ public func `catch`( failure: @escaping ( sending JSValue) -> some ConvertibleToJSValue )
144
+ -> JSPromise
145
+ {
145
146
let closure = JSOneshotClosure {
146
147
failure ( $0 [ 0 ] ) . jsValue
147
148
}
@@ -152,7 +153,7 @@ public final class JSPromise: JSBridgedClass {
152
153
/// Schedules the `failure` closure to be invoked on rejected completion of `self`.
153
154
@available ( macOS 10 . 15 , iOS 13 . 0 , watchOS 6 . 0 , tvOS 13 . 0 , * )
154
155
@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
156
157
{
157
158
let closure = JSOneshotClosure . async {
158
159
try await failure ( $0 [ 0 ] ) . jsValue
@@ -171,5 +172,4 @@ public final class JSPromise: JSBridgedClass {
171
172
}
172
173
return . init( unsafelyWrapping: jsObject. finally!( closure) . object!)
173
174
}
174
- #endif
175
175
}
0 commit comments