
Show HN: Scala-ts – Scala to TypeScript compiler - miloszpp
https://github.com/miloszpp/scala-ts
======
sjrd
To dispel misconceptions: from the top of the readme:

"scala-ts is a simple tool which can generate TypeScript interfaces and
classes from Scala case classes."

Not really what I call a compiler. This is more a REST endpoint consumer
generator.

PS: for the reverse exercise, here is a _syntactical_ TypeScript to Scala
translator: [https://github.com/densh/TypeScript/tree/topic/scala-
emitter...](https://github.com/densh/TypeScript/tree/topic/scala-
emitter?files=1)

~~~
pyrophane
Ah, thank you. I was already trying to figure out the why I would need to
compile my Scala down to typescript, presumably so I could then compile that
down to JavaScript

~~~
sjrd
If you want to compile your Scala code to JavaScript, there's already a widely
accepted and stable solution: [https://www.scala-js.org/](https://www.scala-
js.org/)

------
mi100hael
Handy if you're already serializing case classes to be consumed by a
TypeScript frontend, but otherwise I'd suggest looking into Scala.js.

------
joostdevries
I love using Scala on the server and Typescript in the browser. And adjusting
ts type definitions by hand gets tiresome very quickly. So I look forward to
trying this out.

------
wmil
Let me ask the obvious. Can this generate TSX from Scala?

~~~
manojlds
Should have opened the link:

scala-ts is a simple tool which can generate TypeScript interfaces and classes
from Scala case classes

~~~
softawre
That doesn't answer the question. TSX is typescript-JSX (e.g., the typescript-
typed React node-building language inside javascript).

~~~
manojlds
Why not? Anyone asking about JSX should get their answer from that
description.

------
thelarry
Is this any better than scala.js?

~~~
sjrd
No. To be more precise, it does a completely different job. As I said in
another comment, it isn't actually a Scala compiler. Comparing it to Scala.js
is nonsense to begin with.

