fix: type

This commit is contained in:
tiddlygit-test 2021-04-24 19:45:43 +08:00
parent 8339db631e
commit fbde09ad1f
2 changed files with 10 additions and 8 deletions

View file

@ -38,9 +38,9 @@ export class View implements IViewService {
private initIPCHandlers(): void {
// https://www.electronjs.org/docs/tutorial/online-offline-events
ipcMain.handle(ViewChannel.onlineStatusChanged, (_event, online: boolean) => {
ipcMain.handle(ViewChannel.onlineStatusChanged, async (_event, online: boolean) => {
if (online) {
this.reloadViewsWebContentsIfDidFailLoad();
await this.reloadViewsWebContentsIfDidFailLoad();
}
});
}
@ -324,8 +324,9 @@ export class View implements IViewService {
void session.fromPartition(`persist:${id}`).clearStorageData();
if (view !== undefined) {
// currently use workaround https://github.com/electron/electron/issues/10096
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
(view as any).webContents.destroy();
// @ts-expect-error Property 'destroy' does not exist on type 'WebContents'.ts(2339)
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
view.webContents.destroy();
}
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
delete this.views[id];
@ -354,8 +355,9 @@ export class View implements IViewService {
public hibernateView = (id: string): void => {
if (this.getView(id) !== undefined) {
// currently use workaround https://github.com/electron/electron/issues/10096
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
(this.getView(id) as any).webContents.destroy();
// @ts-expect-error Property 'destroy' does not exist on type 'WebContents'.ts(2339)
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
this.getView(id).webContents.destroy();
this.removeView(id);
}
};

View file

@ -73,8 +73,8 @@ export class WikiGitWorkspace implements IWikiGitWorkspaceService {
if (workspace === undefined) {
throw new Error(`Need to get workspace with id ${id} but failed`);
}
await this.wikiService.stopWatchWiki(workspace.name).catch((error) => logger.error((error as Error).message, error));
await this.wikiService.stopWiki(workspace.name).catch((error: any) => logger.error((error as Error).message, error));
await this.wikiService.stopWatchWiki(workspace.name).catch((error: Error) => logger.error(error.message, error));
await this.wikiService.stopWiki(workspace.name).catch((error: Error) => logger.error(error.message, error));
await this.wikiService.removeWiki(workspace.name, workspace.isSubWiki ? workspace.mainWikiToLink : undefined, response === 0);
await this.workspaceViewService.removeWorkspaceView(id);
await this.menuService.buildMenu();