I'm trying to import some async-await functions from a file. However, it seems that none of the exports become visible after importing. I'm only seeing this issue with asyc-await. As far as I can see, I did the same thing with normal function and it seems to work okay.
The file I'm trying to import is helper.ts
with code like:
// some dependencies like below:
import mydriver from "driver";
const driver = mydriver.driver(
// connection settings
);
module.exports = {
myFunction: async (arg) => {
const session = driver.session();
var result = await session.writeTransaction(
// a query
);
session.close();
return result;
}
}
Then in another file I import this like:
import helper = require("./helper");
// Below line throws error
var result = helper.myFunction(arg);
The error is
Property 'myFunction' does not exist on type 'typeof "/mydirectory/helper"'