News for hackers. Stuff that matters.
Re:Show HN: Scala-ts – Scala to TypeScript compiler by sjrd on Friday December 09, 2016 @07:16PM (#13143065)
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...

Re:Show HN: Scala-ts – Scala to TypeScript compiler by pyrophane on Friday December 09, 2016 @07:57PM (#13143292)
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
Re:Show HN: Scala-ts – Scala to TypeScript compiler by sjrd on Saturday December 10, 2016 @03:11AM (#13144682)
If you want to compile your Scala code to JavaScript, there's already a widely accepted and stable solution: https://www.scala-js.org/
Re:Show HN: Scala-ts – Scala to TypeScript compiler by agentgt on Friday December 09, 2016 @11:32PM (#13144032)
Funny thing is you don't even need a compiler to do what the project is ostensibly doing which is just stub generation aka struct type mapping (i.e. data objects). You can use reflection (you only have to do it once so its not slow). I have done this with Java (use reflection to generate JavaScript stubs).
Re:Show HN: Scala-ts – Scala to TypeScript compiler by clhodapp on Friday December 09, 2016 @11:40PM (#13144060)
Reflection APIs and compiler internals actually tend to be quite similar. In the case of Scala in particular, the reflection API was literally produced by scooping out part of the compiler into a separate library and trying to polish (or hide) the rough edges. The effort wasn't entirely successful in producing an easy-to-use API, but the in-development successor project, scala.meta, is still very compiler-y (just because, again, compiler internals tend to look a lot like reflection APIs).

Further, it is my belief that your project actually was a compiler, whether you thought of it as that or not!

Re:Show HN: Scala-ts – Scala to TypeScript compiler by lmm on Saturday December 10, 2016 @04:57AM (#13144934)
It's a compiler but not a Scala compiler. Rather it's a compiler for a smaller language, whether one thinks of and names that language or not.

(I actually recommend pushing that line of thought all the way through, and using something like thrift (with Scrooge) for this kind of problem. The thrift compiler is a compiler and the thrift IDL is a defined and specified language rather than an ad-hoc subset of Scala)

Re:Show HN: Scala-ts – Scala to TypeScript compiler by mi100hael on Saturday December 10, 2016 @09:12AM (#13145710)
Handy if you're already serializing case classes to be consumed by a TypeScript frontend, but otherwise I'd suggest looking into Scala.js.
Re:Show HN: Scala-ts – Scala to TypeScript compiler by joostdevries on Saturday December 10, 2016 @03:48AM (#13144759)
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.
Re:Show HN: Scala-ts – Scala to TypeScript compiler by wmil on Friday December 09, 2016 @10:46PM (#13143904)
Let me ask the obvious. Can this generate TSX from Scala?
Re:Show HN: Scala-ts – Scala to TypeScript compiler by manojlds on Saturday December 10, 2016 @07:53AM (#13145443)
Should have opened the link:

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

Re:Show HN: Scala-ts – Scala to TypeScript compiler by softawre on Saturday December 10, 2016 @10:52AM (#13146169)
That doesn't answer the question. TSX is typescript-JSX (e.g., the typescript-typed React node-building language inside javascript).
Re:Show HN: Scala-ts – Scala to TypeScript compiler by manojlds on Sunday December 11, 2016 @05:22AM (#13150447)
Why not? Anyone asking about JSX should get their answer from that description.
Re:Show HN: Scala-ts – Scala to TypeScript compiler by thelarry on Saturday December 10, 2016 @11:41AM (#13146434)
Is this any better than scala.js?
Re:Show HN: Scala-ts – Scala to TypeScript compiler by sjrd on Saturday December 10, 2016 @01:40PM (#13147119)
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.