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

Method tag

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

* Narrows the focus to the variant of a tagged union with the given * `_tag` value. * * **Details** * * - On a Prism, returns a Prism. * - On an Optional, returns an Optional. * - Shorthand for `.refine(s => s._tag === tag)`. * - A non-matching value fails wit

(
    this: Prism<S, A>,
    tag: Tag
  )

Source from the content-addressed store, hash-verified

662 * @see `.refine()` — for arbitrary type guards
663 */
664 tag<S, A extends { readonly _tag: SchemaAST.LiteralValue }, Tag extends A["_tag"]>(
665 this: Prism<S, A>,
666 tag: Tag
667 ): Prism<S, Extract<A, { readonly _tag: Tag }>>

Callers 15

JsonPatchParseErrorClass · 0.65
SpecFetcher.tsFile · 0.65
UnauthorizedClass · 0.65
CustomErrorClass · 0.65
UnauthorizedClass · 0.65
CustomErrorClass · 0.65
ClientFailureClass · 0.65
RateLimitErrorClass · 0.65
UserErrorClass · 0.65

Implementers 1

OptionalImplpackages/effect/src/Optic.ts

Calls

no outgoing calls

Tested by 1

makeValueCodecFunction · 0.52