2 ms·
That's fairly subjective and I can see arguments for both sides, in the above example I've gone with the approach the Typescript documentation itself gives whic
by Etheryte 5y ago
That's fairly subjective and I can see arguments for both sides, in the above example I've gone with the approach the Typescript documentation itself gives which uses any. Given the parameter is only used as an input, using any and unknown are interchangeable and there is no difference in this specific case.
- wdfx 5y agoI somewhat agree, but to me the semantics using unknown makes more sense as the function is attempting to answer a question of the input object. "What is object? I don't know. Does it meet these conditions? Yes then object is Human else not."
- Etheryte 5y agoWhile I see where you're coming from, semantic formulation like this is highly subjective. All the same the problem statement could be "Given any kind of input, tell me whether it's a Human or not".