MCPcopy Create free account
hub / github.com/effect-app/libs / checkEffect

Function checkEffect

repos/effect/packages/effect/src/SchemaGetter.ts:446–461  ·  view source on GitHub ↗
(
  f: (input: T, options: SchemaAST.ParseOptions) => Effect.Effect<
    undefined | boolean | Schema.FilterIssue,
    never,
    R
  >
)

Source from the content-addressed store, hash-verified

444 * - `false` or a `string` — value is invalid, fails with an `Issue`.
445 * - An `Issue` object — fails with that issue directly.
446 * - `{ path, issue }` — fails with a nested path issue (`issue` may be a
447 * message string or a full {@link SchemaIssue.Issue}).
448 * - Does not transform the value — input and output types are the same.
449 *
450 * **Example** (Validating effectfully)
451 *
452 * ```ts import.meta.vitest
453 * import { Effect, Option, SchemaGetter } from "effect"
454 *
455 * const nonNegative = SchemaGetter.checkEffect<number>((n) =>
456 * Effect.succeed(n >= 0 ? undefined : "must be non-negative")
457 * )
458 * await Effect.runPromise(nonNegative.run(Option.some(1), {})) // => Option.some(1)
459 * ```
460 *
461 * @see {@link transform} when you need to change the value, not just validate
462 * @see {@link fail} for unconditional failure
463 *
464 * @category validation

Callers

nothing calls this directly

Calls 6

someMethod · 0.80
onSomeFunction · 0.70
pipeMethod · 0.65
fFunction · 0.50
failMethod · 0.45
succeedMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…