-
Notifications
You must be signed in to change notification settings - Fork 365
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
Generated types are incompatible with ECMAScript modules #793
Comments
nodenext
moduleResolution
I have implemented support for this here: #799 |
@silasdavis Thank you! 👍 |
This should not be closed as long as the PR is still opened |
Merged as: #840 |
Im still running into the same issue: the Typechain command "typechain": "typechain --node16-modules --target ethers-v6 --out-dir ./src/typechain './truffle/contracts_build/contracts*/*.json'", Multiple errors with the format: src/typechain/index.ts:92:32 - error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './factories/contracts_v0.5/Owned__factory.js'?
92 export { Owned__factory } from "./factories/contracts_v0.5/Owned__factory"; Versions: "@typechain/ethers-v6": "^0.4.0",
"typechain": "^8.2.0", |
For those running into this issue, I just execute a js script that add the && node addExtensionJs.js The script command: https://github.com/dappnode/toolkit/blob/main/addExtensionJs.js |
@krzkaczor The output when --node16-modules is enabled is almost correct but is still not valid ESM code. The output includes both direct exports and rolled up exports using the The line should be Is there a way to disable the I see this is the same issue that was raised here and was supposedly fixed but I'm still seeing it use the latest typechain version Edit: I've found the problem and submitted a PR to fix here: #898 |
Hello,
when having
"module": "NodeNext"
in tsconfig.json, I get the following error:There doesn't seem to be an option to make typescript generate imports with file extensions. When I manually modify the typescript files and the extensions (
.js
or/index.js
) to all the imports the issue disappears. Is there a way to enable this? If not would be great to have the support.The repository I am working on is open-source so I can send a link if somebody would like to reproduce it.
Thank you
The text was updated successfully, but these errors were encountered: