-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Add main type declarations #36
Conversation
export declare var require: NodeRequire; | ||
|
||
// Taken from `RemoteMainInterface` | ||
export {app, autoUpdater, BrowserView, BrowserWindow, ClientRequest, clipboard, CommandLine, contentTracing, Cookies, crashReporter, Debugger, desktopCapturer, dialog, Dock, DownloadItem, globalShortcut, inAppPurchase, IncomingMessage, ipcMain, Menu, MenuItem, MessageChannelMain, MessagePortMain, nativeImage, nativeTheme, net, netLog, Notification, powerMonitor, powerSaveBlocker, protocol, screen, ServiceWorkers, session, shell, systemPreferences, TouchBar, TouchBarButton, TouchBarColorPicker, TouchBarGroup, TouchBarLabel, TouchBarOtherItemsProxy, TouchBarPopover, TouchBarScrubber, TouchBarSegmentedControl, TouchBarSlider, TouchBarSpacer, Tray, webContents, WebRequest} from 'electron'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding this since it might not be exported anymore in the next version of Electron.
Is there a plan to merge? |
Ping @miniak @MarshallOfSound |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry for the delay, this got lost in my inbox. I'm not super familiar with how .d.ts files work but if this works then I'm happy to merge it.
Hi, when is this expected to be included in the next release? Currently, I'm poly-filling with declare module '@electron/remote' {
import { remote } from 'electron';
export = remote;
} I would love to use a more accurate type definition in my project. |
It looks like the tests are failing on main: https://app.circleci.com/pipelines/github/electron/remote/117/workflows/8de10615-98d8-4bb5-9baa-0d69e50c5a2d/jobs/197 It seems related to this PR. Any ideas? |
I'll check |
🎉 This PR is included in version 1.1.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
I'm getting the following errors in v1.1.0:
It seems interface NodeRequireCache {
[path: string]: NodeModule;
}
interface NodeExtensions {
'.js': (m: NodeModule, filename: string) => any;
'.json': (m: NodeModule, filename: string) => any;
'.node': (m: NodeModule, filename: string) => any;
[ext: string]: (m: NodeModule, filename: string) => any;
} This should be alright because of the declaration merging feature in TypeScript. |
Yes, sure! I did the same. |
This problem (NodeRequireCache) happens here too. Odd thing is that the types are there and the node types are updated to v14.14.45. I'll have to revert to the deprecated module until this is solved. EDIT:
|
Please see #58. |
I noticed that the file defined in
main
in thepackage.json
file doesn't have type declarations since it is written in JavaScript.This fix might help with #35.