Live data from Hacker News

TypeScript is now officially 10 years old

coderoasis.com

91–100 of 207 posts

Re: TypeScript is now officially 10 years old

#91
post #81

Earlier quoted context omitted.

I personally can’t agree with that. TS catches me writing numerous bugs a day, the structural typing plus static analysis is a superb combination. If your code base is in JS without types, you probably have many bugs, you just don’t know about them. Especially around undefined/null handling. TypeScript also allows me to refactor fearlessly, which substantially improves the quality of my code as I can do mini-rewrites…

> 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.

well I can, I wrote a year-long js project that I abandoned as refactorings gradually turned into eternal bug-fests. I started from scratch in typescript, and the project is now 3x the dead project, with none of the bugs. and refactorings have become painless, with the compiler tools and editor telling me what I must fix up. There may be a special breed of programmers who need no such help, but I have yet to meet them in my 32+y long professional programming career :-)

Re: TypeScript is now officially 10 years old

#92
I have a rather funny story about Typescript from ~4 years ago. I joined a team that had, amongst other things, an Node-Express.js and React-redux stack, all in vanilla Javascript.

I was a bit younger and bolder then; I lamented with the lead developer about how vanilla JS was probably not a good idea for what was to be a large enterprise platform. The response I got back was probably what you would expect from a senior developer receiving criticism from a rather newly minted developer: Oh i've tried Typescript, but it's just SO VERBOSE. I feel like I can't get ANYTHING done, etc. etc. etc.

I've personally been all in on TS from close to day one - around 2013 when I started some very early web development (hooray for the AngularJS/Angular days! /s). It somewhat scratches my ego and has been rather interesting to see the developer mindset change, particularly that of vanilla JS developers of old. Response like ones I had have gone from often negative, complaining about verbosity and I guess frustration with anything different from what they are used to, to overwhelmingly positive. Old guards join us, or fade away, I suppose.

Re: TypeScript is now officially 10 years old

#94
post #81

Earlier quoted context omitted.

I personally can’t agree with that. TS catches me writing numerous bugs a day, the structural typing plus static analysis is a superb combination. If your code base is in JS without types, you probably have many bugs, you just don’t know about them. Especially around undefined/null handling. TypeScript also allows me to refactor fearlessly, which substantially improves the quality of my code as I can do mini-rewrites…

> 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.

I find it catches a lot of design mistakes for me which I would put in the non-trivial bugs category. Many bugs that result from design mistakes are less immediate, like hard to spot edge cases (a better design makes them impossible) or code that lends itself to becoming messier and more bug prone in the future as it's changed/extended (a better design makes this less likely).

Re: TypeScript is now officially 10 years old

#95
post #85
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…

The whole reason Microsoft made TypeScript was so that Intellisense would work. Then that became part of the religion and elaborated on with millions of dollars of marketing.

I think you meant to write TypeScript.

Re: TypeScript is now officially 10 years old

#96
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've had a very different experience than yours with the Typescript codebases I've encountered, which were mostly well designed. I have no doubt codebases with polymorphic union type abominations exist, but I wouldn't say they are the majority, far from it in my experience. It also seems to me those are a case of "problem lies between chair and keyboard", not a fault of the language. Bad code can be written in any la…

> I've had a very different experience than yours with the Typescript codebases I've encountered, which were mostly well designed.

Agreed. And in fact, the founders of a project having explicitly chosen TypeScript is often in and of itself an indicator that the team cares about code quality and writing style.

As you say, you can write poorly in any language. But people who care about quality choose TypeScript.

Re: TypeScript is now officially 10 years old

#97
post #93

As a C++/C#/Java developer I just couldn't deal with Javascript. Since discovering TS its fast becoming my favorite language. I think I might even use in the back end going forward.

I like TS as a language but the single threaded nature of js will eventually weigh you down.

Re: TypeScript is now officially 10 years old

#98
I feel like I am the only one in the world not liking typescript. It is not that I don't like types, it is what those types do to the readability of the codebase in terms of verbosity. My original programming language was Java but I switched to Node.js because I liked the simplicity of the code written in it. Nowadays every Javascript project seems worse than a Java project in terms of verbosity.

My main gripe with projects becoming verbose is that the code becomes hard to understand at a glance. Functions that usually could be 10 lines are now 15 lines becomes of the formatter and each line looks more gibberish because everything has a type. You have to manually filter out that noise. The best way I can describe it is that entropy is increased in order to get type safety.

Re: TypeScript is now officially 10 years old

#99

Earlier quoted context omitted.

I.e. cringing all the time?

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.

Re: TypeScript is now officially 10 years old

#100

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.

You’re right on the first (although classes are out of fashion, so this is low impact)

On the second, doesn’t this work?: ‘function foo({ bar = 3 }: { bar?: number })’

Post reply on HN