-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Closed
Labels
area: typescriptoutdatedA 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 issuepkg: traverse (scope)
Description
💻
- Would you like to work on a fix?
How are you using Babel?
@babel/cli
Input code
import { type Foo } from './foo'
function Foo() {}Configuration file name
babel.config.json
Configuration
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"browsers": ["last 2 versions", "ie 11"]
},
"modules": "auto"
}
],
"@babel/preset-react",
"@babel/preset-typescript"
],
"plugins": ["@babel/plugin-proposal-class-properties"],
}Current and expected behavior
Current behavior
Babel throws an error :
Duplicate declaration "Foo"
1 | import { type Foo } from './foo'
2 |
> 3 | function Foo() {}
| ^^^
4 |
However there is no error if the type Foo is declared in the same file as the function Foo.
Expected behavior
Babel should accept that an imported type and a value can share the same name.
Environment
Babel version: v7.20.5
Node: 16.15.1
Yarn: 1.22.19
OS: Linux 6.0 Arch Linux
Monorepo: yes (yarn workspaces)
Possible solution
No response
Additional context
No response
thinh-kieu
Metadata
Metadata
Assignees
Labels
area: typescriptoutdatedA 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 issuepkg: traverse (scope)