refactor: replace a few any-s with proper types (#25681)

This commit is contained in:
Milan Burda 2020-10-08 03:01:23 +02:00 committed by GitHub
parent 603f9242d9
commit fb11a12d5b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 170 additions and 53 deletions

View file

@ -4,7 +4,7 @@ const { BaseWindow } = process._linkedBinding('electron_browser_base_window') as
Object.setPrototypeOf(BaseWindow.prototype, EventEmitter.prototype);
(BaseWindow.prototype as any)._init = function () {
BaseWindow.prototype._init = function () {
// Avoid recursive require.
const { app } = require('electron');

View file

@ -4,9 +4,9 @@ const { BrowserWindow } = process._linkedBinding('electron_browser_window') as {
Object.setPrototypeOf(BrowserWindow.prototype, BaseWindow.prototype);
(BrowserWindow.prototype as any)._init = function (this: BWT) {
BrowserWindow.prototype._init = function (this: BWT) {
// Call parent class's _init.
(BaseWindow.prototype as any)._init.call(this);
BaseWindow.prototype._init.call(this);
// Avoid recursive require.
const { app } = require('electron');

View file

@ -7,11 +7,11 @@ let _screen: Electron.Screen;
// side-effecting and calling createScreen upon import of this module, instead
// we export a proxy which lazily calls createScreen on first access.
export default new Proxy({}, {
get: (target, prop) => {
get: (target, prop: keyof Electron.Screen) => {
if (_screen === undefined) {
_screen = createScreen();
}
const v = (_screen as any)[prop];
const v = _screen[prop];
if (typeof v === 'function') {
return v.bind(_screen);
}