Here is what I am trying to do:
import * as R from 'fp-ts/lib/Record';
type Ex<T extends Record<string, unknown>> = { [K in keyof T]: (n: number) => T[K] };
const f =
<T extends Record<string, unknown>>(ex: Ex<T>) =>
(n: number): T =>
pipe(
ex,
R.map((e) => e(n)),
);
The problem is, I get:
Type 'keyof T' is not assignable to type 'string'.
Type 'string | number | symbol' is not assignable to type 'string'.
Type 'number' is not assignable to type 'string'.ts(2345)
If this were a monad, I could use Apply.sequenceS, but I don’t know to do the equivalent thing when it’s a simple function.