Skip to content

Commit 44ef457

Browse files
committed
Fix issue in Js.Promise2 where then and catch were returning undefined
master version of PR #5996
1 parent b43f176 commit 44ef457

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ These are only breaking changes for unformatted code.
6161
- Fix issue with overlapping labelled argument with default value https://github.com/rescript-lang/rescript-compiler/pull/5989
6262
- Fix issue with using alias and default value together https://github.com/rescript-lang/rescript-compiler/pull/5989
6363
- GenType: fix issue with V3 compatibility mode (see https://github.com/rescript-lang/rescript-compiler/issues/5990) https://github.com/rescript-lang/rescript-compiler/pull/5991
64+
- Fix issue in `Js.Promise2` where `then` and `catch` were returning `undefined` https://github.com/rescript-lang/rescript-compiler/pull/5997
6465

6566
#### :nail_care: Polish
6667

jscomp/others/js_promise2.res

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ type error
44
/** Type-safe t-first then */
55
let then: (promise<'a>, 'a => promise<'b>) => promise<'b> = %raw(`
66
function(p, cont) {
7-
Promise.resolve(p).then(cont)
7+
return Promise.resolve(p).then(cont)
88
}
99
`)
1010

1111
/** Type-safe t-first catch */
1212
let catch: (promise<'a>, error => promise<'a>) => promise<'a> = %raw(`
1313
function(p, cont) {
14-
Promise.resolve(p).catch(cont)
14+
return Promise.resolve(p).catch(cont)
1515
}
1616
`)
1717

lib/es6/js_promise2.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33

44
var then = (function(p, cont) {
5-
Promise.resolve(p).then(cont)
5+
return Promise.resolve(p).then(cont)
66
});
77

88
var $$catch = (function(p, cont) {
9-
Promise.resolve(p).catch(cont)
9+
return Promise.resolve(p).catch(cont)
1010
});
1111

1212
export {

lib/js/js_promise2.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33

44
var then = (function(p, cont) {
5-
Promise.resolve(p).then(cont)
5+
return Promise.resolve(p).then(cont)
66
});
77

88
var $$catch = (function(p, cont) {
9-
Promise.resolve(p).catch(cont)
9+
return Promise.resolve(p).catch(cont)
1010
});
1111

1212
exports.then = then;

0 commit comments

Comments
 (0)