I am trying to supply types to TypeScript type checking. This is so that I can bypass Property 'request' does not exist on type 'EthereumProvider'
like whats descriebd in the link below.
Specifically for window.ethereum
I am trying to enable it by going:
import { MetaMaskInpageProvider } from "@metamask/providers";
// later...
declare global {
interface Window {
ethereum: MetaMaskInpageProvider;
// ethereum: any;
}
}
Like that.
But I get:
(property) Window.ethereum?: MetaMaskInpageProvider
All declarations of 'ethereum' must have identical modifiers.ts(2687)
This code is from here.
I don't understand "must have identical modifiers." What's that mean?
I don't have any other interfaces defining ethereum
. So thats not it.
I also only reference "ethereum" in my code by going window.ethereum.doSomething
Any ideas?
Also I can't recreate this error because I have no idea how it came to be in the first place...