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

Programming

17354 readers
332 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
[–] Vincent@feddit.nl 110 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 πŸ˜…

[–] DannyBoy@sh.itjust.works 55 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 22 points 7 months ago (10 children)

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

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

And the ts devs support this

[–] jeremyparker@programming.dev 4 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)
[–] lemmyvore@feddit.nl 6 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 5 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 5 points 7 months ago* (last edited 7 months ago) (2 children)

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

load more comments (2 replies)
load more comments (7 replies)
[–] redcalcium@lemmy.institute 39 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.

[–] magic_lobster_party@kbin.run 35 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@programming.dev 13 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

[–] Bourff@lemmy.world 8 points 7 months ago

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

[–] eager_eagle@lemmy.world 7 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)
[–] shnizmuffin@lemmy.inbutts.lol 34 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.

[–] Vincent@feddit.nl 16 points 7 months ago (1 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.)

[–] 56_@lemmy.ml 5 points 7 months ago

I think the important part is that the syntax will become standardised, rather than being defined by microsoft/typescript, potentially allowing for alternative implementations. It could also make the build step optional in some cases, which is something people dislike about typescript currently.

Hoping this is true. The biggest annoyance with typescript is needing some kind of compiler. Haven't used Bun or Deno very much, both of which natively support TS, but there are still incompatibilities with the way Node does things and how certain modules were built (CommonJS vs ESM). I like writing JavaScript but the tooling is utter crap.

[–] hperrin@lemmy.world 29 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.

[–] TCB13@lemmy.world 21 points 7 months ago* (last edited 7 months ago) (9 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.

[–] Vincent@feddit.nl 4 points 7 months ago (1 children)

TypeScript sometimes is the testing ground for the future features of ECMAScript

They have an explicit policy to only include features that are stage 3 already (i.e. that are pretty much certain to land in the language as-is). The only times they've diverged from this is long in the past (I think enum is the main remnant of that, for which I'd recommend using unions of literal string types instead), and experimentalDecorators under pressure from Angular - which has always been behind a flag explicitly named experimental.

So I really wouldn't worry too much about that.

load more comments (1 replies)
load more comments (8 replies)
[–] locke@sopuli.xyz 20 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.

[–] SorteKanin@feddit.dk 8 points 7 months ago

Your manager is a fad.

If only...

[–] RonSijm@programming.dev 20 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

[–] porgamrer@programming.dev 19 points 7 months ago

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.

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

Fight me.

[–] Pencilnoob@lemmy.world 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.

[–] breadsmasher@lemmy.world 12 points 7 months ago (2 children)

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

[–] tias@discuss.tchncs.de 14 points 7 months ago* (last edited 7 months ago) (3 children)

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

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

WASM made huge strides last year. You can run entire operating systems inside a WASM hypervisor now, and lots of packaging and transpiling projects came of age last year.

Example: https://copy.sh/v86/?profile=windows98

[–] tias@discuss.tchncs.de 9 points 7 months ago

Great, but can you access the DOM?

[–] breadsmasher@lemmy.world 4 points 7 months ago

By saying gut feeling I hope I am being clear I have zero tangible evidence? πŸ˜…

Maybe over the next decade its usage will grow? Or maybe it will end up relegated to performance critical applications, or JS/TS just end up with the same/better performance anyway.

load more comments (1 replies)
load more comments (1 replies)
[–] grue@lemmy.world 12 points 7 months ago

Javascript is a fad.

Reject web dev; return to native.

[–] TehPers@beehaw.org 11 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.

[–] eager_eagle@lemmy.world 10 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

[–] onlinepersona@programming.dev 9 points 7 months ago* (last edited 7 months ago)

The developer of Svelte moved from Typescript to JSDoc and explained in depth in an interview (you can find it on youtube). ECMA (the dudes making Javascript/ECMAscript) also started noticing that maybe static typing would be useful and there's a proposal to add typing to it. Whether that's moving forward or not, no idea, but if it were to come to vanillaJS, it's imaginable that typescript would be much less useful than it is now.

CC BY-NC-SA 4.0

[–] penquin@lemm.ee 9 points 7 months ago (1 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 (1 replies)
[–] DumbAceDragon@sh.itjust.works 9 points 7 months ago (2 children)

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

[–] cbarrick@lemmy.world 5 points 7 months ago (23 children)

Dynamic typing is not a fad.

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

load more comments (23 replies)
load more comments (1 replies)
[–] FizzyOrange@programming.dev 9 points 7 months ago (1 children)
[–] hydroptic@sopuli.xyz 16 points 7 months ago* (last edited 7 months ago)

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

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

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

load more comments (2 replies)
[–] tsonfeir@lemm.ee 7 points 7 months ago

JavaScript will implement the things that work out in TypeScript. So… yes and no?

[–] eratic@slrpnk.net 5 points 7 months ago* (last edited 7 months ago) (3 children)

Personally I'd rather use JSDoc in my own projects for type annotations and call it a day. I find TS a bit annoying but that might be because I'm not that familiar with it.

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