|
|
|
|
|
by Nevermark
596 days ago
|
|
When someone gives you a truly completely unconstrained object, what they hand you is “unknown”. You don’t even know how to query it to find anything out about it. But you could pass it to someone else. When someone asks you for a completely unconstrained object, the type is “any”. It’s technically the same type from two perspectives. (Not saying this extreme version of the concepts are how they are implemented. Never had a chance to use such types before.) |
|
1. As a nit-pick "unconstrained object" is not best modeled by `unknown` because that includes non-objects as well, there's better types to use for that
2. Someone asking you for any unconstrained data would also be `unknown`
`any` is not a type at all, it is an annotation to disable the type system