typing cleanup

This commit is contained in:
Eugene Pankov 2021-07-14 00:03:05 +02:00
parent e245629c5a
commit 57a198b082
16 changed files with 27 additions and 23 deletions

View file

@ -64,7 +64,7 @@ export class AppRootComponent {
activeTransfersDropdownOpen = false
private logger: Logger
private constructor (
constructor (
private hotkeys: HotkeysService,
private updater: UpdaterService,
public hostWindow: HostWindowService,

View file

@ -13,7 +13,7 @@ import { ToolbarButton, ToolbarButtonProvider } from '../api'
export class StartPageComponent {
version: string
private constructor (
constructor (
private config: ConfigService,
private domSanitizer: DomSanitizer,
public homeBase: HomeBaseService,

View file

@ -31,7 +31,7 @@ export class TabHeaderComponent extends BaseComponent {
@Input() progress: number|null
@ViewChild('handle') handle?: ElementRef
private constructor (
constructor (
public app: AppService,
public config: ConfigService,
private hostApp: HostAppService,

View file

@ -10,7 +10,7 @@ import { AppService } from '../services/app.service'
styles: [require('./windowControls.component.scss')],
})
export class WindowControlsComponent {
private constructor (public hostWindow: HostWindowService, public app: AppService) { }
constructor (public hostWindow: HostWindowService, public app: AppService) { }
async closeWindow () {
this.app.closeWindow()

View file

@ -81,7 +81,7 @@ const PROVIDERS = [
SortablejsModule.forRoot({ animation: 150 }),
],
declarations: [
AppRootComponent as any,
AppRootComponent,
CheckboxComponent,
PromptModalComponent,
StartPageComponent,

View file

@ -63,7 +63,7 @@ export class HotkeysService {
* @param nativeEvent event object
*/
pushKeystroke (name: string, nativeEvent: KeyboardEvent): void {
(nativeEvent as any).event = name
nativeEvent['event'] = name
this.currentKeystrokes.push({
ctrlKey: nativeEvent.ctrlKey,
metaKey: nativeEvent.metaKey,

View file

@ -2,7 +2,7 @@ import * as path from 'path'
import * as fs from 'fs/promises'
import * as fsSync from 'fs'
import * as os from 'os'
import promiseIpc from 'electron-promise-ipc'
import promiseIpc, { RendererProcessType } from 'electron-promise-ipc'
import { execFile } from 'mz/child_process'
import { Injectable, NgZone } from '@angular/core'
import { PlatformService, ClipboardContent, HostAppService, Platform, MenuItemOptions, MessageBoxOptions, MessageBoxResult, FileUpload, FileDownload, FileUploadOptions, wrapPromise } from 'tabby-core'
@ -49,11 +49,11 @@ export class ElectronPlatformService extends PlatformService {
}
async installPlugin (name: string, version: string): Promise<void> {
await (promiseIpc as any).send('plugin-manager:install', name, version)
await (promiseIpc as RendererProcessType).send('plugin-manager:install', name, version)
}
async uninstallPlugin (name: string): Promise<void> {
await (promiseIpc as any).send('plugin-manager:uninstall', name)
await (promiseIpc as RendererProcessType).send('plugin-manager:uninstall', name)
}
async isProcessRunning (name: string): Promise<boolean> {

View file

@ -91,13 +91,13 @@ import { LocalProfilesService } from './profiles'
TerminalTabComponent,
ShellSettingsTabComponent,
LocalProfileSettingsComponent,
] as any[],
],
declarations: [
TerminalTabComponent,
ShellSettingsTabComponent,
EnvironmentEditorComponent,
LocalProfileSettingsComponent,
] as any[],
],
exports: [
TerminalTabComponent,
EnvironmentEditorComponent,

View file

@ -30,7 +30,7 @@ export class DockMenuService {
iconPath: process.execPath,
iconIndex: 0,
})),
}] : null as any)
}] : null)
}
if (this.hostApp.platform === Platform.macOS) {
this.electron.app.dock.setMenu(this.electron.Menu.buildFromTemplate(

View file

@ -160,7 +160,7 @@ export class Session extends BaseSession {
cwd,
env: env,
// `1` instead of `true` forces ConPTY even if unstable
useConpty: (isWindowsBuild(WIN_BUILD_CONPTY_SUPPORTED) && this.config.store.terminal.useConPTY ? 1 : false) as any,
useConpty: isWindowsBuild(WIN_BUILD_CONPTY_SUPPORTED) && this.config.store.terminal.useConPTY ? 1 : false,
})
this.guessedCWD = cwd ?? null

View file

@ -471,7 +471,7 @@ export class SSHSession extends BaseSession {
this.logger.info(stripAnsi(msg))
}
async handleAuth (methodsLeft?: string[]): Promise<any> {
async handleAuth (methodsLeft?: string[] | null): Promise<any> {
this.activePrivateKey = null
while (true) {

View file

@ -146,7 +146,7 @@ export class SSHService {
callback(await session.handleAuth(methodsLeft))
})
},
} as any)
})
} catch (e) {
this.notifications.error(e.message)
throw e

View file

@ -49,7 +49,7 @@ export class TerminalStreamProcessor {
output: this.inputReadlineOutStream,
terminal: true,
prompt: this.options.inputMode === 'readline-hex' ? 'hex> ' : '> ',
} as any)
})
this.inputReadline.on('line', line => {
this.onTerminalInput(Buffer.from(line + '\n'))
this.resetInputPrompt()

View file

@ -56,7 +56,7 @@ export class XTermFrontend extends Frontend {
allowTransparency: true,
windowsMode: process.platform === 'win32',
})
this.xtermCore = (this.xterm as any)._core
this.xtermCore = this.xterm['_core']
this.xterm.onBinary(data => {
this.input.next(Buffer.from(data, 'binary'))
@ -365,7 +365,11 @@ export class XTermFrontend extends Frontend {
private getLineAsHTML (y: number, start: number, end: number): string {
let html = '<div>'
let lastStyle: string|null = null
const line = (this.xterm.buffer.active.getLine(y) as any)._line
const outerLine = this.xterm.buffer.active.getLine(y)
if (!outerLine) {
return ''
}
const line = outerLine['_line']
const cell = new CellData()
for (let i = start; i < end; i++) {
line.loadCell(i, cell)

View file

@ -64,7 +64,7 @@ import { TerminalCLIHandler } from './cli'
AppearanceSettingsTabComponent,
ColorSchemeSettingsTabComponent,
TerminalSettingsTabComponent,
] as any[],
],
declarations: [
ColorPickerComponent,
ColorSchemePreviewComponent,
@ -74,7 +74,7 @@ import { TerminalCLIHandler } from './cli'
SearchPanelComponent,
StreamProcessingSettingsComponent,
LoginScriptsSettingsComponent,
] as any[],
],
exports: [
ColorPickerComponent,
SearchPanelComponent,

View file

@ -16,17 +16,17 @@ import { DemoProfilesService } from 'profiles'
FormsModule,
NgbModule,
TabbyCorePlugin,
TabbyTerminalModule as any,
TabbyTerminalModule,
],
providers: [
{ provide: ProfileProvider, useClass: DemoProfilesService, multi: true },
],
entryComponents: [
DemoTerminalTabComponent,
] as any[],
],
declarations: [
DemoTerminalTabComponent,
] as any[],
],
exports: [
DemoTerminalTabComponent,
],