fix: mark type-only re-exports so isolated-module runtimes can load the source - #39
Merged
Merged
Conversation
…he source Bun (and any transpiler running with isolatedModules / verbatimModuleSyntax) strips interface exports per file, so a plain re-export of a type fails at load time with e.g. "export 'Statement' not found in './statement.js'". Found by importing src/index.ts directly under Bun 1.3.
Owner
|
Thanks for the contribution. I enabled isolatedModules in tsconfig also. |
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.
Problem
Importing
src/index.tsdirectly under Bun 1.3 (or any consumer transpiling withisolatedModules/verbatimModuleSyntax) fails at load time:Bun strips interface exports per file, so a plain
export { Statement }of a type has nothing to bind to at runtime.tscwithverbatimModuleSyntaxreports the same lines as TS1205/TS1484.Fix
Mark the affected re-exports as
export type/import type:src/index.ts:AccountBalanceResponse,ClientResponse,StatementResponse,ElectronicStatementOptions,ElectronicStatementResponse,PortfolioResponsesrc/mt940parser.ts:Balance,Statement,TransactionNo behaviour change for the compiled
dist/build.vitest run: 29 files, 165 tests pass.Found while wiring the library into a Bun app to test against a Sparkasse; will report on that separately.