Skip to content

Typescript enum definitions are not used in function signatures #2154

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

Closed
Vlad-Shcherbina opened this issue May 25, 2020 · 4 comments · Fixed by #3647
Closed

Typescript enum definitions are not used in function signatures #2154

Vlad-Shcherbina opened this issue May 25, 2020 · 4 comments · Fixed by #3647
Labels

Comments

@Vlad-Shcherbina
Copy link
Contributor

To reproduce

  1. Run wasm-bindgen --target web on the wasm generated from the following library:
    use wasm_bindgen::prelude::*;
    
    #[wasm_bindgen]
    pub enum Hand {
        Left = 0,
        Righ = 1,
    }
    
    #[wasm_bindgen]
    pub fn f(h: Hand) -> Hand { h }
  2. Inspect generated .d.ts

Expected result

export enum Hand {
  Left,
  Righ,
}

export function f(h: Hand): Hand;

Actual result

export enum Hand {
  Left,
  Righ,
}

export function f(h: number): number;

Version info

wasm-bindgen 0.2.62

@alexcrichton
Copy link
Contributor

I unfortunately don't have the time to implement a new feature like this, but a PR would be much appreciated!

@ChristianIvicevic
Copy link
Contributor

I unfortunately don't have the time to implement a new feature like this, but a PR would be much appreciated!

The requested feature is really nice to have but the PR opened 3.5 years ago is stale. What are the chances that you pick up the work on this feature? Sadly I can't personally contribute myself.

@daxpedda
Copy link
Collaborator

I'm not aware of any current maintainer wanting to implement this.
But I'm happy to review a potential PR.

@ChristianIvicevic
Copy link
Contributor

@daxpedda I just opened a PR that is ready to be reviewed :)

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

Successfully merging a pull request may close this issue.

4 participants