Bug Report
Current Behavior
If the Typescript code exports an interfaces that was imported from other module, that interface reference is kept in the Javascript code after transpilation.
Input Code
File A:
export interface ExportedInterface {
value: string
}
File B:
import { ExportedInterface } from './file-a';
export { ExportedInterface }
export function test(): ExportedInterface {
return { value: '1' };
}
Expected behavior/code
The result code should not keep reference of that interface because is a type.
export function test() {
return {
value: '1'
};
}
Babel Configuration (.babelrc, package.json, cli command)
{
presets: [
['@babel/preset-env', { modules: false }],
'@babel/preset-typescript',
],
}
Environment
- Babel version(s): v7.0.0-beta.54
- Node/npm version: Node 10.5.0/npm 6.2.0
- OS: OSX 10.13.5
- Monorepo no
- How you are using Babel: cli (but is the same with loader)
Possible Solution
Looks like the here is a comment in the code that could be related to this issue: https://github.com/babel/babel/blob/master/packages/babel-plugin-transform-typescript/src/index.js#L52
Additional context/Screenshots
The generated code currently is the following one:
File A:
// No error, the file is generated empty
File B:
import { IInterface } from './test-sub';
export { IInterface };
export function test() {
return {
value: '1'
};
}
Bug Report
Current Behavior
If the Typescript code exports an interfaces that was imported from other module, that interface reference is kept in the Javascript code after transpilation.
Input Code
File A:
File B:
Expected behavior/code
The result code should not keep reference of that interface because is a type.
Babel Configuration (.babelrc, package.json, cli command)
Environment
Possible Solution
Looks like the here is a comment in the code that could be related to this issue: https://github.com/babel/babel/blob/master/packages/babel-plugin-transform-typescript/src/index.js#L52
Additional context/Screenshots
The generated code currently is the following one:
File A:
// No error, the file is generated emptyFile B: