Skip to content

fix: use export type for SwiftRuntimeThreadChannel re-export#742

Open
shivanshu877 wants to merge 1 commit intoswiftwasm:mainfrom
shivanshu877:fix/export-type-swiftruntimethreadchannel
Open

fix: use export type for SwiftRuntimeThreadChannel re-export#742
shivanshu877 wants to merge 1 commit intoswiftwasm:mainfrom
shivanshu877:fix/export-type-swiftruntimethreadchannel

Conversation

@shivanshu877
Copy link
Copy Markdown

Fixes #477

SwiftRuntimeThreadChannel is a TypeScript type alias, not a value. Re-exporting it with the value-style export { ... } causes esbuild and rolldown (which run in isolatedModules mode by default) to fail with:

Cannot re-export a type when 'isolatedModules' is enabled.

This breaks anyone trying to bundle JavaScriptKit with Vite or other esbuild/rolldown-based toolchains.

Changing to export type { SwiftRuntimeThreadChannel } makes the intent explicit and restores compatibility with esbuild/rolldown without affecting tsc or any runtime behaviour — a value-only consumer wouldn't be importing this anyway.

Test plan

  • tsc still compiles cleanly.
  • Type-only consumers still resolve the import.
  • Local verification with esbuild / rolldown is welcome from a maintainer with the toolchain set up.

SwiftRuntimeThreadChannel is a type alias, not a value. Re-exporting
it with `export { ... }` causes esbuild and rolldown (which run in
isolatedModules mode) to fail with "cannot re-export a type using
'export { ... }'" because the bundler cannot tell the export is
type-only at the module boundary.

Changing to `export type { SwiftRuntimeThreadChannel }` makes the
intent explicit and restores compatibility with esbuild/rolldown-based
build tools (Vite, etc.) without affecting tsc or any runtime
behaviour.

Reported in swiftwasm#477
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JavaScript runtime portability

1 participant