×
top 200 commentsshow all 283

[–]QualityVote[M] [score hidden] stickied comment (0 children)

Hi! This is our community moderation bot.


If this post fits the purpose of /r/ProgrammerHumor, UPVOTE this comment!!

If this post does not fit the subreddit, DOWNVOTE This comment!

If this post breaks the rules, DOWNVOTE this comment and REPORT the post!

[–]Neutraali 547 points548 points  (13 children)

This sub is now "JS developer discovers strong types".

[–]Rostifur 70 points71 points  (10 children)

I was gonna say "TS is like JS with strong types"

[–]MyDickIsHug3 52 points53 points  (8 children)

It’s not like it is JS with strong types

[–]Voidrith 12 points13 points  (7 children)

welllllllll you can use //ts-ignore or just cast stuff to whatever the hell you want to get around the type checks, so its ... mostly strong types.

But because its still javascript and javascript is stupid, it gives you the tools you need to shoot yourself in the foot when working with libraries that don't have proper .d.ts files

[–]KronktheKronk 16 points17 points  (6 children)

Having the power to ignore the rules when it's valuable is valuable

[–]Voidrith 10 points11 points  (5 children)

Oh, I know. I use typescript at work and have to deal with a few libraries without proper type decs so i often find myself having to cast as any or "as unknown as <whateverthefucktype>" to get around typescripts restrictions.

TS can do a lot and help a lot and has some really cool features, but it is still not going to save you from all the problems JS has with types

[–]DarkTechnocrat 6 points7 points  (1 child)

50 shades of any

[–]Eoussama 1 point2 points  (0 children)

The good ending

[–]sammegeric 328 points329 points  (11 children)

I love TS

[–]tijunoi 291 points292 points  (8 children)

Me too. Reputation is her best album.

[–]SignificanceLonely58 37 points38 points  (3 children)

from now on whenever i see ts i will be thinking of her.

take my angry award

[–]syzaak 11 points12 points  (2 children)

it's better than thinking in JS

[–]eatmynasty 11 points12 points  (2 children)

Wrong. 1989 is.

[–]tijunoi 5 points6 points  (1 child)

I am afraid of what I have started. Truth is I’m a swiftie and not quite sure on what her best album is.

[–]Charles_Stover 4 points5 points  (0 children)

No such thing as a bad album when you're the GOAT.

[–]TabCompletion 3 points4 points  (0 children)

The haters gonna hate, amIright?

[–]MelonheadGT 3 points4 points  (0 children)

T-Swizzle

[–]b-igu 5 points6 points  (0 children)

She is the Best!

[–]AppropriateRain624 240 points241 points  (46 children)

I don’t even write simple scripts in js. Why? Not enough intellisense. You have to keep track of everything. What argument does this take, what was the type of this variable, etc.

To be honest, even in medium size project typescript feels like magic and saves you so much time you would have spent debugging the stupidest bugs.

[–]kopczak1995 88 points89 points  (36 children)

Similar for python. It's fine for simple, small stuff, but I always feel like it could break apart in no time.

[–]bmcle071 50 points51 points  (9 children)

They added type hints recently, but they aren’t type checked. It just helps you as a developer know what goes in and out of a function. What really grinds my gears about Python is how some things are dynamically assigned. I use SQLAlchemy and there are several classes in there which don’t get a type annotation, you just have to know what methods are available on them.

[–]NeuroXc 15 points16 points  (6 children)

Mypy exists for type checking Python, but it feels even less usable than TS did 5+ years ago in its infancy. It has the potential to be good, but right now it creates a lot of annoyance and false positives with not very helpful error messages.

[–]bmcle071 1 point2 points  (3 children)

I’ve heard of it and decided not to use it. Typescript is super popular and everywhere, though I only heard of MyPy when I went digging

[–]Bake_Jailey 1 point2 points  (2 children)

Or, enable type checking in Pylance (pyright at the cli), which most everyone already has if they're using VS Code.

[–]FerricDonkey 1 point2 points  (0 children)

I've had to use mypy. It helps, but yeah, it kind of sucks. Pycharm's built in type checking, on the other hand, is pretty awesome. Not perfect, but a lot better.

[–]Vectorial1024 3 points4 points  (1 child)

