From e2137445762f3fa1c683d14e64474aa51607a86c Mon Sep 17 00:00:00 2001 From: Mykola Mokhnach Date: Mon, 1 Apr 2024 14:32:03 +0200 Subject: [PATCH] fix: Make 'executable' opt optional (#726) --- lib/adb.ts | 4 ++-- lib/options.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/adb.ts b/lib/adb.ts index ea48c6af..2454ef64 100644 --- a/lib/adb.ts +++ b/lib/adb.ts @@ -40,8 +40,8 @@ export class ADB { const options: ADBOptions = _.defaultsDeep(opts, _.cloneDeep(DEFAULT_OPTS)); _.defaultsDeep(this, options); - // avoid TS error by explicitly assigning - this.executable = options.executable; + // The above defaultsDeep call guarantees the 'executable' field to be always assigned + this.executable = options.executable as ADBExecutable; if (options.remoteAdbHost) { this.executable.defaultArgs.push('-H', options.remoteAdbHost); diff --git a/lib/options.ts b/lib/options.ts index 1c74fca0..34fa9780 100644 --- a/lib/options.ts +++ b/lib/options.ts @@ -11,7 +11,7 @@ export interface ADBOptions { keystorePassword?: string; keyAlias?: string; keyPassword?: string; - executable: ADBExecutable; + executable?: ADBExecutable; tmpDir?: string; curDeviceId?: string; emulatorPort?: number;