TypeScript issues with Electron 15.x and 2.0.1
Farmers-Tyler-Dougherty opened this issue ยท 7 comments
Receiving build errors in my electron project. It appears as though there are errors in the types files between the native electron resources and this expansion lib mappings. Anyone else seeing this issue, or any guidance on correcting the issue?
(ex1)
Error: node_modules/@electron/remote/index.d.ts:8:43 - error TS2339: Property 'ClientRequest' does not
exist on type 'typeof CrossProcessExports'.
8 export var ClientRequest: typeof Electron.ClientRequest;
(ex2)
Error: node_modules/@electron/remote/index.d.ts:10:41 - error TS2339: Property 'CommandLine' does not
exist on type 'typeof CrossProcessExports'.
10 export var CommandLine: typeof Electron.CommandLine;
Downgraded to electron 14.1.0 and project builds correctly. You appear to have an undocumented compatibility issue with Electron 15.x.
Same, works with 14.1.0 but fails with 15.x
Ditto. Just ran into this yesterday.
Ran into this as well
I also confirm this issue only occurs on Electron 15.x. Downgrading to 14.x solves the issue.
I have a similar problem also with electron 14.0.1
and @electron/remote": "1.2.2"
:
Error: node_modules/@electron/remote/index.d.ts:60:28 - error TS2694: Namespace 'NodeJS' has no exported member 'Require'.
60 export var require: NodeJS.Require;
The following replacement for index.d.ts appears to resolve the issue for me while also working for Electron 14.x, but I'm not familiar enough with the @electron/remote project to have confidence that this is the appropriate fix for a pull request:
import * as Electron from 'electron';
// Taken from RemoteMainInterface
export var app: Electron.App;
export var autoUpdater: Electron.AutoUpdater;
export var BrowserView: typeof Electron.BrowserView;
export var BrowserWindow: typeof Electron.BrowserWindow;
export var ClientRequest: Electron.ClientRequest;
export var clipboard: Electron.Clipboard;
export var CommandLine: Electron.CommandLine;
export var contentTracing: Electron.ContentTracing;
export var Cookies: Electron.Cookies;
export var crashReporter: Electron.CrashReporter;
export var Debugger: Electron.Debugger;
export var desktopCapturer: Electron.DesktopCapturer;
export var dialog: Electron.Dialog;
export var Dock: Electron.Dock;
export var DownloadItem: Electron.DownloadItem;
export var globalShortcut: Electron.GlobalShortcut;
export var inAppPurchase: Electron.InAppPurchase;
export var IncomingMessage: Electron.IncomingMessage;
export var ipcMain: Electron.IpcMain;
export var Menu: typeof Electron.Menu;
export var MenuItem: typeof Electron.MenuItem;
export var MessageChannelMain: typeof Electron.MessageChannelMain;
export var MessagePortMain: Electron.MessagePortMain;
export var nativeImage: typeof Electron.nativeImage;
export var nativeTheme: Electron.NativeTheme;
export var net: Electron.Net;
export var netLog: Electron.NetLog;
export var Notification: typeof Electron.Notification;
export var powerMonitor: Electron.PowerMonitor;
export var powerSaveBlocker: Electron.PowerSaveBlocker;
export var protocol: Electron.Protocol;
export var screen: Electron.Screen;
export var ServiceWorkers: Electron.ServiceWorkers;
export var session: typeof Electron.session;
export var shell: Electron.Shell;
export var systemPreferences: Electron.SystemPreferences;
export var TouchBar: typeof Electron.TouchBar;
export var TouchBarButton: Electron.TouchBarButton;
export var TouchBarColorPicker: Electron.TouchBarColorPicker;
export var TouchBarGroup: Electron.TouchBarGroup;
export var TouchBarLabel: Electron.TouchBarLabel;
export var TouchBarOtherItemsProxy: Electron.TouchBarOtherItemsProxy;
export var TouchBarPopover: Electron.TouchBarPopover;
export var TouchBarScrubber: Electron.TouchBarScrubber;
export var TouchBarSegmentedControl: Electron.TouchBarSegmentedControl;
export var TouchBarSlider: Electron.TouchBarSlider;
export var TouchBarSpacer: Electron.TouchBarSpacer;
export var Tray: typeof Electron.Tray;
export var webContents: typeof Electron.webContents;
export var WebRequest: Electron.WebRequest;
// Taken from Remote
export function getCurrentWebContents(): Electron.WebContents;
export function getCurrentWindow(): Electron.BrowserWindow;
export function getGlobal(name: string): any;
export var process: NodeJS.Process;
export var require: NodeJS.Require;