Error when using wagmi and @wagmi/core packages together.
heyitsarpit opened this issue · comments
arpit commented
Describe the bug
getting this error when importing actions from @wagmi/core
"wagmi" Property '#private' in type 'Emitter' refers to a different member that cannot be accessed from within type 'Emitter'.
Link to Minimal Reproducible Example
No response
Steps To Reproduce
- create wagmi config using
createConfig
imported fromwagmi
. - now import any function from
@wagmi/core
that requires passing the config as first argument, eg.switchChain
- passing the config as first param to
switchChain
will throw a typescript error about private field access.
Wagmi Version
2.5.20
Viem Version
2.9.21
TypeScript Version
5.2.2
Check existing issues
- I checked there isn't already an issue for the bug I encountered.
Anything else?
No response
arpit commented
the way to fix this for now is to import switchChain
from wagmi/actions
which internally is already reexporting @wagmi/core
.
github-actions commented
Hello @heyitsarpit. Please provide a minimal reproduction using new.wagmi.sh for runtime issues or TypeScript Playground for type issues. Issues marked with "needs reproduction" will be closed if they have no activity within 3 days.