If it looks like a duck... !

[–]ianthisawesome 0 points1 point  (0 children)

It's actually 'If it walks like a duck and it quacks like a duck, then it must be a duck'

[–]thanksgive 11 points12 points  (9 children)

I do really large projects in python. If you use type hints and read doc strings it’s easy

[–]GrooseIsGod 0 points1 point  (4 children)

I'm new I don't understand the problem without "strong" types. Isn't that better?

[–]SirPitchalot 0 points1 point  (0 children)

Even c++ is moving towards (strict) duck typing with concepts where before it was weak duck typing (at compile time, with plain templates). Both languages now make it much easier to break circular dependencies and write generic code. After working with python for some time now it just feels so clumsy to have all these helper types that need to be marshalled and unmarshalled from the data structures you actually want so it’s nice to see c++ incorporate more pythonic constructs.

I think with python’s inspect module you could probably write a decorator that would assert that the correct types were passed by inspecting the type decorations. That would give at least run time strong typing with sensible errors that could be nop’d out when not debugging.

[–]HobblingCobbler 5 points6 points  (7 children)

I love python. It's great for putting together powerful scripts fast. But I do with they would introduce a TS for python. Seems to me like this should already have been done. Hints are just that. They don't police anything and that is another problem in itself.

[–]redluohs 2 points3 points  (0 children)

Is it just not that a lot of programmers ignore warnings for some reason.

As long as you enable, say pycharm, type warnings (linting) and don’t ignore them you essentially have type checking without any runtime additions.

It’s of course not as safe as say, java, c++ or rust (even if people ignore a lot of warnings in those languages too), but it’s way more convenient than working without types.

And python is already strongly typed so it will error when it tries to do something stupid (unlike js or c) wich is what rust, c++ and ts primarily solve.

[–]kabiskac 0 points1 point  (5 children)

Hasn't Python been supporting types for a while?

[–]Goudja14 2 points3 points  (3 children)

It's not supporting types at all. Only hints.

[–]kabiskac 1 point2 points  (2 children)

How is that different from Typescript?

[–]Goudja14 4 points5 points  (1 child)

Typescript will not compile if types are wrongly used. It will throw an error before runtime.

[–]kabiskac 0 points1 point  (0 children)

Oh, thank you.

[–]FerricDonkey 2 points3 points  (1 child)

If you type hint and use an ide like pycharm, it works well. Things that would be compilation errors because of bad types in, say, C still aren't enforced by the interpreter, but the ide will highlight issues and provide a list of all such type hint violations that you can go through.

But if you don't, it's massively painful. I can't imagine doing a large python project in a more bare bones editor.

[–]zeth0s 1 point2 points  (3 children)

Try pydantic, might help

[–]kopczak1995 1 point2 points  (2 children)

Not doing much python professionally :) I had to once patch few simple scripts together and lately been doing similar thing but on corpo scale (awful thing). I'm usually .NET dev.

[–]zeth0s 1 point2 points  (1 child)

It is a good language for ML and AI. It feels nice in general, and nowadays, with pydantic and fastapi it is pretty good even for other things. Slow for some task, but nice to use

[–]kopczak1995 1 point2 points  (0 children)

Well, it has it's uses. I wouldn't force to use C# everywhere like JS folks, lol

[–]Yokhen 0 points1 point  (0 children)

That’s why you use mypy

[–]santi4442 9 points10 points  (0 children)

Unless of course someone uses “any” on everything

[–]ImBrokeNowBoi 12 points13 points  (0 children)

Ever heard of JSDoc?

[–]Masterflitzer 2 points3 points  (0 children)

that's what is hard coming from Java/C# background and beginning with JS, without intellisense you're lost sometimes

[–]AppropriateRain624 173 points174 points  (2 children)

There is a reason why big codebase prefer statically typed languages.

[–]hawleyal 1 point2 points  (0 children)

Because big corporations can't hire and retain good talent and have to settle for a mixed bag of recent grads and defunct dinosaurs.

[–]dixonormous23 44 points45 points  (1 child)

TypeScript would have caught the title typo

[–]still_oblivious 4 points5 points  (0 children)

But it’s still a string

