.d.ts in wasm32-unknown-unknown builds

  1. What part of Rust -> wasm32 generates the *.d.ts files ?

  2. What are the guides on controlling what goes into *.d.ts ?

  3. For situations where I'm doing Rust -> wasm32 + scripting in TypeScript, any good guides on tips/tricks for *.d.ts ?

Wasm-bindgen is responsible for generating the .d.ts files. You can use #[wasm_bindgen(skip_typescript)], #[wasm_bindgen(typescript_custom_section)] for custom typescript interfaces and #[wasm_bindgen(typescript_type = "...")] to control the typescript interfaces.

1 Like