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

Method refine

repos/effect/packages/effect/src/Optic.ts:687–687  ·  view source on GitHub ↗

* Narrows the focus to a subtype `B` using a type guard. * * **Details** * * - On a Prism, returns a Prism. * - On an Optional, returns an Optional. * - Pass optional `annotations` to customize the error message. * * **Example** (Narrowing a union) * * `

(
    this: Prism<S, A>,
    refinement: (a: A) => a is B,
    annotations?: Schema.Annotations.Filter
  )

Source from the content-addressed store, hash-verified

685 * inner issue is {@link SchemaIssue.MissingKey}, for both `getResult` and
686 * `replaceResult`.
687 *
688 * **Example** (Accessing records safely)
689 *
690 * ```ts import.meta.vitest

Callers 8

email.tsFile · 0.65
phoneNumber.tsFile · 0.65
prefixedStringIdFunction · 0.65
moreStrings.tsFile · 0.65
Schema.tst.tsFile · 0.65
api.tst.tsFile · 0.65
Optic.test.tsFile · 0.65
Schema.test.tsFile · 0.65

Implementers 1

OptionalImplrepos/effect/packages/effect/src/Optic

Calls

no outgoing calls

Tested by

no test coverage detected