Live data from Hacker News

TypeScript is now officially 10 years old

coderoasis.com

81–90 of 207 posts

Re: TypeScript is now officially 10 years old

#81
post #48

Earlier quoted context omitted.

Can be said about regular modern JS as well. Whether your project has types or not is not alone going to determine the success of the project.

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.

Re: TypeScript is now officially 10 years old

#82

Earlier quoted context omitted.

Opposite experience. Rust was my stepping stone into "hey, maybe JS will be better with some degree of static typing?" Yes it would. But not the way TypeScript does it though, and there aren't any other viable options, are there? TypeScript brands itself a "superset" of JavaScript. In practice, it arbitrarily invalidates completely sensible JavaScript idioms.

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

Re: TypeScript is now officially 10 years old

#83

And still useless if you are at least half decent in js.

Worse than useless.

It actually is. TS is like a force multiplier for shit devs. All the worst code I've ever seen has been in TS and within the last 5 years. The average code quality has fucking plummetted in that time too, it's not just the worst offenders.

Re: TypeScript is now officially 10 years old

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

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.

Re: TypeScript is now officially 10 years old

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

Re: TypeScript is now officially 10 years old

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

This. Probably every TS codebase I ever worked in had zero to none function- or inline docs with people always claiming "documented by TS". I call that BS, and you can see that in their projects. "Typescript codebase" became the equivalent of "generic low quality codebase" imo. I'll never understand why people need a programming language inside a programming language and refuse simplicity (i.e. using jsdocs, which ha…

You can use some jsdoc in typescript, see https://www.typescriptlang.org/docs/handbook/jsdoc-supported...

However I tend to only use /** a comment */ before a type definition or argument which will add the comment along with the type in autocomplete.

I get the feeling you've stumbled more on the debate about commenting code/inline docs vs code that self documents. My general impression of Javascript developers is that they are comfortable adding comments whereas Typescript people are not so comfortable for some reason. Maybe because a lot of them are coming from Java and C# where writing clean code™ is more preferable to adding comments.

Personally I think there's a middle ground. I've met some Javascript developers insisting on adding a comment before each statement and I've met some java developers having a no comment policy in their codebase (so that pull requests wont merge if there are comments).

Re: TypeScript is now officially 10 years old

#87
post #40
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…

> There's even the future possibility of much of its type syntax being absorbed back into JavaScript: https://github.com/tc39/proposal-type-annotations ... as comments. Which superficially resemble the syntax of type hints but do nothing. Which has to be one of the worst language design decisions of all time.

I don't see the problem with this design decision.

I'm not the biggest fan of static type checking (especially in a language like Javascript, where it isn't used for safety guarantees), but it has its uses.

The "as comments" part of it isn't about syntax. They really mean no runtime overhead/behavior. (I don't think they should have put it that way -- it's just going to cause confusion.)

Is there really any question that "no runtime overhead" needs to be an option? (I think any proposal that didn't include this would be DOA.)

It also seems clear to me it needs to be the default option, for multiple reasons (language changes should be backwards compatible as much as possible, it should be easy to adopt new language features incrementally, type usage is an application-level concern.

Note: there's nothing in this proposal that prevents run-time enforcement. Good design limits scope but keeps your options open.

Re: TypeScript is now officially 10 years old

#88

Earlier quoted context omitted.

> How did people even live before VSCode's type hint popups covered up the previous line? Same. Like normal people do when they use Visual Studio/IntelliJ/QTCreator

I.e. cringing all the time?

Cringing at compile time safety or what?

Re: TypeScript is now officially 10 years old

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

[deleted]

Re: TypeScript is now officially 10 years old

#90

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