Skip to content

Commit f5c5713

Browse files
author
Ben Keen
committed
Code review feedback: check param type
1 parent 64bc197 commit f5c5713

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

rush-plugins/rush-bridge-cache-plugin/src/BridgeCachePlugin.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import type {
1414
RushSession
1515
} from '@rushstack/rush-sdk';
1616
import { CommandLineParameterKind } from '@rushstack/ts-command-line';
17-
import type { CommandLineFlagParameter, CommandLineParameter } from '@rushstack/ts-command-line';
17+
import type { CommandLineParameter } from '@rushstack/ts-command-line';
1818

1919
const PLUGIN_NAME: 'RushBridgeCachePlugin' = 'RushBridgeCachePlugin';
2020

@@ -225,6 +225,14 @@ export class BridgeCachePlugin implements IRushPlugin {
225225
this._requireOutputFoldersParameterName
226226
);
227227

228-
return !!(requireOutputFoldersParam && (requireOutputFoldersParam as CommandLineFlagParameter).value);
228+
if (!requireOutputFoldersParam) {
229+
return false;
230+
}
231+
232+
if (requireOutputFoldersParam.kind !== CommandLineParameterKind.Flag) {
233+
throw new Error(`The parameter "${this._requireOutputFoldersParameterName}" must be a flag.`);
234+
}
235+
236+
return requireOutputFoldersParam.value;
229237
}
230238
}

0 commit comments

Comments
 (0)