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, 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

See all

Title

The company

  • Remote

Title

The company

  • Remote

Title

The company

  • Remote

Title

The company

  • 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

WorksHub

CareersCompaniesSitemapFunctional WorksBlockchain WorksJavaScript WorksAI WorksGolang WorksJava WorksPython WorksRemote Works
hello@works-hub.com

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

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!

© 2024 WorksHub

Privacy PolicyDeveloped by WorksHub