Live data from Hacker News

Ask HN: Is TypeScript worth it?

news.ycombinator.com

91–100 of 469 posts

Re: Ask HN: Is TypeScript worth it?

#91

I think Typescript isn't worth using, and I find this unfortunate. The Typescript team clearly has put years of work into this, and clearly has tried to shore up the deficiencies in Javascript. Are you writing a brand-new codebase that needs to work on multiple platforms, and not exclusively in a browser? Don't use Typescript, use a language with native WASM support. This includes avoiding solutions that involve Elec…

I mostly agree with this, and haven't been happy developing JS for some time. I don't enjoy having to deal with bundles, webpack, TypeScript, bloated dependency graphs.

Luckily I can use Go for new projects, and even when picking it up at first I quickly found it more pleasurable to use than NodeJS. I don't JS on the backend if I can avoid it.

On the frontend, I would still argue on balance SPA/bundling is the best option when your company is developing an application. I appreciate that for many things HTML/CSS with minimal JS works well, but for anything dynamic where you have a team of devs, the community and dependencies around React are too useful to replace with much else.

Re: Ask HN: Is TypeScript worth it?

#92
100% worth it to me. I love typescript. Working on large enterprise applications where one function calls other function and it goes 10+ layers deep I don't know how I would work without typescript. Just being able to see this function takes argument of type FOO and returns type BAR[] is incredibly valuable.

Re: Ask HN: Is TypeScript worth it?

#93
post #81

Earlier quoted context omitted.

Same here, I've found it very useful in projects where I don't have a lot of dependencies. In another project with more exotic dependencies, it has become a hassle somewhat. I've found learning the .d.ts syntax to help easily get out of a situation, but it was a learning curve I still run into sometimes.

I find that I just make the .d.ts files any types I could document types for that module, but I don't, and instead assume types as the output of code I have that interacts with them

I do that sometimes too. Sometimes I type the couple things I need out of a module. If it's something I end up relying on more, I usually start digging deeper and end up cloning it. The hardest are the large libraries with no types and no DefinitelyTyped types. Also monorepos can be annoying, when the main package is typed but the individual packages aren't, if you have to start poking at things deeper.

You do get a lot of escape hatches for different outcomes though, dependant on amount of desired effort

Re: Ask HN: Is TypeScript worth it?

#94
post #50

Yep. I've had the foolish (mis?)fortune of scaling a couple of frontend projects from small to not-so-small starting in JavaScript and then converting to TypeScript. In each one, starting out with vanilla JavaScript was faster (no build!), but at some point our velocity would slow as changes required more testing infrastructure. After switching to TypeScript, we were faster than before. Sure, dealing with TypeScript…

> Sure, dealing with TypeScript can be a hassle, but it is less hassle than dealing with broken software. Can you think of examples where it's prevented broken software? I would prefer to spend more time writing good unit test coverage which in my experience would catch anything that TypeScript would have caught. I have seen it be more useful for autocomplete and self-documenting code, which I could get using JSDoc o…

Piping data around an application where each step applies a transformation. It is very difficult without a type system to keep track of what the inputs and outputs are supposed to be at each step. Typescript makes this a breeze.

Re: Ask HN: Is TypeScript worth it?

#95
You couldn’t pay me to work with Vanilla JS on any real life project. It feels like going back to horse and buggy.

The biggest things I wouldn’t be able to live without:

- the self-documenting nature of Typescript code (I instantly know what a function accepts and returns by hovering over it).

- the comprehensive auto complete my ide gets (saves hundreds of trips to the docs / source code per day).

- the incredible productivity gains when refactoring (change one thing, instantly get notified of all 30 places in the codebase that change introduced errors and clean them up in minutes).

Re: Ask HN: Is TypeScript worth it?

#97

I choose to avoid typescript for most of my projects and teams. There are some exceptions. I have some fundamental guiding principles I apply to engineering, and I find that TypeScript violates these: 1) Reduce complexity 2) Don't be clever 3) Achievement over activity 4) Longevity --------------------- #1 Reduce complexity --------------------- Cross compilation introduces additional complexity with debugging and pr…

I strongly agree with #1 and #2 and that is why I like typescript. It keeps things simple for me. I can look at what a function's inputs and outputs are without having to guess. I don't have to worry about having an array of strings and then someone deciding to throw a boolean in the middle. I know what all the keys on my object are and what kind of values they will contain. Code I have never looked at I can quickly figure out the structure.

Re: Ask HN: Is TypeScript worth it?

#98

You couldn’t pay me to work with Vanilla JS on any real life project. It feels like going back to horse and buggy. The biggest things I wouldn’t be able to live without: - the self-documenting nature of Typescript code (I instantly know what a function accepts and returns by hovering over it). - the comprehensive auto complete my ide gets (saves hundreds of trips to the docs / source code per day). - the incredible p…

> on any real life project

Could you elaborate on what the barometer/measuring stick for what makes a project real life?

I think I know what you mean. Bigger than ____ lines of code/files I'm guessing?

X number of classes/interfaces/APIs?

Re: Ask HN: Is TypeScript worth it?

#99

You couldn’t pay me to work with Vanilla JS on any real life project. It feels like going back to horse and buggy. The biggest things I wouldn’t be able to live without: - the self-documenting nature of Typescript code (I instantly know what a function accepts and returns by hovering over it). - the comprehensive auto complete my ide gets (saves hundreds of trips to the docs / source code per day). - the incredible p…

> on any real life project Could you elaborate on what the barometer/measuring stick for what makes a project real life? I think I know what you mean. Bigger than ____ lines of code/files I'm guessing? X number of classes/interfaces/APIs?

Not GP but I would never use bare JS again for anything other than maybe like a 20 line script, for the same reasons as GP

Re: Ask HN: Is TypeScript worth it?

#100
post #16

Earlier quoted context omitted.

So much this. If you’re learning JavaScript or any components of the language, you’re better off just starting with typescript (given the technical acumen up front). It’s absolutely a no brainer, long term roi. If presented the opportunity to integrate or use now vs later. The community is also very active, and it’s under Microsoft - and has been well maintained and quite active. Lots of libraries.

> you’re better off just starting with typescript It depends. The tooling is still a barrier (even though it's gotten smaller); the cost is small for a real project, but for someone who's learning and knows nothing about the ecosystem, it could be a real obstacle to dive all the way in at once. The exception would be if you're starting with something like Deno that integrates TypeScript seamlessly. Outside of that, t…

If you're just starting off with JS or TS you shouldn't be messing with tooling at all. Just install one of the many create-react-app derivatives, run one command and start developing. All those boilerplate generators support TypeScript now, too, so you don't even need to do anything extra to start using TypeScript. Even TypeScript itself can be incrementally adopted since it's a superset of JS.

You will outgrow those app generators, but for a learning project? There is no need for you to even see a webpack file.

Post reply on HN