Skip to content

Merge "export * as" exports  #38041

Closed
Closed
@alshdavid

Description

@alshdavid

Search Terms

Namespacing exports as

Suggestion

Currently to export things under a conceptual "package" namespace in TypeScript developers must add a proxy barrel file

a.ts

export const a = 'foo'

b.ts

export const b = 'bar'

index.barrel.ts

export * from './a'
export * from './b'

index.ts

export * as mypackage from './index.barrel'

It would be great if the `export * as mypackage' statement could merge exports with the same name

Examples

a.ts

export const a = 'foo'

b.ts

export const b = 'bar'

index.ts

export * as mypackage from './a'
export * as mypackage from './b'

Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Out of ScopeThis idea sits outside of the TypeScript language design constraintsSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions