3 ms·
This looks similar to detructuring assignment, but it isn't: - no recursive destructuring - `import {y} from 'x'` is not the same as `import x from 'x'; const
by Kinrany 6y ago
This looks similar to detructuring assignment, but it isn't:
- no recursive destructuring
- `import {y} from 'x'` is not the same as `import x from 'x'; const {y} = x`
- deleted 6y ago[deleted]
- fireattack 6y agoThanks for pointing it out, didn't know that. But I think your second point is more to do with the fact `import` by default imports `default` instead of the whole thing. If you use import * as x from 'x'; then `const {y} = x;` works. I personally will consider it is `import from` being different from a typical object instead of {x} here being different from typical destructuring assignment (by that I mean they still follow the same pattern; not necessarily say they're the same thing.)