[–]AndyTheSane 9 points10 points  (0 children)

I went through this conversion over 25 years ago.. going from CBM64 BASIC (variables are declared on first use, type inferred) to C. Once you've got over the whole 'i have to spend 10 seconds typing a variable declaration' issue, it's so much better.

[–]Operabug 31 points32 points  (0 children)

As a UI developer, learning Typescript made me a better programmer.

[–]Kuja27 6 points7 points  (0 children)

I made this meme like a year ago 😂 glad it’s gaining traction

[–]ryandeanrocks 15 points16 points  (0 children)

You’ve all just got Stockholm Syndrome. laughs in WebAssembly

[–]MAGA_WALL_E 3 points4 points  (0 children)

Turning Javascript into Java in one easy step.

[–]rarlei 98 points99 points  (18 children)

It's Javascript with extra steps

[–]aoechamp 103 points104 points  (5 children)

any, any, any

[–]Lumpy-Obligation-553 43 points44 points  (2 children)

Are you okey?

[–]synbioskuun 25 points26 points  (1 child)

You've been hit by

You've been struck by

[–]DrFloyd5 12 points13 points  (0 children)

A smooth criminal.

[–]Cult92 29 points30 points  (1 child)

// @ts-ignore

[–]imGnarly 9 points10 points  (0 children)

Hired

[–]raskolnikovcyka 27 points28 points  (0 children)

yes, if you only develop todo lists

[–]Carteeg_Struve 32 points33 points  (2 children)

It’s JavaScript, but actually usable.

[–]TheDownvotesFarmer 10 points11 points  (1 child)

Readable*

Because with pure vanilla using closures it is good enough to have a good software done, but people don't use it.

[–]Carteeg_Struve 1 point2 points  (0 children)

Fair enough. 👍

[–]deanrihpee 22 points23 points  (1 child)

It's JavaScript but more sane

[–]dpash 0 points1 point  (0 children)

Usable

[–]zkulickyprd 2 points3 points  (0 children)

agree

once people discover that writing .d.ts is just enough, next step is to use jsdoc to let intellisense work

[–]okayestuser -1 points0 points  (2 children)

correction: it's the cooler JS

[–]imGnarly 13 points14 points  (1 child)

No, JS is the cool brother that dropped out school to play the guitar. He got the chicks when he was younger and being careless had few consequences. Now that we’re older, the lean brother that studied engineering and was all geeky and tight gets all the job offers.

[–]okayestuser 1 point2 points  (0 children)

that is a much better description lol

[–]EagleNait 0 points1 point  (0 children)

I'll gladly take those extra steps

[–]PatchesMaps 23 points24 points  (0 children)

I don't mind Typescript but its fandom is ridiculous and aggravating.

[–]BakuhatsuK 3 points4 points  (2 children)

TS's type system is really freaking good.

It's support for Generics is really good, leagues above Java's one for example. Probably out of necessity because TS is intended to allow all the things that you can do in JS but in a type-safe manner, and JS being dynamically typed allows for a lot of things.

The type-inference is crazy good as well, so you get a lot of safety with not a lot of type annotations. Sometimes, type-safe code in TS (with noImplicitAny enabled) is literally the same as what you would write in JS.

For example:

[1, 2, 3].map(x => `cool ${x}`)
// [1, 2, 3] inferred as number[]
// x inferred as number
// whole expression inferred as string[]

I think only Haskell and Rust have more sophisticated type inference.

However, not even Haskell and Rust have proper union types. In TS you can do null-safe programming without banning null/undefined. And you don't have to use wrappers like Maybe or Option to achieve it. For more details on why solving null-safe programming with those wrappers is not ideal, check this talk.

(Null-safe programming using Maybe/Option is still preferable to not doing null-safe programming at all so please Java people keep the transition to Option<T>, and C++ people please keep using std::optional<T>).

The problems mentioned in the talk, such as not being able to relax an interface by making optional a function parameter, or not being able to strengthen your promise by removing optional from the return type (because it breaks callers) are non-issues in TS thanks to proper union types.

TS also has structural typing (as opposed to nominal typing), which allows for easier extension of libraries, and for library authors not needing to defensively create an ISomething for every class just to allow extensibility.

