Question about Js.Promise.then_

I’m working on converting an old ReasonML/Bucklescript app to Rescript, and I ran into a bit of a surprising behavior. The app contained a module which provided standard infix aliases for bind and map like so:

let (>>=) = (m, f) => Js.Promise.then_(f, m)
let (>>|) = (m, f) => Js.Promise.then_(x => Js.Promise.resolve(f(x)), m)

However, in the process of removing those aliases, I accidentally discovered that Js.Promise.then_ seems to type-check as both functions. This result was very surprising to me, and I just wanted to check whether this is expected? Thanks!

Can you clarify what you mean by this? I’m not quite getting it. Is there a typo here?

By the look of it, it should typecheck as both. The difference is that in the >>= binding, f (that the consumer should provide) is inferred to be 'a => Promise.t('b), whereas for the map, f is just 'a => 'b (so the helper wraps its result is in a promise for the consumer).

Thanks for the responses. Turns out there was a different issue… the code which we thought were compiling actually wasn’t compiling at all, which lead to us not seeing any build errors. The type system is not broken.