Live data from Hacker News

Ten Years of TypeScript

devblogs.microsoft.com

111–120 of 147 posts

Re: Ten Years of TypeScript

#111
post #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.

Use Deno. Everything including writing and building TS is built in.

Re: Ten Years of TypeScript

#112

Earlier quoted context omitted.

Hey, I mistake appropriateness of being blunt too. I’m autistic, so. I’m kind of impressed you dug through my recent comment history, even if the quote feels misplaced. Anyway feel free to be blunt with me, if you recognize me around. But I’ll also be blunt when I notice a critique is probably misplaced.

All good. To explain: I quickly scanned some of their recent comments to see if my assumptions could be wrong. When I noticed they were Danish, I then wondered if you were American, so I used hn.algolia.com to scan your comments for “American” as a keyword. You said you were, but at that point I luckily noticed the comment of yours that I quoted, which I just couldn’t resist cheekily passing back to you, because it f…

FWIW I think “comment quality” is a weird self-policing cargo cult thing here that reflects moderation attitudes more than it reflects basic decency, and I appreciate your candor and openness to critique more than anything else in this discussion. I’m sure you’ll find if you look further through my comments that I think basic decency extends beyond the politeness expected here when they conflict. Regardless thank you for a fruitful conversation!

Re: Ten Years of TypeScript

#113
post #93

Earlier quoted context omitted.

Typescript as a language is better than "isn't too bad", it's great! I love the syntax for unions and how normal things like "if" will narrow types. But I agree that it's a shame that the JS ecosystem is such a mess. Granted, dealing with it is essentially Typescript's purpose, but I would love for it to be a full fledged language on its own, divorced from JS. How cool would it be if you could write normal backend ap…

I wished Flow or ReScript would have won. TypeScript is too C#-ish for my taste. Well, still better than nothing, I guess.

Make your linter forbid the class keyword, it's all about how you write it. The language allows both OOP and functional styles.

Re: Ten Years of TypeScript

#114
post #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.

If it’s just the tooling that makes you dislike it, the tooling is just as frustrating if you write plain JS. If you don’t have specific gripes with the TypeScript syntax and type system as such, I’d suggest trying just using it without any additional tooling (typescript as a dev dependency, tsc as the only build step) in a project amenable to that. The biggest downside is slower iteration when tsc itself is slow. Bu…

Use swc to compile TypeScript. It doesn't typecheck (use tsc in your IDE for that) but the iteration speed is insane.

Re: Ten Years of TypeScript

#115

Earlier quoted context omitted.

The real genius of it is that it's really not a "type" system at all: it's a contract system. The nearest thing like it was Eiffel. The new "satisfies" feature in 4.9 makes this even more clear. Honestly there's so much space to cover here, I think it's just going to keep getting better and better.

I’m curious what you’re distinguishing here. To me a type system and a contract system are identical concepts with different descriptions. It seems like you might be highlighting the structural typing aspects of TypeScript’s type system versus nominal or concrete types in many others, but that’s been clear for most TS usage for since well before `satisfies` so I’m not sure if my interpretation is right.

I agree, there's doesn't seem to be any reason why you can't use types to express something like contracts. I think the general name for these kinds of types is 'refinement types':

"a refinement type is a type endowed with a predicate which is assumed to hold for any element of the refined type. Refinement types can express preconditions when used as function arguments or postconditions when used as return types"

- https://en.wikipedia.org/wiki/Refinement_type

There's even some literature linking contracts and types directly:

"Traditional static type systems are effective for verifying basic interface specifications. Dynamically-checked contracts support more precise specifications, but these are not checked until run time, resulting in incomplete detection of defects. ... This paper explores the key ideas and implications of hybrid type checking, in the context of the λ-calculus extended with contract types, i.e., with dependent function types and with arbitrary refinements of base types."

- https://users.soe.ucsc.edu/~cormac/papers/toplas09.pdf

Re: Ten Years of TypeScript

#116
post #83
post #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.

