I made tooling to easily call Zig and generally include Zig code in TypeScript projects, both native and Wasm targets. Still a lot of work left to do with marshalling different types, but the API is starting to look pretty nice:
It’s a bit similar to Zigar mentioned here earlier but much lighter, provides static typing for Zig functions on TS side and doesn’t hide the Zig build config.
Hey! Sorry I found this project late. I’ve been doing a parallel effort to bind zig to typescript. I took the no brain method of converting a zig type to a JSON string and doing a JSON.parse on the frontend and vice-versa to communicate - then just did a zig script to generate a .d.ts file telling Typescript what to expect out of the JSON string. It’s not a fast method by any means … the only optimization is when zig finds a type that could be represented as a TypedArray, it just passes the slice info for Typescript to find manually from the Wasm memory.
It would definitely be awesome if there was some way to build up an interface in Typescript for pulling data from deep struct hierarchies in zig/wasm memory without basically cloning the whole structure… But probably a lot of work.