Type error: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'
See original GitHub issueHi! 👋
Firstly, thanks for your work on this project! 🙂
I got this error from typescript while creating build version of nextjs. ( I am using 5.5.1
version of ethers on Ubuntu 20.04 LTS )
npm run build
> build
> next build
./node_modules/ethers/src.ts/ethers.ts:96:5
Type error: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.
94 | // Types
95 |
> 96 | ContractFunction,
| ^
97 | ContractReceipt,
98 | ContractTransaction,
99 | Event,
info - Checking validity of types
And here is the diff that solved my problem:
diff --git a/node_modules/ethers/src.ts/ethers.ts b/node_modules/ethers/src.ts/ethers.ts
index f192c6d..899f802 100644
--- a/node_modules/ethers/src.ts/ethers.ts
+++ b/node_modules/ethers/src.ts/ethers.ts
@@ -58,7 +58,7 @@
-export {
+export type {
Signer,
Wallet,
diff --git a/node_modules/ethers/src.ts/index.ts b/node_modules/ethers/src.ts/index.ts
index b1071dd..1622084 100644
--- a/node_modules/ethers/src.ts/index.ts
+++ b/node_modules/ethers/src.ts/index.ts
@@ -14,7 +14,7 @@
-export {
+export type {
Signer,
Wallet,
diff --git a/node_modules/ethers/src.ts/utils.ts b/node_modules/ethers/src.ts/utils.ts
index 7a4de87..e8f32e4 100644
--- a/node_modules/ethers/src.ts/utils.ts
+++ b/node_modules/ethers/src.ts/utils.ts
-export {
+export type {
AbiCoder,
defaultAbiCoder,
This issue body was partially generated by patch-package.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
isolatedModules refusing to export a type created in the same ...
Actual behavior: Transpile is rejected with error: Cannot re-export a type when the '--isolatedModules' flag is provided.
Read more >Cannot re-export a type when using the --isolatedModules ...
TS 3.8+. You can use type-only imports and exports with --isolatedModules : // types.ts export type MyType = { a: string; b: number;...
Read more >isolatedmodules' flag is provided requires using 'export type'
Re -exporting a type when the '--isolatedModules' flag is provided requires using 'export ... You just need to use this syntax when re-exporting...
Read more >isolatedModules - TSConfig Option - TypeScript
Exports of Non-Value Identifiers. In TypeScript, you can import a type and then subsequently export it: ts. import { someType , someFunction }...
Read more >Re exporting a type when the isolatedModules flag is provided ...
'Re exporting a type when the isolatedModules flag is provided requires using export type. So far so good and that works without the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
OK, thank you for the help.
You might need to ping Hardhat for this problem. I don’t think it’s anything ethers can solve. 😒