Skip to content

Commit fb98e8f

Browse files
dcramerclaude
andcommitted
fix: Use explicit type exports for Bun compatibility
TypeScript interfaces (GitHubRepo, SyncResult, SyncProgress) were being re-exported as values, which fails in Bun since types are erased at runtime. Changed to use `export type` for type-only exports. Also added a guideline to AGENTS.md to prevent this issue in the future. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 064e849 commit fb98e8f

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

AGENTS.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,19 @@ When adding or modifying CLI commands, update:
5454
- `src/cli/help.ts` — Built-in help text
5555
- `docs/src/pages/cli.astro` — CLI reference documentation
5656

57+
## TypeScript Exports
58+
59+
Use `export type` for type-only exports (interfaces, type aliases). Bun requires explicit type exports:
60+
61+
```ts
62+
// Good
63+
export type { GitHubRepo } from "./remote.js";
64+
export { getGitHubRepo } from "./remote.js";
65+
66+
// Bad - fails in Bun
67+
export { GitHubRepo, getGitHubRepo } from "./remote.js";
68+
```
69+
5770
## Testing
5871

5972
When adding new behavior or modifying existing functionality, review `TESTING.md` to determine if tests are needed. Key points:

src/core/github/index.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,15 @@
22
// Internal utilities should be imported directly from their source files
33

44
export { getGitHubToken } from "./token.js";
5+
export type { GitHubRepo } from "./remote.js";
56
export {
6-
GitHubRepo,
77
getGitRemoteUrl,
88
parseGitHubUrl,
99
getGitHubRepo,
1010
parseGitHubIssueRef,
1111
} from "./remote.js";
12-
export {
13-
GitHubSyncService,
14-
SyncResult,
15-
SyncProgress,
16-
getGitHubIssueNumber,
17-
} from "./sync.js";
12+
export type { SyncResult, SyncProgress } from "./sync.js";
13+
export { GitHubSyncService, getGitHubIssueNumber } from "./sync.js";
1814
export {
1915
createGitHubSyncService,
2016
createGitHubSyncServiceOrThrow,

0 commit comments

Comments
 (0)