holochain-open-dev / holoom

Tools for weaving blockchain data into holochain
1 stars 1 forks source link

Automate TS type generation #23

Open 8e8b2c opened 1 week ago

8e8b2c commented 1 week ago

Currently all types defined in packages/client were created by hand. In principle this step could be automated to reduce the risk of these types getting out of sync.

This guide indicates an option that seems worth explorering: https://imfeld.dev/writing/generating_typescript_types_from_rust

I've experimented with it briefly, and the main pain-point seems to be that the current rust structs/enums incorporate external crates such as alloy_primitives::Signature which we either need to wrap or substitute in order to support JsonSchema derivations.

8e8b2c commented 1 week ago

Aforementioned experiment: https://github.com/holochain-open-dev/holoom/tree/8e8b2c/ts-gen-experiment

8e8b2c commented 21 hours ago

At the same time, TS types should go into a shared npm module to fix the reduplication that has occurred in the other various packages