MarshallOfSound / MarshallOfSound/ipc

Generated barrel re-exports use `export { Interface }` instead of `export type { Interface }`

Open
#10 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
29
Forks
3
PR merge metrics
No merged PRs in 30d

Description

## Description

The generated barrel files (e.g. `renderer/app.ts`) re-export TypeScript interfaces as value exports instead of type-only exports. This breaks at runtime with esbuild/Vite since single-file transpilers strip types from source modules, making the named re-export unresolvable.

## Generated code (`renderer/app.ts`)

```ts
export * from '../common/app.js';
export { AppService, IAppServiceRenderer } from '../_internal/renderer/app.js';
```

`IAppServiceRenderer` is a TypeScript interface. In `_internal/renderer/app.ts`, it's imported as `import type { IAppServiceRenderer }` — so esbuild strips it during transpilation. The barrel re-export then fails at runtime:

```
Uncaught SyntaxError: The requested module '/_internal/renderer/app.ts'
does not provide an export named 'IAppServiceRenderer'
```

## Expected

Type-only names should use `export type`:

```ts
export { AppService } from '../_internal/renderer/app.js';
export type { IAppServiceRenderer } from '../_internal/renderer/app.js';
```

## Notes

- This is the same class of issue that TypeScript's `isolatedModules` flag warns about — re-exporting a type as a value requires cross-file analysis that single-file transpilers (esbuild, SWC) don't perform.
- Workaround: post-process the generated barrel files to split value and type re-exports.

## Environment

- `@marshallofsound/ipc`: 2.6.2
- Electron 40, Vite 7, TypeScript 6

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the generated renderer/app.ts and compare its exports with the type-only import in _internal/renderer/app.ts, then trace back to the generator that produced the barrel. Verify the generated output with an esbuild or Vite single-file transpilation flow; done means interfaces use type-only re-exports and no runtime named-export error occurs.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.