refine typescript type of tryExecuteComand

Summary: You can now descriminate based on `hasProblem`. Thus removing asserting operator

Reviewed By: LukeDefeo

Differential Revision: D50366398

fbshipit-source-id: a16a5419ce946831bd2d1624b1baa75c89a47aa3
This commit is contained in:
Anton Kastritskiy
2023-10-17 16:01:08 -07:00
committed by Facebook GitHub Bot
parent 1a6e0ef42e
commit 73862c9408
2 changed files with 9 additions and 4 deletions

View File

@@ -183,7 +183,7 @@ export function getHealthchecks(): FlipperDoctor.Healthchecks {
message: `Xcode version is not selected. You can select it using command "sudo xcode-select -switch <path/to/>Xcode.app". ${result.message}.`, message: `Xcode version is not selected. You can select it using command "sudo xcode-select -switch <path/to/>Xcode.app". ${result.message}.`,
}; };
} }
const selectedXcode = result.stdout!.toString().trim(); const selectedXcode = result.stdout.toString().trim();
if (selectedXcode == '/Library/Developer/CommandLineTools') { if (selectedXcode == '/Library/Developer/CommandLineTools') {
return { return {
hasProblem: true, hasProblem: true,

View File

@@ -69,9 +69,14 @@ export namespace FlipperDoctor {
message: string; message: string;
}; };
export type SubprocessHealtcheckRunResult = HealthcheckRunResult & { export type SubprocessHealtcheckRunResult =
stdout?: string; | (HealthcheckRunResult & {
}; hasProblem: true;
})
| (HealthcheckRunResult & {
hasProblem: false;
stdout: string;
});
export type CategoryResult = [ export type CategoryResult = [
string, string,