Closed
Description
Expected Behaviour
For a project like this:
// bar.ts
export {IFoo, FOO} from "./foo";
export type IBar = {};
// foo.ts
export type IFoo = {};
export const FOO = 1;
// index.ts
import {FOO, IFoo, IBar} from "./bar";
declare function foo(i: number): IFoo;
declare function bar(): IBar;
foo(FOO);
bar();
Regardless of whether transpileOnly
is enabled, the output for bar.ts should be (assuming module=ESNEXT):
export var FOO = 1;
Actual Behaviour
The actual output is:
export { IFoo } from "./foo";
export var FOO = 1;
which causes webpack to complain:
WARNING in ./src/bar.ts
1:0-34 "export 'IFoo' was not found in './foo'
@ ./src/bar.ts
@ ./src/index.ts
When transpileOnly
is off, the module is correctly emitted. This may very well be a compiler bug, but I'm not sure how to use tsc
to reproduce this.
Steps to Reproduce the Problem
git clone https://github.com/univerio/ts-loader-type-export-issue
cd ts-loader-type-export-issue
yarn
./node_modules/webpack-cli/bin/webpack.js