call js file generated with wasm in javascript

Calling generated JS file in JavaScript but always getting this

function getalldata() { wasm.getalldata(); }

not the actual data

Here is what index.js looks like:

import { getalldata } from './pkg';
document.write(getalldata);

This is what lib.rs

#[wasm_bindgen]
#[derive(Debug, Serialize, Deserialize)]
struct Turbo {
....
}

#[wasm_bindgen]
pub fn getalldata() {

    .....

}