this post was submitted on 02 Apr 2024
139 points (98.6% liked)

Programming

17651 readers
343 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities [email protected]



founded 2 years ago
MODERATORS
 

I was talking to my manager the other day, discussing the languages we are using at $dayjob. He kind of offhandedly said that he thinks TypeScript is a temporary fad and soon everything will go back to using JavaScript. He doesn't like that it's made by Microsoft either.

I'm not a frontend developer so I don't really know, but my general impression is that everything is moving more and more towards TypeScript, not away from it. But maybe I'm wrong?

Does anyone who actually works with TypeScript have any impression about this?

you are viewing a single comment's thread
view the rest of the comments
[–] DannyBoy 76 points 8 months ago (1 children)

As long as JavaScript is being used, TypeScript will be used. It makes writing JavaScript tolerable.

[–] [email protected] 31 points 8 months ago (4 children)

Imo they'll add typing to vanilla js, which will kill ts.

[–] [email protected] 42 points 8 months ago (1 children)
[–] [email protected] 12 points 8 months ago (1 children)

And I'm sure Microsoft would be happy to not have to do it anymore. And I personally would much prefer an actual typing system rather than a glorified linter.

Tho I wonder if it will end up being like jQuery, in the sense that, by the time core jQuery features got added to vanilla js, jQuery had developed new features that validated its continued existence. Maybe TS will go further than what gets absorbed into JS and keep it alive.

[–] [email protected] 3 points 8 months ago (1 children)

Honestly, I've never used jQuery despite writing JS for over 10 years. Just because I hate the reliance on massive nebulous packages so many have. Especially when I looked into it years ago, so much of what I saw jQuery being used for was stuff that was extremely easy to implement yourself. How has it changed?

[–] [email protected] 1 points 8 months ago (1 children)

jQuery is a lot smaller and less nebulous than its competitors (looking at you,~~React~~ literally every JavaScript framework).

Jquery was what was popular when i learned js. I'm kinda glad it was, honestly: jQuery is a little unique in that it doesn't have magic to it the way js frameworks do. Everything you can do in jQuery, you can do in vanilla JavaScript pretty easily. With, say, React, how is a newcomer supposed to understand how a series of React components become HTML?

So jQuery kept it "real" for me. Fewer abstractions between me and the HTML meant it was easier for me to connect the dots as a self taught developer.

As for how it's changed, it's more any how vanilla JavaScript has changed. A lot of the things that made jQuery so much easier and cleaner than vanilla are now baked in, like document.querySelector(), element.classList, createElement(), addEventListener()... It had Ajax methods that, before jQuery, were a tremendous pain in the ass.

jQuery was great, but, you basically had to use it with something like PHP, because it had no back end. So when angular came out (and a few others that aren't around anymore and I've forgotten), it allowed you to replace both PHP and jQuery, and developers rejoiced.

Why did they rejoice? I'm not actually sure there was reason to, objectively speaking. As developers, we like new tech, especially if that new tech requires us to think about code differently, even if, in retrospect, it's a hard argument to make to say that, if we had just stuck with PHP and jQuery we would be somehow worse off than we are with React.

Of course, in tech, when a new system changes how we think, sometimes (not as often as we'd like) it helps us reconsider problems and find much more elegant solutions. So, would we have all the innovations we have today if all these js frameworks has never existed? Obviously we can't really answer that -- but it's a toke of copium for when we get nostalgic for the PHP/jQuery days.

(Also, for you newer people reading this, you should probably be aware that the PHP/jQuery mini-stack is still very quietly used. You'll definitely see it, especially in php-baaed COTS.)

[–] [email protected] 1 points 8 months ago

Thanks for informing me, but I still kinda wonder why someone would use it today?

[–] [email protected] 8 points 8 months ago* (last edited 8 months ago)

And also JS.

Well "kill" is perhaps a strong word but it definitely won't be JS anymore at that point. The changes required to bake in strong type support would be radical.

[–] [email protected] 5 points 8 months ago (1 children)

That would be a great solution, because while I love Typescript, I hate compiled web code. One of the coolest things about the internet is that as it's supposed to work, you can download the source code for any website you go to. It's open source by design. I hate closed source websites and I hate compiled website code that helps close the source it's quite a contradiction because typescript is awesome and I recognise that compilation is the only way to get it to run on our web infrastructure. So it would be great if we could just type JavaScript and solve the contradiction that way.

[–] [email protected] 5 points 8 months ago* (last edited 8 months ago) (2 children)

Doesn't typescript compile to js anyways? Is it obfuscated?

[–] [email protected] 3 points 8 months ago

It's not intentionally obfuscated or minified. Generally it just strips out types and comments, but depending on how it's configured, it will rewrite certain things to work in ES5. At my work our build process uses a separate minification and bundling step, which also serves to a obfuscate our proprietary code.

[–] [email protected] 3 points 8 months ago

It transpiles to js and there is some level of stripping for optimization yes.

[–] [email protected] 3 points 8 months ago (2 children)

the can’t add proper typing without adding a compiler. Whatever they add will be closer to puthon’s type hints. I’ve had to write primary in python lately and type hints help very very slightly, and tools like pyright catch so many false errors due to lack of hints in libraries that we’re forced to add ignore statements on too many lines. I genuinely don’t understand how there can be so many languages and all of them be painful to use

[–] [email protected] 3 points 8 months ago (1 children)

I genuinely don’t understand how there can be so many languages and all of them be painful to use

What about kotlin?

[–] [email protected] 3 points 8 months ago (1 children)

yes I heard it’s great. Scala was one language where I didn’t constantly feel like getting hit in the head with a hammer and I’ve heard Kotlin has a similar experience. I’m not interested in Android development so I haven’t tried it

[–] [email protected] 3 points 8 months ago (1 children)

Kotlin isn't just for Android; IMO unless you're trying to do purely functional programming, it's preferable to Scala for JVM work.

[–] [email protected] 1 points 8 months ago* (last edited 8 months ago)

Yeah anywhere were you would use Java. Scala has a too high adoption cost. Kotlin is better suited for enterprise, has a stronger ecosystem and better interop with Java. I did enjoy scala though when experimented with it. The only thing I missed was the lack of control flow, no labels, continue, break

[–] [email protected] 2 points 8 months ago (1 children)

I have very minimal pain in Go

[–] [email protected] 2 points 8 months ago (1 children)

I’ve heard good things about it, looking forward to learning it (hopefully soon)

[–] [email protected] 3 points 8 months ago

I was able to pick it up extremely quickly. Just basically looking at existing projects. Tbh, I don't even know how I learned it.