Currently we are using TypeScript for writing the frontend part of a web application which communicates with backend in Scala. The backend part exposes a REST API.
One of the drawbacks of such desing is the need for writing Data Transfer Objects definitions for both backend and frontend and making sure that they match each other (in terms of JSON serialization). In other words, you need to define the types of objects being transferred between backend and frontend in both Scala and TypeScript.
Since this is a rather tedious job, I came up with an idea to write a simple code generation tool that can produce TypeScript class definitions based on Scala case classes.
I’ve put the project on Github. It’s also available via SBT and Maven. Here is the link to the project: https://github.com/miloszpp/scala-ts
Did you like this TypeScript article? I bet you'll also like this free PDF!
🐛 10 TypeScript tips to catch more bugs 🐛