Closed DanielRosenwasser closed 6 years ago
That's a good point, thank you Daniel!
Another thought I had - perhaps creating a Proxy object and wrapping the function with this Proxy will allow to actually detect the argument types in runtime?
The dts-gen solution sounds easier to start with though.
@DanielRosenwasser great suggestion, i'll have a stab at it
Just as a heads up, dts-gen uses a package called dts-dom which is also another handy utility you can use for building up declarations. 😃
While 'Function' is very general, it's problematic in some ways because it's not assignable back to types with more general call signatures like
(...args: any[]) => any
.You can probably take some inspiration from how dts-gen determines arity for function to improve things here.