The interface between WASM and JS is limited to native types that WASM supports which is just integers [0] (and maybe doubles?). With that limited API you cannot pass full structures around, the best you can do is pass what are essentially pointers to memory around [1].
[0] - https://developer.mozilla.org/en-US/docs/WebAssembly/Underst...
[1] - https://becominghuman.ai/passing-and-returning-webassembly-a...