microsoft / microsoft/TypeScript

Re-exporting namespace declarations in ES6 ambient declaration

Open
#4,336 10 comments 24 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

In Discussion Suggestion
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

Right now many declaration files take this form:

declare namespace MyLib {

}

declare module 'myLib' {
  export = MyLib;
}

However, there doesn't seem to be an equivalent for ES6 modules:

declare module 'myLib' {
  export default MyLib; // this works for exporting the default, but other exported items in MyLib are not considered to be named exports of the ES6 module
  export * from MyLib; // this is essentially what I'm trying to accomplish
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files or tests. Start with TypeScript's handling of ambient namespace declarations and ES6 module exports, then determine the intended re-export semantics for MyLib. Done means the namespace members are recognized as named exports of the declared ES6 module, with the behavior verified by suitable compiler tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.