In short, TS's type system is among the best you can find out there. Thanks for coming to my TED talk.

[–]angeal98 2 points3 points  (4 children)

Am I the only one that had probably more problems with TS than benefits?
For me stuff just doesn't work.

Stuff like libraries that don't have typechecking, and suddenly I have to use any or write types for some library which is time consuming.

When I write React.ts code, how the hell am I supposed to know all the native types? It's impossible to understand/remember all the event/node/react types.

Stuff like filter / map / reduce methods that aren't smart enough to determine return type and I have to tell TS what type it is, which is pretty annoying. Seriously I use them all the time!

Many advanced usecases make me tell typescript that what I am doing is right, and that ts shouldn't throw errors because it's limited.

[–]theUnstoppableGeek 2 points3 points  (0 children)

If you're using libraries that don't have type definitions, you don't have to write any for it. You're just writing JavaScript at that point.

If you don't know the type that's being expected, hover on the prop or use Ctrl + Shift + Space in VS Code to show you the expected arguments and their types. Or you can also make TS infer it for you. You don't have to remember any of those, pretty sure most people don't.

Filter/reduce methods do sometimes require some type assertion, but I don't mind since it's one of the very few places where I have to do so. Plus, I'd much rather write a type assertion once in a while than using only JS.

[–]Zephit0s 2 points3 points  (1 child)

yarn add -D @types/yourlibrary

Any serious library have a package for its types

[–]prxvvy 2 points3 points  (0 children)

agreed. I now use typescript for everything even for simple scripts or small projects. Using only js is like walking being blind altho theres linters but i better stick w ts

[–]ConsistentCascade 11 points12 points  (5 children)

no you can't change my mind, i will never use typescript, i rather struggle for hours than depend on a library

[–]Zephit0s 12 points13 points  (0 children)

Typescript is only a dev dependencies you know.

[–]PhatOofxD 10 points11 points  (0 children)

You're telling me you write an your code and have never used a single library?

[–]theUnstoppableGeek 5 points6 points  (0 children)

Good luck with that mentality lmao

[–]astrogoat 1 point2 points  (0 children)

I bet you depend on the library known as the “V8 runtime”. Why draw the line there?

[–]ismoke3s 20 points21 points  (16 children)

I understand how TS is useful and keeps your code more robust, unfortunately for me who struggles with regular JS, i feel like TS type declaration and all its rules adds another level of complexity that will trip me up more lol.

[–]weshuiz13[S] 22 points23 points  (0 children)

I had that to, it took me a long time before i started thinking i was ready

That's why i made this post now

[–]TheRolf 9 points10 points  (0 children)

You feel like it would be a double pain but believe me, I almost quit JavaScript because of of types. Now I know what kind of data I am manipulating and I know where it can fail before even restarting my app. It's very useful

[–]Sentient_Blade 6 points7 points  (1 child)

Throw yourself into it and you'll soon find it's the other way around.

Rules help you code better. Imagine being given a bunch of bricks, concrete, steel pipe, wood, and being told to build a house. There's a thousand different ways to put it all together wrong.

Now imagine something with "rules" about how things work together, lego for example. Now consider that a 5 year old can build a lego house.

Programming is more complicated than lego, but the presence of rules and constraints will save you endless pain.

[–]redacted_4_security 0 points1 point  (0 children)

I like this description.

[–]Aisha_23 5 points6 points  (0 children)

As someone who has struggled with js for a year, I can tell you that once you're comfortable with js, you'll most likely like typescript. I tried typescript when I was still struggling with js and I didn't really like coding with it, but after picking it up again a couple of months ago I fell in love with it and I'm slowly rebuilding some of my own projects with it.

[–]Chrazzer 4 points5 points  (0 children)

I would say it is actually the oposite. TypeScript gives you a lot of help and tooling with intellisense and autocompletion and such.

You don't really have to worry about declaring types at first. Typescript can infer most types from your code

[–]TheDownvotesFarmer 1 point2 points  (5 children)

Well, it looks cleaner and readable but at the end it is just javascript its end result because it is a transcompiler something could happen on the results, maybe unexpected results and making it difficult to fix. But anyways I like the idea.

[–]NameTheory 11 points12 points  (4 children)

