'enableRemoteModule is missing from Electron v14 TypeScript type definitions

I've upgraded to Electron 14, refactored my project to accomodate for the "Removed: remote module" breaking change, but I'm unable to compile it due to the following TypeScript error:

Type '{ plugins: true; nodeIntegration: true; contextIsolation: false; enableRemoteModule: true; backgroundThrottling: false; webSecurity: false; }' is not assignable to type 'WebPreferences'.

Object literal may only specify known properties, and 'enableRemoteModule' does not exist in type 'WebPreferences'.ts(2322)

electron.d.ts(12612, 5): The expected type comes from property 'webPreferences' which is declared here on type 'BrowserWindowConstructorOptions'

The affected code:

const window = new electron.BrowserWindow({
    // ...
    webPreferences: { 
      plugins: true, 
      nodeIntegration: true, 
      contextIsolation: false,
      enableRemoteModule: true, 
      backgroundThrottling: false,
      webSecurity: false 
    }, 
    // ...
  });

Is this a bug or an intentional change in Electron v14? What's a workaround?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source