I'm trying to preserve the type information of arguments to a callback, where the callback is a generic:
function Foo<Template>(argument: Template) {
// Do something with argument
}
function Bar(callback: Function) {
callback('something')
}
let x = Bar( Foo<String> )
This does not look like valid typescript syntax. Any way to do this?
let x = Bar(Foo)
, but I'm not exactly sure what you're trying to accomplish. The functionFoo
takes a generic type parameter but it doesn't have to, since it's not doing anything special with it. AndBar
doesn't seem to care what kind of function it takes. Maybe you could flesh out the example with some more motivating use cases?