wasm-bindgen icon indicating copy to clipboard operation
wasm-bindgen copied to clipboard

Supporting using `readonly` attribute on `struct`

Open Chaoses-Ib opened this issue 3 months ago • 1 comments

#151 added support for using readonly attribute on fields. But when using it on a struct it'll be ignored and emit a "unused variable" warning. Is it possible to support using readonly attribute on struct too? This can make the code clearer to read if there are many readonly fields.

Chaoses-Ib avatar Oct 18 '25 09:10 Chaoses-Ib

You mean to use readonly on the struct, and then only generate getters for all the public fields, right? That sounds reasonable.

Spxg avatar Oct 31 '25 08:10 Spxg