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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add type declarations for all wasm files? #49

Open
Zerebokep opened this issue Feb 9, 2024 · 5 comments
Open

Add type declarations for all wasm files? #49

Zerebokep opened this issue Feb 9, 2024 · 5 comments
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@Zerebokep
Copy link

title, https://github.com/jamsinclair/jSquash/blob/main/examples/cloudflare-worker-esm-format/src/index.js

Screenshot

PNG wasm seems to be fine.

@Zerebokep Zerebokep added the bug Something isn't working label Feb 9, 2024
@jamsinclair
Copy link
Owner

Thank you! I'll try dive in and fix these up when I can. PRs are also welcome 🙇

@jamsinclair jamsinclair added enhancement New feature or request and removed bug Something isn't working labels Mar 24, 2024
@jamsinclair
Copy link
Owner

jamsinclair commented Mar 24, 2024

Thanks for your patience. Is this affecting your usage of the modules at all?

Typing this becomes difficult as it needs to be typed for the consuming environment. There might need to be different types depending on how it's being consumed due to WebAssembly being a non-standard import. E.g. Cloudflare resolves the import directly to a WebAssembly Module but there might be other bundlers or tools where this is not the case.

I'll leave this as is for now as I don't think there's an easy work-around.

@jamsinclair jamsinclair changed the title type declarations for jpeg and webp wasm are missing Add type declartions for all wasm files Mar 24, 2024
@jamsinclair jamsinclair changed the title Add type declartions for all wasm files Add type declartions for all wasm files? Mar 24, 2024
@Zerebokep
Copy link
Author

Nope, I'll add // @ts-ignore for now.

@jamsinclair jamsinclair changed the title Add type declartions for all wasm files? Add type declarations for all wasm files? Mar 25, 2024
@dreitzner
Copy link

dreitzner commented Jul 11, 2024

This is already the case in squoosh. The types where added manually (or generated somehow)

Original commit: GoogleChromeLabs/squoosh@273b421

@jamsinclair jamsinclair added the help wanted Extra attention is needed label Jul 17, 2024
@jamsinclair
Copy link
Owner

Yes, it seems wasm-pack generates them. All Rust-based codecs should have those definitions such as:

The other codecs are generated via the Emscripten tool. Perhaps there might be a flag or tool that can be used to help generate that?

Contributions or suggestions are welcome 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants