Me, who's not in web dev:
What Typescript drama is there? It's fantastic. It's been an industry standard for years. In my anecdotal experience the only people that hate it are juniors who did pure JS at their bootcamp and seniors that have refused to learn anything for the last 5 years.
DHH (guy who founded Ruby on Rails) ripped typescript out of a supporting library and swapped it for JavaScript. He did it in his typical fashion of not allowing discussion and being a dick (PR only open for a couple hours and then merged disregarding all the negative feedback about the change) . So people are mad at him again.
He does stupid shit like this all the time because he’s a fucking knob.
RoR will always have a special place in my heart, but yeah... DHH sure does have opinions. What possible justification is there for removing it when it's already there? Guess someone could just shift the types out to DT.
Edit: So I read his blog post about it. He's dropping it because he just doesn't like it and he's allowed to not like it. Okay then 🤷
His blog to me sounds like he did it because it was too difficult for him to understand a few errors. Says it all.
or people used to work alone never having to go back to their code (e. g. bad consultancy jobs)
Even alone I find it indespensible. I find it's mainly useful for writing code correctly the first time around.
Svelte decided to ditch it because it became impractical due to the compilation step slowing down development and making debugging their compiler harder. I think for libraries it makes sense to go the jsdoc way as long as consumers can choose typescript.
I'm choosing the third side: WebAssembly
You can even compile Fortran code to wasm and run it on a web browser. Who need Javascript's puny 64bit floating point precision when you can have Fortran's superior 128bit floating point precision?
vanilla javascript? what are you, fucking Amish?
I'd rather stay out of the frontend all together but I'd rather chop my balls off than go back to JS.
Plot twist: You are transgender and love working with JS
TypeScript of course. The compiler often times catches mistakes in variable names, API methods, whatever. So it saves time by not having to run the whole application all the time. Also the input help is much better, when the editor knows sth is a string or a number, for example.
Honestly, as a mainly backend dev wanting to do more full stack, webdev is frustratingly intimidating. I keep trying to look up best practices but there's so little in the way of consensus. "Use JQuery, no use Vue! React is better, but also React is clunky and bad. Write pure js, no don't that's a waste of time, at least use typescript." It's all such a mess and I spend so long trying to figure out what to use. I'm trying to just pick something and stick with it, but I keep worrying that I'm not doing things the best way.
I'd agree with you if you were saying this about 8 years ago, but IMO the post-jQuery-front-end dust has settled and the "best" (in terms of what most organisations end up choosing) hasn't really changed in a while.
- Typescript unless you've got a really good reason not to.
- React if you have anything remotely complex.
- Webpack (or one of the wrappers) to bundle it up.
Sure, someone may like a React alternative, and that's completely fine. But at the end of the day, most companies are using React because it's basically industry standard at this point, and it's got too much momentum behind it for that to change any time soon.
I'd say the back end is where all the choice is these days
Typescript is great for catching long standing bugs in old legacy JS.
Me: 2024 is finally going to be the year of WASM, boys!
And then there's me, missing flash :(
Flash and AS3 was so much fun to work in. I completely understand why the industry moved away from it but even today we have yet to fully catch up to all the media animation and programmatic features it provided all in one. RIP.
I just wish WASM could replace JS rather than merely augment it for non-DOM work.
I think there's a positive coming from this competition, though. Apparently this infighting has re-lit the want for type annotations to be embedded in vanilla JS (ECMAScript proposal). I feel like this would be the ideal scenario: things working right out of the box without needing a compile step or additional tooling.
You can get as close as it gets to this experience by using alternative runtimes such as Deno or Bun, which have native TS support (meaning you can just execute a .ts file without having to transpile it), but of course as soon as you have to write code for a browser you are back in the middle ages.
I dunno, Typescript can be nice at times but it always feels like I'm bolting on something that doesn't belong on top.
I'll still use it for now. Not sure JSDoc is as adequate for an enterprise app for me. I know Svelte and stuff do, but I'll wait and see.
Typescript may have a million problems that make getting into it annoyingly hard and even seem pointless, but once it's settled in your project and used well... Damn is it fucking good.
And I'm saying that even though I had to disable intellisense and most of those advanced features because the project I work for is too large and typescript would easily use over 20GB of RAM and get my computer to freeze.
But if you're trying to use it like a traditional typed language, you'll only see the bad side of it and you'll certainly hate it.
My issue with typescript... and, correct me if I'm wrong... is it doesn't exist without Javascript. Typescript needs to be compiled down into Javascript to be run. It has no stand alone interpreter (that I'm aware of) and definitely not one baked into web browsers or NodeJS (or adjacent) tools. In essence, Typescript is jank sitting on top of and trying to fix Javascript's uber jank, simultaneously fracturing the webdev space while not offering itself as a true competitive and independent language for said space.
That's my amateur two cents for what it's worth.
The fact that TypeScript doesn't attempt to obfuscate JavaScript, and just fills in the gaps, is what makes it the best solution to the problem.
It's not a separate language, it's Javascript tooling
I don't think it really fractures anything considering you can call a ts package from js without knowing. The other way also works with third party typings in DefinitelyTyped.
It really just adds a bit of extra type info into js, looks like js, and transpiles into js that looks almost exactly like the input, including comments and spacing and such if you like, so there isn't any lockin.
There isn't any competition, it's just an extra optional tool for the js ecosystem in my eyes.
As a professional with 25 years of experience I agree with you. The entire modern architecture was created by people who don't like simple things that work. I'm pretty sure there are a couple of high ranking master developers sitting at the head of W3C competing to create the most convoluted system possible.
You are correct.
That says I would never ever EVER start a project without TS.
It's like coding with hands vs coding with your elbow.
Just fyi, while they don't help with running TS in the browser, the Bun and Deno runtimes both natively run TS without any compilation.
I'm kind of a beginner... Can someone explain why you would make/use/have a dynamically and/or weak typed language? Is it just to not write some toInteger / as u64 / try_from()? I mean the drawbacks seem to outweigh the benefits...
The typical arguments for a dynamic typed language are that it takes less time to write something in it.
The benefits of static typed languages are that your development environment can be a lot smarter (ironically enough leading to faster development speed) and several classes of bugs being unable to happen. In a statically typed language, the IDE can detect if you're trying to call a function that takes a number but you're actually providing a string. In this case the IDE will let you know and you can immediately fix silly mistakes like that.
If you are writing small and simple apps it will give you more velocity and much less boiler plate.
As apps grow it becomes harder to keep track of things and can quickly grow into a mess. You then start to need external tools to give you the features of a strong static type system.
Also from a web point of view you don't want the website to crash and burn with every error. JS will power through things like invalid types. Imagine if any error caused the website to just stop.
I learned typescript because so many authors are using it.
I think it's like jQuery. Learn it because you'll have to debug someone's code one day.
HTML + CSS. No need for any of that newfangled "*script" bloatware / malware.
I am just a little "programmer" (if I can even call myself like that), and I'm using Typescript. Sure, it has it's own shortcomings, as everything, but it looks better than plain JS (at least in vscode)
I like TypeScript for its types and type-checking, but I also want to write JavaScript to avoid having a local build step, and having to wait for things to transpile/compile/etc when running locally. I have a pretty large project where I've gotten both worlds by just using JSDoc and only using TS for type-checking. VSCode still offers built-in type-checking with JSDocs and ofc the type-checking can also be run separately if needed.
Programmer Humor
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics