How to use Biconomy Gasless Transactions in javascript?

I am reading the meta transaction tutorial given in the gasless biconomy docs (see here: https://docs-gasless.biconomy.io/products/enable-gasless-transactions/choose-an-approach-to-enable-gasless/eip-2771/2.-code-changes/sdk). I’ve come across a code example but it’s in typescript and I wish to use javascript in my next.js project. How can this be rewritten to javascript?

const biconomy = new Biconomy(window.ethereum as ExternalProvider, {
  apiKey: config.apiKey.prod,
  debug: true,
  contractAddresses: [<contractAddress1>, <contractAddress2>], // list of contract address you want to enable gasless on
});

// The first argument of the Biconomy class is an EIP 1193 type provider that has to be passed. 
// If there is a type mismatch you'll have to set the type of the provider as 
// External Provider
export type ExternalProvider = {
  isMetaMask?: boolean;
  isStatus?: boolean;
  host?: string;
  path?: string;
  sendAsync?: (request: { method: string, params?: Array<any> }, callback: (error: any, response: any) => void) => void
  send?: (request: { method: string, params?: Array<any> }, callback: (error: any, response: any) => void) => void
  request?: (request: { method: string, params?: Array<any> }) => Promise<any>
}

// To create contract instances you can do:
const contractInstance = new ethers.Contract(
  config.contract.address,
  config.contract.abi,
  biconomy.ethersProvider
);

Hi there! You can remove any of the typescript syntax which include things like the types example:

you can remove the entire ExternalProvider type and instead of window.ethereum as ExternalProvider you would simply pass window.ethereum.

With that said I would still highly recommend using typescript as it would be a lot easier to catch smaller errors that could occur.