I'm trying to figure out how Record<string, unknown> works. On the whole I don't understand how assignability to Record<string, unknown> works, because it seems to center around whether TS decides to magically add an unwritten index signature or not.
Experimenting with Record<string, unknown>, it seems to accept objects that are defined as type aliases, but not objects that are defined as interfaces. (It also doesn't accept classes, I presume because those are interfaces.) That's unfortunate because it makes it very hard to guess how it will interact with 3p types, let alone my own, since simple aliases and interfaces are otherwise interchangeable in many ways.
More specifically, I'm trying to get a type that means "An object, but not an array or function" (object allows those other types) and was hoping Record<string, unknown> would work. Is there any decent type to use for that?
The Playground lets you write TypeScript or JavaScript online in a safe and sharable way.