( self: Param<Kind, A>, value: unknown, expected: string )
| 2437 | * Alternative parameters do not identify the selected flag or argument for error reporting. |
| 2438 | */ |
| 2439 | const invalidValue = <Kind extends ParamKind, A>( |
| 2440 | self: Param<Kind, A>, |
| 2441 | value: unknown, |
| 2442 | expected: string |
| 2443 | ): CliError.InvalidValue | CliError.ValidationError => { |
| 2444 | const singles = extractSingleParams(self) |
| 2445 | if (singles.length !== 1) { |
| 2446 | return new CliError.ValidationError({ message: expected }) |
| 2447 | } |
| 2448 | return new CliError.InvalidValue({ |
| 2449 | option: singles[0].name, |
| 2450 | value: globalThis.String(value), |
| 2451 | expected, |
| 2452 | kind: singles[0].kind |
| 2453 | }) |
| 2454 | } |
| 2455 | |
| 2456 | /** |
| 2457 | * Gets the underlying Single param from a potentially nested param structure. |
no test coverage detected