Skip to content

fix: report tstransform compiler exits instead of hanging - #43

Open
obany wants to merge 1 commit into
nextfrom
bugfix/tstransform-compiler-exit
Open

obany wants to merge 1 commit into
nextfrom
bugfix/tstransform-compiler-exit

Conversation

@obany

@obany obany commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

📝 Description

Makes tsTransform reject with a clear error when the native TypeScript compiler process exits unexpectedly, instead of leaving its promise unsettled so the tstransform bin ends with exit code 13 and only the compiler's Go stack trace.

🔄 Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • ⚡ Performance improvement
  • ♻️ Code refactoring
  • 📦 Dependencies update

🛠️ Changes Made

  • Connect the async API client up front and race the compile against the compiler process exiting, rejecting with "The TypeScript compiler exited unexpectedly (code …, signal …)" unless the exit comes from closing the API
  • After a crash, close the client before the API, as API.close otherwise waits forever on the initialize request the dead compiler never answers
  • Move the compile into its own function, and declare the internal client members used in IApiClientInternals
  • Add a test which points the API at node as the compiler, which rejects the compiler arguments and exits straight away

🧪 Testing

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have tested this change manually
  • Testing not required for changes

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.

1 participant