node-bindgen
node-bindgen copied to clipboard
Feature Request: Generate d.ts definitions
It would be great to also generate .d.ts type definitions so that we'd get TypeScript compile time checking against the native library too.
Thank you for this library, it's great!
You are welcome. Yes, it seems like typescript integration will be valuable
This task is a bit of work (not a bad thing). I think there's a couple main things about this that are nontrivial but we will want:
- configuring the output directory (and whatever things the generations will in the future support). The setup for generated definiton output should be similar to cbindgen and rust-bindgen.
- How do we find the things to generate the typescript bindings for? We will probably want to do something like how cbindgen parses the entire crate, module, and submodules looking for things that are prefixed with
externbut in our case, we'd need to look for thenode_bindgenproc macro (I think this can be done) in our case. - Generating the docstring in the typescript shouldn't be too hard once we get the ladder of these.
- Maybe we'd want module support for things? In the fluvio-client-node project for example, maybe we'd want
consumer.rsto have aconsumer.d.tsand forproducer.rsto have aproducer.d.tsor something. This would obviously be a low priority feature.