Generated files have mixed imports from `ethers` umbrella package and `@ethersproject` sub-packages
The moment a project imports from the umbrella ethers npm package, it already has (almost) all dependencies that can be individually imported via the @ethersproject sub-packages. E.g. my ERC20.d.ts file contains the following imports
import {
ethers,
EventFilter,
Signer,
BigNumber,
BigNumberish,
PopulatedTransaction,
BaseContract,
ContractTransaction,
Overrides,
CallOverrides,
} from "ethers";
import { BytesLike } from "@ethersproject/bytes";
import { Listener, Provider } from "@ethersproject/providers";
import { FunctionFragment, EventFragment, Result } from "@ethersproject/abi";
Note that bytes, providers and abi are imported as separate npm modules, even though they're contained in ethers. See, e.g. the README of bytes:
Most users will prefer to use the umbrella package, but for those with more specific needs, individual components can be imported.
So I propose that all @ethersproject imports are replaced by the equivalent ethers imports, saving some package dependencies.
Why not use the individual subpackages for the sake of ESM and tree-shaking?
I think realistically, most projects using typechain-generated code would already use ethers, in which case the @ethersproject imports would add unnecessary deps. Note also that the ethers folks themselves suggest to use ethers over @ethersproject in most cases.
Best would be to make this behavior configurable, using ethers by default.
Configurable would be excellent, tbh.