ethers.js
ethers.js copied to clipboard
Why is `CommunityResourceable` not exported?
Describe the Feature
Currently, the CommunityResourceable export is not exported - it is commented out.
How come?
Un-commenting CommunityResourceable would allow alchemy-sdk to remove an old, unsupported dependency.
Code Example
export type {
CommunityResourcable
} from "./community.js";
That is weird. I’m not sure why I removed it.
I’ll track down the commit history, but I certainly have no issue exporting it in the next minor bump.
I just noticed - the export is, in fact, misspelled! It should be CommunityResourceable, not CommunityResourcable.
Quick update - I think I understand why this interface was commented out. Even after exporting it from providers/index.ts and ethers.ts, it just won't import for some reason. Live replit link using my patched version of ethers. Until this is actually fixed and CommunityResourceable becomes a valid import, could I trouble you to remove the minor-bump label? Thanks!
I don’t have a replit account, so I can’t see the link.
what is the error you get when trying to import it? Are you exporting it as a type and importing it as a type?
Both
import { CommunityResourceable } from "ethers";
and
import type { CommunityResourceable } from "ethers";
Don't work :(
(installed using `npm install github:aaronzshey/ethers.js)
It is exported as a type! Here and here
This is quite strange, because importing other types, such as Networkish or WebSocketLike doesn't work.
Oh! After making the changes are you updating the dist files for both cjs and esm for your tests? npm run build-clean should build what you need. Can you check the imported files that it is present there?
What's really strange is that npm run build was working fine for me earlier. But after updating src.ts/ethers.ts, it stopped working and I would get these errors:
node_modules/@types/node/globals.d.ts(385,15): error TS2300: Duplicate identifier 'Response'.
node_modules/@types/node/globals.d.ts(386,9): error TS2300: Duplicate identifier 'Response'.
node_modules/@types/node/globals.d.ts(399,15): error TS2300: Duplicate identifier 'Headers'.
node_modules/@types/node/globals.d.ts(400,9): error TS2300: Duplicate identifier 'Headers'.
src.ts/utils/geturl-browser.ts(9,11): error TS2300: Duplicate identifier 'Headers'.
src.ts/utils/geturl-browser.ts(14,11): error TS2300: Duplicate identifier 'Response'.
src.ts/utils/geturl-browser.ts(71,13): error TS2740: Type 'Response' is missing the following properties from type 'Response': ok, type, url, redirected, and 7 more.
and then lib.commonjs and lib.esm would each only have two files: package.json and README.md. Is there a build requirement I've missed
There shouldn’t be, that I can think of. Are there any changes to the ts config? Is it using the pegged version of ts? That error certainly seems weird…
A quick diff check of the configs - doesn't look like it. I'll go through the versions right now and see if anything looks amiss.
Okay, great thought about the changes to config files. In package-lock, @types/node was bumped from 18.15.13 -> 20.14.9, probably because I just installed typescript today. I'll revert these versions and keep you updated.
Commit 21731f9 resolves #4776 - the issues were in my tsconfig files, and the @types/node version. CommunityResourceable is now present in cjs and esm, and can be imported using import { CommunityResourceable } from "ethers" or import type { CommunityResourceable } from "ethers". Looking forwards to the next minor release!
Just re-opening so I don’t forget for the next minor-bump. :)
One quick note; I will likely leave the spelling as is (sans the e), for fear it could break something.