Skip to content

Disambiguate type-only exports for isolated transpilers - #1185

Open
sogav21 wants to merge 1 commit into
ecomfe:masterfrom
sogav21:fix/1094-type-only-exports
Open

sogav21 wants to merge 1 commit into
ecomfe:masterfrom
sogav21:fix/1094-type-only-exports

Conversation

@sogav21

@sogav21 sogav21 commented Nov 17, 2026

Copy link
Copy Markdown

SWC compiles TypeScript one file at a time. The public export barrel currently mixes value exports with type-only exports, which makes SWC emit a runtime re-export for PointLike. Node then rejects the barrel because PointLike is an interface.

Use explicit export type declarations for the type-only exports and enable TypeScript's isolatedModules check to catch future instances. The published declaration API and the existing runtime bindings are preserved.

Fixes #1094.

Verification

  • npm run checktype -- --pretty false and npm run lint
  • npm test -- --runInBand passed all 68 tests
  • npm run build:lib and npm run release
  • SWC 1.16.22 ESM output loads in Node 22.23.1 after the change. The same test previously failed to resolve PointLike.
  • Compared all 115 package declaration exports and all 119 emitted library JavaScript files with the base revision.

AI assistance was used in preparing this change and running the checks.

This branch has not been deployed

No deployments
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.

使用 swc 编译报 type 类型错误

1 participant