microsoft / microsoft/TypeScript
Support `export { x as default }` in namespace declarations
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
Search Terms
Suggestion
options for allow use import { xxx } from 'yyy'; when TS2497 resolves to a non-module entity
without warn or use // @ts-ignore
Error:(11, 19) TS2305: Module has no exported member 'isGitRoot'.
Error:(11, 36) TS2497: Module resolves to a non-module entity and cannot be imported using this construct.
Use Cases
Examples
demo.ts
import gitRoot, { isGitRoot } from 'git-root2';
declare function gitRoot(cwd?: string): string;
declare namespace gitRoot {
function isGitRoot(target: string): boolean;
function async(cwd?: string): Promise<string>;
}
declare const _default: typeof gitRoot & {
gitRoot(cwd?: string): string;
default(cwd?: string): string;
async(cwd?: string): Promise<string>;
};
export = _default;
Checklist
My suggestion meets these guidelines:
[x] This wouldn't be a breaking change in existing TypeScript / JavaScript code
[x] 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. new expression-level syntax)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the demo.ts import and the declare namespace/export = example in the issue, then investigate the compiler behavior represented by TS2497 and TS2305. Done means the proposed namespace export form supports the shown import without a warning or ts-ignore, with the expected diagnostics covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100