Aaah I see – I tried using computed property names while destructuring before, but it never worked because I tried it without assigning to an alias. (so just const { [foo] } = bar; – makes sense that this doesn't work now that I think about it)
Very nice to know that it works when using an alias, thanks!
16
u/erfling Apr 28 '19
These are pretty cool.
I was unaware of the aliasing feature for destructured objects. As a TS user, it's confusing. I wish you could us "as"