Live data from Hacker News

TypeScript is now officially 10 years old

coderoasis.com

121–130 of 207 posts

Re: TypeScript is now officially 10 years old

#121

Earlier quoted context omitted.

> Typescript is for big project and team collaboration. TypeScript is for any kind of project, it just makes your code safer, easier to debug, easier to read / come back to in the future, etc. > Fast! That doesn't mean anything. Especially for a small project, the TypeScript to JavaScript compilation will take milliseconds, there is no speed impact at all.

My project is small but TS takes 4-5 seconds to compile it from scratch on each run. The main speed impact is in developer productivity though. If something ain't working right, now I first gotta fix the types before I can see if I've fixed the actual logic. I imagine if my codebase was more "OOP-y" (i.e. if I replaced every layer of my domain model with 3 layers of dependency injection, turning the whole thing into…

> But for any sane developer having made the mistake to touch TypeScript, the capability to strip the types and run the code with broken types, is essential.

You’re free to hold that opinion, but I think you see (based on downvoting) that your definition of a “sane” developer is not as universal as you may have thought.

Personally I almost never see any value in running known broken code.

If I need to run/test a subset of my code without a complete working system, I have unit-tests for that purpose.

Re: TypeScript is now officially 10 years old

#123
post #9

>TypeScript never set out to build a separate, distinct, and prescriptive language. Instead, TypeScript had to be descriptive. Sadly, the majority of people writing Typescript rarely care about descriptive and readable code these days. Somehow the focus shifted from using types to better understand complex systems through the code itself , to writing whatever polymorphic union type abomination that yields the best In…

I‘m not well versed in type theory and some of the types libraries require, especially in the React ecosystem, really make my brain hurt. And sometimes it seems unnaturally hard to figure out what is even expected to type something correctly.

Re: TypeScript is now officially 10 years old

#124
post #84

Earlier quoted context omitted.

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!

Let them fight windmills while we have a good time.

Re: TypeScript is now officially 10 years old

#125

TS on frontend feels like devs making their editor choice (VScode) a hard dependancy

What do you mean? I'm editing TS perfectly fine in Jetbrains IDEs, and some coworkers use emacs and vim without any issues, still getting all the error highlights, etc.

Is there an editor that doesn't work with Typescript? Even without type error integration into the editor view, you could still run tsc in your shell of choice to manually check if everything is OK.

Re: TypeScript is now officially 10 years old

#127
post #114

Earlier quoted context omitted.

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 u…

JSX is also not TS at all, yet it gets preferential treatment (TSX). Unlike JSX/TSX, the TypeScript used by Vue is just TypeScript - wrapped in a tag next to some other stuff, so you know where the part you need to type check starts and where it ends. All TS needs to do to support this, on a basic level, is ignore the non-TS parts, i.e. let you turn each non-TS line into a comment.

But no, even adding supported extensions to the compiler, that's right, not even formats, just making TS recognize a new extension as a file that it can load code from, is a no-go; a pre-load hook is the simplest thing to add, had they not made it explicitly, intentionally non-extensible.

I didn't even have time to get into the "stacking of language servers" (something that can and should be as simple as a pipe, and of course Microsoft has all the reasons to make it the opposite of that). So the Volar people literally had to monkey patch Node's the standard library and edit TSC's source on the fly to make anything, work, at all.

It all just goes downhill from there. Designing good APIs is hard enough - having to design them around the arbitrary barriers of some Microsoft boffins who decided to add a complex type system to a language which desperately needs a simple macro system - and took 10 years to do a shit tier job - oh, such an enlightening experience! Let's just say that I have become acutely aware that during the past year I have, well, degraded. As a person. And I literally attribute about 50% of that degradation to my ill-advised choice to do my work in TypeScript. Because like everyone I thought "hey, it's just a superset of JS, can't be that bad..."

Re: TypeScript is now officially 10 years old

#128

I was unsure of Typescript at first, but it has become an absolute joy and absolute pleasure to develop in. I was reluctant to introduce a build step (having got used to the simple refresh cycle of a browser plus vanilla javascript) but I am pleased to say that this is a bit of a non-issue now with modern tooling like esbuild et al. I still avoid NPM like the absolute plague, but the good news is that tooling like De…

Wait until you try a language that was supposed to have a decent type system from the beginning!

The thing is, TS has a very pragmatic type system [1], with multiple opt-outs or workarounds if necessary.

"Decent type systems" are usually in your way (especially if you want to quickly prototype something), and despite "decency" have abysmal tools (like "hey I've changed this function signature, update all call sites etc.)

[1] It's getting more and more complex, but even if you write something like this, it's still aiming to help you:

   Partial>>

Re: TypeScript is now officially 10 years old

#129

Typescript is for big project and team collaboration. JS is still my choice for personal or small project. Fast!

Considering how mature is the TS ecosystem, I see no reason to not use it for my personal projects.

You tend to have to write a bunch of code that mostly catches problems you don’t have.

Personally, I’m marginally on the side of using TS even for small 1-2 person projects, but only slightly, and I can understand the case not to.

Well designed projects are no more complex than they need to be, and for many smaller projects that means — at least for web ones — that you have few significant “type barriers” where types are non-trivial and communicate or structure things in a way that is useful. And the type-heavy areas also tend to be where the app is ingesting data from a non-local source — exactly where static type checking is useless. (It’s always extra annoying when you’re fighting the type checker when writing the code that really ensures the data has a valid form.)

Re: TypeScript is now officially 10 years old

#130
post #84

Earlier quoted context omitted.

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!

I have to disagree. Adding the types will increase the number of the characters/lines of code which with a 80-char formatter limit can make functions look almost gibberish at a glance. Do that on a whole codebase and it becomes a mess to look at.
Post reply on HN