1
1
mirror of https://github.com/Eugeny/tabby.git synced 2024-11-27 00:50:49 +03:00

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,
],