microsoft / microsoft/TypeScript

Re-exporting namespace declarations in ES6 ambient declaration

Open
#4,336 10 comments 24 reactions 0 assignees View on GitHub
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:

``` typescript
declare namespace MyLib {

}

declare module 'myLib' {
export = MyLib;
}
```

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

``` typescript
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

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.