DEV Community

Discussion on: Async/await can still surprise you... A LOT!

Collapse
 
frankdspeed profile image
Frank Lemanschik

you should not even show that in this post and it is a anti pattern x10 a so called 10 x anti pattern because it breaks Environment Interop. you should use new Promise((res,rej)=>/* .... */) Because when i want to read your code or search in your code i do not know what is going on. Also you make it hard to Polyfill. I do not like what i see here overall.

For any one if you find such code replace it with nativ Promises or a Promise Polyfill that is known so that your code can get reused by others if you only code for your own use and you or your team are the only people that use that it is ok to do so. As long as you do not get affraid by the diffrent behavior of throw new Error() inside the then able.

Collapse
 
assuncaocharles profile image
Charles Assunção

Dude, it's just a curiosity. Relax and take easy, not suggesting usage in real life application in any moment.

Collapse
 
frankdspeed profile image
Frank Lemanschik

sorry i maintain projects like rollup and when i see such code i get fear that i need to support such stuff and i do not want to do that. But i see i will need to do it anyway