What is the best way to design recursive types in the wit file? I think there is a proposal coming soon
This issue discusses a couple of workarounds: index-based and resource-based.
Nice this is awesome perfect.
I have a tangential question but is it possible to have a resource defined in a record type to be then used as an input to export function?
What do you mean by a resource defined in a record type? Can you give an example?
If you're wondering whether you can export a function that has a parameter whose type is that of an exported resource (or that of a record that has a field whose type is that of an exported resource, etc.), then yes, that should work fine.
Oh nice! I
was mostly wondering about an export function which parameter is an imported type or contains one.
I guess I have a similar use case as the one described in the link but would love to do all my serde processesing in the host(using the resource hack)
Yeah, exported functions should be able to refer to imported types, but not the other way around: https://github.com/WebAssembly/component-model/issues/272
Last updated: Dec 06 2025 at 06:05 UTC