As a tool for composability, I have a function that takes a class constructor argument and returns a function that uses the arguments it is passed to construct an instance of the class I initially passed in.
class Thing {
constructor (metadata) { this.metadata = metadata; }
}
const A = (C) => (...a) => new C(...a);
const X = A(Thing);
When I hover over X, I want it to tell me that the function signature is essentially (metadata) => Thing. Instead, it says that the signature of X is (...a) => any. What annotations are required in order to get TypeScript (latest version) to infer the signature of X correctly?