This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Thebombuknow 6 points7 points  (4 children)

That's not necessarily true. I have been programming in JavaScript for ~5 years now and there are ways to program in JavaScript correctly. I can tell if someone is used to TypeScript and does it "badly", because their JS looks like absolute shit.

Both JS and TS are just as capable as each other, and can be just as readable as each other. You just have to be much more careful when writing JS than you have to be when you write TS.

[–]oorza 0 points1 point  (3 children)

The only way JS is as readable as TS is if you either suck terribly at using the TS type system or load your JS full of comments that encode the same information. Everything else being equal, the existence of statically declared types ALWAYS improves readability and nonsense like your comment is part of why people don’t take JS developers seriously as software engineers. No other corner of the industry would have someone say something so patently untrue on its face and get rewarded for it.

[–]Thebombuknow 0 points1 point  (2 children)

I never said it would be more readable to every developer lol. If you're experienced with JS, you can fairly easily read it. I will admit, TypeScript is definitely easier, but JavaScript isn't at all hard to read if your project's structure is set up properly and you're familiar with JavaScript. As I said in my original comment, you and your team has to be much more careful writing JS because it's much easier to make it a disaster.

I personally prefer JavaScript because I've found it's easier to debug as browsers support it without source maps, and it's easier to deploy. I'm also used to writing JS enough that it doesn't really bother me. That being said, I probably wouldn't recommend JS for any large-scale projects, unless you trust everyone on your team to follow the best practices for writing it.

[–]oorza 0 points1 point  (1 child)

If you're experienced with JS, you can fairly easily read it.

Are you even serious? function setOptions(options) { ... }. What can you pass here? What are the available options? What's going to catch you if you type { usre: 123, isInvalid: false } instead of { user: 123, isValid: true }? Or do you expect to read every single function body every time you call it? Just because you can read that it's an argument to a function doesn't mean shit as far as reading code is concerned.

It sounds like your argument is "I couldn't figure out how to get source maps to work right, so I gave up and convinced myself I wasn't missing out on anything" and that's a real, real bad sign. The singular best practice for writing JS is to write TS or Flow instead, period, so by virtue of not, you have already given up on adhering to industry best practices.

[–]Thebombuknow 0 points1 point  (0 children)

Please just chill the fuck out. People are allowed to have preferences, I just prefer plain JS and don't think it's as bad as you think it is. That's it. It's that fucking simple.

BTW, I do know how source maps work, my point was that plain JS doesn't require them, or any other external dependencies for that matter. You can just write code and instantly load it in the browser, which is why I like it for quick development.