If you get unexpected results when you run something coded with typescript then you probably have input types wrong or you are using ts-ignore, any types or something else that breaks it. If you stop taking shortcuts and actually ensure things have the correct types then it'll work as you intend.

TL;DR: user error causes unexpected results

[–]NeuroXc 0 points1 point  (0 children)

Once you learn it, I find that it makes programming much easier. Autocomplete becomes more useful by telling you what types a function can actually take, and more importantly you receive errors at compile time rather than runtime. It's huge for reducing production bugs and, for me at least, reduces development time.

[–]dimittrikovk2 9 points10 points  (28 children)

What are the uses of TS and what is its syntax "similar" to

[–]The_nameless_biped 17 points18 points  (8 children)

As a C# developer I tried to learn JS and Python many times but to me it seems it's very time consuming not having the benefits of a static typed language. The lack of proper auto suggestion, many type checks, ambiguous return types, the extra comments that are required to describe something that is self explanatory in strongly typed languages. These are some of the issues that TS is trying to address.

I would never start a big project using a dynamic typed language.

Edit: I've corrected my misuse of terms. I used weakly / strongly typed but I meant static / dynamic typed

[–]ColetteFeetFan 2 points3 points  (1 child)

Weakly typed is not the same as dynamically typed. E.g. C is weakly typed but it's still a statically typed language

[–]The_nameless_biped 1 point2 points  (0 children)

You are right!!!! I was talking about static/dynamic types. Apparently I still need some reading to do!

[–]dimittrikovk2 0 points1 point  (4 children)

Personally I've mainly only used python before, but I don't consider myself a developer. I like the appeal of scripting because to me it seems more straightforward and because I usually don't write more than 100-200 lines of code. In fairness, my biggest projects were Reddit bots, most of which are extremely unoptimised because I was getting used to both python, praw and properly reading the documentation at the same time

[–]The_nameless_biped 3 points4 points  (3 children)

I also wrote small python scripts for data analysis and for that is perfect. The problem starts with large projects and multiple developers.

[–]dimittrikovk2 4 points5 points  (2 children)

Yeah, I totally agree. Python is a one-man-fucking-around kinda tool. The kind of thing you'd run on a raspberry pi mainly for fun, or to make a quick ugly hack for whatever. Or like in my case, for making random bots that remind every 2 hours some teenagers to stay hydrated and that says hello to automod in that same subreddit because I have nothing better to do

[–]weshuiz13[S] 38 points39 points  (6 children)

Its a safety net over regular javascript You have to write a little extra code

But it will prevent you from making silly mistakes like If you fergot a await and your whole code breaks It saved me much hassle over time and corrected even mistakes i would not have seen otherwise

Not only can it correct/suggest fixed It makes documentation much better

Like enforcing strong typing Making sure your variables/args use the correct typing and not end up using a string instead of a number

And if a lib/framework supports typescript You can view the documentation just in the editor And because it is strong typed it is also easy to see what kind of variable you should use, while the site based documention may lack

In the beginning i hated but just like the meme i started loving it

[–]Albert-o-saurus 3 points4 points  (0 children)

Wow. You really hate checking your spelling, or grammar, or syntax, or punctuation.

Ts is perfect for you.

[–]dimittrikovk2 1 point2 points  (4 children)

So, is it like a JavaScript add-on or an alternative to it?

Personally I haven't really used js pretty much at all, but I want to start using it in the future if I can

[–]ColetteFeetFan 17 points18 points  (2 children)

It's a superset of JS and compiles into JS. Every JS program is a valid TS program too.

Also, TS has some QoL features like nullish coalescing and null-safety operators. As a Python dev i love it and I'm doing a vue-ts project right now

[–]Tubthumper8 11 points12 points  (1 child)

Also, TS has some QoL features like nullish coalescing and null-safety operators.

FYI these are JavaScript features, not exclusive to TypeScript:

[–]ColetteFeetFan 1 point2 points  (0 children)

Good to know! Thank you for correcting me.

[–]weshuiz13[S] 5 points6 points  (0 children)

Yes it is basicly a js addon you use in node It's just a dev tool it will get compiled to vanilla js at the end

[–]adamMatthews 2 points3 points  (0 children)

