bun icon indicating copy to clipboard operation
bun copied to clipboard

Re-exporting typescript types generates syntax errors

Open theakman2 opened this issue 2 years ago • 2 comments

What version of Bun is running?

0.5.0

What platform is your computer?

Xubuntu 22.10 x86-64 Linux-5.19.0-29-generic-x86_64-with-glibc2.36

What steps can reproduce the bug?

  1. Create file IFoo.ts:
export interface IFoo {
	bar: number;
}

export class Foo {};
  1. Create file IFooRexport.ts:
export { Foo, IFoo } from "./IFoo";
  1. Create file main.ts:
import { Foo } from "./IFooReexport";

new Foo();
  1. Execute main.ts:
bun main.ts

What is the expected behaviour?

The script executes without any errors.

What do you see instead?

The script returns exit code 1 with the following error:

SyntaxError: Indirectly exported binding name 'IFoo' is not found.

Additional information

Compiling main.ts with tsc doesn't throw any errors.

theakman2 avatar Jan 20 '23 06:01 theakman2

As a temporary workaround, try export type { IFoo }

Jarred-Sumner avatar Jan 20 '23 06:01 Jarred-Sumner

That seems to work, thank you!

theakman2 avatar Jan 20 '23 07:01 theakman2

Duplicate of #5426

Electroid avatar Oct 25 '23 22:10 Electroid