-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Provide all exported variables from index.ts #221
Comments
This seems like it would be an awfully noisy namespace, won't it? There are also collisions, such as I will try it out in some TypeScript samples, but the way I would prefer it to work is:
I am a fairly heavy user of ethers, and usually the frequency with my use of entry points is very low; usually calling a Provider, Wallet and a Contract or two, with calls to formatEther and parseEther here and there. Everything else I generally need is available on those objects. This hierarchy is also reflected in the documentation, which will be updated this week for v4. The top level is functionality everyone often needs, at least some time. Most of the utilities and things that are somewhat buries are fairly specialized for advanced functionality. |
I'm not against namespacing, especially if there are collisions. I believe the The root of my problem is that not everything can actually be imported directly from If the problem of not everything being exposed in |
I see the problem you mean now. I will try a few things and see which feels more natural. The options, I think, seem to be to expose more of the related types in the relevant modules, or possibly having a I don't really want external things calling the constructor on TransactionResponse, for example; but maybe that is okay? I just feel usually when people try to do that, they are expecting things that the library functions fill in, and are surprised they aren't filled in. |
All I need is an interface so if I create a function that takes an ethers |
Have you tried the I'm going to close this now, but if you have issues with it, please feel free to re-open. :) |
@ricmoo Sorry for bringing this back from the dead. First off, great library, been really enjoying it so far. But I've been trying to type some of my functions, and I want to get access to various types, such as I see there used to be an |
@onethread Yupp, that’s the current recommended way if you are using the specific packages. I just checked and it looks like it isn’t exported in the umbrella package. I’ll add it for the upcoming 5.7 release. |
The missing types for EIP-712 have been added in v5.7.0. Thanks! :) |
At the moment, importing requires pulling in from a number of different sources as seen in this snippet:
It would be nice if instead I could just get all of it from
ethers
. Also note, I need theimport {} from 'ethers'
at the moment even though I don't pull anything from it because without it, TypeScript gets confused when trying to find the packagesethers/utils
andethers/providers/provider
. I think this may be a bug in TypeScript, though I don't understand it will enough to be certain.To simplify the process of exporting everything, in
index.ts
you can do the following:This will allow the user to do:
The text was updated successfully, but these errors were encountered: