fix: use export type for SwiftRuntimeThreadChannel re-export#742
Open
shivanshu877 wants to merge 1 commit intoswiftwasm:mainfrom
Open
fix: use export type for SwiftRuntimeThreadChannel re-export#742shivanshu877 wants to merge 1 commit intoswiftwasm:mainfrom
export type for SwiftRuntimeThreadChannel re-export#742shivanshu877 wants to merge 1 commit intoswiftwasm:mainfrom
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.