Closed semmel closed 3 years ago
Do you have an idea why this resulted to invalid code?
Do you have an idea why this resulted to invalid code?
Targeting ES5 TS generates for the PromiseCtr a function expression, while targeting ES6 an arrow function expression. Apparently these differ in how the can employed as class constructors using new
.
var sCons = function(x) { return new String(x);};
new sCons("d"); // OK
var sConsF = x => new String(x);
new sConsF("d") // Uncaught TypeError: sConsF is not a constructor
Maybe in TS new sConsF()
is fine but in ES6 it is not.
My take from this is that the TS compiler does a great job compiling to ES5, but with ES6 and later I am skeptical.
I see, thanks!
I wish we have some automatic test to catch this kinda errors.
Oh, now we have!
Fix included in 3.0.16. Thanks!
Btw the test here allows us to easily add more smoke tests for the ES6 module.
Thanks! Works great. Awesome update speed 🚤
Btw the test here allows us to easily add more smoke tests for the ES6 module.
Yes, should've used that. Next time 🤞🏻
This fixes the ES6 implementation of
.firstToPromise()
indist/Bacon.mjs
. E.g. in Node.js 12 with the latest (v3.0.15) version of Bacon: