Okay so why is TypeScript in literally every JavaScript job post now? I get asked this a lot. And honestly I have thoughts. I've been pushing for TypeScript on my projects for a while now. Not because someone told me to. Because I once sat with a JavaScript codebase that had been around for a few years and genuinely did not know what half the functions expected as input. No types. No hints. Just trial and error and a lot of hope. You'd change something small and a user would hit a runtime error you never saw coming. That was enough for me. TypeScript just tells you upfront. This function expects this shape. That prop is not optional. Your IDE stops guessing and starts helping. You move faster on big codebases because you're not constantly jumping between files trying to figure out what's going on. So yeah I get why it's a baseline now. If you're building anything serious with a team it's kind of just the expected thing at this point. Not a nice to have. But okay I'll be fair. For a small side project or a quick prototype? Honestly sometimes it's just extra. The config, the setup, getting all the types right when you just want to ship something fast. It can feel like a lot. And here's the thing nobody really talks about. You can still write absolutely terrible TypeScript. I've seen codebases with TypeScript in the stack and any literally everywhere. Types switched off wherever it got hard. At that point what are we even doing. So it's not the tool. It's whether the team actually uses it properly. Anyway. That's my two cents. Have you worked somewhere that truly used TypeScript well or somewhere that just had it for the job post? What was the vibe? #TypeScript #JavaScript #Frontend #ReactJS #TechLead #WebDevelopment #SoftwareEngineering #Sydney
"For a small side project or a quick prototype?" If it's that small, and not going to become a large feature/project, docblocks with var & type are ok imo.
I’m working in one of those codebases you described. `any` everywhere. Tons of type coercion. Illegal access of private and protected properties. Every bad practice you can think of exists in this codebase.
I loath using "any". I ran into a weird situation a few months ago I had to use it. Which in turn meant I had to use @ts-ignore which I'm also not a fan of. I figure once in ~4 years is acceptable.
I've always said that if I had to choose a coding language to be friends with it would be JavaScript, because it just does its best with whatever bs you give it and I value that in a human. (I see its attempts at adding a string and an int as the equivalent of "Er, you wanna do a midnight trip to the beach and order a Maccers? Weird, but OK I guess.. Let's go!") But for coding? Where you want actual consistency and solid feedback on why something might not be working? Yeah, TypeScript any day! 🌟
I dumped vanilla js ages ago for the same reasons. TypeScript is a joy to work with, mostly. Sometimes the config or tooling cause friction, but that's a lot better now. Oh and sometimes the errors are a bit chaotic to say the least, but AI helps to clarify if needed.
I will never go back to js.Why should I? Just to run into an error to get to know something is wrong...
This conversation honestly reminds me a lot of unit testing - "We require knowledge of Jest of React testing library." If you’re only doing it because it’s “the thing to do” and not because you understand the value, you end up missing the point. Same with TypeScript - If the codebase is full of *any* everywhere, you’re basically opting out of the benefits while keeping the unnecessary complexity. TypeScript definitely has its place and can be extremely beneficial when it’s used properly. Knowing the expected input/output shapes and data contracts in a codebase is huge for clarity and maintainability. Imo TypeScript is one way of achieving that, but not the only one bc things like PropTypes (now just an npm package) also help validate types, just at runtime instead of compile time. I think it really depends on the project and the goal. Not every project needs TypeScript.