Live data from Hacker News

Ten Years of TypeScript

devblogs.microsoft.com

51–60 of 147 posts

Re: Ten Years of TypeScript

#51

Honest question: why did TypeScript succeed while ActionScript 3.0, another ECMAScript-superset language with typing and OOP (and predates TS by a few years), is all but a distant memory? Is it more than just Adobe being a terrible steward of its tech? With that said, TS is definitely a blessing; I recently had the privilege of migrating to it after having written a hobby project in plain JS, and the difference in us…

> Honest question: why did TypeScript succeed while ActionScript 3.0, another ECMAScript-superset language with typing and OOP (and predates TS by a few years), is all but a distant memory? Is it more than just Adobe being a terrible steward of its tech?

Microsoft and Yahoo voted against ES4 adoption at the ECMA committee, cause Microsoft had, what was it called again? Silverlight, Their flash alternative to promote so they weren't interested in improving Javascript in anyway. Due to Microsoft stupidity, carelessness for standards, the web lost a decade of improvements.

Adding insult to injury in that absurd era, Microsoft had its own AS3 implementation called JScript.net before C# became more popular.

I'm surprised nobody ever wrote a book about this saga, it's completely absurd and petty but there are plenty of stories to tell.

Re: Ten Years of TypeScript

#52
post #37

Honest question: why did TypeScript succeed while ActionScript 3.0, another ECMAScript-superset language with typing and OOP (and predates TS by a few years), is all but a distant memory? Is it more than just Adobe being a terrible steward of its tech? With that said, TS is definitely a blessing; I recently had the privilege of migrating to it after having written a hobby project in plain JS, and the difference in us…

I liked AS3 quite a bit, but it was limited to Adobe products. I don’t think it was ever given a chance to make an impact beyond Flash and Air.

Well no it wasn't limited to Flash, since it was supposed to be ES4. This is why ES4 doesn't exist as a standard, Javascript went from ES3 to ES5.

Re: Ten Years of TypeScript

#53
post #32

I like the idea of typescript. I tried to port a vanilla js browser game to typescript and I found it introduced a lot of complexity to the project. It sucked me into the npm ecosystem and forced me to rewrite every file to use js modules import/export syntax and a bundler like webpack to resolve all the modules business for browsers when none of those were needed before. Of course I could set TS modules to none but…

You can use JSDoc (or a derivative thereof) in plain JS and get hints in the editor. Never used it myself though.

Anyway, ES modules have good browser support these days:

https://caniuse.com/es6-module-dynamic-import

Re: Ten Years of TypeScript

#54
post #36

We need: - exact object type - match expression flow is still better at: - OO - nominal typing for classes, conforming to liskov substitution principles - first class opaque types - first class exact object types - better flow based inference - comment types - no extra dsl, full access to the language, so simple, so powerfull for the times you don't want transpilation phase - [edit] spread types map to spread in runt…

Flow feels almost like the Betamax to Typescript's VHS - Flow is better technically in many ways (in addition to the things you mention, I miss being able to spread the properties of one type into another, rather than having to inherit from an interface), but in practice, in terms of engineering cost, it's so much more expensive that it's hard to justify using it. Flow's team have made it clear [0] that they don't ca…

>I miss being able to spread the properties of one type into another, rather than having to inherit from an interface)

What would that achieve that intersection types don't already?

Re: Ten Years of TypeScript

#55
I was a long time Flow hold-out, switched to TypeScript a year ago and never looked back.

There are a few things I miss, and a few things that Flow did do better; TS is obviously not perfect. But it's a real joy to use.

As for people writing JS in 2022 without any kind of static typing: I fear for you.

Re: Ten Years of TypeScript

#56
post #38

Great post/looking back at the core decisions/bets that worked out really well (from the post): * "Impose no runtime overhead on emitted programs." * "Align with current and future ECMAScript proposals." * "Preserve runtime behavior of all JavaScript code." * "Avoid adding expression-level syntax." * "Use a consistent, fully erasable, structural type system." I also really liked the callout of their approach to "inno…

In most programming languages JS style APIs (i.e. give me anything and I will try to interpret it somehow in an undocumented or poorly documented way) are antipatterns. TS is often bringing sanity to libraries that switch from JS to TS.

I think TS team is doing really great job. I would not call it standing on the shoulders of predecessor, more like trying to build something stable on the swamp. JS definitely does not have a positive influence on TS.

TS is not a great programming language, but it is really great accomplishment considering that it supports and extends JS in a such good way.

Re: Ten Years of TypeScript

#57
post #47

Generally a huge positive. With tools like swc, there's really fast compilation & typechecking now. With --watch, the DX is pretty good but yeah sometes has to be restarted anyways. A couple not so greats: Typescript has added a lot fo confusion & chaos to the ESM transition. A lot of typescript code is in ESM style, byt if you pull the package, it outputs cjs or what not. TypeScript 4.8- very recent- is the first to…

I thought swc still doesn’t do type checking and just strips the type annotations?

Re: Ten Years of TypeScript

#58
I've spent the last two years working with TypeScript solely. Coming from ~20 years with PHP and using Kotlin and Dart for some years as well, I feel that I'm doing something wrong.

I absolutely loathe working with TypeScript. The community is the most fragmented I've ever experienced, the silly amount of package managers, builders... TypeScript just doesn't fit with me.

Re: Ten Years of TypeScript

#59
post #30
post #12

Earlier quoted context omitted.

I don’t understand the benefit of nominal typing when structural typing is available?

The idea is that two types with the same structure aren't always the same thing. This is easily solved by a tagged type in TS [1], though a bit of syntactic sugar over it would be nice. [1]: https://kubyshkin.name/posts/newtype-in-typescript/

In practice I’m very happy with structural types. It provides all the safety I could wish for and slots in well with the underlying language and broader ecosystem.

Though I do miss an easy way to create something like a type Email of string, as it conforms to a set of rules. But that’s a small price to pay.

Post reply on HN