Skip to content

Chapter 8: html-fund-me-fcc | TypeScript compiliation error for window.ethereum #614

Discussion options

You must be logged in to vote

You can use (window as any).ethereum to get around the type check.

Or,
In your root folder of the project, you can create a new file called global.d.ts and there define the ethereum type like the below code -

interface Window {
    ethereum: any
}

This should fix the type check issue.

Another way around would be, to declare the whole window object as any at the beginning of your index.

declare var window: any

The above may or may not disable your IntelliSense for the window object.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@sanjayojha
Comment options

@dibakarsutradhar
Comment options

Answer selected by sanjayojha
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants