Yep your points are correct, If the function expect a Type we should construct a type and pass it…
Vladimir Gorej

Your function is not pure because the window object is mutable. Shared mutable state is a major source of coupling, and in JS, the window object literally is the global object.

Your function is also coupled to the shape of the object you pass to it. Instead of taking the window object, could your function take separate parameters, which are then passed to the function independent of the window object (or any other object)?