@@ -16,7 +16,7 @@ executed.
1616If the actual `Promise` object in JavaScript environment lives longer than this `JSPromise`, it may
1717attempt to call a deallocated `JSClosure`.
1818*/
19- public final class JSPromise < Success, Failure> : JSValueConvertible , JSValueConstructible {
19+ public final class JSPromise < Success, Failure> : ConvertibleToJSValue , ConstructibleFromJSValue {
2020 /// The underlying JavaScript `Promise` object.
2121 public let jsObject : JSObject
2222
@@ -88,7 +88,7 @@ extension JSPromise where Success == (), Failure == Never {
8888 }
8989}
9090
91- extension JSPromise where Failure: JSValueConvertible {
91+ extension JSPromise where Failure: ConvertibleToJSValue {
9292 /** Creates a new `JSPromise` instance from a given `resolver` closure. `resolver` takes
9393 two closure that your code should call to either resolve or reject this `JSPromise` instance.
9494 */
@@ -113,7 +113,7 @@ extension JSPromise where Failure: JSValueConvertible {
113113 }
114114}
115115
116- extension JSPromise where Success: JSValueConvertible , Failure: JSError {
116+ extension JSPromise where Success: ConvertibleToJSValue , Failure: JSError {
117117 /** Creates a new `JSPromise` instance from a given `resolver` closure. `resolver` takes
118118 a closure that your code should call to either resolve or reject this `JSPromise` instance.
119119 */
@@ -138,7 +138,7 @@ extension JSPromise where Success: JSValueConvertible, Failure: JSError {
138138 }
139139}
140140
141- extension JSPromise where Success: JSValueConstructible {
141+ extension JSPromise where Success: ConstructibleFromJSValue {
142142 /** Schedules the `success` closure to be invoked on sucessful completion of `self`.
143143 */
144144 public func then(
@@ -160,7 +160,7 @@ extension JSPromise where Success: JSValueConstructible {
160160 closure invoked on sucessful completion of `self`. The returned promise will have a new
161161 `Success` type equal to the return type of `success`.
162162 */
163- public func then< ResultType: JSValueConvertible > (
163+ public func then< ResultType: ConvertibleToJSValue > (
164164 success: @escaping ( Success ) -> ResultType ,
165165 file: StaticString = #file,
166166 line: Int = #line
@@ -179,7 +179,7 @@ extension JSPromise where Success: JSValueConstructible {
179179 closure invoked on sucessful completion of `self`. The returned promise will have a new type
180180 equal to the return type of `success`.
181181 */
182- public func then< ResultSuccess: JSValueConvertible , ResultFailure: JSValueConstructible > (
182+ public func then< ResultSuccess: ConvertibleToJSValue , ResultFailure: ConstructibleFromJSValue > (
183183 success: @escaping ( Success ) -> JSPromise < ResultSuccess , ResultFailure > ,
184184 file: StaticString = #file,
185185 line: Int = #line
@@ -195,12 +195,12 @@ extension JSPromise where Success: JSValueConstructible {
195195 }
196196}
197197
198- extension JSPromise where Failure: JSValueConstructible {
198+ extension JSPromise where Failure: ConstructibleFromJSValue {
199199 /** Returns a new promise created from chaining the current `self` promise with the `failure`
200200 closure invoked on rejected completion of `self`. The returned promise will have a new `Success`
201201 type equal to the return type of the callback, while the `Failure` type becomes `Never`.
202202 */
203- public func `catch`< ResultSuccess: JSValueConvertible > (
203+ public func `catch`< ResultSuccess: ConvertibleToJSValue > (
204204 failure: @escaping ( Failure ) -> ResultSuccess ,
205205 file: StaticString = #file,
206206 line: Int = #line
@@ -236,7 +236,7 @@ extension JSPromise where Failure: JSValueConstructible {
236236 closure invoked on rejected completion of `self`. The returned promise will have a new type
237237 equal to the return type of `success`.
238238 */
239- public func `catch`< ResultSuccess: JSValueConvertible , ResultFailure: JSValueConstructible > (
239+ public func `catch`< ResultSuccess: ConvertibleToJSValue , ResultFailure: ConstructibleFromJSValue > (
240240 failure: @escaping ( Failure ) -> JSPromise < ResultSuccess , ResultFailure > ,
241241 file: StaticString = #file,
242242 line: Int = #line
0 commit comments