Hacker News new | ask | show | jobs
by joelg236 1890 days ago
This isn't valid syntax, no
2 comments

This is a regression. This was possible with "require" and destructuring assignment.
I don't know why you are getting downvoted. I agree. The difference is that ES6 imports are meant to be more optimized and also can allow for async/top-level async modules. I believe part of the additions of ES6 modules made it harder to treat the right hand side like a complete object that can be destructured. In summary, it's not the syntax, it's the difference in feature richness between ES6 and CommonJS importing.
Yeah, I'm not saying that import was a mistake or even a good idea done in the wrong way. I use "import" whenever I can in my own code. It could be impossible to import only the particular things one needs, and that trusting tree-shaking is the best we can do. However, it very much seems like a first version to me, and that import statements could be made smart enough to destructure.
Yeah, was afraid it might be bad ES6. But this is Delo, so they can do whatever they want.
No they can't, Deno is JavaScript compliant