Skip to content

Fix issue in Js.Promise2 where then and catch were returning `u… #5997

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ These are only breaking changes for unformatted code.
- Fix issue with overlapping labelled argument with default value https://github.com/rescript-lang/rescript-compiler/pull/5989
- Fix issue with using alias and default value together https://github.com/rescript-lang/rescript-compiler/pull/5989
- 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
- Fix issue in `Js.Promise2` where `then` and `catch` were returning `undefined` https://github.com/rescript-lang/rescript-compiler/pull/5997

#### :nail_care: Polish

Expand Down
4 changes: 2 additions & 2 deletions jscomp/others/js_promise2.res
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ type error
/** Type-safe t-first then */
let then: (promise<'a>, 'a => promise<'b>) => promise<'b> = %raw(`
function(p, cont) {
Promise.resolve(p).then(cont)
return Promise.resolve(p).then(cont)
}
`)

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

Expand Down
4 changes: 2 additions & 2 deletions lib/es6/js_promise2.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@


var then = (function(p, cont) {
Promise.resolve(p).then(cont)
return Promise.resolve(p).then(cont)
});

var $$catch = (function(p, cont) {
Promise.resolve(p).catch(cont)
return Promise.resolve(p).catch(cont)
});

export {
Expand Down
4 changes: 2 additions & 2 deletions lib/js/js_promise2.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@


var then = (function(p, cont) {
Promise.resolve(p).then(cont)
return Promise.resolve(p).then(cont)
});

var $$catch = (function(p, cont) {
Promise.resolve(p).catch(cont)
return Promise.resolve(p).catch(cont)
});

exports.then = then;
Expand Down