Closed
Description
Describe the Bug
After upgrading to 0.2.56, there are errors in the generated crate.d.ts (not the _bg one) that are due to invalid generated typescript.
Steps to Reproduce
- Use the https://github.com/rustwasm/wasm-pack-template or whatever to create a new project
- Insert the following test case
#[wasm_bindgen]
pub struct Foo {}
#[wasm_bindgen]
impl Foo {
pub fn test1(&mut self) -> bool {
true
}
pub fn test2(&mut self, _foo: f32) {
return;
}
}
Expected Behavior
The expected (and generated as of 0.2.55) d.ts looked like this:
export class Foo {
free(): void;
/**
* @returns {boolean}
*/
test1(): boolean;
/**
* @param {number} _foo
*/
test2(_foo: number): void;
}
Actual Behavior
When using wasm-bindgen
0.2.56 instead, the following invalid typescript is generated instead:
export class Foo {
free(): void;
/**
* @returns {bool}
*/
test1(): bool;
/**
* @param {number} this.ptr
*/
test2(this.ptr: number): void;
}
Additional Context
There might be other regressions; these are just the ones that I immediately found in my wasm project.