It's basically just JavaScript, but with some type checks at build time.

So things that would be runtime bugs/crashes (get picked up by a tester/user) become compile-time errors (get picked up by the developer).

But TypeScript is very configurable. You can turn all the rules off and turn it back into JavaScript, or add extra rules to make it stricter. Many rules will require extra syntax all over your code, making it look slightly differnet to JavaScript, but they are all optional. So you can decide on a sliding scale how strict you want your checks to be when compiling.

[–]Ok_Detective5953 6 points7 points  (8 children)

It’s a JavaScript superset that looks a lot like C# (even made by the same guy Anders Hejlsberg)

I’d recommend Google or Bing if you’d like to learn more. Very helpful in answering questions like this

— edit —

To be a bit clearer, anything JS can be used for so can TypeScript. That’s because TS is converted to JS and then run in the browser or a JS environment as normal JS.

[–]RevanchistVakarian 2 points3 points  (0 children)

Anders Hejlsberg is the best language designer of all time, change my mind

[–]dimittrikovk2 -4 points-3 points  (6 children)

Id rather get the opinion of users rather than the "corporate description", which is half the time just vague bullshit

Thanks for the comment, but I use DuckDuckGo or Startpage

[–]Ok_Detective5953 3 points4 points  (3 children)

Wikipedia does a decent job of being descriptive, and there’s several good websites out there explaining TypeScript that DuckDuckGo can find for you.

Never hurts to run a quick search, then ask more detailed questions on something like Reddit or even Quora.

[–]WeleaseBwianThrow 0 points1 point  (1 child)

Jesus dude, its a reasonable question asked in a reasonable way. If you felt it was beneath you to answer it and they should be googling it anyway, why respond?

These answers were more about securing your own sense of self-worth than anything else.

[–]Ok_Detective5953 2 points3 points  (0 children)

Sometimes people forget that you can, and should, look things up on your own. It doesn’t hurt to suggest answering your own questions via Googling.

Everyone who programs learns this too. Especially if you go into it as a career. When a junior asks a lot of Google-able questions they get bad performance reviews and/or scolded for not doing that first by more senior teammates.

So I don’t think it’s unreasonable to suggest that someone tries that, in addition to giving them a brief answer to the question.

[–]dimittrikovk2 -1 points0 points  (0 children)

Thanks for reminding me why I left this sub on my first account. Really appreciate it

[–]burnblue 0 points1 point  (0 children)

The opinion of users can be found on the internet, via search engines. If you want to learn you use the search engine that finds you the types of results you want. Less sophisticated ones than Google give higher precedence to the "corporate" result

[–]CorruptedStudiosEnt 0 points1 point  (0 children)

I hate Google and Bing, but they're borderline necessary for coding because of their significantly better search algorithms when it comes to more niche things. DDG most often led to me taking about five times longer to find the same information that would be on the first page of Google on my first search.

Also, just to be clear, these questions have usually been asked tens or even hundreds of times across various communities.

If you don't want the broad corporate description, literally just type the name of community sites you'd expect to see the question on at the end of your search. Stack Overflow, Reddit, whatever. Then you're still getting user opinion without being the nth person to ask a question that's probably been asked plenty of times.

[–]MirageTF2 1 point2 points  (0 children)

OK but hear me out here

JSX TSX

sorry that was my inner React calling

[–]HaaaaaammmGurl 1 point2 points  (0 children)

I will admit TypeScript is a lovely shade of lipstick, if you admit you're still putting it on a pig.

[–]Natalia-1997 1 point2 points  (0 children)

Me, but with Estrogen instead

[–]Mrblob85 1 point2 points  (0 children)

TS is a poor man’s statically typed language.

[–]__n01z3 7 points8 points  (8 children)

(For those who are downvoting or are considering downvoting, I’m writing about my personal experience.)

The moment you jump in the TS bandwagon, you will become tied to type definitions and your project will be depending on TS evolution instead of the standard JS spec.

You will go on a witch hunt for typing errors just to find out that the problem doesn’t lie in your project… some type definitions were just wrong.

To work properly you will want to define types for all project dependencies and APIs. You will end up in a sort StarCraft Zerg creep where everything must be typed to work correctly.

