Reputation: 9248
Many of the import forms in JavaScript and TypeScript have export parallels, to allow for easy re-exporting of values and types. E.g.
export { A, B } from './module'
or
export { default as Name } from './module'
Ohers don't, for reasons that make sense to me. E.g.
export Name from './module'
wouldn't make sense, as we're not specifying which name we want to re-export Name
under.
But why does this not work:
export * as Name from './module'
Isn't it clear that we're exporting all named exports from './module'
under the Name
name? To me it seems obvious that our intention here is to group all the exports from the file into an object which we then export just like another named export, similarly to how this is ok
import * as Name from './module'
because it's clear that we're importing all exports under the Name
name
Upvotes: 1
Views: 285