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

Function argument names are lost in .d.ts files #1327

Closed
Vlad-Shcherbina opened this issue Mar 7, 2019 · 1 comment
Closed

Function argument names are lost in .d.ts files #1327

Vlad-Shcherbina opened this issue Mar 7, 2019 · 1 comment
Labels

Comments

@Vlad-Shcherbina
Copy link
Contributor

To reproduce:

  1. Check out the recent version:
    git clone [email protected]:rustwasm/wasm-bindgen.git
    cd wasm-bindgen
    git checkout eaaf3461
    
  2. Run without-a-bundler example:
    cd .\examples\without-a-bundler\
    cargo build --target wasm32-unknown-unknown --release
    mkdir pkg
    cargo run --manifest-path ../../crates/cli/Cargo.toml --bin wasm-bindgen -- ../../target/wasm32-unknown-unknown/release/without_a_bundler.wasm --out-dir pkg --browser
    

These commands are from build.sh, except I was running them on Windows.

  1. Examine pkg/*.d.ts files.

Expected

These files to contain meaningful function signatures like function add(a: number, b: number): number.

Actual

The file pkg/without_a_bundler_bg.d.ts is as expected.
The file pkg/without_a_bundler.d.ts, however, contains the following:

/* tslint:disable */
/**
* @returns {void} 
*/
export function main(): void;
/**
* @param {number} arg0 
* @param {number} arg1 
* @returns {number} 
*/
export function add(arg0: number, arg1: number): number;

Argument names are lost and replaced with arg0, arg1.


It is important for the latter file to contain useful function signatures, because that's the definition file that will be used by TypeScript when importing the wrapper module without_a_bundler.js.

@alexcrichton
Copy link
Contributor

Thanks for the report! I think this is a duplicate of #1129 so I'm going to close this in favor of that

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

No branches or pull requests

2 participants