egoist / egoist/tsup

Imported Typescript interface is not being removed from JS output

Open
#765 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
11.3k
Forks
275
PR merge metrics
No merged PRs in 30d

Description

Reproduction: https://github.com/steinybot/bug-reports/tree/tsup/imported-ts-interface

`volume.ts`:
```
export interface DirectoryJSON {
[key: string]: string;
}
```

`index.ts`:
```
import {
DirectoryJSON,
} from './volume.js';

export { DirectoryJSON };
```

Outputs:
`index.js`:
```
import {
DirectoryJSON
} from "./volume.js";
export {
DirectoryJSON
};
```

Which blows up when you try and import it as clearly `volume.js` has no export named `DirectoryJSON`.

Contributor guide

Open the contributing guide

Research direction

Start with the linked reproduction at github.com/steinybot/bug-reports/tree/tsup/imported-ts-interface and compare the generated index.js with the TypeScript interfaces in volume.ts and index.ts. Done means the generated JavaScript no longer imports or exports the type-only DirectoryJSON symbol, and importing the output does not fail because volume.js lacks that export.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.