News for hackers. Stuff that matters.
Re:Angular 2 is terrible by seanwilson on Thursday December 01, 2016 @07:58PM (#13085095)
> Angular is a not a JavaScript framework, but a TypeScript framework. TypeScript likes to pretend it is safe because it is strongly typed. This is somewhat true, but TypeScript suffers from the exact same problem Java does - it is not null safe. Worse, because TypeScript has no runtime component and emits no warnings for many unsafe casts, the language only offers the illusion of safety. For instance, this is perfectly valid TypeScript code that raises no warnings.

TypeScript has compiler flags to give compiler errors when null errors are possible. You can also turn off the implicit "any" type and use linters to stop explicit use of it.

It's a pretty good compromise given it has to work with what's out there already and it's certainly an order of magnitude safer than plain JavaScript.

Re:Angular 2 is terrible by raquo on Friday December 02, 2016 @07:54PM (#13093569)
The problem is, typescript will still silently infer 'any' type in certain cases even with all the no-implicit-any compiler flags enabled, and you'll never know when this happens until you have a bug.

Not to mention that its type system is unsound by design, and not because of null. Typescript only pretends to be safe, so in practice you end up writing a lot of type annotations for very dubious gain.

Stricter options like Facebook Flow or Scala.js are way more useful.

Re:Angular 2 is terrible by rkwz on Saturday December 03, 2016 @12:13PM (#13096455)
> Not to mention that its type system is unsound by design, and not because of null. Typescript only pretends to be safe, so in practice you end up writing a lot of type annotations for very dubious gain. Stricter options like Facebook Flow or Scala.js are way more useful.

Curious, can you explain why Flow is a more "sound" type system than Typescript?

Re:Angular 2 is terrible by throwwatgku on Thursday December 01, 2016 @10:00PM (#13085628)
+1

typescript is to js as c++ is to c. Not a perfect abstraction and still with some problems, but realistically as good as were going to get any time soon.

It's even implemented the same way, a massive preprocessor built to take away most of the pain from something so ubiquitous that it's unfixable.

Re:Angular 2 is terrible by thecolorblue on Friday December 02, 2016 @09:37AM (#13088807)
It seems like it would be easier to write in a language that does have the safety needed and then compiling to javascript. scala.js comes to mind.