3 ms·
Typescript's main advantage is convenience and familiarity to JS devs. With typescript you just put type hints on your good old javascript and you get to keep u
by nikitaga 5y ago
Typescript's main advantage is convenience and familiarity to JS devs. With typescript you just put type hints on your good old javascript and you get to keep using all your javascript coding patterns.
This comes at a cost of unsafety / unsoundness which is a tradeoff by design. Scala's type system is infinitely more robust. I use Typescript occasionally with all the strictest flags, and yet it allows invalid code that shouldn't compile, all the damn time. Such unreliable type checking is all but worthless to me personally.
Scala is hands down better than Typescript for functional programming. It was actually designed for that from the start. But it's not religious about it either, its OOP features are rich and integrate with FP features very nicely.
Scala.js community and ecosystem is small compared to Typescript, but very diverse and passionate. The mechanism of interfacing with JS is in principle similar to Typescript, but in practice takes a bit more setup.
Also with Scala/Scala.js, you get to a whole other level of productivity when you use the same language on both the client and the server.
- cerved 5y agoI meant in regards to compile times I'm intimately familiar with both languages but thanks for the run down
- nikitaga 5y agoIncremental compilation is pretty fast on Scala.js – it usually takes just a few seconds for me, about half of which is usually webpack bundling. Although if you make a code change that affects many modules of your app, it will take a bit more, but still very reasonable. I haven't had a chance to compare speeds apples-to-apples, but I expect Typescript incremental compilation to be faster than Scala.js. Though, to me this metric has stopped being relevant because using a type safe language I stopped looking at my changes in the browser every minute, like I used to do when I was writing frontends in Javascript. LESS/CSS compilation is the only part where I really care about speed since pixel pushing always needs trial and error, so I set it up to be separate from Scala.js compilation, and it's as fast as it would be in JS world.