We're planting a tree for every job application! Click here to learn more

Scala-TS v0.5.0

CĂ©dric Chantepie

3 Feb 2021

•

1 min read

Scala-TS v0.5.0
  • Scala

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](https://docs.scala-lang.org/tour/traits.html# subtyping), 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

Did you like this article?

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.

See other articles by CĂ©dric

Related jobs

Title

The company

title

Remote

Title

The company

title

Remote

Title

The company

title

Remote

Title

The company

title

Remote

Related articles

JavaScript Functional Style Made Simple

JavaScript Functional Style Made Simple

Daniel Boros

•

12 Sep 2021

JavaScript Functional Style Made Simple

JavaScript Functional Style Made Simple

Daniel Boros

•

12 Sep 2021

CareersCompaniesSitemapFunctional WorksBlockchain WorksJavaScript WorksAI WorksGolang WorksJava WorksPython WorksRemote Works
email iconhello@works-hub.comUK flag

Ground Floor, Verse Building, 18 Brunswick Place, London, N1 6DZ

US flag

108 E 16th Street, New York, NY 10003

Subscribe to our newsletter

Join over 111,000 others and get access to exclusive content, job opportunities and more!

© 2021 WorksHub

Privacy PolicyDeveloped by WorksHub