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

What the suffix meaning (bg) with _bg.js and _bg.d.ts when we built into pkg folder? #2290

Closed
sombochea opened this issue Aug 20, 2020 · 1 comment
Labels

Comments

@sombochea
Copy link

sombochea commented Aug 20, 2020

Summary

I so wonder about the built files in pkg folder. Because the files end with _bg.js and _bg.d.ts has defined different methods with parameter(s) when we return the method as String. But I don't know, why it's happened like that.

Additional Details

Note* I'm replaced the JavaScript to TypeScript! (not pkg files) and only file that have suffix _bg.d.ts that wrong export functions.

The function that have return String value

#[wasm_bindgen]
pub fn sample() -> String {
    "hello".into()
}

The function export in TypeScript

export function sample(a: number): void;

As that, I cannot return the value into output in JavaScript. I think, it can be cause by rust wasm or mis-configuration or something else.

Thank you!

@alexcrichton
Copy link
Contributor

"bg" stands for "bindgen" here, and they're intended to be internal files generated by wasm-bindgen for your project.

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