Skip to content

Commit 2a3d4aa

Browse files
committed
Remove any from platform/terminal
Part of #274723
1 parent 093beda commit 2a3d4aa

File tree

7 files changed

+15
-20
lines changed

7 files changed

+15
-20
lines changed

eslint.config.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -581,11 +581,6 @@ export default tseslint.config(
581581
'src/vs/platform/telemetry/common/telemetryUtils.ts',
582582
'src/vs/platform/telemetry/node/1dsAppender.ts',
583583
'src/vs/platform/telemetry/node/errorTelemetry.ts',
584-
'src/vs/platform/terminal/common/terminal.ts',
585-
'src/vs/platform/terminal/node/ptyHostService.ts',
586-
'src/vs/platform/terminal/node/ptyService.ts',
587-
'src/vs/platform/terminal/node/terminalProcess.ts',
588-
'src/vs/platform/terminal/node/windowsShellHelper.ts',
589584
'src/vs/platform/theme/common/iconRegistry.ts',
590585
'src/vs/platform/theme/common/tokenClassificationRegistry.ts',
591586
'src/vs/platform/update/common/updateIpc.ts',

src/vs/platform/terminal/common/terminal.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ export const enum ProcessPropertyType {
255255
ShellIntegrationInjectionFailureReason = 'shellIntegrationInjectionFailureReason',
256256
}
257257

258-
export interface IProcessProperty<T extends ProcessPropertyType> {
258+
export interface IProcessProperty<T extends ProcessPropertyType = ProcessPropertyType> {
259259
type: T;
260260
value: IProcessPropertyMap[T];
261261
}
@@ -301,7 +301,7 @@ export interface IPtyService {
301301
readonly onProcessReplay: Event<{ id: number; event: IPtyHostProcessReplayEvent }>;
302302
readonly onProcessOrphanQuestion: Event<{ id: number }>;
303303
readonly onDidRequestDetach: Event<{ requestId: number; workspaceId: string; instanceId: number }>;
304-
readonly onDidChangeProperty: Event<{ id: number; property: IProcessProperty<any> }>;
304+
readonly onDidChangeProperty: Event<{ id: number; property: IProcessProperty }>;
305305
readonly onProcessExit: Event<{ id: number; event: number | undefined }>;
306306

307307
createProcess(
@@ -774,7 +774,7 @@ export interface ITerminalChildProcess {
774774
readonly onProcessData: Event<IProcessDataEvent | string>;
775775
readonly onProcessReady: Event<IProcessReadyEvent>;
776776
readonly onProcessReplayComplete?: Event<void>;
777-
readonly onDidChangeProperty: Event<IProcessProperty<any>>;
777+
readonly onDidChangeProperty: Event<IProcessProperty>;
778778
readonly onProcessExit: Event<number | undefined>;
779779
readonly onRestoreCommands?: Event<ISerializedCommandDetectionCapability>;
780780

src/vs/platform/terminal/node/ptyHostService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export class PtyHostService extends Disposable implements IPtyHostService {
8787
readonly onProcessOrphanQuestion = this._onProcessOrphanQuestion.event;
8888
private readonly _onDidRequestDetach = this._register(new Emitter<{ requestId: number; workspaceId: string; instanceId: number }>());
8989
readonly onDidRequestDetach = this._onDidRequestDetach.event;
90-
private readonly _onDidChangeProperty = this._register(new Emitter<{ id: number; property: IProcessProperty<any> }>());
90+
private readonly _onDidChangeProperty = this._register(new Emitter<{ id: number; property: IProcessProperty }>());
9191
readonly onDidChangeProperty = this._onDidChangeProperty.event;
9292
private readonly _onProcessExit = this._register(new Emitter<{ id: number; event: number | undefined }>());
9393
readonly onProcessExit = this._onProcessExit.event;

src/vs/platform/terminal/node/ptyService.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ import { hasKey } from '../../../base/common/types.js';
3737
type XtermTerminal = pkg.Terminal;
3838
const { Terminal: XtermTerminal } = pkg;
3939

40-
export function traceRpc(_target: any, key: string, descriptor: any) {
40+
export function traceRpc(_target: Object, key: string, descriptor: PropertyDescriptor) {
4141
if (typeof descriptor.value !== 'function') {
4242
throw new Error('not supported');
4343
}
4444
const fnKey = 'value';
4545
const fn = descriptor.value;
46-
descriptor[fnKey] = async function (...args: unknown[]) {
46+
descriptor[fnKey] = async function <TThis extends { traceRpcArgs: { logService: ILogService; simulatedLatency: number } }>(this: TThis, ...args: unknown[]) {
4747
if (this.traceRpcArgs.logService.getLevel() === LogLevel.Trace) {
4848
this.traceRpcArgs.logService.trace(`[RPC Request] PtyService#${fn.name}(${args.map(e => JSON.stringify(e)).join(', ')})`);
4949
}
@@ -110,7 +110,7 @@ export class PtyService extends Disposable implements IPtyService {
110110
readonly onProcessOrphanQuestion = this._traceEvent('_onProcessOrphanQuestion', this._onProcessOrphanQuestion.event);
111111
private readonly _onDidRequestDetach = this._register(new Emitter<{ requestId: number; workspaceId: string; instanceId: number }>());
112112
readonly onDidRequestDetach = this._traceEvent('_onDidRequestDetach', this._onDidRequestDetach.event);
113-
private readonly _onDidChangeProperty = this._register(new Emitter<{ id: number; property: IProcessProperty<any> }>());
113+
private readonly _onDidChangeProperty = this._register(new Emitter<{ id: number; property: IProcessProperty }>());
114114
readonly onDidChangeProperty = this._traceEvent('_onDidChangeProperty', this._onDidChangeProperty.event);
115115

116116
private _traceEvent<T>(name: string, event: Event<T>): Event<T> {
@@ -663,7 +663,7 @@ class PersistentTerminalProcess extends Disposable {
663663

664664
private readonly _bufferer: TerminalDataBufferer;
665665

666-
private readonly _pendingCommands = new Map<number, { resolve: (data: any) => void; reject: (err: any) => void }>();
666+
private readonly _pendingCommands = new Map<number, { resolve: (data: unknown) => void; reject: (err: unknown) => void }>();
667667

668668
private _isStarted: boolean = false;
669669
private _interactionState: MutationLogger<InteractionState>;
@@ -685,7 +685,7 @@ class PersistentTerminalProcess extends Disposable {
685685
readonly onProcessData = this._onProcessData.event;
686686
private readonly _onProcessOrphanQuestion = this._register(new Emitter<void>());
687687
readonly onProcessOrphanQuestion = this._onProcessOrphanQuestion.event;
688-
private readonly _onDidChangeProperty = this._register(new Emitter<IProcessProperty<any>>());
688+
private readonly _onDidChangeProperty = this._register(new Emitter<IProcessProperty>());
689689
readonly onDidChangeProperty = this._onDidChangeProperty.event;
690690

691691
private _inReplay = false;
@@ -931,7 +931,7 @@ class PersistentTerminalProcess extends Disposable {
931931
this._onPersistentProcessReady.fire();
932932
}
933933

934-
sendCommandResult(reqId: number, isError: boolean, serializedPayload: any): void {
934+
sendCommandResult(reqId: number, isError: boolean, serializedPayload: unknown): void {
935935
const data = this._pendingCommands.get(reqId);
936936
if (!data) {
937937
return;

src/vs/platform/terminal/node/terminalProcess.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ export class TerminalProcess extends Disposable implements ITerminalChildProcess
130130
readonly onProcessData = this._onProcessData.event;
131131
private readonly _onProcessReady = this._register(new Emitter<IProcessReadyEvent>());
132132
readonly onProcessReady = this._onProcessReady.event;
133-
private readonly _onDidChangeProperty = this._register(new Emitter<IProcessProperty<any>>());
133+
private readonly _onDidChangeProperty = this._register(new Emitter<IProcessProperty>());
134134
readonly onDidChangeProperty = this._onDidChangeProperty.event;
135135
private readonly _onProcessExit = this._register(new Emitter<number>());
136136
readonly onProcessExit = this._onProcessExit.event;
@@ -542,8 +542,8 @@ export class TerminalProcess extends Disposable implements ITerminalChildProcess
542542
const object = this._writeQueue.shift()!;
543543
this._logService.trace('node-pty.IPty#write', object.data);
544544
if (object.isBinary) {
545-
// TODO: node-pty's write should accept a Buffer
546-
// eslint-disable-next-line local/code-no-any-casts
545+
// TODO: node-pty's write should accept a Buffer, needs https://github.com/microsoft/node-pty/pull/812
546+
// eslint-disable-next-line local/code-no-any-casts, @typescript-eslint/no-explicit-any
547547
this._ptyProcess!.write(Buffer.from(object.data, 'binary') as any);
548548
} else {
549549
this._ptyProcess!.write(object.data);

src/vs/platform/terminal/node/windowsShellHelper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export class WindowsShellHelper extends Disposable implements IWindowsShellHelpe
9191
}
9292
}
9393

94-
private traverseTree(tree: any): string {
94+
private traverseTree(tree: WindowsProcessTreeType.IProcessTreeNode | undefined): string {
9595
if (!tree) {
9696
return '';
9797
}

src/vs/workbench/contrib/terminal/browser/terminalProcessManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ export class TerminalProcessManager extends Disposable implements ITerminalProce
386386
newProcess.onDidChangeProperty(({ type, value }) => {
387387
switch (type) {
388388
case ProcessPropertyType.HasChildProcesses:
389-
this._hasChildProcesses = value;
389+
this._hasChildProcesses = value as IProcessPropertyMap[ProcessPropertyType.HasChildProcesses];
390390
break;
391391
case ProcessPropertyType.FailedShellIntegrationActivation:
392392
this._telemetryService?.publicLog2<{}, { owner: 'meganrogge'; comment: 'Indicates shell integration was not activated because of custom args' }>('terminal/shellIntegrationActivationFailureCustomArgs');

0 commit comments

Comments
 (0)