Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Show HN: Transpile Scala to TypeScript
1 point by halfmatthalfcat on April 27, 2020 | hide | past | favorite
Hey HN! I created a Scala compiler plugin that takes Scala case classes and traits, transpiles them into Typescript, and emits it as a build artifact.

There's a couple of SBT plugins that try to accomplish this but due to binary incompatibilities, can't work on Scala codebases that aren't on either Scala 2.10 (SBT 0.x) or Scala 2.12 (SBT 1.x). Using a Scala compiler plugin, it operates at the compiler level (as it's own Phase) so there's guaranteed to be no binary compatibility issues.

I ran into this as I'm working on a Scala 2.13 project and couldn't get any of the current solutions to work (due to a myriad of reasons).

Why do I need to transpile my Scala into Typescript? I have a Typescript frontend and don't want to manually curate my TS definitions coming from the backend. With Scala2TS, I can simply compile my Scala app and have the TS interfaces ready to be published to my NPM registry, then consumed by my frontend app.

Thanks for checking this out!

https://github.com/scala2ts



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: