Live data from Hacker News

How an Anti-TypeScript “JavaScript developer” like me became a TypeScript fan

chiragswadia.medium.com

111–120 of 400 posts

Re: How an Anti-TypeScript “JavaScript developer” like me became a TypeScript fan

#111

Earlier quoted context omitted.

I guess static first is a chore because at that point you have no idea what invariant or structure is required for the task. After prototyping you know where to tighten the bolts.

> you have no idea what invariant or structure is required for the task I often write the program in TypeScript types/interfaces first because it forces me to think about the data flow both in and out. In my opinion, data, not code, is the most important thing about a program.

that way of working was my only pleasurable experience in eclipse/java

start with interfaces and let the live type checker tell you where your incoherences are. Very very smooth way to work.

Re: How an Anti-TypeScript “JavaScript developer” like me became a TypeScript fan

#112

I just can't bring myself to use curly bracket languages. I can't make a good enough case for any of them. I read way too much code to make myself read code that's not beautiful.

that's an odd take considering the article is comparing JS/TS which have an identical amount of curly brackets

Re: How an Anti-TypeScript “JavaScript developer” like me became a TypeScript fan

#113

Two downsides to TS: an extra step to transpile, and having to write shims when it bugs out and can't verify an external declaration. Upsides? When tuned to its most pedantic settings I've uncovered a handful of bugs that would have otherwise launched. That's worth far more than a few tiny annoyances. tslint > jslint.

If you are working on the server side, ts-node has been a huge timesaver. It removes the extra step of compiling and lets you just run your script with `ts-node script.ts` or even `#!/usr/bin/env ts-node` at the top of your file works. https://github.com/TypeStrong/ts-node

babel-node is also very nice, and more lenient about type checking. i've discovered nodemon with babel node gives me the ability to hack something together and adding a tsc build pipeline helps me correct the types when i'm done

Re: How an Anti-TypeScript “JavaScript developer” like me became a TypeScript fan

#114

I was hesitantly open to TS when the hype was first ramping up. The team I was on (and I've seen this in lots of code elsewhere too) was doing stuff like this: declare let myColor: Color | undefined; Suddenly everything turned into Java with signatures cascading endlessly. I'm not blaming TS, it's more of a.. lack of faith to make the full jump? Or limitation of the underlying Javascript? This problem should be solve…

assuming you meant

  let myColor: Color | undefined;
I don't understand what the problem is. Native JS would require you to define the starting scope of the variable (unless you're relying on global scope!).

Then you declare what the type is: Color or undefined. The state of the variable can be one of two things. Perhaps I've been writing TS for too long but I think I'm missing the problem here.

Re: How an Anti-TypeScript “JavaScript developer” like me became a TypeScript fan

#115

After being an early adopter of TypeScript, I decided to skip TypeScript in my next projects for a few years because I thought it was not worth the hassle. I remember spending a lot of time in DefinitelyTyped to create and fix type definitions, and when Babel and ES6 were popular I used that instead. I recently changed my mind and started to migrate a large JavaScript codebase to TypeScript, in strict mode. I conside…

Typescript is more popular now because projects are migrating more and more business logic layer to front end. Thus the need for type safety and static analysis.

I’m agnostic about Typescript. Bare JavaScript is very efficient and optimized language, well suited for smaller projects.

However, when project scope balloons up, then Typescript becomes more useful. It’s way of enforcing descriptive comments a code, than trying to be a type safe language.

Re: How an Anti-TypeScript “JavaScript developer” like me became a TypeScript fan

#116

Earlier quoted context omitted.

Same. Lead dev here. Part of my problem stems from the lack of typed libraries across the JS ecosystem. Party supported typing leads to more issues, I've found. Then there's the IDE. I don't use code hinting. In fact, I find it irritating. So, I draw no benefit from TS in this regard. Then there's the cryptic error messages. They've gotten better over the years but I always seem to spend more time debugging TS than w…

As another lead/senior dev, I've found that onboarding hires that know some TS into a TS codebase is a hugely slicker process than onboarding people into a pure JS codebase, simply because the typechecker can do the overhead of having to check each call etcetera. The issues you are having sound like teething issues but as someone who's worked with TS for years I've found they aren't hugely difficult to overcome, eith…

> I mean that's a personal preference, but if you're a lead dev and you have people starting work on a codebase they have little experience with, it's a godsend because they aren't totally blind.

Very much this. I pushed to move the scripting language for our game engine project dot big bang from JS to TS primarily because the typing makes the entire codebase much more discoverable and beginner friendly. Using Monaco embedded in the browser programmers get great auto-complete and inline code documentation as well as the compilation step making some simple and common runtime errors much harder or impossible to run into. Qualitatively the mixed experience bunch we have using it now all much prefer the TS experience to the JS one we had before.

Re: How an Anti-TypeScript “JavaScript developer” like me became a TypeScript fan

#117

Earlier quoted context omitted.

Senior probably means they've been doing JS for decades before TS was invented. They got along just fine without it for so many years, why rock the boat now? Or maybe it is more of a Senior person has a ton of work to do and not enough time to do it in so there isn't time left to learn a whole new way of writing JS. Or maybe many of the errors TS is meant to catch, the Senior developer has already learned over the de…

> Senior probably means they've been doing JS for decades before TS was invented. JS has only been around for 25 years. I’m a “Senior person” and I’ve been seriously working with JS for less than 5 years.

Well, I'm Senior too and I've been working with JS for 23-24 years. So I guess I'm projecting my own experience.

Re: How an Anti-TypeScript “JavaScript developer” like me became a TypeScript fan

#118

Earlier quoted context omitted.

Wasn’t CoffeeScript the preferred way to write JS in Ruby on Rails for years?

HAML and coffeescript.

I miss the elegance of Haml. Moving from an indented syntax for DOM literals to the likes of JSX felt like a step backwards.

Re: How an Anti-TypeScript “JavaScript developer” like me became a TypeScript fan

#119

It's probably worth taking a step back and interrogating why the actual "Why was I Anti-TypeScript?" a little bit more and use it as an opportunity for broader self development. The author didn't use and understand something, and rather than trying to they instead just defaulted to rejection. It's midly disapointing seeing this in people who label themselves as "Senior".

I think the skepticism of new shiny things is healthy. Of the set of things that exist, most things are worse than the things one already uses/prefers. Most new things solve a specific problem that may not overlap with the problems one is trying to solve. With software development, a huge part of the puzzle is tooling (as the article points out), so even if typescript is obviously superior as a language, the tooling…

Strong typing is not shiny or new and, even if you're a javascript guy, not being remotely familiar with any strongly-typed language (or generics?!) is a red flag.

(edit: red flag is a bad description, because he ended up being self-reflective and looking deeper, which is just about the furthest thing from a red flag.)

Re: How an Anti-TypeScript “JavaScript developer” like me became a TypeScript fan

#120

Earlier quoted context omitted.

I also have fond memories of painstakingly converting hundreds of coffeescript files back to JS. There's something to be said for using the native language.

Browser support and consistency got a lot better. JavaScript was a minefield of compatibility problems. Many intentional, cough: Microsoft. Jquery was awesome because it dealt with most of that

JQuery dealt with DOM and browser stuff. Coffeescript dealt with syntactic language stuff. I can't think of a case where Coffeescript helps with the same thing JQuery does, although it may exist.
Post reply on HN