We use cookies and other tracking technologies to improve your browsing experience on our site, analyze site traffic, and understand where our audience is coming from. To find out more, please read our privacy policy.

By choosing 'I Accept', you consent to our use of cookies and other tracking technologies.

We use cookies and other tracking technologies to improve your browsing experience on our site, analyze site traffic, and understand where our audience is coming from. To find out more, please read our privacy policy.

By choosing 'I Accept', you consent to our use of cookies and other tracking technologies. Less

We use cookies and other tracking technologies... More

Login or register
to apply for this job!

Login or register
to publish this job!

Login or register
to save this job!

Login or register
to save interesting jobs!

Login or register
to get access to all your job applications!

Login or register to start contributing with an article!

Login or register
to see more jobs from this company!

Login or register
to boost this post!

Show some love to the author of this blog by giving their post some rocket fuel 🚀.

Login or register to search for your ideal job!

Login or register to start working on this issue!

Login or register
to save articles!

Engineers who find a new job through WorksHub average a 15% increase in salary 🚀

Blog hero image

Scala-TS v0.5.0

Cédric Chantepie 3 February, 2021 | 1 min read

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

Author's avatar
Cédric Chantepie
Cédric Chantepie is IT architect, with varied development experience, obsessed by software quality (CI, testing, ...) and involved in open source projects.
    Scala
    Java
    Haskell
    C
    emacs lisp
    Shell
    common lisp
    OCaml
    Golang
    cqrs
    dsl
    Microservices
    object storage
    REST
    quality assurance
    test driven development
    Typescript
    Akka
    akka streams
    Spark
    cocoa
    jni
    React
    apache cassandra
    MongoDB
    PostgreSQL
    MySQL
    amazon sqs
    Kafka
    Redis
    Google Cloud
    Google Cloud
    AWS
    amazon s3
    SBT
    Maven
    Travis-CI
    circle ci
    jenkins
    unix
    Rust

Related Issues

cosmos / gaia
  • Started
  • 0
  • 4
  • Intermediate
  • Go
cosmos / gaia
  • Started
  • 0
  • 3
  • Intermediate
  • Go
cosmos / ibc
  • Open
  • 0
  • 0
  • Intermediate
  • TeX
cosmos / ibc
cosmos / ibc
  • Started
  • 0
  • 1
  • Intermediate
  • TeX
viebel / klipse-clj
viebel / klipse-clj
  • Started
  • 0
  • 4
  • Intermediate
  • Clojure
viebel / klipse
  • Started
  • 0
  • 1
  • Intermediate
  • Clojure
viebel / klipse
  • 1
  • 2
  • Intermediate
  • Clojure
viebel / klipse
  • Started
  • 0
  • 4
  • Intermediate
  • Clojure
  • $80

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 Stack OverflowStart with Email