this post was submitted on 28 Dec 2025
396 points (95.6% liked)
Programmer Humor
33524 readers
884 users here now
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
- If the mod doesn't find it funny, you're banned. Ha-ha!... For real: do not use the community for "statements". There are other places for such content. Keep it chill and funny.
founded 3 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Typescript literally doesn't work though, every large system has some JavaScript interface somewhere and the "any" type propagates through the system because there's no type safety at runtime
Fuck them both to death
Don't use any, and figure out any interfaces or types you don't have. Have a modocum of discipline to add the compile time safety
JavaScript introduces it, if it uses typescript code you lose all type safety
I add a lint rule to prevent using the
anytype. Solves the problemSo, not a language win after all?
Javascript is shit because it was never intended to be a serious language, but it's (realistically) the only language in browsers so it's everywhere. So there's necessarily a LOT of tooling to make it suck less. The current generation of tooling is starting to get kinda good, like Bun, Deno, Vite, Biome etc, but it's still a mess of competing standards, where other languages give you standards and simplicity for free.
I don’t understand how this would happen. If the any type truly “propagates through the system”, that means you’re passing around a variable of which you say, “I don’t know what this is. You deal with it.” How can you do any meaningful operations on it when you don’t know the type?
You write your typescript code to expect a given type but at the end of the day it's JavaScript with a type checking compiler so when "'any" gets in through a library or interface somewhere you just get a random "undefined" somewhere when you try to perform an operation with it because it's just JavaScript at the end of the day
What you’re describing is not really an ‘any’ type in the code but garbage data. No language is going to save you if you read a file expecting a character but it’s actually an int.
Think of it like Haskell's
castfrom theTypeableclass.Yes, if somebody sends random stuff, you'll have to handle a failure, or do the equivalent of returning
undefined, what is way easier than properly handling it in TS. What you do from there is up to you.No the problem is that there's literally nothing at runtime stopping JavaScript inserting any type it wants into your function that only takes an int for example
There are plenty of libraries to provide type safety at runtime.
I wouldn't make a typescript repo. But every single one I've had to work on has had the same problem