-
Notifications
You must be signed in to change notification settings - Fork 80
fix: mismatched ethers types when in esm project #211
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
base: master
Are you sure you want to change the base?
fix: mismatched ethers types when in esm project #211
Conversation
Fix mismatch of ethers/lib.commonjs Provider with ethers/lib.esm Provider. This has been an issue when attempting to construct configuration driven provider fallbacks for did-resolver Drilling down to the Provider type via this package within an esm package yielded a `lib.commonjs` `Provider` that did not match the esm ethers `Provider`. Restructure build directories into `lib.commonjs` and `lib.esm`. Matches structure in ethers.js Adjust .gitignore to exclude new out directories Separated into two tsconfig files named `tsconfig.{common,esm}.json` [package.json] Removed `source` [not in spec] Removed `type`, `module`, and `types` from top level Added `import` and `require` to `exports` and re-added `types` Modified `files` to point to new out dirs, removed LICENSE (included by default), and src (no utility). Modified script `clean` Added new `build:` scripts both called from `build`
This might seem like a non-issue without some context. We're pulling two types, one from type ArgumentsType<T> = T extends (...args: infer U) => any ? U : never;
type FuncGetResolver = typeof ethrDidResolver;
type FuncParameter = ArgumentsType<FuncGetResolver>[0];
interface InfuraConfiguration {
infuraProjectId: string;
}
type MultiProviderConfiguration = Exclude<FuncParameter, InfuraConfiguration>;
type ProviderConfiguration = Exclude<
MultiProviderConfiguration['networks'],
undefined
>[number];
type ProviderOrConfig = ConstructorParameters<
typeof FallbackProvider
>[0][number];
type FallbackProviderConfig = ProviderOrConfig extends AbstractProvider
? never
: ProviderOrConfig; However, at the end of this process the
|
1a5ea48
to
1235b16
Compare
1235b16
to
85e79b1
Compare
For ease of testing, use the branch #publish on my repo. Warning Only With "pnpm": {
"overrides": {
"ethr-did-resolver": "pauldesmondparker/ethr-did-resolver#publish"
}
}, npm: "overrides": {
"ethr-did-resolver": "github:pauldesmondparker/ethr-did-resolver#publish"
} yarn: "resolutions": {
"ethr-did-resolver": "https://github.com/pauldesmondparker/ethr-did-resolver#publish"
} |
Fixed test. Forgot to specify a tsconfig file in Jest config. Locally I get a warning about linking for Ganache, but it's likely the version of node I used: Also ran format and lint. |
Fix mismatch of ethers/lib.commonjs Provider with ethers/lib.esm Provider. This has been an issue when attempting to construct configuration driven provider fallbacks for did-resolver
Drilling down to the Provider type via this package within an esm package yielded a
lib.commonjs
Provider
that did not match the esm ethersProvider
.Restructure build directories into
lib.commonjs
andlib.esm
. Matches structure in ethers.jsAdjust .gitignore to exclude new out directories
Separated into two tsconfig files named
tsconfig.{common,esm}.json
[package.json]
Removed
source
[not in spec]Removed
type
,module
, andtypes
from top level Addedimport
andrequire
toexports
and re-addedtypes
Modifiedfiles
to point to new out dirs, removed LICENSE (included by default), and src (no utility).Modified script
clean
Added new
build:
scripts both called frombuild