this post was submitted on 02 Apr 2024
7 points (100.0% liked)

Programming

17518 readers
572 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 !webdev@programming.dev



founded 1 year 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?

top 50 comments
sorted by: hot top controversial new old
[–] expr@programming.dev 7 points 7 months ago (2 children)

No, because raw-dogging JavaScript isn't something grown-up software shops do.

[–] LeroyJenkins@lemmy.world 3 points 7 months ago

[Object object] would like a word

[–] oscar@programming.dev 1 points 7 months ago

Can't they just use JSDoc?

[–] Vincent@feddit.nl 7 points 7 months ago

If TypeScript still is a fad at this point, his definition of fad is far lengthier than mine is.

I'm fairly sure TypeScript will remain in popular use longer than whatever project you're working on 😅

[–] AlecSadler@sh.itjust.works 4 points 7 months ago

In a small company with a non-complex product, there is a chance that TS creates more slowdowns than not.

In a large company with multiple cooks in the kitchen and a complex product, I'm personally of the mindset that there is substantial gain from typescript. I've had coworkers tell me it's bullshit, and then I do the smallest lift possible to convert and the amount of bugs it reveals are insane.

Is it necessary? No, probably not. But unless everyone's a 10/10 dev working on the world's simplest product, why not just do it and enjoy the benefits?

INB4 JavaScript blahblah, yeah I've added type hints to pure JS projects too and discovered bugs. At this point I don't get it. Typical resistance I get is that it's too prescriptive and lacks JS's dynamic nature - well, fuck off, I don't want to read through 200+ lines of code where you're changing types and shit on me willy-nilly.

[–] DannyBoy@sh.itjust.works 3 points 7 months ago (1 children)

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

[–] jeremyparker@programming.dev 2 points 7 months ago (4 children)

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

[–] epyon22@programming.dev 4 points 7 months ago (1 children)

And the ts devs support this

[–] jeremyparker@programming.dev 1 points 7 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.

[–] aidan@lemmy.world 1 points 7 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?

[–] jeremyparker@programming.dev 1 points 7 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.)

[–] aidan@lemmy.world 1 points 7 months ago

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

[–] lemmyvore@feddit.nl 1 points 7 months ago* (last edited 7 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.

[–] exocrinous@startrek.website 1 points 7 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.

[–] Lojcs@lemm.ee 1 points 7 months ago* (last edited 7 months ago) (2 children)

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

[–] lolcatnip@reddthat.com 1 points 7 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.

load more comments (1 replies)
[–] iarigby@lemmy.world 1 points 7 months ago (4 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

[–] testAccount@programming.dev 1 points 7 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?

[–] iarigby@lemmy.world 2 points 7 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

[–] BatmanAoD@programming.dev 2 points 7 months ago

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

load more comments (3 replies)
[–] Lmaydev@programming.dev 3 points 7 months ago (1 children)

When anyone in a professional setting says they don't like having a mega corp supporting something I lose a bit of respect for their opinion tbh.

Yes we all know mega corps suck.

But if you're using anything in a professional production environment that is meant to last in the long term this is 100% what you want.

[–] Valmond@lemmy.world 3 points 7 months ago

Some of us are old enough to remember the browser wars and EEE, so I definitely understands not wanting to be sucked into some mega corps eco system with future lock-ins. Often you can't do anyhhing else, but that doesn't mean it doesn't suck.

[–] TheHottub@lemmy.world 3 points 7 months ago

Id rather quit than go back to pure JavaScript.

[–] iarigby@lemmy.world 2 points 7 months ago

Typescript is the only way I can agree to code in Javascript. And the only way you can have a sane project without writing double or triple the amount if unit tests for each function just to check things that a compiler would do. However it is absolutely a lipstick on a pig thing with confusing behavior sometimes, but that’s because the underlying language it is trying to make bearable is bonkers

[–] RustyShackleford@programming.dev 2 points 7 months ago

Static typing, for the win, and I'll die on this hill.

Fight me.

[–] surely_not_a_bot@lemmy.world 2 points 7 months ago

Wow, he's living in 2012 or whatever. A true time traveler.

[–] DumbAceDragon@sh.itjust.works 2 points 7 months ago (24 children)

No. Dynamic typing, though, is absolutely a fad.

load more comments (24 replies)
[–] hperrin@lemmy.world 2 points 7 months ago

TypeScript might not be here to stay, but typed JavaScript definitely is. I’ve switched to writing 100% TypeScript, and haven’t looked back. The fact that just adding types to one of my (admittedly more complex) libraries surfaced 3 unknown bugs was eye opening to me.

[–] nick@campfyre.nickwebster.dev 1 points 7 months ago* (last edited 7 months ago) (1 children)

Hi, I've been doing TypeScript in my day-job and hobbies for six and a bit years now. I would not write JS in any other way.

TS is also a superset of JS so all JS is valid (unless you turn on strict mode). So there is no productivity loss/learning curve unless you want there to be.

In fact, a lot of people who think they're not using typescript are using it because their editors use typescript definitions for autocomplete and JSDoc type signatures are powered by typescript.

load more comments (1 replies)
[–] redcalcium@lemmy.institute 1 points 7 months ago (4 children)

CoffeeScript was a fad, but TypeScript seems to gaining more and more popularity these days, with new runtimes like deno supporting them natively. TypeScript finally gave Microsoft relevancy again in webdev world, so I bet they'll go a great length to make sure it stays that way. If Microsoft were still making their own browser engine, I bet they'll make it natively supports TypeScript too.

[–] eager_eagle@lemmy.world 1 points 7 months ago* (last edited 7 months ago) (1 children)

CoffeeScript wasn't a fad, it just became obsolete because JS adopted the syntax sugar CoffeeScript was selling. In a way, it did its job.

[–] flying_sheep@lemmy.ml 2 points 7 months ago

Yup! All of the following features were in CoffeeScript first: Modules, classes, arrow functions, async functions, parameter defaults, ...spread, destructuring, template strings.

So I'd say it was extremely successful in making JavaScript better.

load more comments (3 replies)
[–] RonSijm@programming.dev 1 points 7 months ago* (last edited 7 months ago)

Javascript is a fad, we should all move to WASM. 🙃

But no, TypeScript is not a fad. Unless a better "Typescript like" thing comes out - I know how in frontend land people like to make their own substitute framework that does something slightly different than an existing framework - But I don't really see why anyone would want to make a NewTypeScript, and not just expand existing TypeScript

[–] sloppy_diffuser@sh.itjust.works 1 points 7 months ago (4 children)

I don't see it dying from my perspective. Its only been getting better and better. The only thing I could see displacing it in my org is maybe Rust due to WASM proving a transition path.

We use TS on the back end to leverage our teams existing skill set and libraries we've built up.

I know it's a meme to use "the next best thing" in the ecosystem, but we've been really happy with the newish Effect library + Bun runtime. Effect is like a merger of the older fp-ts/io-ts libraries (same author works on both) with Zio from the Scala ecosystem. It vastly simplifies the former and the new stuff with dependency injection and defect management is refreshing. With the Bun runtime, we see a 15x faster startup time (great for dev). Its halved the RAM requirements in prod. We don't even need to transpile... We still do for prod to tree-shake dev-only code to ensure its not available in prod, but deploying to dev is FAST.

load more comments (4 replies)
load more comments
view more: next ›