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}.`,
};
}
const selectedXcode = result.stdout!.toString().trim();
const selectedXcode = result.stdout.toString().trim();
if (selectedXcode == '/Library/Developer/CommandLineTools') {
return {
hasProblem: true,

View File

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