Importing base types like Contract or Wallet is trivial:
import { Contract, Wallet } from "ethers";
const myContract: Contract = ...
But I had to dig up the source code to figure out how to import BigNumber:
import { utils } from "ethers";
const myBigNumber: utils.BigNumber = ...
It'd be nice to have this explained in the docs.
I've been mulling back-and-forth how to add this to the new docs, especially since many things are available from their sub-modules too.
I'll work on this on the next docs pass.
To add on to this, how do I import types like Block and Network. They seem to be internal to Ethers.
You can use:
import type { Network } from '@ethersproject/networks';
import type { Block } from '@ethersproject/abstract-provider';
FWIW I am now importing the BigNumber type like this:
import { BigNumber} from "@ethersproject/bignumber";
And I started using Sourcegraph to find where to import types from.
Most helpful comment
I've been mulling back-and-forth how to add this to the new docs, especially since many things are available from their sub-modules too.
I'll work on this on the next docs pass.