You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
scristobal
changed the title
Missing typescript declaration files in package.json
Missing raw wasm module typescript declaration files in package.jsonNov 13, 2022
kimwallmark
pushed a commit
to kimwallmark/rustwasm_book
that referenced
this issue
Apr 9, 2023
wasm_game_of_life_bg.js and wasm_game_of_life_bg.wasm.d.ts are now being
generated by `wasm-pack build`.
There is some additional information about these files in
rustwasm/wasm-pack#199 and
rustwasm/wasm-pack#1193 .
🐛 Bug description
When importing a NPM module generated by wasm-pack, typescript is unable to find declarations for the raw wasm module.
🤔 Expected Behavior
The file
{name_prefix}_bg.wasm.d.ts
should be included inpackage.json
so that typescript can find the types.👟 Steps to reproduce
I followed the Rust-WASM book, and published the package to NPM as described in https://rustwasm.github.io/docs/book/game-of-life/publishing-to-npm.html
In a separate project import the module from NPM and attempt to access
memory
as in the book withconst { memory } = await import('example-pkg/example-pkg_wasm_bg.wasm');
typescript is unable to find the type declarations.
🌍 Your environment
Include the relevant details of your environment.
wasm-pack version: 0.10.3
rustc version: 1.65.0 (897e37553 2022-11-02)
The text was updated successfully, but these errors were encountered: