ethers.js icon indicating copy to clipboard operation
ethers.js copied to clipboard

Why is `CommunityResourceable` not exported?

Open aaronzshey opened this issue 1 year ago • 13 comments

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";

aaronzshey avatar Jun 27 '24 01:06 aaronzshey

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.

ricmoo avatar Jun 27 '24 01:06 ricmoo

I just noticed - the export is, in fact, misspelled! It should be CommunityResourceable, not CommunityResourcable.

aaronzshey avatar Jun 27 '24 21:06 aaronzshey

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!

aaronzshey avatar Jun 27 '24 23:06 aaronzshey

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?

ricmoo avatar Jun 28 '24 00:06 ricmoo

Both

import { CommunityResourceable } from "ethers";

and

import type { CommunityResourceable } from "ethers";

Screen Shot 2024-06-27 at 5 53 06 PM Screen Shot 2024-06-27 at 5 53 33 PM

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.

aaronzshey avatar Jun 28 '24 00:06 aaronzshey

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?

ricmoo avatar Jun 28 '24 00:06 ricmoo

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

aaronzshey avatar Jun 28 '24 01:06 aaronzshey

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…

ricmoo avatar Jun 28 '24 01:06 ricmoo

Screen Shot 2024-06-27 at 6 13 33 PM

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.

aaronzshey avatar Jun 28 '24 01:06 aaronzshey

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.

aaronzshey avatar Jun 28 '24 01:06 aaronzshey

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!

aaronzshey avatar Jun 28 '24 01:06 aaronzshey

Just re-opening so I don’t forget for the next minor-bump. :)

ricmoo avatar Jun 28 '24 06:06 ricmoo

One quick note; I will likely leave the spelling as is (sans the e), for fear it could break something.

ricmoo avatar Aug 31 '24 00:08 ricmoo

Added in v6.14.0.

Thanks! :)

ricmoo avatar May 07 '25 02:05 ricmoo