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 activeTransfersDropdownOpen = false
private logger: Logger private logger: Logger
private constructor ( constructor (
private hotkeys: HotkeysService, private hotkeys: HotkeysService,
private updater: UpdaterService, private updater: UpdaterService,
public hostWindow: HostWindowService, public hostWindow: HostWindowService,

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -2,7 +2,7 @@ import * as path from 'path'
import * as fs from 'fs/promises' import * as fs from 'fs/promises'
import * as fsSync from 'fs' import * as fsSync from 'fs'
import * as os from 'os' 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 { execFile } from 'mz/child_process'
import { Injectable, NgZone } from '@angular/core' import { Injectable, NgZone } from '@angular/core'
import { PlatformService, ClipboardContent, HostAppService, Platform, MenuItemOptions, MessageBoxOptions, MessageBoxResult, FileUpload, FileDownload, FileUploadOptions, wrapPromise } from 'tabby-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> { 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> { 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> { async isProcessRunning (name: string): Promise<boolean> {

View file

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

View file

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

View file

@ -160,7 +160,7 @@ export class Session extends BaseSession {
cwd, cwd,
env: env, env: env,
// `1` instead of `true` forces ConPTY even if unstable // `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 this.guessedCWD = cwd ?? null

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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