Migrate BaseDevice from js to tsx

Summary: As per the title

Reviewed By: passy

Differential Revision: D16687261

fbshipit-source-id: a9d85424fb0a08fada7edd0355c356907518d366
This commit is contained in:
Pritesh Nandgaonkar
2019-08-09 06:50:45 -07:00
committed by Facebook Github Bot
parent 18f43daa04
commit 47a55b0f26
29 changed files with 60 additions and 61 deletions

View File

@@ -5,12 +5,11 @@
* @format
*/
import type {DeviceType, DeviceShell} from './BaseDevice.js';
import type {DeviceType, DeviceShell} from './BaseDevice.tsx';
import BaseDevice from './BaseDevice.tsx';
import {Priority} from 'adbkit-logcat-fb';
import child_process from 'child_process';
import child_process_promise from 'child-process-es6-promise';
import BaseDevice from './BaseDevice.js';
import ArchivedDevice from './ArchivedDevice.js';
type ADBClient = any;

View File

@@ -4,13 +4,13 @@
* LICENSE file in the root directory of this source tree.
* @format
*/
import BaseDevice from './BaseDevice.js';
import BaseDevice from './BaseDevice.tsx';
import type {
DeviceType,
OS,
DeviceShell,
DeviceLogEntry,
} from './BaseDevice.js';
} from './BaseDevice.tsx';
export default class ArchivedDevice extends BaseDevice {
constructor(

View File

@@ -5,8 +5,7 @@
* @format
*/
import type stream from 'stream';
import type ArchivedDevice from './ArchivedDevice';
import stream from 'stream';
export type LogLevel =
| 'unknown'
@@ -17,20 +16,20 @@ export type LogLevel =
| 'error'
| 'fatal';
export type DeviceLogEntry = {|
date: Date,
pid: number,
tid: number,
app?: string,
type: LogLevel,
tag: string,
message: string,
|};
export type DeviceLogEntry = {
date: Date;
pid: number;
tid: number;
app?: string;
type: LogLevel;
tag: string;
message: string;
};
export type DeviceShell = {
stdout: stream.Readable,
stderr: stream.Readable,
stdin: stream.Writable,
stdout: stream.Readable;
stderr: stream.Readable;
stdin: stream.Writable;
};
export type DeviceLogListener = (entry: DeviceLogEntry) => void;
@@ -41,13 +40,13 @@ export type DeviceType =
| 'archivedEmulator'
| 'archivedPhysical';
export type DeviceExport = {|
os: string,
title: string,
deviceType: DeviceType,
serial: string,
logs: Array<DeviceLogEntry>,
|};
export type DeviceExport = {
os: string;
title: string;
deviceType: DeviceType;
serial: string;
logs: Array<DeviceLogEntry>;
};
export type OS = 'iOS' | 'Android' | 'Windows' | 'MacOS';
@@ -71,7 +70,7 @@ export default class BaseDevice {
serial: string;
// possible src of icon to display next to the device title
icon: ?string;
icon: string | null | undefined;
logListeners: Map<Symbol, DeviceLogListener> = new Map();
logEntries: Array<DeviceLogEntry> = [];
@@ -135,7 +134,7 @@ export default class BaseDevice {
this.logListeners.delete(id);
}
spawnShell(): ?DeviceShell {
spawnShell(): DeviceShell | null | undefined {
throw new Error('unimplemented');
}
@@ -143,7 +142,7 @@ export default class BaseDevice {
throw new Error('unimplemented');
}
archive(): ?ArchivedDevice {
archive(): any | null | undefined {
return null;
}
}

View File

@@ -5,9 +5,9 @@
* @format
*/
import type {DeviceType, LogLevel, DeviceLogEntry} from './BaseDevice.js';
import type {DeviceType, LogLevel, DeviceLogEntry} from './BaseDevice.tsx';
import child_process from 'child_process';
import BaseDevice from './BaseDevice.js';
import BaseDevice from './BaseDevice.tsx';
import JSONStream from 'JSONStream';
import {Transform} from 'stream';

View File

@@ -5,7 +5,7 @@
* @format
*/
import BaseDevice from './BaseDevice.js';
import BaseDevice from './BaseDevice.tsx';
export default class MacDevice extends BaseDevice {
os = 'MacOS';

View File

@@ -5,7 +5,7 @@
* @format
*/
import BaseDevice from './BaseDevice.js';
import BaseDevice from './BaseDevice.tsx';
export default class WindowsDevice extends BaseDevice {
os = 'Windows';