Scala-TS v0.5.0
Scala-TS is a simple tool which generates TypeScript types from Scala types.
For example, with a Scala case class as below,
case class Incident(id: String, message: String)
It generates the appropriate TypeScript:
export interface Incident {
id: string;
message: string;
}
const incident: Incident = {
id: 'id',
message: 'A message'
}
Scala-TS now supports a lot a type kinds: generic class, Value class, sealed trait, enumeration, union type.
See more examples
It's useful to share model between Scala and TypeScript (e.g.across REST API).
This new major release 0.5.0 provide easy to use, but yet highly configurable & extensible compiler and SBT plugins to generate TypeScript types from Scala compiled one.
It can be configured by adding to project/plugins.sbt
:
addSbtPlugin("io.github.scala-ts" % "sbt-scala-ts" % "0.5.0")
Then the plugin can be enabled per project:
// Not enabled by default
enablePlugins(TypeScriptGeneratorPlugin)
The TypeScript files are generated at compile-time.
sbt compile
See documentation
Originally published on scala-ts.github.io
Related Jobs
Related Articles
Related Issues
- Open
- 0
- 0
- Intermediate
- Open
- 0
- 0
- Intermediate
- Started
- 0
- 28
- Intermediate
- Submitted
- 1
- 0
- Intermediate
Get hired!
Sign up now and apply for roles at companies that interest you.
Engineers who find a new job through WorksHub average a 15% increase in salary.
Start with GitHubStart with TwitterStart with Stack OverflowStart with Email