Skip to content

chore: upgraded yargs and typescript #5629

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/common/file-system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ export class FileSystem implements IFileSystem {
}

public async futureFromEvent(eventEmitter: any, event: string): Promise<any> {
return new Promise((resolve, reject) => {
return new Promise<any>((resolve, reject) => {
eventEmitter.once(event, function () {
const args = _.toArray(arguments);

Expand All @@ -186,7 +186,7 @@ export class FileSystem implements IFileSystem {

switch (args.length) {
case 0:
resolve();
resolve(undefined);
break;
case 1:
resolve(args[0]);
Expand Down
4 changes: 2 additions & 2 deletions lib/common/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ export function settlePromises<T>(promises: Promise<T>[]): Promise<T[]> {
const length = promises.length;

if (!promises.length) {
resolve();
resolve(null);
}

_.forEach(promises, (currentPromise, index) => {
Expand Down Expand Up @@ -491,7 +491,7 @@ export async function getFuturesResults<T>(
): Promise<T[] | T[][]> {
const results = await Promise.all(promises);

return _(results).filter(predicate).flatten().value();
return _(results).filter(predicate).flatten().value() as T[] | T[][];
}

/**
Expand Down
14 changes: 7 additions & 7 deletions lib/common/mobile/application-manager-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,25 +117,25 @@ export abstract class ApplicationManagerBase
}
}

public abstract async installApplication(
public abstract installApplication(
packageFilePath: string,
appIdentifier?: string,
buildData?: IBuildData
): Promise<void>;
public abstract async uninstallApplication(
public abstract uninstallApplication(
appIdentifier: string
): Promise<void>;
public abstract async startApplication(
public abstract startApplication(
appData: Mobile.IApplicationData
): Promise<void>;
public abstract async stopApplication(
public abstract stopApplication(
appData: Mobile.IApplicationData
): Promise<void>;
public abstract async getInstalledApplications(): Promise<string[]>;
public abstract async getDebuggableApps(): Promise<
public abstract getInstalledApplications(): Promise<string[]>;
public abstract getDebuggableApps(): Promise<
Mobile.IDeviceApplicationInformation[]
>;
public abstract async getDebuggableAppViews(
public abstract getDebuggableAppViews(
appIdentifiers: string[]
): Promise<IDictionary<Mobile.IDebugWebViewInfo[]>>;

Expand Down
2 changes: 1 addition & 1 deletion lib/common/mobile/ios/device/ios-device-operations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export class IOSDeviceOperations
}

// We need this because we need to make sure that we have devices.
await new Promise((resolve, reject) => {
await new Promise<void>((resolve, reject) => {
let iterationsCount = 0;
const maxIterationsCount = 3;

Expand Down
2 changes: 1 addition & 1 deletion lib/common/mobile/ios/ios-device-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export abstract class IOSDeviceBase implements Mobile.IiOSDevice {
}, `ios-debug-socket-${this.deviceInfo.identifier}-${appId}.lock`);
}

protected abstract async getDebugSocketCore(
protected abstract getDebugSocketCore(
appId: string
): Promise<net.Socket>;

Expand Down
2 changes: 1 addition & 1 deletion lib/common/test/unit-tests/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ describe("helpers", () => {
element: any,
passedChunkSize: number
) => {
return new Promise((resolve) =>
return new Promise<void>((resolve) =>
setImmediate(() => {
const remainingElements = _.difference(
initialDataValues,
Expand Down
2 changes: 1 addition & 1 deletion lib/common/test/unit-tests/mobile/devices-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ function resetDefaultSetInterval(): void {
}

async function assertOnNextTick(assertionFunction: Function): Promise<void> {
await new Promise((resolve) => {
await new Promise<void>((resolve) => {
setTimeout(() => {
assertionFunction();
resolve();
Expand Down
9 changes: 5 additions & 4 deletions lib/options.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as helpers from "./common/helpers";
import * as yargs from "yargs";
import * as yargs from 'yargs';
import { hideBin } from 'yargs/helpers';
import * as _ from "lodash";
import {
IDictionary,
Expand Down Expand Up @@ -366,9 +367,9 @@ export class Options {
opts[this.getDashedOptionName(key)] = value;
});

const parsed = yargs(process.argv.slice(2)).version(false).help(false);
this.initialArgv = parsed.argv;
this.argv = parsed.options(<any>opts).argv;
const parsed = yargs(hideBin(process.argv)).version(false).help(false);
this.initialArgv = parsed.argv as any;
this.argv = parsed.options(<any>opts).argv as any;

// For backwards compatibility
// Previously profileDir had a default option and calling `this.$options.profileDir` always returned valid result.
Expand Down
4 changes: 2 additions & 2 deletions lib/services/debug-service-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ export abstract class DebugServiceBase

public abstract get platform(): string;

public abstract async debug(
public abstract debug(
debugData: IDebugData,
debugOptions: IDebugOptions
): Promise<IDebugResultInfo>;

public abstract async debugStop(): Promise<void>;
public abstract debugStop(): Promise<void>;

protected getCanExecuteAction(
deviceIdentifier: string
Expand Down
4 changes: 2 additions & 2 deletions lib/services/livesync/android-device-livesync-service-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ export abstract class AndroidDeviceLiveSyncServiceBase extends DeviceLiveSyncSer
super($platformsDataService, device);
}

public abstract async transferFilesOnDevice(
public abstract transferFilesOnDevice(
deviceAppData: Mobile.IDeviceAppData,
localToDevicePaths: Mobile.ILocalToDevicePathData[]
): Promise<void>;
public abstract async transferDirectoryOnDevice(
public abstract transferDirectoryOnDevice(
deviceAppData: Mobile.IDeviceAppData,
localToDevicePaths: Mobile.ILocalToDevicePathData[],
projectFilesPath: string
Expand Down
2 changes: 1 addition & 1 deletion lib/services/livesync/android-livesync-tool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ export class AndroidLivesyncTool implements IAndroidLivesyncTool {
await this.writeToSocket(hash);
}

private sendFileContent(filePath: string): Promise<boolean> {
private sendFileContent(filePath: string): Promise<void> {
return new Promise((resolve, reject) => {
if (!this.verifyActiveConnection(reject)) {
return;
Expand Down
Loading