Live data from Hacker News

Ten Years of TypeScript

devblogs.microsoft.com

11–20 of 147 posts

Re: Ten Years of TypeScript

#11

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…

You can’t type generators properly a la redux-saga

Re: Ten Years of TypeScript

#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?

Re: Ten Years of TypeScript

#13

Earlier quoted context omitted.

> TS is known to produce app bundles that perform slower than handwritten JS code Wrong. TS doesn’t bundle files. TS doesn’t produce code unless you target an earlier ES version than what you write, in which case there’s no way around it: native for-of loops and await/async will always be faster regardless of what you use to transpile it. I think you’re confusing the tool with something else.

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 inside of a loop (which you'd never do in real life code), I can't imagine there'd be any performance penalty.

[1] https://www.typescriptlang.org/play?target=99#code/HYQwtgpgz...

Re: Ten Years of TypeScript

#16
TypeScript is the best thing to happen to web dev, and it keeps getting better. My only gripe is that sometimes in a codebase that is heavy on inferred types I need to restart the TS server occasionally. Nonetheless, unless there is a specific requirement that TS isn't the right choice for, it's the language I reach to for everything.

Re: Ten Years of TypeScript

#18

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…

Pattern matching is actually being discussed in tc39 for JS as a whole (where TS reps are some of the champions, ofc): https://github.com/tc39/proposal-pattern-matching

The specifics of the proposal will likely shift a bit since it's still stage 1 (2?).

Re: Ten Years of TypeScript

#19

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

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.
Post reply on HN