2 ms·
There is literally an example for using destructuring in the linked article. So it is supported.
by kuschkufan 3y ago
There is literally an example for using destructuring in the linked article. So it is supported.
- ojintoad 3y agoCan you clarify where it indicates it's supported i.e. which specific example? I re read and didn't see it myself, seems others are missing it. To be fair I don't see it not being supported either by the examples.
- masklinn 3y agoThe last example: { await using { connection } = getConnection(); // Do stuff with connection } // Automatically closed! edit: according to the ES proposal issues, this might be something that doesn't actually exist, on purpose (it's rather ambiguous as to what will be disposed of): https://github.com/tc39/proposal-explicit-resource-management/issues/78#issuecomment-1135152072 https://github.com/tc39/proposal-explicit-resource-managemen...
- ojintoad 3y agoThanks! Yes that example is subtly different. I did also click through to the proposal but didn't see that issue. It does seem like it's still unclear what's intentional or not.
- pwdisswordfishc 3y agoIt’s intentional. The grammar production in the proposal is parametrized as ~Pattern (a parameter introduced in the proposal), which means it does not allow destructuring. https://tc39.es/proposal-explicit-resource-management/#prod-UsingDeclaration https://tc39.es/proposal-explicit-resource-management/#prod-...