MCPcopy Create free account
hub / github.com/Effect-TS/effect / invalidValue

Function invalidValue

packages/effect/src/cli/Param.ts:2439–2454  ·  view source on GitHub ↗
(
  self: Param<Kind, A>,
  value: unknown,
  expected: string
)

Source from the content-addressed store, hash-verified

2437 * Alternative parameters do not identify the selected flag or argument for error reporting.
2438 */
2439const 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.

Callers 1

Param.tsFile · 0.85

Calls 1

extractSingleParamsFunction · 0.85

Tested by

no test coverage detected