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

Support for methods? #39

Open
nappa85 opened this issue Nov 3, 2023 · 0 comments
Open

Support for methods? #39

nappa85 opened this issue Nov 3, 2023 · 0 comments

Comments

@nappa85
Copy link

nappa85 commented Nov 3, 2023

Probably connected to #3, let's say I have this code:

use wasm_bindgen::prelude::*;

#[derive(serde::Deserialize, tsify::Tsify)]
#[tsify(from_wasm_abi)]
pub struct Foo {
    bar: Bar,
}

#[derive(serde::Deserialize, tsify::Tsify)]
#[tsify(from_wasm_abi)]
pub struct Bar {
    inner: String,
}

#[wasm_bindgen]
impl Bar {
    pub fn foobar(self) -> bool {
        true
    }
}

#[wasm_bindgen]
pub fn foo(foo: Foo) {}

It generates this typescript:

/* tslint:disable */
/* eslint-disable */
/**
* @param {Foo} foo
*/
export function foo(foo: Foo): void;
export interface Foo {
    bar: Bar;
}

export interface Bar {
    inner: string;
}

As you can see, no trace of foobar method. Is it possible to enable methods generation?

Anyway, I can suppose that this code will result in a null pointer exception from second call to foobar, since it consumes self, and that's why I think it's related to #3

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

No branches or pull requests

1 participant