I’ve seen this same thing happen with Python’s type hints. Turns out giving an “escape hatch” type for devs who have no clue what the type actually is leads to a lot of useless type hints.
the myth of type safety
Submitted 11 months ago by Zangoose@lemmy.world to programmer_humor@programming.dev
https://lemmy.world/pictrs/image/eeebc53c-069d-4c09-8a6b-61e9e8a42760.jpeg
Comments
Anders429@programming.dev 11 months ago
Knusper@feddit.de 11 months ago
Yeah, it’s especially bad, when a library doesn’t provide type hints itself. It can be comically difficult to find out what the return type of a function is, because every if-else-branch might have a different return value, so you may need to read the function body in full to figure out what the type might be.
Add to that, that lots of the tooling around type hints isn’t as fleshed out / useful as it is in fully typed languages and I can definitely understand why someone might not immediately feel like it’s a valuable use of their time.
Lowpast@lemmy.world 11 months ago
Sounds like you don’t know how to properly use TypeScript…
Zangoose@lemmy.world 11 months ago
If I had the willpower or time to go through a multi-thousand line (not including the html templates) legacy Angular 6 codebase where almost every property is typed ‘any’ then I assure you I would have, it’s driving me insane 🙃, also why I prefer backend
0xSim@fedia.io 11 months ago
The boy scout technique: fix your types when you're working on a bug or a feature, one file at a time. Also try to use
unknown
instead ofany
for more sensitive parts, it will force you to typecheck.roadrunner_ex@lemmy.ca 11 months ago
I kinda feel your pain. A project that I helped launch is written in Typescript technically, but the actual on-the-ground developers were averse to using type safety, so
any
is used everywhere. So, it becomes worst of both worlds, and the code is a mess (I don’t have authority in the project anymore, and wouldn’t touch it even if I could).I’m also annoyed at some level because some of the devs are pretty junior, and I fear they are going to go forward thinking Typescript or type safety in general is bad, which hurts my type-safety-loving-soul
walter_wiggles@lemmy.nz 11 months ago
Print the code out and burn it