Sure, there's many other ways to type it, but none adds any kind of additional safety or strictness over Record<any, any> which was my point that `any` is the correct type in many cases, except when it widens a type.
But in my case it's not widening anything, in Record<A, B>, B can already be `any`thing.
People tend to see it as an unsafe escape hatch (which is how it is abused), but it's just a set of all possible types.
I know it's not equivalent, it was just an example to show what `any` does (and that it's more than "just a set of all possible types").
The `T extends Record<any, any>` on line 11 is a type parameter constraint though. Are you referring to something else when you say "constraining the type"?
'any' has always been intended as an escape hatch, so no abuse here [1]. The type representing the set of all possible values (the top type in the type lattice) is 'unknown'.
The widest possible function type is `(...args: never) => unknown`. This is because parameters are contravariant, and `never` is the bottom type. Using that type works in the author's example[0].
I've got an issue open about TypeScript's provided `ReturnType` type which is somewhat related to this[1].
That was the tipping point in transition from "we are serious and use static typing instead of lame JavaScript" into "ok we lost control over this thing".
Playground with example here: https://tinyurl.com/5ahs366a