I'm adding typescript type definitions to my Lua library and I've run in to bit of a block,
in Lua I pass a function to my library which returns a factory
If it was JS it would be something like this:
const Factory = Library((params) => {console.log(params.text)});
and later you would
const instance = Factory({text: "Hello world"});
instance();
I have typescript definition for the factory that requires a function arg and returns the correct class type, but I also want type definitions to work for the function's param argument.
export function Library(chunk:(params:object)=>void):(params:object)=>instance;
(The usecase would be, import the function, load it with my library, and create stuff with the factory, and I'm wondering if it's possible to make the various param objects type safe)