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

Programming

17483 readers
239 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 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
[–] [email protected] 148 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 πŸ˜…

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

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

[–] jeremyparker 31 points 7 months ago (14 children)

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

[–] epyon22 42 points 7 months ago (1 children)

And the ts devs support this

[–] jeremyparker 12 points 7 months ago (3 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.

load more comments (3 replies)
load more comments (13 replies)
[–] [email protected] 59 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.

[–] [email protected] 48 points 7 months ago (2 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.

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

CoffeeScript was a fad because it didn’t solve anyone’s problems. It was basically β€œlook how cool code you can write”.

TypeScript is gaining popularity because static typing solves real problems. It’s also a superset of JavaScript instead of being a completely new language from scratch, which makes it easier for JavaScript devs to learn.

[–] brian 18 points 7 months ago (1 children)

it felt to me like coffeescript solved problems that people had, then js got equivalent features. arguably that could happen to ts as well

[–] [email protected] 9 points 7 months ago

Exactly, it was pretty useful until ~2015 imho. Then JS got better, and coffeescript did not follow these evolutions.

[–] [email protected] 13 points 7 months ago* (last edited 7 months ago) (2 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.

load more comments (2 replies)
[–] RustyShackleford 46 points 7 months ago

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

Fight me.

[–] [email protected] 38 points 7 months ago (2 children)

A fad? No, definitely not. TypeScript brings features (and structure) that will /should probably make their way into JS.

It's sort of like asking, "does SASS replace CSS" or "is liquid the next HTML?" They're just implementations of features FE developers want in the core spec of JS, CSS, and HTML.

[–] [email protected] 16 points 7 months ago (2 children)

that will /should probably make their way into JS.

Not really, IMHO. The main advantage of TS is that it will help you catch errors without having to run a particular piece of code - i.e. you won't have to move to the third page of some multi-page form to discover a particular bug. In other words, it helps you catch bugs before your code even reaches your browser, so it doesn't bring you much to have them in the browser.

(There is a proposal to allow running TS in the browser, which would be nice, but you'd still run a type checker separately to actually catch the bugs.)

load more comments (2 replies)
load more comments (1 replies)
[–] porgamrer 37 points 7 months ago (1 children)

5 years ago everything was moving to TypeScript. Now everything has moved. Developers are still catching up, but it will be one-way traffic from here.

I'm guessing your manager thinks TypeScript is like CoffeeScript. It is not like CoffeeScript.

Also, TypeScript is only the beginning. In the halls of the tech giants most devs view TypeScript as a sticking plaster until things can be moved to webassembly. It will be a long time until that makes any dent in JS, but it will also be one-way traffic when it does.

load more comments (1 replies)
[–] [email protected] 35 points 7 months ago* (last edited 7 months ago) (1 children)

Typescript makes writing Javascript a reasonable thing to do. Your manager is a fad.

[–] [email protected] 13 points 7 months ago

Your manager is a fad.

If only...

[–] expr 25 points 7 months ago (2 children)

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

load more comments (2 replies)
[–] Lmaydev 25 points 7 months ago (3 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.

load more comments (3 replies)
[–] RonSijm 25 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

[–] [email protected] 24 points 7 months ago (2 children)

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

[–] [email protected] 11 points 7 months ago (24 children)

Dynamic typing is not a fad.

Python is older than Java, older than me. It is still going strong.

load more comments (24 replies)
load more comments (1 replies)
[–] [email protected] 23 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)
[–] [email protected] 20 points 7 months ago* (last edited 7 months ago) (10 children)

I believe both are true... and I also develop a LOT in Angular (with TypeScript).

TypeScript is great but the thing is that if you look at the history of TypeScript and JS/ECMAScript you'll find out that TypeScript sometimes is the testing ground for the future features of ECMAScript - pretty much like what happens with Sass and CSS that how even has nesting and scopes.

The issue with TypeScript/Sass etc. is that it requires a compiler and that's totally obnoxious and completely defeats the point of having interpreted code on browsers. Depending on the project it might be better to go for TypeScript + Angular/React or other compiled solution or simply something vanilla with jQuery or the Vue runtime (no compilation) and other libraries.

If TypeScript ever goes away the underlaying features that make it great will be implemented in ECMAScript in the same way that we got modules, classes etc. and I really hope it happens. Less compilation usually equals code more maintainable in the long run because you won't require hundreds of dependencies (that will eventually break) to get it to compile.

load more comments (10 replies)
[–] [email protected] 20 points 7 months ago (1 children)

I'll riot if I ever need to write pure js again. 98% of web devs would be better served writing in TS. If you're actually knowledgeable enough to write more efficient js, more power to you but honestly I was probably being generous saying 2% of web devs fall into that category.

load more comments (1 replies)
[–] [email protected] 19 points 7 months ago* (last edited 7 months ago)

I hope not. I'm pretty sure me and my coworkers would be at each others' throats if it were not for some form of typed JS holding our Frankenstein codebase together.

[–] [email protected] 17 points 7 months ago

Imagine changing your file extension from .js to .ts and calling it a fad. JS is TS. The difference is that TS does more (by actually doing stuff before runtime as a static analyzer, similar to eslint). If TS is a fad, then modern web dev is a fad.

Which, to be fair, it is.

[–] [email protected] 16 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

[–] [email protected] 15 points 7 months ago (2 children)

A language that helps me write Javascript without writing Javascript? Nah, that ain't no fad, that's a grace from whatever god is up there.

load more comments (2 replies)
[–] [email protected] 15 points 7 months ago (1 children)

Technicalities aside, TS is being pushed by MSFT in their SaaS custom components, and that right there will keep it relevant a while. MSFT is known for changing names a lot, but not for killing technologies.

After over 5 years of writing TS, I have had to do plain JS sometimes, and it is scary. It feels like walking blindfold. I'm spoiled.

load more comments (1 replies)
[–] [email protected] 15 points 7 months ago

I don't think it's going away until ECMA supports native types. Until then it's the best game in town.

If a team decides to move away from it, it's only few hours work to entirely remove. So even if it's going away, it's risk free until then.

But I cannot imagine why any team would elect to remove Typescript without moving to something else similar. Unless it's just a personal preference by the developers who aren't willing to learn it. It removes so many issues and bugs. It makes refactoring possible again. I think teams that want to remove all types are nostalgic, like a woodworker who wants to use hand tools instead of power tools. It's perfectly fine, and for some jobs it's better. But it's not the most efficient use of a team to build a house.

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

Javascript is a fad.

Reject web dev; return to native.

load more comments (1 replies)
[–] [email protected] 13 points 7 months ago (2 children)

What's the point of calling something a "fad"? If the technology works well and it provides value to you, why should you care what other people think?

(Example: Look at PHP)

[–] [email protected] 14 points 7 months ago

The point of calling something is fad is a way to tell you that you shouldn't invest a lot of time into this because that knowledge will become obsolete soon.

I mean this is particularly relevant in the JS world because every week there's a new revolutionary framework that renders the previous framework obsolete. (Although, not sure if that's slowing down now...)

load more comments (1 replies)
[–] FizzyOrange 12 points 7 months ago (1 children)
[–] [email protected] 16 points 7 months ago* (last edited 7 months ago)

They already said he is a manager, no need to repeat

[–] [email protected] 12 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.

[–] [email protected] 11 points 7 months ago

after reading the title I thought he'd suggest something better than TS would take its place, but going back to JS? nah

[–] [email protected] 11 points 7 months ago (2 children)

Based solely on gut feel, I think Typescript will become less popular as Wasm grows

[–] [email protected] 14 points 7 months ago* (last edited 7 months ago) (4 children)

When will Wasm grow, according to your gut? I feel like I've been waiting for a decade now.

load more comments (4 replies)
load more comments (1 replies)
[–] [email protected] 10 points 7 months ago (6 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 (6 replies)
[–] [email protected] 9 points 7 months ago

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

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

Id rather quit than go back to pure JavaScript.

load more comments (1 replies)
load more comments
view more: next β€Ί