rpetrich / babel-plugin-transform-async-to-promises

Transform async/await to somewhat idiomatic JavaScript promise chains
MIT License
246 stars 17 forks source link

`_catch` is undefined in inline mode #90

Open macgyver opened 6 months ago

macgyver commented 6 months ago

hi there, i was noticing that there's a certain situation in which an undefined function will be called - when I run this input in "inlined" mode:


(async function () {
    try {
        await false();
    } catch (e) {}
})();

the output looks like this:

function(){try{const _temp=_catch(function(){return Promise.resolve(false()).then(function(){});},function(){});return Promise.resolve(_temp&&_temp.then?_temp.then(function(){}):void 0);}catch(e){return Promise.reject(e);}}()

it is still referencing the _catch function from the helpers module - is this a bug? i would have expected the inlined version to not use any helpers. Thanks for taking a look! I'd be happy to pay for a bug fix. Just let me know if you're still maintaining this library.