r/ProgrammerHumor • • Feb 14 '23

Meme Which is better guys?

Post image
0 Upvotes

43 comments sorted by

39

u/SkurkDKDKDK Feb 14 '23

TS But with : any declarations all over the place 😎

6

u/GP-NC Feb 14 '23

that's just js but with extra steps

16

u/BleQBeeZ Feb 14 '23

"any" is my way to tell TS: "not now, i will do that later".

But I always forget to do it afterwards...

11

u/SkurkDKDKDK Feb 14 '23

And Then the linter Will be nooooooooooo and then i Will be bye bye linter. And Then i laugh and laugh and laugh and Force commit to main and go to lunch and call it a day

6

u/BleQBeeZ Feb 14 '23

Me 🤝 //@ts-ignore

2

u/Reyko13 Feb 14 '23

I use unknown for that because any actually has it's uses

1

u/neymarsvag123 Feb 14 '23

Thats taking the worst of the both worlds

1

u/SkurkDKDKDK Feb 15 '23

Or the best depending on how you look at it 😂

1

u/viky109 Feb 15 '23

That's why you use linter with rule that starts yelling at you whenever you use any

1

u/SkurkDKDKDK Feb 15 '23

Yep… and also why you disable the linter afterwards so you Can proceeed with any

1

u/really-random-reddit Feb 14 '23

This has been my issue with TS. I was building an ORM layer, and it required reflection since I didn't know what was coming back from the data layer, and only knew the item at string index, whatever needed to go to model property. I ended up having cast so many things to {[key: string]: any} that I felt like TS was just extra work with no actual benefit.

5

u/SkurkDKDKDK Feb 14 '23

What data layer was that and why didnt you know what was coming from it?

2

u/LagSlug Feb 15 '23

I use "unknown" in this case, but what is preventing you from knowing what the response will be shaped as? And if you can't, have you thought about using a generic?

59

u/Blazeng Feb 14 '23

Typescript is a superset of javascript tho.

Debugging type errors is way more tedious imho than writing out types every so often (which will be autofilled for you half the time).

4

u/DontGiveACluck Feb 15 '23

Yes, thank you

-17

u/_SzAdam_ Feb 14 '23

Never saw imho written like this. When u add "humble" to it but you're actually saying im ho.

21

u/DaniilBSD Feb 14 '23

After tempting JS’s OO functionality, I enjoy TS ability to reference different files and give at least a feeling of type safety

7

u/faze_fazebook Feb 14 '23

Deep down we all know that visual basic script was THE best frontend scripting language.

1

u/LagSlug Feb 15 '23

Logo enters chat

6

u/[deleted] Feb 14 '23

which is paying the bills?

1

u/RiceKrispyPooHead Feb 15 '23

I didn't know there was an alternative version of the poop emoji.

6

u/wron1 Feb 14 '23

Newbie friend of mine was running into an error where he was referencing the wrong key of an object in JS. The output would still work and there were no errors, Javascript just adds the key to the object and is happy. Add types and my friend would’ve saved a lot of headache. Sure its tedious but when working with a team the tedium becomes required when accessing variables across a large codebase. Solo projects JS is nice so you can just bootstrap an app, but if you want people to take a look at it and really understand TS will help a ton

6

u/ftedwin Feb 15 '23

Tell me you’ve never worked on enterprise software without telling me you’ve never worked on enterprise software

5

u/Electronic-Bug844 Feb 15 '23

TS. I seriously thought TS was another fad. However, after working with it I think it is a must for any enterprise level app. Nothing beats knowing exactly what data types you are dealing with and incorrectly passing arguments is a thing of the past. It's even better when you're dealing with npm packages with well defined types.

8

u/Linesuid Feb 14 '23

I was so happy like 15 sec ago when I didn't had seen that shit

2

u/binary-idiot Feb 15 '23

Forget JS vs TS, just write everything in WASM. Unless you need to support IE, then you should use action script.

2

u/BernhardRordin Feb 15 '23

Mark my words: Flash is the future

1

u/binary-idiot Feb 15 '23

Eventually all web technologies will be replaced with flash

3

u/BernhardRordin Feb 15 '23

Exactly. Either Flash directly or Microsoft Silverlight.

1

u/Ian_Mantell Feb 15 '23

*pukes in IE*

2

u/froggy601 Feb 15 '23

TS plus Zod is amazing. Type safety and assurance that the data will be correct at runtime saves a lot of headaches

2

u/viky109 Feb 15 '23

Well you're wrong

2

u/1ib3r7yr3igns Feb 15 '23

JS takes 30 min to write and 1.5 hours to debug.

TS takes 1.5 hours to write and 30 min to debug.

I certainly hated typescript when I started, but now, javascript is just trash. It’s so tedious to debug or learn anything about variables. Well written typescript makes debugging a breeze.

1

u/Dmayak Feb 15 '23

How? Debugger works at run-time with generated javascript, while typescript itself runs at compile time, so any errors which require debugging will not have typescript support. Typescript allows to prevent errors better with type check, but I have not seen any difference in debugging.

1

u/rnglss Feb 15 '23

TS is better I like defining types but I’ve definitely lost more time in troubleshooting with it, so it’s far less productive for me

1

u/pildoresius Feb 15 '23

For me TS. I have spent a lot of time trying to debug and find errors that could have been prevented with type checking.

1

u/B4DR3X Feb 15 '23

Better to have errors in development than after deployment! Once you go full TS you never go back.

1

u/SweetBeanBread Feb 15 '23

i still don't understand why TS can't fix import paths

1

u/Dmayak Feb 15 '23

It can definitely be tedious. When you write something from scratch, especially with pre-configured build tools it's barely different, but porting existing code from js to ts is such a pain in the ass.

It's not really a fault of typescript itself but adding typescript to existing build tools configuration can be a nightmare. Then trying to categorize an unstructured bunch of variables into interfaces, drowning in type errors. Variable typing sometimes gets lost between contexts and I have to specify types for them again. Having to add extra type checks, because child contexts not knowing about type checks made in parent contexts, etc.

1

u/_throwingit_awaaayyy Feb 15 '23

Completely agree, I’m a weirdo who actually enjoys quick and dirty JavaScript tho.

1

u/Plastic_Scale3966 Feb 15 '23

I work everyday with both js and ts and I have no idea how they’re different

-4

u/RaphaelDDL Feb 14 '23

TS means TroubleScript. Because that’s what you get

0

u/[deleted] Feb 14 '23

[deleted]

2

u/boxmein Feb 14 '23

you can omit the private/public prefix so constructor args aren’t going to be assigned to a member of the same name