this post was submitted on 18 Oct 2023
327 points (96.1% liked)

Programmer Humor

32563 readers
590 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] 9point6@lemmy.world 13 points 1 year ago* (last edited 1 year ago) (1 children)

Not true, in the absolute worst case, unknown is what you should be reaching for, but it's pretty rare that you can't create some kind of type to interface with JS if it's not already got types. You can even use jsdoc comments as type hints in the JS too if you own that code.

My not particularly hot hot-take: There's basically no legitimate use case for any apart from "I don't have time to type all this now, because I'm converting a massive project from JS to TS"

[–] jana@leminal.space 5 points 1 year ago (1 children)

There are some cases where any must be used instead of unknown but they usually involve generic constraints and seem more like a bug than intended behavior

[–] 9point6@lemmy.world 2 points 1 year ago

Ah you're right there, and I also agree, that feels more like a bug than by design