Skip to content

Commit

Permalink
runtime(Js.Promise): remove @mel.send.pipe in favor of @mel.send (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
anmonteiro authored Jan 21, 2025
1 parent 9c3b8bc commit 9540c8e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions jscomp/runtime/js_promise.ml
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,13 @@ external all6 :

external race : 'a t array -> 'a t = "race" [@@mel.scope "Promise"]

external then_ : (('a -> 'b t)[@mel.uncurry]) -> 'b t = "then"
[@@mel.send.pipe: 'a t]
external then_ : (('a -> 'b t)[@mel.uncurry]) -> ('a t[@mel.this]) -> 'b t
= "then"
[@@mel.send]

external catch : ((error -> 'a t)[@mel.uncurry]) -> 'a t = "catch"
[@@mel.send.pipe: 'a t]
external catch : ((error -> 'a t)[@mel.uncurry]) -> ('a t[@mel.this]) -> 'a t
= "catch"
[@@mel.send]
(* [ p |> catch handler]
Note in JS the returned promise type is actually runtime dependent,
if promise is rejected, it will pick the [handler] otherwise the original promise,
Expand Down

0 comments on commit 9540c8e

Please sign in to comment.