I have the following TS code:
type FunctionMap = Record<
string,
(...params: any) => any
>
function needsARecordOfFunctions(functions: FunctionMap) {
/* ... */
}
needsARecordOfFunctions({ myFunc: 'foobar' }); // Type 'string' is not assignable to type '(...params: any) => any'.
needsARecordOfFunctions(); // Expected 1 arguments, but got 0.
needsARecordOfFunctions({ myFunc: () => {} }); // ✅
// This passes but I want it to fail
needsARecordOfFunctions({});
My question is, how can I get needsARecordOfFunctions({}) to fail with a type error in the above code? I would like to define a record type that, well, has at least one record defined in it.