Live data from Hacker News

Ten Years of TypeScript

devblogs.microsoft.com

21–30 of 147 posts

Re: Ten Years of TypeScript

#21

Earlier quoted context omitted.

Typescript by itself is just the language. You could try a different typescript compiler like esbuild for example.

> However, esbuild does not do any type checking so you will still need to run tsc -noEmit in parallel with esbuild to check types.

You're right, I didn't count with that

Re: Ten Years of TypeScript

#22
post #20

This seems like a great time to announce my successor to CoffeeScript: Civet, a language that transpiles to TypeScript. https://github.com/DanielXMoore/Civet

TBH I have 99 problems but the syntax is not one

Re: Ten Years of TypeScript

#24
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 usability between the two is night and day. But I can't help but feel that I've seen this all before years ago in AS3.

Re: Ten Years of TypeScript

#25
post #12

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…

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

You can't use `instanceof` ie. for your error types, actually every time you use class that extends something - it'll not be typed correctly. Basically nothing OO/class/inheritance related is typed correctly. Flow does it correctly.

Re: Ten Years of TypeScript

#26

The number one problem with typescript is how slow it is. Compiling a 14k line project takes 5s. This is absurdly slow.

When you can write a busy beaver machine in the type system, LOC ceases to be a good indicator or how long something should take to typecheck, imo. If you're frustrated with your build, you should use the trace tools on the TS wiki[1] to track down what types are slow to check, so you can attribute the slowness to the appropriate library authors/yourself and decide for yourself if the speed/correctness tradeoff they've made is right for you.

[1]https://github.com/microsoft/TypeScript-wiki/blob/main/Perfo...

Re: Ten Years of TypeScript

#27

Given the number of codebases littered with 'any', and the fact that TS is known to produce app bundles that perform slower than handwritten JS code, I'm in two minds about celebrating those ten years... But it is strange to think it's been ten years.

Do you have examples of slower code generated by typescript? TS is a superset of JS so it changing anything that has a large performance impact seems odd, but maybe I’m missing something here. The types aren’t even available at runtime, what’s the biggest slow down you’ve seen?

https://thenewstack.io/which-programming-languages-use-the-l...

Re: Ten Years of TypeScript

#29

Earlier quoted context omitted.

Ts does produce code, ie. for enums, modules/namespaces.

Const enums get completely erased by the compiler, and modules are a native js feature. Non-const enums and namespaces are probably the only aspects of typescript that actually have any significance at runtime, but they get compiled into simple objects. The compiler output is very close to what you'd write by hand. Take a look at this compiler output here [1]. Unless you're constantly recreating enums and namespaces…

So ts does produce code.

Re: Ten Years of TypeScript

#30
post #12

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…

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/

Post reply on HN