ran into this writing a declaration for Ramda applySpec.
type Func<T> = (...args: any[]) => T;
type Spec<T> = {
[P in keyof T]: Func<T[P]> | Spec<T[P]> ;
};
/**
* Given a spec object recursively mapping properties to functions, creates a function
* producing an object of the same structure, by mapping each property to the result
* of calling its associated function with the supplied arguments.
*/
declare function applySpec<T>(obj: Spec<T>): (...args: any[]) => T;
var g1 = R.applySpec({
sum: (a) => 3,
nested: {
mul: (b) => "n"
}
});
// Expected:
// g1: {sum: number; nested: { mul: string; }};
// Actual:
// g1: {sum: number; nested: { mul: (a)=>string; }};
ran into this writing a declaration for Ramda applySpec.