mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-13 04:28:41 -09:00
some type fixes
This commit is contained in:
parent
b90d37bd9c
commit
0eb05e8416
4 changed files with 8 additions and 9 deletions
|
|
@ -26,13 +26,12 @@ class AutoUpdater extends EventEmitter implements Electron.AutoUpdater {
|
|||
this.emit('update-not-available');
|
||||
return;
|
||||
}
|
||||
return res.json().then(({name, notes, pub_date}) => {
|
||||
return res.json().then(({name, notes, pub_date}: {name: string; notes: string; pub_date: string}) => {
|
||||
// Only name is mandatory, needed to construct release URL.
|
||||
if (!name) {
|
||||
throw new Error('Malformed server response: release name is missing.');
|
||||
}
|
||||
// If `null` is passed to Date constructor, current time will be used. This doesn't work with `undefined`
|
||||
const date = new Date(pub_date || null);
|
||||
const date = pub_date ? new Date(pub_date) : new Date();
|
||||
this.emit('update-available', {}, notes, name, date);
|
||||
});
|
||||
})
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ if (isDev) {
|
|||
console.log('running in dev mode');
|
||||
|
||||
// Override default appVersion which is set from package.json
|
||||
gitDescribe({customArguments: ['--tags']}, (error: any, gitInfo: any) => {
|
||||
gitDescribe({customArguments: ['--tags']}, (error: any, gitInfo: {raw: string}) => {
|
||||
if (!error) {
|
||||
app.setVersion(gitInfo.raw);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ export default function fetchNotifications(win: BrowserWindow) {
|
|||
})
|
||||
.then((res) => res.json())
|
||||
.then((data) => {
|
||||
const {message} = data || {};
|
||||
const message: {text: string; url: string; dismissable: boolean} | '' = data.message || '';
|
||||
if (typeof message !== 'object' && message !== '') {
|
||||
throw new Error('Bad response');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* eslint-disable eslint-comments/disable-enable-pair */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
import {app, dialog, BrowserWindow, App, ipcMain as _ipcMain} from 'electron';
|
||||
import {app, dialog, BrowserWindow, App, ipcMain as _ipcMain, MenuItemConstructorOptions} from 'electron';
|
||||
import {resolve, basename} from 'path';
|
||||
import {writeFileSync} from 'fs';
|
||||
import Config from 'electron-store';
|
||||
|
|
@ -277,7 +277,7 @@ function requirePlugins(): any[] {
|
|||
const {plugins: plugins_, localPlugins} = paths;
|
||||
|
||||
const load = (path_: string) => {
|
||||
let mod: any;
|
||||
let mod: Record<string, any>;
|
||||
try {
|
||||
mod = require(path_);
|
||||
const exposed = mod && Object.keys(mod).some((key) => availableExtensions.has(key));
|
||||
|
|
@ -313,7 +313,7 @@ function requirePlugins(): any[] {
|
|||
...localPlugins.filter((p) => basename(p) !== 'migrated-hyper3-config')
|
||||
]
|
||||
.map(load)
|
||||
.filter((v) => Boolean(v));
|
||||
.filter((v): v is Record<string, any> => Boolean(v));
|
||||
}
|
||||
|
||||
export const onApp = (app_: App) => {
|
||||
|
|
@ -416,7 +416,7 @@ export const getDeprecatedConfig = () => {
|
|||
return deprecated;
|
||||
};
|
||||
|
||||
export const decorateMenu = (tpl: any) => {
|
||||
export const decorateMenu = (tpl: MenuItemConstructorOptions[]) => {
|
||||
return decorateObject(tpl, 'decorateMenu');
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue