News for hackers. Stuff that matters.
Re:A 'CSS reset' for TypeScript, improving types for common ... by bigyikes on Friday March 03, 2023 @05:27AM (#35007862)
Here’s how I think about it, in much looser terms:

unknown = I don’t know

any = I don’t care

Often the implications are the same, but as you can intuit, any is a lot more relaxed.

Any will work anywhere because you just don’t care what the type is.

Unknown is stricter. It won’t work in cases where other types expect you to know what type you’re dealing with.

The compiler treats unknown very cautiously, whereas you can slap an any on pretty much anything.

There are no comments on this comment yet.