That is the same as saying you hate Kotlin because Android annoys you. Or blaming JavaScript for the browser DOM. Please correctly blame the ecosystem that you dislike, instead of thoughtlessly using a language as a label for an ecosystem.

> Please correctly blame the ecosystem that you dislike, instead of thoughtlessly using a language as a label for an ecosystem.

While I understand your point, I can't help but feel like the two are connected.

I _do_ have some beefs with the language itself, though. The export syntax concept is awful, the overly flexible type system to which I still haven't seen the point with and of course the whole thing needs to be transpiled to actually run.

Minor annoyances, sure. Easily to blame my abilities and capabilities as the reason for not understanding and enjoying TypeScript. But the ecosystem really hits the nail and by working with TypeScript on a daily basis, I'm forced to interact with it.

The developer community is so fragmented to anything else I’ve experienced. Granted, I don’t know every language and their respective communities, but the whole NodeJS/TypeScript community seems to have no common direction whether it comes to dependency managers, coding styles, transpilers, bundlers or much about any other “best practice” paradigms. And this also something that is pestering packages and the maintainers. I don’t experience this vast amount of fragmentation in PHP, Python, Kotlin or Dart. Whenever you reach out to the community, you’re rarely met with more opinions than you have fingers and toes; sure - not all agree on everything, but there’s more often than not, a sense of consensus on what a common approach to any given problem could be. While I of course could just have been very unlucky for the past two years, the community is the main (but not the only) reason I will not work with anything related to TypeScript or NodeJS ever again.

Re: Ten Years of TypeScript

#117

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.

Do you have interests beyond the JS world? TypeScript being the best thing to happen to web dev sounds a bit hyperbolic.

There are a lot of other great languages, but none of them run in the browser. Once you know that your frontend is in TS, there are a lot of advantages to writing the BE in it also. Like I said, there are exceptions, but it has become my default.

Re: Ten Years of TypeScript

#118
post #116
post #83

Earlier quoted context omitted.

That is the same as saying you hate Kotlin because Android annoys you. Or blaming JavaScript for the browser DOM. Please correctly blame the ecosystem that you dislike, instead of thoughtlessly using a language as a label for an ecosystem.

> Please correctly blame the ecosystem that you dislike, instead of thoughtlessly using a language as a label for an ecosystem. While I understand your point, I can't help but feel like the two are connected. I _do_ have some beefs with the language itself, though. The export syntax concept is awful, the overly flexible type system to which I still haven't seen the point with and of course the whole thing needs to be…

> I can't help but feel like the two are connected. I _do_ have some beefs with the language itself, though. The export syntax concept is awful, the overly flexible type system to which I still haven't seen the point with and of course the whole thing needs to be transpiled to actually run.

They are connected, but almost exclusively in the JS -> TS direction: typescript imports are javascript imports, the type system is messy because javascript is messy (whether complete compatibility with javascript was a good goal is another question...), etc.

> But the whole NodeJS/TypeScript community seems to have no common direction whether it comes to dependency managers, coding styles, transpilers, bundlers or much about any other “best practice” paradigms.

Yep.

Re: Ten Years of TypeScript

#119
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…

It's very case-by-case if a rewrite makes sense or not. For a greenfield project you'll have a whole different experience and it's more of a no-brainer, moreso the less you depend on un(der)typed frameworks.

Re: Ten Years of TypeScript

#120
am I the only one who hates typescript?... development time is extended because you need to create all the types / interfaces for every variable and function. And you blow up the already complex / almost unreadable code with type definitions.

Some of the definitions can be very complex, a dev needs time to decrypt what other dev wrote and what I can finally use as a parameter in a function. Sometimes even if you put the correct parameters, it still doesn't work, and you need to fiddle around with webpack or other config files or spend hours on google to find a possible solution for a "simple" thing.

I just want to create code and solution... I used to work on a project with typescript only, and it was a huge pita, especially because the ts was very complex. Never again typescript projects for me.

Post reply on HN