In the end, you will discover what you really needed was simply to write some tests…

[–]Sokaron 8 points9 points  (2 children)

where everything must be typed to work correctly.

codebase goals tbh

what you really needed was simply to write some tests…

no reason to not have both (typing and tests)

[–]rotateReality 0 points1 point  (0 children)

This... I'm definitely on the TS bandwagon, but it's not without its drawbacks. Your code throwing or not even compiling because a type lib hasn't been updated is a (albeit short-lived) pain in the ass.

Its still better than pure JS, though.

[–]Arktuos 0 points1 point  (2 children)

I'm curious how in-depth your experience goes. This is sorta my opinion of the Rust borrow checker, but I'm nearly positive it's because of my lack of extensive experience. Typescript, on the other hand, has saved me actual months of time on large projects, but I've been working with it for 5 or 6 years, and I worked with C# for years before that, so the design philosophy is pretty familiar to me.

I'm asking because this sounds like it might be that you spent years in dynamically typed languages and are just discovering static typing. Similar to my thoughts on borrow checking and lifetimes; I think this is an opinion primarily driven by discomfort and/or ignorance rather than fact. I'm relatively sure every typescript build is backwards compatible, and while I do run into the occasional mistyping in a library, it's A) quick to debug and fix, and B) not nearly as frequent as actual logic bugs in a library, which are more dangerous, IMO.

[–]Architektual 7 points8 points  (3 children)

My new job is in typescript, and I don't like it.

[–]Zephit0s 4 points5 points  (1 child)

Learn to love it, it's amazing

[–]Architektual 2 points3 points  (0 children)

So is JavaScript, I love it

[–]Slavichh 0 points1 point  (0 children)

Just ‘rm -rf .’

[–]Jacob_C 2 points3 points  (1 child)

TS isn't amazing as a language but it makes it possible to write JavaScript without becoming an alcoholic or jumping in front of a train. I'm 100% with you, TS is a god send.

[–]aeropl3b 0 points1 point  (0 children)

Came here for this!

[–]iiMoe 1 point2 points  (0 children)

I don't understand the hype about it it reminds me of c# but for the web so idk IMO i only admit it's cool to have types annotations

[–]Samuel_Vicente 0 points1 point  (2 children)

Ts still sound stupid for me like I have to explain to it what I’m doing and it will prompt some weird ass error message then I will have to go around wasting my time to solve something that wouldn’t fuck my code but I’m too afraid to use //ts ignore

[–]redacted_4_security 1 point2 points  (1 child)

This is a valid argument if you are the only one who will ever touch the code and the project is small enough you can easily keep a mental map of everything it's doing.

I spent the first 5 years of my career primarily working in plain JS, then I spent a long time on .NET projects working with C#. There were a lot of "grass is greener" moments in both cases. Now I've been doing projects with TS for a couple years and it honestly feels like the perfect combination of both worlds.

Everybody is welcome to their own opinions, but at this point I would never willing go back to vanilla JS.

[–]Samuel_Vicente 0 points1 point  (0 children)

Makes sense, I also can’t go back to JS I feel like TS makes my code looks more professional/cool

[–]pinnsvin0 0 points1 point  (2 children)

Bruh, Typescript is useless bloat, that just consumes additional energy to compile itself to JS. That thing just takes whole JS neatiness of being instantly ready to run on a browser, without any compliation. If we really want to use statically typed language, we just should invest more in WASM.:4549:

[–]tLxVGt -1 points0 points  (6 children)

One dev forced us to use TS in the project.

The only thing that changed: (e as any).method()

[–]jjman72 11 points12 points  (3 children)

I can honestly say, then you are using it wrong.

[–]Zephit0s 1 point2 points  (2 children)

why are you getting downvoted

[–]jjman72 1 point2 points  (0 children)

Lots of people using TypeScript wrong I guess. lol

[–]SK1Y101 0 points1 point  (0 children)

Typescript is really quite nice

[–]Adam-Kay- 0 points1 point  (0 children)

I don’t think I’ve ever even heard of TypeScript before

[–]ManiacsThriftJewels 0 points1 point  (6 children)

tries to use something that's part of a JavaScript object that TS doesn't know about yet

