I'm trying to pass a Web3Provider as a prop to a hook with others, and I keep getting an error
Here's the code of how I get the provider
const provider = new ethers.providers.Web3Provider(window.ethereum)
Then I have inside the return statement:
<Form provider={provider} />
And in the hook
export const Form = (provider: ethers.providers.Web3Provider) => {
Types should be the same, but I keep getting the error:
(JSX attribute) Web3Provider.provider: ethers.providers.ExternalProvider
Type 'Web3Provider' is not assignable to type 'ExternalProvider'. Types of property 'send' are incompatible. Type '(method: string, params: any[]) => Promise' is not assignable to type '(request: { method: string; params?: any[] | undefined; }, callback: (error: any, response: any) => void) => void'. Types of parameters 'method' and 'request' are incompatible. Type '{ method: string; params?: any[] | undefined; }' is not assignable to type 'string'.
I have tried casting to any in the form, but then I get an error when calling a method I can call outside.