Live data from Hacker News

TypeScript is now officially 10 years old

coderoasis.com

111–120 of 207 posts

Re: TypeScript is now officially 10 years old

#111
post #84
post #81

Earlier quoted context omitted.

> TS catches me writing numerous bugs a day I see this sentiment a lot but I honestly can't think of any non-trivial bugs that TS has caught for me. 99% of the bugs it catches I would see 1 second later when my page hot reloads and crashes.

That’s the beauty though, isn’t it. Most bugs are trivial. I appreciate typescript getting the trivial bugs right more often than I’d trust myself to do so.

Right? The argument that static/strict typing mostly catches trivial bugs isn't an argument against the value of that language, and yet people seem to think it is!

Re: TypeScript is now officially 10 years old

#112

I wish Flow, Facebook’s TypeScript, was more popular, as I think it has some better properties. But yeah, the tooling is kind of bad and it is all written in OCaml, while TypeScript is in TypeScript…

I always felt the decision to write flow in ocaml was ahead of its time. Flow compiler is much faster than TS.

Native bundlers like esbuild, swc etc. are mainstream now but they came much later.

Re: TypeScript is now officially 10 years old

#113

Earlier quoted context omitted.

Cringing at compile time safety or what?

No, cringing at some "helpful" popup appearing right over the previous line of code. If anything, they could've made it appear under the current line; code's still written top to bottom so it's less likely for "suggested relevant info" to obscure the actual relevant info.

You can press f8 to view the problem in a "peek view" under the problem line, or view on the problems panel.

Re: TypeScript is now officially 10 years old

#114

Earlier quoted context omitted.

I don't understand what you are referring to - the TypeScript compiler has 0 (non-dev) dependencies: https://github.com/microsoft/TypeScript/blob/main/package.js... .

Yes, it also comes delivered as several near-identical builds for different contexts, each of which is nearly non-extensible. Have you seen the kind of monkey patching Volar (Vue tooling) does to enable type checking of TypeScript embedded in Vue templates? Meanwhile, native JSX support lol

Well TS does have its complexities, but it is somewhat surprising to see the complaint being that supporting typechecking for something that is not TS at all (and something TS authors know nothing about) is complex.

It is amazing that the whole langserver stacking that volar does is possible at all - I don't believe there is any equivalent prior art that worked as well as it does. Despite all the complexity the end user experience is pretty good. If someone had mentioned to me this kind of cross language type-checking can work as nicely before I used volar I would have been super skeptical.

Sure it has its caveats. But it is also completely possible to use vue in pure typescript.

I don't fault them for having native jsx support, React was just too popular in the target user base. I do hope that someday js+ts gets kotlin style builders, but until I'll gladly use volar.

Re: TypeScript is now officially 10 years old

#115

Earlier quoted context omitted.

> In practice, it arbitrarily invalidates completely sensible JavaScript idioms. Such as?

For one, try redefining a property as a getter/setter pair in a subclass. Also, try implementing a function that takes keyword arguments, some of which are required, and some of which have default values. I'll wait. When you're back I might've remembered some more.

> For one, try redefining a property as a getter/setter pair in a subclass.

This is actually a completely invalid pattern in JavaScript, and it's really good that TypeScript errors for it.

Class fields are created with a define property step in the constructor, so they would shadow the getter/setter in the subclass.

The super class needs to have a getter/setter pair itself to be overrideable.

The upcoming `accessor` keyword will help by makes getter/setter pairs automatically.

As for required args and defaults, TypeScript doesn't really change anything over JavaScript except adding type warnings: https://www.typescriptlang.org/play?#code/MYewdgzgLgBAZiEMC8...

Re: TypeScript is now officially 10 years old

#116
post #108

Earlier quoted context omitted.

> In practice, it arbitrarily invalidates completely sensible JavaScript idioms. Such as?

One of the first things that made a bad impression on me was back in the day when classes were still used in the js world. I was not pleased when it told me I have have to do this.blahBlah = value in the constructor because it didn't quite catch, and maybe still doesn't, that Object.defineProperties(this, { bla: { value: ... } blah: {get, set} }) is completely legit That said, I do prefer ts to vanilla. It's less wor…

But who want to use

    Object.defineProperties
when there is a clearer and shorter way?

Or am I misunderstanding something?

Re: TypeScript is now officially 10 years old

#117
post #37

Typescript was my stepping stone into the world of Rust. Even before Deno made it easy, it was straightforward enough to configure a simple tsconfig and just run tsc. Much like cargo, there is a lot to be said for "it just works" tooling - especially for beginners or even new programmers. It is probably fair to say it is one of the most influential and impactful languages of all time. There's even the future possibil…

Is there any news about the status of the type-annotations-as-comments proposal? The README has said "Details will change in the coming days" since March 31. I know TCs are supposed to move deliberately, but this is such a neat idea I'm impatient.

Re: TypeScript is now officially 10 years old

#119
post #67

Earlier quoted context omitted.

That’s not true. You can import JS directly into TS or use ts-ignore annotations.

Quoted post unavailable.

You can directly import any valid JS module using TypeScript if you have “allowJS”: true in the compiler options of your tsconfig.json file. The comparison to FFI doesn’t make any sense. FFI requires compiling a special library that explicitly exports the C types. This is different than TS. Using TS, you can import any valid JS module without any special preparation. Also, you can’t import all compiled languages into each other using FFI. You can only import and export C-based types. There is no way to export a Go struct for consumption via FFI, for instance. All valid JS modules will work with TypeScript.

Re: TypeScript is now officially 10 years old

#120
post #112

I wish Flow, Facebook’s TypeScript, was more popular, as I think it has some better properties. But yeah, the tooling is kind of bad and it is all written in OCaml, while TypeScript is in TypeScript…

I always felt the decision to write flow in ocaml was ahead of its time. Flow compiler is much faster than TS. Native bundlers like esbuild, swc etc. are mainstream now but they came much later.

But writing Typescript in Typescript allowed the language-designers to dogfood the developer-experience of being a Typescript-developer.

Just like MS eventually did with C# too. After the C#-compiler was reimplemented in C# (Roslyn), that’s when the language was truly allowed to develop. And it also made it much easier to make C# a truly cross-platform language.

When the language-designers don’t have to use their own language, they have objectively much less motivation to improve upon the language or it’s tooling than if they do.

The Flow-team didn’t use Flow to write Flow and that shows in its lack of development, its lack of tooling, its lack of contributors and ultimately in its lack of adoption.

Post reply on HN