News for hackers. Stuff that matters.
Re:Problems with TypeScript in 2020 by jillesvangurp on Thursday April 16, 2020 @03:01AM (#22886879)
It's a fixable problem. The attraction of Typescript was that all javascript is valid typescript. Great feature in the past years where people were migrating from one to the other. But now that most projects start out on typescript (honestly, if you are not you are doing it wrong) and never write a single line of Javascript, it's becoming an anti feature. The whole point of typescript is that we want to get away from that madness rather than stay close to it.

It already has a strict mode; it's time for an even stricter mode that simply cuts loose from javascript and flat out removes access to all the little compromises with strong typing that exist only because of javascript. It's a compilation target and with WASM emerging, even that is not a long term certainty.

IMHO the difference between e.g. Kotlin and Typescript is becoming smaller and smaller. I do both. There's been a cross over of lots of nice language features from Kotlin and other languages to Typescript. But at this point, Kotlin is a still a lot cleaner/safer than Typescript even though both can transpile to javascript and it also has a bit nicer ergonomics in some areas. E.g. data classes, property and interface delegation, co-coutines, etc. are all things that would be highly useful in Typescript as well. Android developers seem to love these features. And as Kotlin transpiles to javascript, there's no question about whether or not that can be done because it's already been done.

Re:Problems with TypeScript in 2020 by millstone on Thursday April 16, 2020 @04:03AM (#22887180)
"Even stricter mode" means interposing more friction. If JS is reduced to a "compilation target" for a language that models some lowest-common-demoninator browser, and requires hoop-jumping to break out of that model, then browsers are forever unable to evolve.
Re:Problems with TypeScript in 2020 by jillesvangurp on Thursday April 16, 2020 @09:57AM (#22889393)
You're describing the past 20 years. Time to move on from that and stop treating this weird convoluted mess as if it's the only way to do things. JS as a compilation target will probably morph into deprecating it in favor of WASM.

In any case, most frontend projects have been using transpilers for quite some time now to deal with compatibility issues. It's browser JS is increasingly used as a compilation target. The exception is smallish websites where people don't care about older browsers or using new js features not yet shipped to browsers. Those exist, but it's becoming a minority.

For the rest of us, browser JS is something ugly and minified that webpack spits out and that you probably rarely even look at.