fix: use export type for SwiftRuntimeThreadChannel re-export#742
fix: use export type for SwiftRuntimeThreadChannel re-export#742shivanshu877 wants to merge 1 commit into
export type for SwiftRuntimeThreadChannel re-export#742Conversation
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
|
Local verification (per @krodak's earlier request): Ran on macOS 26 / Apple Swift 6.3.2:
(JavaScriptKit's full test suite needs the SwiftWasm toolchain + carton to execute the WebAssembly-side tests; those require the project's CI runners. The Mac-native subset above is what's directly affected by this PR.) |
Carton is not required, you can test locally with SwiftWasm toolchain, you will find instructions in .md files in repo. you might find those skills useful as well: https://github.com/swiftwasm/Swift-Wasm-Agent-Skill |
Fixes #477
SwiftRuntimeThreadChannelis a TypeScript type alias, not a value. Re-exporting it with the value-styleexport { ... }causes esbuild and rolldown (which run inisolatedModulesmode by default) to fail with: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 affectingtscor any runtime behaviour — a value-only consumer wouldn't be importing this anyway.Test plan
tscstill compiles cleanly.