title: How to extend web3js with TypeScript?
body: <p>So I'm trying to build a prototype on React w/ TypeScript for an application that I'm developing - which in the future I'm going to migrate to Django, that's why I want to use web3js, to pass it later to web3.py - and a I wanna use the relay methods of Infura, so the users don't need to have a cryptowallet.</p>
  <p>How I'm trying to do it is by following the Infura tutorial on ITX and getting everything on web3js. Right now what I have is this:</p>
  <pre><code>//Configure the provider
  let web3  = new Web3(
    new Web3.providers.HttpProvider(
      `https://:${process.env.REACT_APP_PROJECT_SECRET}@${process.env.REACT_APP_ETHEREUM_NETWORK}.infura.io/v3/${process.env.REACT_APP_PROJECT_ID}`
    )
  );
  
  web3.extend({
    property: &quot;relay&quot;,
    methods: [
      {
        name: &quot;getBalance&quot;,
        call: &quot;relay_getBalance&quot;,
        params: 1
      },
    ],
  })
  </code></pre>
  <p>This is what I do at the start of the React component. Later, I wanna have a callback that, when I want, it'll retrieve the balance of the gas pool so it'll be something like:</p>
  <pre><code>() =&gt; web3.relay.getBalance(...)
  </code></pre>
  <p>The problem is that, when I try to use it like that, as the property doesn't exist on the Web3 class, I can't compile it. Is there a way to extend the class definition so I can define - and use - the relay methods inside its own module? I've tried with JS and works fine, but I would really like to keep the project on TS.</p>