-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Closed
Labels
area: typescripthelp wantedoutdatedA 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
- I would like to work on a fix!
import RenamedModule = OriginalModule is native Typescript's feature for creating module alias but @babel/preset-typescript does not allow this syntax.
Current behavior
@babel/preset-typescript gives an error.
Error: `import =` is not supported by @babel/plugin-transform-typescript
Please consider using `import <moduleName> from '<moduleName>';` alongside Typescript's --allowSyntheticDefaultImports option.
Input Code
declare module LongNameModule {
export type SomeType = number;
}
import AliasModule = LongNameModule;
const some: AliasModule.SomeType = 3;
console.log(some);Expected behavior
It outputs: 3.
Using tsc and ts-node, it is compiled as expected.
Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command, .eslintrc)
- Filename:
babel.config.js
{
presets: [
[
'@babel/env',
{
modules: false,
targets: {
esmodules: true,
},
},
],
[
'@babel/typescript',
{
allowDeclareFields: true,
},
],
],
};Environment
- Babel version: v7.12.3
- Node/npm version: Node 14/yarn 1.22.10
- OS: alpine linux (in docker)
- Monorepo: no
- How you are using Babel: cli
Possible Solution
I have no idea.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area: typescripthelp wantedoutdatedA 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