Ideally we should never use any, but let’s say we are migrating a legacy project to TypeScript and some degree of pragmatism is in order. Let’s consider this block of code:

to get the ball rolling with TypeScript someone probably added an any type here and it seems fairly safe as we never do anything with request in our code base that requires specification, but even in this case any is incorrect – let’s extend the code and see why.

Even when we add specification in the logic we are still not getting any issues with TS because when using any type anything is allowed. What we should do from the very beginning is use unknown, let’s see how the code reacts with this type:

TypeScript is now complaining because we are trying to spread something which it cannot infer as having a type object.
This is good because we now let our tools keep us safe as with unknown they automatically demanded we give specification, and once that specification is added – the code becomes safer.
In a nutshell, never use any because any just disables any logical inference altogether, but unknown will ask for specification when logic requires it.