Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing raw wasm module typescript declaration files in package.json #1193

Open
scristobal opened this issue Nov 13, 2022 · 1 comment 路 May be fixed by #1194
Open

Missing raw wasm module typescript declaration files in package.json #1193

scristobal opened this issue Nov 13, 2022 · 1 comment 路 May be fixed by #1194

Comments

@scristobal
Copy link

馃悰 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 in package.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 with

const { 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)

@scristobal scristobal linked a pull request Nov 13, 2022 that will close this issue
3 tasks
@scristobal scristobal changed the title Missing typescript declaration files in package.json Missing raw wasm module typescript declaration files in package.json Nov 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 .
@deanrumsby
Copy link

Any updates on this issue? Just ran into the problem myself trying to use a package. If there is anything I can do to help would be more than glad to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants