Web3 constructor does not accept custom/non-standard providers in TypeScript #3380
Labels
1.x
1.0 related issues
Good First Issue
Great to learn the internals of web3.js
Types
Incorrect or missing types
Overview
Related to #2266
There should be a way to overload the TypeScript definition of
Web3
constructor to accept custom providers. I've tried everything, even declaration merging won't work. The easiest solution I foresee, which would not be a breaking change, is to provide a basicProvider
interface which all providers must implement. Using a generic type parameter would be even more ideal, because it means properties likecurrentProvider
could be strongly typed, even if they are custom/non-standard.Right now the only workaround is to cast the provider to
any
, which is not ideal.Steps to reproduce the behavior
Web3
instance with non-standard providerThe text was updated successfully, but these errors were encountered: