Improve types

Summary:
The any type was masking how the log object is actually initialised.

Sorry for the deluge of drive-by diffs. Something more substantial is coming.

Reviewed By: mweststrate

Differential Revision: D26250580

fbshipit-source-id: 5ba3f450ac1a646616868a8fd8b3cb42fb14dcc8
This commit is contained in:
Pascal Hartig
2021-02-05 14:23:26 -08:00
committed by Facebook GitHub Bot
parent 93d23e8c0a
commit 949b57b473

View File

@@ -40,7 +40,7 @@ type RawLogEntry = {
}; };
export default class IOSDevice extends BaseDevice { export default class IOSDevice extends BaseDevice {
log: any; log?: child_process.ChildProcessWithoutNullStreams;
buffer: string; buffer: string;
private recordingProcess?: ChildProcess; private recordingProcess?: ChildProcess;
private recordingLocation?: string; private recordingLocation?: string;
@@ -49,7 +49,7 @@ export default class IOSDevice extends BaseDevice {
super(serial, deviceType, title, 'iOS'); super(serial, deviceType, title, 'iOS');
this.icon = 'icons/ios.svg'; this.icon = 'icons/ios.svg';
this.buffer = ''; this.buffer = '';
this.log = this.startLogListener(); this.startLogListener();
} }
screenshot(): Promise<Buffer> { screenshot(): Promise<Buffer> {
@@ -128,7 +128,7 @@ export default class IOSDevice extends BaseDevice {
}); });
this.log.on('exit', () => { this.log.on('exit', () => {
this.log = null; this.log = undefined;
}); });
} }
@@ -144,7 +144,7 @@ export default class IOSDevice extends BaseDevice {
console.error('Could not parse iOS log stream.', e); console.error('Could not parse iOS log stream.', e);
// restart log stream // restart log stream
this.log.kill(); this.log.kill();
this.log = null; this.log = undefined;
this.startLogListener(retries - 1); this.startLogListener(retries - 1);
} }
} }