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

Typescript definition not generated for string enums #2153

Open
Vlad-Shcherbina opened this issue May 25, 2020 · 1 comment · Fixed by #4147
Open

Typescript definition not generated for string enums #2153

Vlad-Shcherbina opened this issue May 25, 2020 · 1 comment · Fixed by #4147
Labels

Comments

@Vlad-Shcherbina
Copy link
Contributor

To reproduce

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

Expected Behavior

export type Hand = 'Left' | 'Right';

export function f(h: Hand): Hand;

Actual Behavior

/**
* @param {any} h 
* @returns {any} 
*/
export function f(h: any): any;

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!

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