I am a beginner in node.js and try to understand this github repo, but I do have a question. I am looking at this file and I try to translate it to node.js and run it on my pc. In this file there is this import statement:

import { BalancerFlashLoan, BalancerFlashLoan__factory } from "../../typechain";

By running my file I get the error:

An unexpected error occurred:

Error: Cannot find module '../typechain'

This folder does not exist and is not created during compilation. Where does it come from? Can this be an issue of transforming from typescript to javascript? If yes, how can I solve this one?

I am very thankful if someone can answer this for me. Thank you very much!

Best regards Daniel

1 Answer 1



Just a quick tip for you. When you run into issues like these, you may want to drop some of what you're stuck on into a search engine. In this case, putting the word 'typechain' into a search engine may have already answered everything for you. Since we're already here, though, I'll spell it out.

You're on the right track - Typechain is indeed a Typescript thing, and won't work in a JS environment. Cleaning up the repo you're using to work with JS instead of Typescript would be quite a chore, since all of the scripts and tests are in TS instead of JS. In theory, you would need to change the file extensions, clear out anything that's TS-specific in any of those files (including imports of Typechain), take out any TS-specific packages from the package.json.

Depending on your needs, it may be easier to work with the repo as-is, and modify what you want to modify. There will obviously be a learning curve with any of the TS parts, but imho will likely be less time (and more constructive) than trying to clear out the TS.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.