(a.k.a. the number of driving times I've had to $!##& cast window or document to any)

I guess the biscuit bit back?

[–]xroalx 1 point2 points  (5 children)

If you're casting window or document to any, you're doing it wrong.

If you have something attached to those objects outside of your code, you can always just create a declaration file or enhance the interfaces.

[–]ManiacsThriftJewels 1 point2 points  (4 children)

I mean, I know I'm doing it wrong, of course.

But still, "just". For supporting native parts of the JS interface. Can't say I'm inclined to.

[–]TokyoBanana 1 point2 points  (2 children)

Is “$” native to JavaScript or the environment you plan to have the code running in? (The browser)

E.g. $ is not in a NodeJS runtime natively.

You have to tell Typescript where you plan to run your code if you want it to help you with that.

[–]xroalx 1 point2 points  (0 children)

What parts? If you set your environment right, the window and document object will by typed properly.

[–]alkavan -1 points0 points  (0 children)

The whole point of JavaScript or any dynamic language is that you don't need to compile it (it compiles just-in-time). Compiling TS is a big overhead. So if you're okay with compiling times and related toolkits maybe better use a normal, compiled, statically typed language, that is also good for math and computation.

[–]PhatOofxD 0 points1 point  (0 children)

Typescript is honestly one of the nicest languages to work with from a syntax perspective

[–]shinjozyro -2 points-1 points  (1 child)

I've never used JavaScript without typescript

[–]norse95 1 point2 points  (0 children)

Me too, I didn’t even realize “any” was bad practice for a while

[–]kacchalimbu007 -1 points0 points  (0 children)

Ts or bootstrap which to used?

[–]PaladinHL -1 points0 points  (0 children)

"TS is love, TS is life."

[–]Flames_Ignited89 0 points1 point  (0 children)

I wonder how to "chance" your mind

[–]king_ragnar00 0 points1 point  (0 children)

I will try

[–]YouGotTangoed 0 points1 point  (0 children)

Should have used TypeScript on your title

[–]Cley_Faye 0 points1 point  (0 children)

Not lives, but… yeah. Anything that can catch a ton of common mistakes without adding a huge overhead is welcome.

[–]narrei 0 points1 point  (0 children)

with this meme i give it a go on my next project

[–]lentilsmeme 0 points1 point  (0 children)

I love using it….But it is so ugly and verbose 😞

[–]I_am_Ravs 0 points1 point  (0 children)

this why my friends and I call TS the Anti-JavaScript 😆

[–]SnappGamez 0 points1 point  (0 children)

optional static typing is king.

static typing for most situations, dynamic typing when its useful.

[–]Blingbike97 0 points1 point  (0 children)

I was the same with JavaScript.

[–]Saith_Cassus 0 points1 point  (0 children)

I don’t hate TS…. I hate that the other devs create hyper convoluted types that I have to tap dance around. Like, dude, why are there 17 layers to this type when “data” is the only property that anyone gives a shit about? Just Lemme use a partial!

[–]stylusrose 0 points1 point  (0 children)

Once they make a language that compiles itself into TypeScript, I will consider it.

[–]RoyalCultural 0 points1 point  (0 children)

Big boy code

[–]puma271 0 points1 point  (0 children)

Relatable

[–]nocivo 0 points1 point  (0 children)

O still hate building javascript apps. Even worse have to build backend apps :/

[–]korokd 0 points1 point  (0 children)

After working with Elm, TypeScript is the bare minimum.

[–]ZyanCarl 0 points1 point  (0 children)

Only for the part where you use types in intellisense…the part you go back and write types sucks

[–]PuzzleheadedSector2 0 points1 point  (0 children)

Are typos in titles just a reddit tradition at this point?

[–]planetixin 0 points1 point  (0 children)

How am I going to "chance" your mind? Throw a dice in your head or something?

[–]GGsparta 0 points1 point  (0 children)

I've been playing with TS for 2 months, and I can safely say that that I don't like web programming. TS is okay, like better than anything else in the web domain but I'm still waiting for the day all of this stuff will be as stable as software programming. Among JS TS Php C C++ Java Shell PS and C# the one I prefer is C#.

But yeah, if you're programming crossplatform webapps, TS actually saves lives