this post was submitted on 28 Dec 2025
396 points (95.6% liked)
Programmer Humor
33550 readers
553 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
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