News for hackers. Stuff that matters.
Re:TypeScript: Control flow analysis for destructured discri... by pjmlp on Thursday November 04, 2021 @03:17AM (#29104274)
Because Typescript only exists on the compiler, while the browser only undestands JavaScript, it is the usual problem of guest languages, the platform leaks.
Re:TypeScript: Control flow analysis for destructured discri... by capableweb on Thursday November 04, 2021 @06:09AM (#29105251)
Well, you could, if people really wanted to, have some sort of runtime type safety, but doesn't seem like that's what people want for various reasons, one thing could be the possible performance impact. Instead, TypeScript only offers type safety at development time.

It seems matsemann fundamentally missed the idea of TypeScript, as it's very clear it only offers compile-time checks and nothing for the runtime.

Re:TypeScript: Control flow analysis for destructured discri... by pjmlp on Thursday November 04, 2021 @06:42AM (#29105438)
Ideally one day TypeScript would take JavaScript's place, but no browser vendor seems keen on the idea.

On the other hand, TypeScript success in adoption is based on following another proven attempts, C++ and Objective-C.

With such approaches, the warts of the copy-paste compatibility with the underlying platform are both a sin and a curse.

Re:TypeScript: Control flow analysis for destructured discri... by capableweb on Thursday November 04, 2021 @07:53AM (#29105953)
> Ideally one day TypeScript would take JavaScript's place, but no browser vendor seems keen on the idea.

Oh god I hope not. JavaScript is hopefully here to stay, and will remain the runtime of the web together with WASM.

TypeScript is a neat idea for enterprise companies where engineering standards tend to not be that great, but that doesn't mean we should lower the possibilities of the current runtime to the lowest common denominator.

Re:TypeScript: Control flow analysis for destructured discri... by pjmlp on Thursday November 04, 2021 @11:10AM (#29108159)
It would still be possible to write JavaScript like code, that is Typescript selling point vs CoffeeScript and Dart, so I don't see a problem with it.
Re:TypeScript: Control flow analysis for destructured discri... by matsemann on Thursday November 04, 2021 @07:12AM (#29105626)
My point is that I can change what I pass in in my code, and the compile time check doesn't catch it. I haven't "fundamentally missed" anything, it's you misreading my post, thanks.