-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Closed
Labels
Has PRoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issue
Description
Bug Report
Current Behavior
Transpilation of the code fails with the following error.
TypeError: D:\Git\babel-duplicate-declaration-example\example.ts: Duplicate declaration "foo"
6 | }
7 | export namespace ns2 {
> 8 | export class foo {
| ^
9 | F1: string;
10 | }
11 | }
at File.buildCodeFrameError (D:\Git\babel-duplicate-declaration-example\node_modules\@babel\core\lib\transformation\file\file.js:261:12)
at Scope.checkBlockScopedCollisions (D:\Git\babel-duplicate-declaration-example\node_modules\@babel\traverse\lib\scope\index.js:344:22)
at Scope.registerBinding (D:\Git\babel-duplicate-declaration-example\node_modules\@babel\traverse\lib\scope\index.js:501:16)
at Scope.registerDeclaration (D:\Git\babel-duplicate-declaration-example\node_modules\@babel\traverse\lib\scope\index.js:444:12)
at Object.BlockScoped (D:\Git\babel-duplicate-declaration-example\node_modules\@babel\traverse\lib\scope\index.js:187:28)
at Object.newFn (D:\Git\babel-duplicate-declaration-example\node_modules\@babel\traverse\lib\visitors.js:230:17)
at NodePath._call (D:\Git\babel-duplicate-declaration-example\node_modules\@babel\traverse\lib\path\context.js:53:20)
at NodePath.call (D:\Git\babel-duplicate-declaration-example\node_modules\@babel\traverse\lib\path\context.js:36:14)
at NodePath.visit (D:\Git\babel-duplicate-declaration-example\node_modules\@babel\traverse\lib\path\context.js:88:12)
at TraversalContext.visitQueue (D:\Git\babel-duplicate-declaration-example\node_modules\@babel\traverse\lib\context.js:118:16)
Input Code
https://github.com/ikenik/babel-duplicate-declaration-example
// typescript
module src {
export namespace ns1 {
export class foo {
F1: string;
}
}
export namespace ns2 {
export class foo {
F1: string;
}
}
}Expected behavior/code
A clear and concise description of what you expected to happen (or code).
Babel Configuration (.babelrc, package.json, cli command)
{
presets: ["@babel/preset-typescript"]
}{
"dependencies": {
"@babel/core": "^7.4.5"
},
"devDependencies": {
"@babel/preset-typescript": "^7.3.3"
}
}npm install
npm startEnvironment
- Babel version(s): v7.4.5
- Node/npm version: Tested and confirmed in Node 8/9/10 with npm 5.6.0
- OS: Windows 10
- Monorepo: no
- How you are using Babel:
cli
Additional context/Screenshots
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Has PRoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issue